mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 06:53:19 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d870159c46 | ||
|
|
4d7fa914cc | ||
|
|
a4bb6e5c1d | ||
|
|
5f65114ce5 | ||
|
|
87bfda4ed2 | ||
|
|
3b61818eb9 | ||
|
|
1680860ff4 | ||
|
|
74ce0ff737 | ||
|
|
90891cc86f | ||
|
|
bb7dc3b79f | ||
|
|
d6d7a520a7 | ||
|
|
c05dfc946e | ||
|
|
c3b2108412 | ||
|
|
2fe9f13908 | ||
|
|
1c93300361 | ||
|
|
ef5761d300 | ||
|
|
37652ae571 | ||
|
|
0ed836095e | ||
|
|
b1b47b7cfa | ||
|
|
c939b27aee | ||
|
|
0ef7287fde | ||
|
|
fce94e630b | ||
|
|
2a38cbc2df | ||
|
|
2ce68890b8 | ||
|
|
4c392f60d6 | ||
|
|
b4e8310f1f | ||
|
|
9cffd0bf0a | ||
|
|
d190585622 | ||
|
|
912c957c9f | ||
|
|
2b9f1ad862 | ||
|
|
b1bfc9ba41 | ||
|
|
d5b8b9ab35 | ||
|
|
a10d64ab75 | ||
|
|
1f3a058ba0 | ||
|
|
c4550ad6ba | ||
|
|
afe2150d19 | ||
|
|
a77d68ef93 | ||
|
|
fad2dbcbf4 | ||
|
|
f9129e758c | ||
|
|
b95a9fab63 | ||
|
|
af752e3a27 | ||
|
|
85d331898f | ||
|
|
8e5f1d449c | ||
|
|
daa81ca944 | ||
|
|
03e3b77578 | ||
|
|
c486a7fe16 | ||
|
|
78cb452725 | ||
|
|
29a3763ecf | ||
|
|
e4a0552663 | ||
|
|
08c70a8318 | ||
|
|
d3762acbf1 | ||
|
|
d0e99b0d46 | ||
|
|
494b395442 | ||
|
|
fa884594a6 | ||
|
|
5b93a70f70 | ||
|
|
a36df13992 | ||
|
|
1190ab6953 | ||
|
|
5ab9285ed3 | ||
|
|
3185fa5adb | ||
|
|
9f553d6ecc | ||
|
|
acb4aa404d | ||
|
|
26d094c341 | ||
|
|
773047de9e | ||
|
|
4a8ad49d60 | ||
|
|
a393b366ac | ||
|
|
dc148cd3f7 | ||
|
|
48c027313d | ||
|
|
b41c609a02 | ||
|
|
90975148a0 | ||
|
|
e658ea89ea | ||
|
|
3fc0c43af0 | ||
|
|
173e397113 | ||
|
|
17fa0e5f31 | ||
|
|
8df1c72a44 | ||
|
|
e3f4c6980e | ||
|
|
7ed8faa7a6 | ||
|
|
283b1ffb87 | ||
|
|
e060c09fe2 | ||
|
|
9a93709831 | ||
|
|
ca0a14e04c | ||
|
|
8fefa2922d | ||
|
|
96f7e64580 | ||
|
|
d79c0b8cef | ||
|
|
81cf2e0386 | ||
|
|
eed69c7bb2 | ||
|
|
271376b898 | ||
|
|
e31056b6ad | ||
|
|
0b7a4203b8 | ||
|
|
95725896a2 | ||
|
|
b476ebb82b | ||
|
|
fd3a75ce72 | ||
|
|
f14232a52e | ||
|
|
43cc233f99 | ||
|
|
31f7961287 | ||
|
|
1918b36f9e | ||
|
|
387f91017c | ||
|
|
d8b51396fa | ||
|
|
0a7c064b05 | ||
|
|
3620aa1def | ||
|
|
b938833097 | ||
|
|
75c3b18c22 | ||
|
|
01076723f4 | ||
|
|
bd670d9040 | ||
|
|
5c7dac41c2 | ||
|
|
f732061d9d | ||
|
|
d7e3d8b2b2 | ||
|
|
c4d3900d68 | ||
|
|
f130f35870 | ||
|
|
2b7574de39 | ||
|
|
bbd658263e | ||
|
|
91731fab14 | ||
|
|
f36ffb903f | ||
|
|
0173108f72 | ||
|
|
bb4402e45a | ||
|
|
661adee396 | ||
|
|
73c5c93e9b | ||
|
|
2427d7c9ee | ||
|
|
e3b048e2d9 | ||
|
|
08f6f621d2 | ||
|
|
7caf1bb596 | ||
|
|
43bfbad61f | ||
|
|
beb4ce1200 | ||
|
|
7bfa7f392c | ||
|
|
47cf338cd6 | ||
|
|
b2a52f6cc1 | ||
|
|
c78ded29e8 | ||
|
|
1c3cb953bd | ||
|
|
53a5cc9ca7 | ||
|
|
3b670e79a5 | ||
|
|
530ff8e3de | ||
|
|
f2d0e0335c | ||
|
|
b4fa9ae676 | ||
|
|
5aa6c4cd36 | ||
|
|
ad8187aefd | ||
|
|
1bfd0388b0 | ||
|
|
cbd7649e02 | ||
|
|
fc83cf7446 | ||
|
|
2bbf0179fc | ||
|
|
dcd1107a9f | ||
|
|
bf07a473ae | ||
|
|
f9b6f22ecf | ||
|
|
fcd6e12c03 | ||
|
|
d7a755c08b | ||
|
|
b776edd026 | ||
|
|
9a289e072c | ||
|
|
4bc503d81d | ||
|
|
4e252226a6 | ||
|
|
ca184a08c9 | ||
|
|
cceec65c38 | ||
|
|
fac78b331b | ||
|
|
ae49b9f3c9 | ||
|
|
edf25e43c0 | ||
|
|
4a563b9cf6 | ||
|
|
ea5e9015e7 | ||
|
|
d8c392b69a | ||
|
|
035783ae0c | ||
|
|
08a3904127 | ||
|
|
cae6d2201c | ||
|
|
b8d38aa2c0 | ||
|
|
d685762382 | ||
|
|
c96de52402 | ||
|
|
b4e6f54d55 | ||
|
|
d145985058 | ||
|
|
03685d6139 | ||
|
|
620c796095 | ||
|
|
37846080a7 | ||
|
|
e24034ee10 | ||
|
|
9f4990cd90 | ||
|
|
7026280df3 | ||
|
|
df9d1d11d5 | ||
|
|
e60a8bc5fe | ||
|
|
1496780fa4 | ||
|
|
2cb2136348 | ||
|
|
e368a5dbcb | ||
|
|
e3dfcb96d1 | ||
|
|
f845ef0add | ||
|
|
cb01f542c0 | ||
|
|
054738329d | ||
|
|
e85de83289 | ||
|
|
06090e06cd | ||
|
|
7729997d96 | ||
|
|
8818eaa2ec | ||
|
|
b715d70366 | ||
|
|
2c6132a460 |
No files matched your search
+108
-11
@@ -60,9 +60,17 @@ jobs:
|
||||
- os: ubuntu-24.04
|
||||
lib: libraea_bundle.so
|
||||
extra: raea-perceive
|
||||
runs-on: ${{ matrix.os }}
|
||||
# a faster runner when the repo names one: vars RELEASE_MAC_RUNNER, RELEASE_LINUX_RUNNER, RELEASE_WINDOWS_RUNNER hold
|
||||
# a JSON list of runs-on labels (Namespace's: a machine and a cache volume); else GitHub's
|
||||
# own, a 3-core M1 with 7 GB on the Mac, where a cold build took 3 hours
|
||||
runs-on: ${{ (matrix.os == 'macos-15' && vars.RELEASE_MAC_RUNNER && fromJSON(vars.RELEASE_MAC_RUNNER)) || (matrix.os == 'ubuntu-24.04' && vars.RELEASE_LINUX_RUNNER && fromJSON(vars.RELEASE_LINUX_RUNNER)) || matrix.os }}
|
||||
# a cold thin-LTO build of raea-cli with the plugin catalog is the long part; GitHub's own limit is 6 hours
|
||||
timeout-minutes: 340
|
||||
env:
|
||||
# the compile cache (the "Compile cache" step): an R2 bucket, read and written by every build
|
||||
RELEASE_CACHE_ENDPOINT: ${{ secrets.RELEASE_CACHE_ENDPOINT }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.RELEASE_CACHE_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.RELEASE_CACHE_SECRET }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -95,7 +103,7 @@ jobs:
|
||||
# rc3's build left 576 MB of macos-15's 320 GB free, and rc4's dSYMs (#88) ran it out linking raea-page-host
|
||||
# (ld: write() failed, errno=28): the image's other Xcodes and the Android and .NET SDKs go first
|
||||
- name: Room for the build
|
||||
if: runner.os == 'macOS' && env.RAEA_PROMOTED_FROM == ''
|
||||
if: runner.os == 'macOS' && env.RAEA_PROMOTED_FROM == '' && vars.RELEASE_MAC_RUNNER == ''
|
||||
run: |
|
||||
df -h . | tail -1
|
||||
keep=$(cd "$(xcode-select -p)/../.." && pwd -P)
|
||||
@@ -104,14 +112,48 @@ jobs:
|
||||
wait
|
||||
echo "kept $keep"
|
||||
df -h . | tail -1
|
||||
# The compile cache: sccache on an R2 bucket. GitHub's own cache can't carry a release build: a tag's run reads
|
||||
# only its own tag's caches and the default branch's (so rc3's never reached rc4), and the repo's 10 GB are CI's.
|
||||
# A bucket is read by every tag. A cold build fills it; a candidate after a small change compiles only the crates
|
||||
# that changed and the ones above them. Linking (thin LTO) and build scripts' runs aren't cached. With no secrets
|
||||
# (a fork) the build runs as before, uncached.
|
||||
# the build folder and cargo's downloads kept between runs on the runner's cache volume (a Namespace runner,
|
||||
# whose labels attach one), so a candidate rebuilds only what changed and links;
|
||||
# sccache below still serves the workspace's own crates, which a fresh checkout's file times mark as changed
|
||||
- name: The build folder, kept on the runner's cache volume
|
||||
if: env.RAEA_PROMOTED_FROM == '' && startsWith(runner.name, 'nsc-')
|
||||
uses: namespacelabs/nscloud-cache-action@v1
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/target
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
- name: Compile cache (sccache)
|
||||
if: env.RAEA_PROMOTED_FROM == '' && env.AWS_ACCESS_KEY_ID != ''
|
||||
uses: mozilla-actions/[email protected]
|
||||
# the script from this workflow's own commit: a dispatched run (a dry run that fills the cache) builds an older
|
||||
# tag, whose tree may not have it
|
||||
- name: The compile cache's script
|
||||
if: env.RAEA_PROMOTED_FROM == '' && env.AWS_ACCESS_KEY_ID != ''
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.sha }}
|
||||
path: .workflow
|
||||
sparse-checkout: tools/release/compile-cache.sh
|
||||
sparse-checkout-cone-mode: false
|
||||
- name: Use the compile cache
|
||||
if: env.RAEA_PROMOTED_FROM == '' && env.AWS_ACCESS_KEY_ID != ''
|
||||
run: bash .workflow/tools/release/compile-cache.sh
|
||||
- name: Build
|
||||
if: env.RAEA_PROMOTED_FROM == ''
|
||||
run: |
|
||||
feat=$(bash tools/bevy-plugins.sh features sdk/raea/bench/bevy-plugins)
|
||||
cargo build --profile dist --locked -p raea-cli --bin raea --no-default-features --features "$feat"
|
||||
cargo build --profile dist --locked -p raea-rune-host
|
||||
cargo build --profile dist --locked -p raea-page-host --features window
|
||||
if [ -n "${{ matrix.extra }}" ]; then cargo build --profile dist --locked -p ${{ matrix.extra }}; fi
|
||||
t() { s=$SECONDS; "$@"; echo "::notice::${{ runner.os }} $(( (SECONDS - s) / 60 )) min: ${*:7}"; }
|
||||
t cargo build --profile dist --locked -p raea-cli --bin raea --no-default-features --features "$feat"
|
||||
t cargo build --profile dist --locked -p raea-rune-host
|
||||
t cargo build --profile dist --locked -p raea-page-host --features window
|
||||
if [ -n "${{ matrix.extra }}" ]; then t cargo build --profile dist --locked -p ${{ matrix.extra }}; fi
|
||||
if [ -n "${RUSTC_WRAPPER:-}" ]; then sccache --show-stats; fi
|
||||
mkdir ship
|
||||
cp target/dist/raea target/dist/${{ matrix.lib }} target/dist/raea-rune-host target/dist/raea-page-host ship/
|
||||
if [ -n "${{ matrix.extra }}" ]; then cp target/dist/${{ matrix.extra }} ship/; fi
|
||||
@@ -124,6 +166,8 @@ jobs:
|
||||
run: bash tools/release/promoted-bins.sh "$RAEA_PROMOTED_FROM" ship
|
||||
# the packing and its checks need only ship/, and macos-15's disk ran out packing rc1 with target/ kept
|
||||
- name: Free the build's disk
|
||||
# not the cache volume's build folder, which the next candidate starts from (a bind mount on Linux)
|
||||
if: ${{ !startsWith(runner.name, 'nsc-') }}
|
||||
run: |
|
||||
df -h . | tail -1
|
||||
rm -rf target
|
||||
@@ -177,8 +221,13 @@ jobs:
|
||||
# accept no licence and download no Microsoft files). The C runtime is the DLL one (the VC++ redistributable): ort's
|
||||
# prebuilt ONNX Runtime is built against it, so crt-static doesn't link (LNK2019 on __imp_ symbols, 10-29).
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
runs-on: ${{ (vars.RELEASE_WINDOWS_RUNNER && fromJSON(vars.RELEASE_WINDOWS_RUNNER)) || 'windows-latest' }}
|
||||
timeout-minutes: 350
|
||||
env:
|
||||
# the compile cache, as build's
|
||||
RELEASE_CACHE_ENDPOINT: ${{ secrets.RELEASE_CACHE_ENDPOINT }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.RELEASE_CACHE_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.RELEASE_CACHE_SECRET }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
@@ -195,6 +244,21 @@ jobs:
|
||||
- name: Toolchain (rust-toolchain.toml's pin)
|
||||
if: env.RAEA_PROMOTED_FROM == ''
|
||||
run: rustup show active-toolchain || rustup toolchain install
|
||||
# nasm, which rav1d's and openh264-sys2's build scripts run: GitHub's Windows image has 2.16, Namespace's has none
|
||||
# (rc3's dry run there stopped at "Unable to run nasm: program not found"). Always NASM's own 2.16.03 zip, never
|
||||
# Chocolatey's: rc4 took Chocolatey's newest, and raea.exe failed to link 135 of openh264's SIMD routines
|
||||
# (WelsSampleSad16x8_sse2 and the rest unresolved) though openh264's C++ was built to call them
|
||||
- name: nasm
|
||||
if: env.RAEA_PROMOTED_FROM == ''
|
||||
run: |
|
||||
v=2.16.03
|
||||
curl -fsSL --retry 3 -o "$RUNNER_TEMP/nasm.zip" "https://www.nasm.us/pub/nasm/releasebuilds/$v/win64/nasm-$v-win64.zip"
|
||||
unzip -q "$RUNNER_TEMP/nasm.zip" -d "$RUNNER_TEMP"
|
||||
# Git Bash on Windows has no /dev/stderr (rc5 stopped here): capture, print, then match
|
||||
out=$("$RUNNER_TEMP/nasm-$v/nasm.exe" -v)
|
||||
echo "$out"
|
||||
case $out in *"version $v"*) ;; *) echo "::error::expected NASM $v, got: $out"; exit 1 ;; esac
|
||||
echo "$RUNNER_TEMP/nasm-$v" >> "$GITHUB_PATH"
|
||||
# jq for Windows ends -r lines with CRLF, so tools/bevy-plugins.sh read "ahoy\r" and lost its Bevy 0.20 block
|
||||
# (feature `ahoy` not found, 11-04); -b writes LF
|
||||
- name: jq that writes LF
|
||||
@@ -219,14 +283,47 @@ jobs:
|
||||
done < <(tr -d '\r' < tools/release/models.tsv)
|
||||
# the app targets' hosts a cargo call each: with raea-cli's crates in one call taffy's features unify and
|
||||
# rune-taffy doesn't build; raea-perceive (`raea song`'s map, #43) a call of its own too
|
||||
- name: The build folder, kept on the runner's cache volume (as build's)
|
||||
if: env.RAEA_PROMOTED_FROM == '' && startsWith(runner.name, 'nsc-')
|
||||
uses: namespacelabs/nscloud-cache-action@v1
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/target
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
- name: Compile cache (sccache, as build's)
|
||||
if: env.RAEA_PROMOTED_FROM == '' && env.AWS_ACCESS_KEY_ID != ''
|
||||
uses: mozilla-actions/[email protected]
|
||||
# the script from this workflow's own commit: a dispatched run (a dry run that fills the cache) builds an older
|
||||
# tag, whose tree may not have it
|
||||
- name: The compile cache's script
|
||||
if: env.RAEA_PROMOTED_FROM == '' && env.AWS_ACCESS_KEY_ID != ''
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.sha }}
|
||||
path: .workflow
|
||||
sparse-checkout: tools/release/compile-cache.sh
|
||||
sparse-checkout-cone-mode: false
|
||||
- name: Use the compile cache
|
||||
if: env.RAEA_PROMOTED_FROM == '' && env.AWS_ACCESS_KEY_ID != ''
|
||||
run: bash .workflow/tools/release/compile-cache.sh
|
||||
# openh264-sys2 is built here every time, never taken whole from the cache volume's target/: a build of it whose
|
||||
# assembly didn't make it into the rlib (0.1.3-rc4's Chocolatey nasm) stays fresh to cargo on a restored target/,
|
||||
# and every link after it fails on the same 135 SIMD routines (v0.1.4-rc1, 11-14: only raea-cli compiled, then
|
||||
# WaverageChromaFilter8_sse2 and the rest unresolved). Its C++ comes back from sccache; the assembly is seconds
|
||||
- name: openh264 built here, not restored
|
||||
if: env.RAEA_PROMOTED_FROM == ''
|
||||
run: rm -rf target/dist/build/openh264-sys2-* target/dist/deps/libopenh264_sys2-* target/dist/.fingerprint/openh264-sys2-*
|
||||
- name: Build
|
||||
if: env.RAEA_PROMOTED_FROM == ''
|
||||
run: |
|
||||
feat=$(bash tools/bevy-plugins.sh features sdk/raea/bench/bevy-plugins)
|
||||
cargo build --profile dist --locked -p raea-cli --bin raea --no-default-features --features "$feat"
|
||||
cargo build --profile dist --locked -p raea-rune-host
|
||||
cargo build --profile dist --locked -p raea-page-host --features window
|
||||
cargo build --profile dist --locked -p raea-perceive
|
||||
t() { s=$SECONDS; "$@"; echo "::notice::Windows $(( (SECONDS - s) / 60 )) min: ${*:7}"; }
|
||||
t cargo build --profile dist --locked -p raea-cli --bin raea --no-default-features --features "$feat"
|
||||
t cargo build --profile dist --locked -p raea-rune-host
|
||||
t cargo build --profile dist --locked -p raea-page-host --features window
|
||||
t cargo build --profile dist --locked -p raea-perceive
|
||||
if [ -n "${RUSTC_WRAPPER:-}" ]; then sccache --show-stats; fi
|
||||
- name: The candidate's binaries (tools/release/promoted-bins.sh)
|
||||
if: env.RAEA_PROMOTED_FROM != ''
|
||||
env:
|
||||
|
||||
Generated
+32
-2
@@ -14459,10 +14459,9 @@ name = "raea-io-gen"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"image",
|
||||
"raea-core-facts",
|
||||
"raea-core-meshcheck",
|
||||
"raea-io-gen-comfy",
|
||||
"raea-io-gen-core",
|
||||
"raea-io-gen-fit",
|
||||
"raea-io-home",
|
||||
"serde_json",
|
||||
]
|
||||
@@ -14484,6 +14483,16 @@ dependencies = [
|
||||
"sha2 0.10.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raea-io-gen-fit"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"raea-core-facts",
|
||||
"raea-core-meshcheck",
|
||||
"raea-io-gen-core",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raea-io-home"
|
||||
version = "0.1.0"
|
||||
@@ -14677,6 +14686,7 @@ dependencies = [
|
||||
"raea-io-net-calls",
|
||||
"raea-io-os",
|
||||
"raea-page",
|
||||
"raea-page-sound",
|
||||
"raea-page-stage",
|
||||
"raea-page-window",
|
||||
"raea-rune-slots",
|
||||
@@ -14693,6 +14703,16 @@ dependencies = [
|
||||
"tiny_http",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raea-page-sound"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bevy",
|
||||
"raea-runtime-js",
|
||||
"raea-sys-mix",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raea-page-stage"
|
||||
version = "0.1.0"
|
||||
@@ -14767,6 +14787,7 @@ dependencies = [
|
||||
"raea-sys-framepass",
|
||||
"raea-sys-grass",
|
||||
"raea-sys-grid",
|
||||
"raea-sys-hold",
|
||||
"raea-sys-look",
|
||||
"raea-sys-matchmove",
|
||||
"raea-sys-material",
|
||||
@@ -15178,6 +15199,7 @@ dependencies = [
|
||||
"raea-runtime-react",
|
||||
"raea-runtime-sound",
|
||||
"raea-sys-frame",
|
||||
"raea-sys-hold",
|
||||
"raea-sys-mix",
|
||||
"serde_json",
|
||||
"twox-hash",
|
||||
@@ -15719,6 +15741,14 @@ dependencies = [
|
||||
"raea-sys-frame",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raea-sys-hold"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bevy",
|
||||
"raea-sys-frame",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raea-sys-image"
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -53,6 +53,7 @@ members = [
|
||||
"engine/rune/js",
|
||||
"engine/rune/layer",
|
||||
"engine/rune/slots",
|
||||
"engine/page/sound",
|
||||
"engine/page/stage",
|
||||
"engine/page/window",
|
||||
"io/trace",
|
||||
@@ -62,6 +63,7 @@ members = [
|
||||
"io/gen",
|
||||
"io/gen-comfy",
|
||||
"io/gen-core",
|
||||
"io/gen-fit",
|
||||
"io/home",
|
||||
"io/soft",
|
||||
"io/av1",
|
||||
@@ -103,6 +105,7 @@ members = [
|
||||
"systems/page-net",
|
||||
"systems/page-ops",
|
||||
"systems/frame",
|
||||
"systems/hold",
|
||||
"systems/layers",
|
||||
"systems/splat",
|
||||
"systems/sprite",
|
||||
|
||||
@@ -65,6 +65,7 @@ pub(crate) fn approve(enc: &mut Encoders, dir: &Folder, fp: &Fingerprint, args:
|
||||
words: None,
|
||||
at: 0,
|
||||
pin: None,
|
||||
band: None,
|
||||
};
|
||||
l.push(row, &features(&c, *a, *b));
|
||||
}
|
||||
|
||||
@@ -156,6 +156,7 @@ pub fn rows(enc: &mut Encoders, who: &str, files: &[PathBuf], per: usize, l: &mu
|
||||
words: None,
|
||||
at: 0,
|
||||
pin: None,
|
||||
band: None,
|
||||
};
|
||||
l.push(r, &features(c, 0.0, WIN));
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
fn row(axis: &str, source: &str) -> Row {
|
||||
Row { media: "m".into(), a: 0.0, b: 2.0, axis: axis.into(), bad: true, weight: 1.0, who: "me".into(), source: source.into(), project: "p".into(), kind: None, region: None, words: None, at: 0, pin: None }
|
||||
Row { media: "m".into(), a: 0.0, b: 2.0, axis: axis.into(), bad: true, weight: 1.0, who: "me".into(), source: source.into(), project: "p".into(), kind: None, region: None, words: None, at: 0, pin: None, band: None }
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -12,44 +12,13 @@
|
||||
use crate::{flag, has, words};
|
||||
use raea_sys_fingerprint::folder::Folder;
|
||||
use raea_sys_fingerprint::taxonomy::Fingerprint;
|
||||
use serde::{Deserialize, Serialize};
|
||||
pub use raea_sys_fingerprint_use::reading::{Reading, agreement, earned};
|
||||
use raea_sys_fingerprint_use::reading::span;
|
||||
use serde_json::{Value, json};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
/// FP5b's bar, out of every 50 checked
|
||||
pub const KIND_BAR: f64 = 45.0 / 50.0;
|
||||
pub const AXIS_BAR: f64 = 40.0 / 50.0;
|
||||
pub const INBOX: &str = "fingerprint";
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
||||
pub struct Reading {
|
||||
pub note: String,
|
||||
pub text: String,
|
||||
pub who: String,
|
||||
pub media: PathBuf,
|
||||
pub t: f64,
|
||||
pub project: String,
|
||||
/// defect, direction, praise or both
|
||||
pub kind: String,
|
||||
pub axis: Option<String>,
|
||||
/// how it was read: kimi or claude
|
||||
pub by: String,
|
||||
/// the person's check: Some(true) agreed, Some(false) not; None until asked
|
||||
#[serde(default)]
|
||||
pub kind_ok: Option<bool>,
|
||||
#[serde(default)]
|
||||
pub axis_ok: Option<bool>,
|
||||
/// a span pin's end: the label covers t..to (FP11b)
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub to: Option<f64>,
|
||||
/// where in the frame the note's marks say the thing is, x0,y0,x1,y1 in 0-1 (FP11b)
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub region: Option<[f32; 4]>,
|
||||
/// the layers under the pin's x,y in the layer pass, on a render with one (FP5a)
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub layers: Vec<String>,
|
||||
}
|
||||
|
||||
|
||||
/// A post's video on this machine: the renders library, else the project's own folder
|
||||
fn media(project: &Path, m: &Value) -> Option<PathBuf> {
|
||||
@@ -88,7 +57,7 @@ pub fn pinned(project: &Path) -> Vec<Reading> {
|
||||
let to = n["pin"]["to"].as_f64().filter(|&to| to > t);
|
||||
let at = n["pin"]["x"].as_f64().zip(n["pin"]["y"].as_f64()).map(|(x, y)| [x - 0.01, y - 0.01, x + 0.01, y + 0.01].map(|v| v.clamp(0.0, 1.0)));
|
||||
let layers = at.map(|b| raea_sys_fingerprint_things::located::layers(&video, t, b)).unwrap_or_default();
|
||||
out.push(Reading { note: n["id"].as_str().unwrap_or("").into(), text: text.into(), who: n["author"]["name"].as_str().unwrap_or("me").into(), media: video.clone(), t, project: name.clone(), to, region: raea_sys_fingerprint_use::grow::marked(&n["pin"]), layers, ..Default::default() });
|
||||
out.push(Reading { note: n["id"].as_str().unwrap_or("").into(), text: text.into(), who: n["author"]["name"].as_str().unwrap_or("me").into(), media: video.clone(), t, project: name.clone(), to, region: raea_sys_fingerprint_use::grow::marked(&n["pin"]), layers, band: raea_sys_fingerprint_use::grow::sound_band(&n["pin"]), ..Default::default() });
|
||||
}
|
||||
}
|
||||
out
|
||||
@@ -201,18 +170,6 @@ pub(crate) fn read_here(args: &[String], cwd: &Path) -> i32 {
|
||||
}
|
||||
}
|
||||
|
||||
/// The share of checked readings the person agreed with, for kind and for axis, and how many were checked
|
||||
pub fn agreement(r: &[Reading]) -> (Option<f64>, Option<f64>, usize) {
|
||||
let share = |v: Vec<bool>| (!v.is_empty()).then(|| v.iter().filter(|x| **x).count() as f64 / v.len() as f64);
|
||||
let checked = r.iter().filter(|x| x.kind_ok.is_some()).count();
|
||||
(share(r.iter().filter_map(|x| x.kind_ok).collect()), share(r.iter().filter_map(|x| x.axis_ok).collect()), checked)
|
||||
}
|
||||
|
||||
/// Whether the readings have earned training (FP5b): 50 checked, the kind right 45 times and the axis 40
|
||||
pub fn earned(r: &[Reading]) -> bool {
|
||||
matches!(agreement(r), (Some(k), Some(a), n) if n >= 50 && k >= KIND_BAR && a >= AXIS_BAR)
|
||||
}
|
||||
|
||||
/// The choices a reading is checked with, and what each says about kind and axis
|
||||
pub const CHOICES: [(&str, bool, bool); 4] = [("Right", true, true), ("Right kind, wrong axis", true, false), ("Wrong kind", false, false), ("Right axis, wrong kind", false, true)];
|
||||
|
||||
@@ -296,8 +253,9 @@ pub(crate) fn learn(enc: &mut raea_sys_columns::Encoders, dir: &Folder, l: &mut
|
||||
(None, true) => continue,
|
||||
};
|
||||
let c = enc.columns(&x.media)?;
|
||||
// a span is the label's time; a moment, 1.5 s before the pin to 0.5 s after (FP11b)
|
||||
let (a, b) = x.to.map_or(((x.t - 1.5).max(0.0), (x.t + 0.5).min(c.dur)), |to| (x.t.max(0.0), to.min(c.dur)));
|
||||
// a span is the label's time (a scene's, a box's on the sound: FP11c), half a second at least; a moment, 1.5 s
|
||||
// before the pin to 0.5 s after (FP11b)
|
||||
let (a, b) = x.to.map_or(((x.t - 1.5).max(0.0), (x.t + 0.5).min(c.dur)), |to| span(x.t, to, c.dur));
|
||||
if b - a < 0.5 {
|
||||
continue;
|
||||
}
|
||||
@@ -307,7 +265,9 @@ pub(crate) fn learn(enc: &mut raea_sys_columns::Encoders, dir: &Folder, l: &mut
|
||||
let shot = seed.and_then(|s| raea_sys_fingerprint_use::grow::through(&x.media, x.t, c.dur, s, 2.0).ok().flatten()).filter(|w| !w.is_empty());
|
||||
for (a, b, region) in shot.map_or_else(|| vec![(a, b, seed)], |w| w.into_iter().map(|(a, b, r)| (a, b, Some(r))).collect()) {
|
||||
let (media, axis, who, project, kind, words) = (c.media.clone(), axis.clone(), x.who.clone(), x.project.clone(), Some(x.note.clone()), Some(x.text.clone()));
|
||||
let row = raea_sys_fingerprint::evidence::Row { media, a, b, axis, bad, weight: 1.0, who, source: "note".into(), project, kind, region, words, at: 0, pin: None };
|
||||
// a defect's box on the sound keeps its pitch band (FP11c)
|
||||
let band = x.band.filter(|_| bad);
|
||||
let row = raea_sys_fingerprint::evidence::Row { media, a, b, axis, bad, weight: 1.0, who, source: "note".into(), project, kind, region, words, at: 0, pin: None, band };
|
||||
l.push(row, &raea_sys_fingerprint::evidence::features(&c, a, b));
|
||||
}
|
||||
made += 1;
|
||||
@@ -334,13 +294,15 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn notes_train_only_once_the_person_agrees_enough() {
|
||||
let r = |k: bool, a: bool| Reading { kind_ok: Some(k), axis_ok: Some(a), ..Default::default() };
|
||||
let mut v: Vec<Reading> = (0..45).map(|_| r(true, true)).collect();
|
||||
v.extend((0..5).map(|_| r(false, false)));
|
||||
assert!(earned(&v), "45 and 45 of 50");
|
||||
v[0] = r(false, true);
|
||||
assert!(!earned(&v), "44 kinds of 50 is under the bar");
|
||||
assert!(!earned(&v[..40]), "fewer than 50 checked");
|
||||
fn a_box_on_the_sound_is_a_reading_s_span_and_band_not_a_region() {
|
||||
let dir = std::env::temp_dir().join(format!("fp11c-{}", std::process::id()));
|
||||
std::fs::create_dir_all(dir.join(".raea/feed")).unwrap();
|
||||
std::fs::write(dir.join("a.mp4"), b"").unwrap();
|
||||
let note = json!({"id": "n1", "text": "that hiss", "author": {"kind": "person", "name": "me"}, "pin": {"kind": "time", "t": 2.0, "to": 4.0, "marks": [{"kind": "box", "on": "sound", "points": [[0.2, 0.9], [0.4, 0.6]]}]}});
|
||||
std::fs::write(dir.join(".raea/feed/p.json"), json!({"media": [{"kind": "video", "path": "a.mp4"}], "notes": [note]}).to_string()).unwrap();
|
||||
let r = pinned(&dir);
|
||||
std::fs::remove_dir_all(&dir).ok();
|
||||
assert_eq!(r.len(), 1);
|
||||
assert_eq!((r[0].t, r[0].to, r[0].band, r[0].region), (2.0, Some(4.0), Some([0.6, 0.9]), None));
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ use raea_sys_fingerprint::pairs::difference;
|
||||
use std::path::Path;
|
||||
|
||||
fn row(media: &str, a: f64, b: f64, axis: &str, weight: f32, who: &str, project: String, words: Option<String>) -> Row {
|
||||
Row { media: media.into(), a, b, axis: axis.into(), bad: true, weight, who: who.into(), source: "pair".into(), project, kind: None, region: None, words, at: 0, pin: None }
|
||||
Row { media: media.into(), a, b, axis: axis.into(), bad: true, weight, who: who.into(), source: "pair".into(), project, kind: None, region: None, words, at: 0, pin: None, band: None }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ pub(crate) fn run(enc: &mut Encoders, args: &[String], cwd: &Path, eval: Eval) -
|
||||
continue;
|
||||
}
|
||||
let who = fp.who.clone().unwrap_or_else(|| "me".into());
|
||||
let row = Row { media: c.media.clone(), a, b, axis: x.axis.clone(), bad: *yes, weight: 1.0, who, source: "postmortem".into(), project: name.clone(), kind: None, region: None, words: Some(x.words.clone()), at: 0, pin: None };
|
||||
let row = Row { media: c.media.clone(), a, b, axis: x.axis.clone(), bad: *yes, weight: 1.0, who, source: "postmortem".into(), project: name.clone(), kind: None, region: None, words: Some(x.words.clone()), at: 0, pin: None, band: None };
|
||||
l.push(row, &features(&c, a, b));
|
||||
}
|
||||
dir.write_ledger(&l)?;
|
||||
|
||||
@@ -252,6 +252,7 @@ fn teach(enc: &mut Encoders, args: &[String], cwd: &Path, eval: Eval) -> Result<
|
||||
words: flag(args, "--words").map(str::to_string),
|
||||
at: 0,
|
||||
pin: None,
|
||||
band: None,
|
||||
};
|
||||
let mut l = dir.ledger()?;
|
||||
l.push(row, &features(&c, a, b));
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
//! Grok Bot (xAI's desktop agent, made by Anysphere: /Applications/Grok Bot.app, bundle com.anysphere.sand) as a
|
||||
//! `raea skills install --agent grokbot` target (docs/skills.feature SK13). Read from its app.asar, 1.1.0 (11-14):
|
||||
//! Grok Bot keeps nothing on this Mac that raea could write. Its agent runs on a computer of its own in the cloud (its
|
||||
//! "box"), its skills are held there, and its MCP servers belong to the person's account (Settings → Integrations →
|
||||
//! Add a custom connector), a server's command running on that computer, not here. It has no hooks, no CLI and no ACP.
|
||||
//! What does reach this Mac is its Execution on this computer: the Bot runs a command here, through its local daemon.
|
||||
//! So raea stages its skill in a folder of its own, stamped and with a preface saying where raea runs, and gives the
|
||||
//! grokbot:// links that finish it in Grok Bot: the Execution setting, and a message to the Bot, filled in but not
|
||||
//! sent, asking it to make the skill from the staged file ("Ask your Bot to create one", as Grok Bot itself says).
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
type R<T> = Result<T, String>;
|
||||
|
||||
/// The folder raea stages Grok Bot's copy in: $RAEA_GROKBOT_HOME, else grokbot in raea's own folder in the home.
|
||||
pub fn home() -> R<PathBuf> {
|
||||
match std::env::var_os("RAEA_GROKBOT_HOME").filter(|v| !v.is_empty()) {
|
||||
Some(d) => Ok(PathBuf::from(d)),
|
||||
None => Ok(crate::agent_mcp::user_home()?.join(".raea").join("grokbot")),
|
||||
}
|
||||
}
|
||||
|
||||
/// Where the staged skills go, one folder per skill holding SKILL.md, as for every agent.
|
||||
pub fn skills_dir() -> R<PathBuf> {
|
||||
Ok(home()?.join("skills"))
|
||||
}
|
||||
|
||||
/// The app, where macOS keeps it (/Applications, or ~/Applications).
|
||||
pub fn app() -> Option<PathBuf> {
|
||||
let home = crate::agent_mcp::user_home().ok();
|
||||
[Some(PathBuf::from("/Applications")), home.map(|h| h.join("Applications"))].into_iter().flatten().map(|d| d.join("Grok Bot.app")).find(|a| a.join("Contents/Info.plist").is_file())
|
||||
}
|
||||
|
||||
/// The largest SKILL.md Grok Bot's Skills → Add new skill → Upload file takes, in bytes (256 KB).
|
||||
pub const MAX_SKILL: usize = 256_000;
|
||||
|
||||
/// After `raea skills install --agent grokbot` has copied raea's skills into `dir` (`said`, what it said doing so): the
|
||||
/// preface in raea's SKILL.md, and the links that finish it. A linked folder is the person's, left as it is. Grok Bot
|
||||
/// gets no hooks (it has none) and no MCP server (its command would run on the Bot's own computer, not this Mac).
|
||||
pub fn stage(dir: &Path, said: String) -> R<String> {
|
||||
let md = dir.join("raea/SKILL.md");
|
||||
if !dir.join("raea").is_symlink() && let Ok(text) = std::fs::read_to_string(&md) {
|
||||
let text = with_preface(&text, dir);
|
||||
if text.len() >= MAX_SKILL {
|
||||
return Err(format!("{}: {} KB, more than the 256 KB Grok Bot's Add new skill takes", md.display(), text.len() / 1000));
|
||||
}
|
||||
std::fs::write(&md, text).map_err(|e| format!("{}: {e}", md.display()))?;
|
||||
}
|
||||
Ok(format!("{said}{}", finish(dir)))
|
||||
}
|
||||
|
||||
/// SKILL.md with the preface after its front matter (or first, when it has none): raea runs on the person's Mac, not on
|
||||
/// the Bot's computer. A copy that has one keeps only one.
|
||||
pub fn with_preface(text: &str, dir: &Path) -> String {
|
||||
if text.contains("> **On Grok Bot.**") {
|
||||
return text.to_string();
|
||||
}
|
||||
let p = format!(
|
||||
"> **On Grok Bot.** raea runs on the person's Mac, not on your computer. Run every `raea` command there, and read\n> every file this skill links (3d.md, reference/cli.md and the rest) from its copy there, in {}, both\n> with Run a command on your local computer (the person turns on Settings → Computer → Execution on this computer).\n> No raea MCP server or hook is set up for you: after saving a composition run `raea check EDIT.tsx --quick` yourself,\n> and `raea show FILE` puts media in front of the person.\n",
|
||||
dir.join("raea").display()
|
||||
);
|
||||
let Some(rest) = text.strip_prefix("---\n") else { return format!("{p}\n{text}") };
|
||||
let Some(end) = rest.find("\n---\n") else { return format!("{p}\n{text}") };
|
||||
let (front, body) = (&rest[..end], rest[end + 5..].trim_start_matches('\n'));
|
||||
format!("---\n{front}\n---\n\n{p}\n{body}")
|
||||
}
|
||||
|
||||
/// A query value as Grok Bot builds its own links (encodeURIComponent): every byte but A-Z a-z 0-9 - _ . ! ~ * ' ( ).
|
||||
fn encode(v: &str) -> String {
|
||||
v.bytes().map(|b| if b.is_ascii_alphanumeric() || b"-_.!~*'()".contains(&b) { (b as char).to_string() } else { format!("%{b:02X}") }).collect()
|
||||
}
|
||||
|
||||
/// One of Grok Bot's deep links (its route table: grokbot://app/v1/ROUTE?KEY=VALUE).
|
||||
pub fn link(route: &str, key: &str, value: &str) -> String {
|
||||
format!("grokbot://app/v1/{route}?{key}={}", encode(value))
|
||||
}
|
||||
|
||||
/// The message to the Bot that makes the skill from the copy staged in `dir`: at most 1000 characters, as its prompt
|
||||
/// link takes.
|
||||
fn ask(dir: &Path) -> String {
|
||||
let md = dir.join("raea/SKILL.md");
|
||||
format!("Please make a private skill named raea from the file {} on my Mac: read it with Run a command on your local computer and keep its text as it is. raea runs on my Mac, so run every raea command there.", md.display())
|
||||
}
|
||||
|
||||
/// What `raea skills install --agent grokbot` says once the copy is staged: where it is, and the links that finish it.
|
||||
pub fn finish(dir: &Path) -> String {
|
||||
let md = dir.join("raea/SKILL.md");
|
||||
let here = match app() {
|
||||
Some(a) => format!("Grok Bot is at {}.", a.display()),
|
||||
None => "Grok Bot isn't installed on this Mac (cursor.com/download/bot); the copy is ready for when it is.".into(),
|
||||
};
|
||||
format!(
|
||||
"{here} It keeps its skills on its own computer and its MCP servers on your account, so the copy waits here: {}. No hooks, and no MCP server: Grok Bot runs a server's command on its computer, where the blender server can't reach this Mac's Blender.\nTo finish, in Grok Bot, signed in:\n 1. turn on Execution on this computer: {}\n 2. send the message this fills in, and the Bot makes the skill from the copy: {}\n or by hand: Skills → Add new skill → Upload file → {}\n`open LINK` opens a link in Grok Bot",
|
||||
dir.display(),
|
||||
link("settings", "id", "local-execution"),
|
||||
link("prompt", "text", &ask(dir)),
|
||||
md.display()
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn the_preface_goes_after_the_front_matter_once() {
|
||||
let d = Path::new("/h/.raea/grokbot/skills");
|
||||
let md = "---\nname: raea\ndescription: d\nversion: 1\n---\n\n# raea\n";
|
||||
let out = with_preface(md, d);
|
||||
assert!(out.starts_with("---\nname: raea\ndescription: d\nversion: 1\n---\n\n> **On Grok Bot.** raea runs on the person's Mac"), "{out}");
|
||||
assert!(out.contains("in /h/.raea/grokbot/skills/raea, both") && out.ends_with("\n\n# raea\n"), "{out}");
|
||||
assert_eq!(with_preface(&out, d), out);
|
||||
assert!(with_preface("# no front matter\n", d).starts_with("> **On Grok Bot.**"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn links_are_built_as_grok_bot_builds_its_own() {
|
||||
assert_eq!(link("settings", "id", "local-execution"), "grokbot://app/v1/settings?id=local-execution");
|
||||
assert_eq!(link("prompt", "text", "a b/ü&+=?#'()"), "grokbot://app/v1/prompt?text=a%20b%2F%C3%BC%26%2B%3D%3F%23'()");
|
||||
// its prompt route takes at most 1000 characters of text in a link of at most 2048, with no format characters
|
||||
let a = ask(Path::new("/h/a-home-folder-with-a-rather-long-name/.raea/grokbot/skills"));
|
||||
assert!(a.chars().count() <= 1000 && link("prompt", "text", &a).len() <= 2048, "{a}");
|
||||
assert!(a.chars().all(|c| !c.is_control() && !('\u{200B}'..='\u{200F}').contains(&c) && !('\u{202A}'..='\u{202E}').contains(&c)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stage_prefaces_the_copy_once_and_refuses_one_too_big_to_upload() {
|
||||
let d = std::env::temp_dir().join(format!("raea-grokbot-stage-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&d);
|
||||
std::fs::create_dir_all(d.join("raea")).unwrap();
|
||||
std::fs::write(d.join("raea/SKILL.md"), "---\nname: raea\nversion: 1\n---\n\n# raea\n").unwrap();
|
||||
let out = stage(&d, "copied\n".into()).unwrap();
|
||||
assert!(out.starts_with("copied\n") && out.contains("grokbot://app/v1/prompt?text="), "{out}");
|
||||
stage(&d, String::new()).unwrap();
|
||||
let md = std::fs::read_to_string(d.join("raea/SKILL.md")).unwrap();
|
||||
assert_eq!(md.matches("> **On Grok Bot.**").count(), 1, "{md}");
|
||||
std::fs::write(d.join("raea/SKILL.md"), "x".repeat(MAX_SKILL)).unwrap();
|
||||
assert!(stage(&d, String::new()).unwrap_err().contains("256 KB"));
|
||||
let _ = std::fs::remove_dir_all(&d);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn finish_says_where_the_copy_is_and_both_links() {
|
||||
let f = finish(Path::new("/h/.raea/grokbot/skills"));
|
||||
assert!(f.contains("the copy waits here: /h/.raea/grokbot/skills."), "{f}");
|
||||
assert!(f.contains("grokbot://app/v1/settings?id=local-execution") && f.contains("grokbot://app/v1/prompt?text=Please%20make%20a%20private%20skill"), "{f}");
|
||||
assert!(f.contains("Upload file → /h/.raea/grokbot/skills/raea/SKILL.md"), "{f}");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
//! Where each agent `raea skills install` knows reads a person's skills, one folder per skill holding SKILL.md. Checked
|
||||
//! by hand on 11-05: claude: ~/.claude/skills (Claude Code's docs); codex: ~/.agents/skills
|
||||
//! (developers.openai.com/codex/skills, the user scope; older builds read ~/.codex/skills); kimi: $KIMI_CODE_HOME/skills,
|
||||
//! else ~/.kimi-code/skills (kimi 2.3.3's own binary; it also reads ~/.agents/skills and ~/.claude/skills); gemini:
|
||||
//! ~/.gemini/skills (geminicli.com/docs/cli/skills). grokbot (11-14): Grok Bot reads no folder here, so its copy is
|
||||
//! staged in raea's own (agent_grokbot.rs).
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// The agents, in the order `raea doctor` and the usage name them.
|
||||
pub const AGENTS: [&str; 5] = ["claude", "codex", "kimi", "gemini", "grokbot"];
|
||||
|
||||
/// The folder `agent` reads skills from.
|
||||
pub fn folder(agent: &str) -> Result<PathBuf, String> {
|
||||
let home = crate::agent_mcp::user_home()?;
|
||||
Ok(match agent {
|
||||
"claude" => home.join(".claude/skills"),
|
||||
"codex" => home.join(".agents/skills"),
|
||||
"kimi" => std::env::var_os("KIMI_CODE_HOME").filter(|v| !v.is_empty()).map(PathBuf::from).unwrap_or_else(|| home.join(".kimi-code")).join("skills"),
|
||||
"gemini" => home.join(".gemini/skills"),
|
||||
"grokbot" => crate::agent_grokbot::skills_dir()?,
|
||||
a => return Err(format!("no agent {a:?}: claude, codex, kimi, gemini or grokbot")),
|
||||
})
|
||||
}
|
||||
|
||||
/// Each agent and the folder it reads skills from, for `raea doctor` (an agent with no folder is skipped).
|
||||
pub fn agents() -> Vec<(&'static str, PathBuf)> {
|
||||
AGENTS.into_iter().filter_map(|a| folder(a).ok().map(|t| (a, t))).collect()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn each_agent_has_its_folder() {
|
||||
assert!(folder("claude").unwrap().ends_with(".claude/skills"));
|
||||
assert!(folder("codex").unwrap().ends_with(".agents/skills"));
|
||||
assert!(folder("gemini").unwrap().ends_with(".gemini/skills"));
|
||||
assert_eq!(folder("grokbot").unwrap(), crate::agent_grokbot::skills_dir().unwrap());
|
||||
assert!(folder("cursor").is_err());
|
||||
assert_eq!(agents().len(), AGENTS.len());
|
||||
}
|
||||
}
|
||||
@@ -11,5 +11,9 @@ pub mod splat;
|
||||
/// the MCP servers `raea skills install` offers an agent (blender, for a running Blender)
|
||||
pub mod agent_mcp;
|
||||
pub mod agent_hooks;
|
||||
/// Grok Bot as a `raea skills install` target: its copy staged on this Mac, and the links that finish it in Grok Bot
|
||||
pub mod agent_grokbot;
|
||||
/// where each agent reads a person's skills
|
||||
pub mod agent_skills;
|
||||
/// `raea setup blender` and `raea blender run`
|
||||
pub mod blender;
|
||||
@@ -129,12 +129,10 @@ fn doctor_finds_old_briefs_and_old_skills() {
|
||||
fn the_root_with_none_set() {
|
||||
let home = scratch("home-root");
|
||||
assert_eq!(default_root(&home), home.join("Documents/raea"));
|
||||
// an empty ~/Studio isn't one; one with a workspace stays the root
|
||||
std::fs::create_dir_all(home.join("Studio/notes")).unwrap();
|
||||
assert_eq!(default_root(&home), home.join("Documents/raea"));
|
||||
// never ~/Studio, even with a workspace in it (Shane 11-14: "no internal no studio"; raea.root says otherwise)
|
||||
std::fs::create_dir_all(home.join("Studio/acme/.raea")).unwrap();
|
||||
std::fs::write(home.join("Studio/acme/.raea/workspace"), "").unwrap();
|
||||
assert_eq!(default_root(&home), home.join("Studio"));
|
||||
assert_eq!(default_root(&home), home.join("Documents/raea"));
|
||||
// iCloud keeping Documents: ~/raea
|
||||
let synced = scratch("home-icloud");
|
||||
std::fs::create_dir_all(synced.join("Library/Mobile Documents/com~apple~CloudDocs/Documents")).unwrap();
|
||||
|
||||
@@ -100,31 +100,19 @@ pub fn root() -> PathBuf {
|
||||
}
|
||||
}
|
||||
|
||||
/// Where workspaces go with no raea.root set: ~/Studio where workspaces are already (the root before 11-10), else
|
||||
/// ~/Documents/raea, or ~/raea when iCloud keeps the Documents folder (a workspace's git history and footage don't
|
||||
/// belong in a synced folder). The feed's host says the same (raea-feed host/workspace.ts defaultRoot).
|
||||
/// Where a workspace someone names goes with no raea.root set: ~/Documents/raea, or ~/raea when iCloud keeps the
|
||||
/// Documents folder (a workspace's git history and footage don't belong in a synced folder). Nothing is made there
|
||||
/// until the person or an agent sets a workspace up (`raea workspace init NAME`); ~/Studio, the root on raea's own Mac
|
||||
/// before 11-10, is no one else's (Shane 11-14: "no internal no studio"). The feed's host says the same (raea-feed
|
||||
/// host/workspace.ts defaultRoot).
|
||||
pub fn default_root(home: &Path) -> PathBuf {
|
||||
let studio = home.join("Studio");
|
||||
if holds_workspace(&studio) {
|
||||
studio
|
||||
} else if home.join("Library/Mobile Documents/com~apple~CloudDocs/Documents").is_dir() {
|
||||
if home.join("Library/Mobile Documents/com~apple~CloudDocs/Documents").is_dir() {
|
||||
home.join("raea")
|
||||
} else {
|
||||
home.join("Documents/raea")
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether a folder in `dir` is a workspace (it has .raea/workspace).
|
||||
fn holds_workspace(dir: &Path) -> bool {
|
||||
let Ok(entries) = std::fs::read_dir(dir) else { return false };
|
||||
for e in entries.flatten() {
|
||||
if e.path().join(".raea/workspace").exists() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
/// The include in a repo's own config that makes `git config` read a committed file. Idempotent; the path is relative
|
||||
/// to the config file, which for a submodule lives under the workspace's .git/modules.
|
||||
pub(crate) fn include(repo: &Path, file: &Path) -> R<()> {
|
||||
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
# text-overflow: ellipsis cuts only text that doesn't fit. A label shrink-wrapped by its box (a grid of picker cells,
|
||||
# each name centred under a dot) drew "Fr…" and "Mou…" for words that fit: the ellipsis was measured against the box's
|
||||
# rounded width, up to a pixel narrower than the text it wraps (each edge rounds on its own), and blitz-paint now
|
||||
# measures against the unrounded width the text was laid out in. Checked, each page rendered twice, once with
|
||||
# `text-overflow: ellipsis` and once with `clip`:
|
||||
# fit shrink-wrapped labels at many x offsets: the two renders are byte-identical (no ellipsis drawn)
|
||||
# over a word wider than its 40 px box: the two renders differ (the ellipsis is drawn)
|
||||
# Exits 1 on a failure.
|
||||
# bench/ellipsis-fit/check.sh (RAEA_BIN: the raea to run, default target/release/raea)
|
||||
cd "$(dirname "$0")/../.." || exit 2
|
||||
BIN=${RAEA_BIN:-$PWD/target/release/raea}
|
||||
export RAEA_SIGN=0 RAEA_MARK=0 RAEA_EXPORT_CACHE=0
|
||||
OUT=$(mktemp -d "${TMPDIR:-/tmp}/raea-ellipsis-fit.XXXXXX")
|
||||
trap 'rm -rf "$OUT"' EXIT
|
||||
status=0
|
||||
page() { # NAME OVERFLOW BODY
|
||||
cat > "$OUT/$1-$2.html" <<HTML
|
||||
<!doctype html><html><head><meta charset="utf-8"><style>
|
||||
html,body{margin:0;width:640px;height:200px;background:#0a0a0a;font:11px/16px system-ui,sans-serif;color:#aaa}
|
||||
.grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:3px;width:617px;padding:9px 11.5px}
|
||||
.cell{display:flex;min-width:0;flex-direction:column;align-items:center;gap:4px;padding:8px 4px 6px}
|
||||
.dot{width:30px;height:30px;border-radius:15px;background:#6c6}
|
||||
.t{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:$2}
|
||||
.narrow{width:40px;margin:20px}
|
||||
</style></head><body><div id="root" data-composition-id="main" data-start="0" data-width="640" data-height="200" data-duration="1">$3</div></body></html>
|
||||
HTML
|
||||
"$BIN" render "$OUT/$1-$2.html" -o "$OUT/$1-$2.png" > "$OUT/$1-$2.log" 2>&1 || { echo "FAIL $1 ($2) didn't render"; cat "$OUT/$1-$2.log"; status=1; }
|
||||
}
|
||||
cells=""
|
||||
for w in Owl Frog Dog Mouse Bunny Bear Fox Cat Tabby Snow Rose Sky Mint Slate; do cells+="<div class=\"cell\"><span class=\"dot\"></span><span class=\"t\">$w</span></div>"; done
|
||||
for ov in ellipsis clip; do
|
||||
page fit "$ov" "<div class=\"grid\">$cells</div>"
|
||||
page over "$ov" "<div class=\"narrow t\">Mousetrap</div>"
|
||||
done
|
||||
cmp -s "$OUT/fit-ellipsis.png" "$OUT/fit-clip.png" && echo "PASS fit: shrink-wrapped labels draw no ellipsis" || { echo "FAIL fit: an ellipsis was drawn on a label that fits"; status=1; }
|
||||
cmp -s "$OUT/over-ellipsis.png" "$OUT/over-clip.png" && { echo "FAIL over: a word wider than its box drew no ellipsis"; status=1; } || echo "PASS over: a word wider than its box ends in an ellipsis"
|
||||
exit $status
|
||||
@@ -201,3 +201,11 @@ Feature: raea's plugin ecosystem: extending the engine and the app, made, shared
|
||||
And may an extension restyle the app itself (a theme), or only draw inside its own frames?
|
||||
And packages install per person, in every project (Shane 11-09: answered)
|
||||
And will packages ever be sold through raea, or stay free with raea taking no part?
|
||||
|
||||
Scenario: EC13. A package that imports raea shares the composition's SDK (#151)
|
||||
Given a package in the project's node_modules (or the person's plugins) that imports "raea", "raea/<module>" or
|
||||
"@raea/<package>", its entry .tsx or plain ESM .js
|
||||
Then the import is the SDK copy the composition's own files import (engine/bundle edit.rs sdk_copy): one SDK, so
|
||||
its hooks read the Clock the engine drives, exactly as the same file imported by a relative path does
|
||||
And never an outside global the bundle leaves unresolved ("Can't find variable: raea" before the first frame)
|
||||
And engine/bundle/tests/bundle.rs a_package_importing_the_sdk_gets_the_work_folders_copy holds it
|
||||
@@ -0,0 +1,157 @@
|
||||
@spec
|
||||
Feature: Feed tasks: the graph view's layering, the to-do list, and sessions started outside the app
|
||||
Shane, 2026-11-13: "note to ship with this next batch for release is that in the react graph view when i zoom in it
|
||||
ends up obstructing other buttons and gui outside of the stage and across the app, so we need to make sure layering
|
||||
works there and remove the agents button in the top right of feed and inbox for a checkbox and this is a editable
|
||||
todolist built to look minimal, skimmable and easy to read with the ability to click into a task to see more
|
||||
details. the other note to add is in the timeline if an agent is currently running even if i have initiated the
|
||||
session myself in terminal or an app and it is still claimed or working on it without being terminated, meaning its
|
||||
still open or the session is active, we should see it in the feed and see updates from it. this should help tie
|
||||
into the todolist stuff too."
|
||||
|
||||
Three parts. Each is done when it works in raea's window (not only in Chrome) and has its tests.
|
||||
|
||||
Background:
|
||||
Given the app's code is apps/app (raea-feed); its branch for parts 2 and 3 is feed-tasks, part 1 is on its main
|
||||
And a window check is a headless raea window of the session's own: `node blitz/pw-run.mjs SPEC` on the BLITZ_E2E
|
||||
bundle, RAEA_PAGE_HOST_BIN a copy of the page host, a fresh raea.root each run
|
||||
|
||||
Rule: FT1. The graph view stays in its own box
|
||||
# Status 11-13: built, in 0.1.3. Engine 37846080a (vendor/blitz-dom/src/node/node.rs, sdk/ui/src/dom/input.ts, a unit test
|
||||
# in sdk/ui/test/dom.test.tsx); app raea-feed #11 (AskCanvas clipped at its box, e2e/canvas-layer.spec.ts).
|
||||
# Cause: Chrome never showed it. In raea's window the canvas was DRAWN clipped, but neither hit test honoured an
|
||||
# overflow clip: blitz-dom's hit_inner tested a clipping box's children wherever they overflowed to, and sdk/ui's
|
||||
# hit dropped the inherited clip at a child with its own z-index and replaced it at a child that clips (a card is
|
||||
# overflow-hidden). Both halves are needed: with only sdk/ui fixed, elementFromPoint is right and a real press
|
||||
# still lands on the canvas (the host's target wins). Checked: the spec in Chrome and in the window; the app's
|
||||
# whole window smoke 28 passed, 49 failed, 4 skipped of 81 before and after, the same tests; sdk/ui 60 tests.
|
||||
# Not read by the hit tests: a transform on a box between a z-indexed child and its stacking-context root (the
|
||||
# painter's clips don't read it either); in sdk/ui, an absolute box whose containing block is above the clipper.
|
||||
|
||||
@done
|
||||
Scenario: FT1a. A press outside the canvas never reaches it, at any zoom
|
||||
Given an ask with four pictures open on its canvas (React Flow), zoomed all the way in (scale 2)
|
||||
Then no point outside the canvas's box finds a piece of the canvas (document.elementFromPoint)
|
||||
And a press on the sidebar, the workspace picker or the header goes to what is drawn there
|
||||
And the canvas clips what it draws at its own box
|
||||
|
||||
@done
|
||||
Scenario: FT1b. A box that clips takes no pointer for what it cuts away, anywhere in the window
|
||||
Given a box with overflow other than visible, and a child that overflows it, with or without its own z-index
|
||||
Then a point outside the box's padding box never hits the child or anything in it
|
||||
But a fixed box, and a box whose containing blocks are above the clipping box, are not cut by it
|
||||
|
||||
Rule: FT2. The agents button is a checkbox that opens the to-do list
|
||||
# Status 11-13: built, in 0.1.3: raea-feed #12, merged ab68f0d (3b2353b, a2dc439). src/feed/todo.ts (the rows),
|
||||
# src/feed/TodoPanel.tsx, brief/format.ts removeTask and moveTask. The Agents panel and its menu surface are gone.
|
||||
# Checked: e2e/todo.spec.ts 4 of 4 in Chrome and 4 of 4 in the window; vitest (todo.test.ts, format.test.ts).
|
||||
# Decisions made here, each open to Shane's word:
|
||||
# - It is the tasks the app already has, not a second list: the project's brief's tasks (## Tasks in brief.md:
|
||||
# what the composer, the Board and agents write) and the edits sent on its items (comment tasks). Nothing is
|
||||
# kept by the list.
|
||||
# - Words are changed in a task's details (one click away, in the same column), not in the list's line: a click
|
||||
# on a line opens it, so the line itself stays a single target.
|
||||
# - A task's comments: an edit's replies; a brief task's are its linked item's open comments. A brief's task has
|
||||
# nowhere of its own to keep a comment yet.
|
||||
# - In the Inbox a new task goes to the project picked beside the line (the first, until picked).
|
||||
# - Reorder is within a project's brief tasks; an edit keeps its place by when it was sent.
|
||||
# Left: no keyboard shortcut opens the list; the Board's card sheet still edits a task's agents, due date and tags.
|
||||
|
||||
@done
|
||||
Scenario: FT2a. Where the agents button was, in a feed and in the Inbox
|
||||
Then a feed's header has no agents button; a checkbox there opens the to-do list in a column on the right
|
||||
And in a project's feed it is the project's list; in the Inbox the workspace's, each project's tasks under its name
|
||||
And its tooltip says what it is; the column closes from its own button and is as it was left next time
|
||||
|
||||
@done
|
||||
Scenario: FT2b. Minimal, skimmable
|
||||
Then a task is one line: a checkbox, its words, and who has it when someone does
|
||||
And its handle and Remove show only on the line pointed at or focused
|
||||
And done tasks are folded away under a count ("2 done"), opened by a click
|
||||
|
||||
@done
|
||||
Scenario: FT2c. Edited where it is read, written at once, with Undo
|
||||
When I type a line and press Enter, check a task off, change its words, drag it by its handle (or Alt+Up/Down),
|
||||
or remove it
|
||||
Then the change is written at once to where the task lives (the brief; a linked item's status; the comment)
|
||||
And Undo at the column's foot, or Cmd+Z, takes the last change back
|
||||
But a brief's change is undone only while the brief is still as that change left it
|
||||
|
||||
@done
|
||||
Scenario: FT2d. A click opens a task's details; Esc goes back
|
||||
Then the details show its words, who is on it and what they last did, the feed item it is linked to, its comments
|
||||
And an agent at work on it in one of the app's own sessions can be stopped there, with its subagents listed
|
||||
And Esc goes back to the list, not out of the feed
|
||||
|
||||
Rule: FT3. A session started outside the app is in the feed while it is open
|
||||
# Status 11-13: built, in 0.1.3: raea-feed #12, merged ab68f0d (7e90a7c, a2dc439). host/outside.ts (POST
|
||||
# /host/outside), src/feed/outside.ts, OutsideKeeper.tsx, OutsideBubble.tsx. No feed tool was added or changed.
|
||||
# Checked: e2e/outside.spec.ts 2 of 2 in Chrome and in the window (the host's list given by the spec);
|
||||
# host/outside.test.ts on files written as Claude Code writes them; the reader run against this Mac's six real
|
||||
# sessions. Not checked: a real session ending while the app's own window is watched by a person.
|
||||
# The signal, the smallest honest one: what the harness already keeps. Nothing new is asked of any session.
|
||||
# - Claude Code keeps ~/.claude/sessions/<pid>.json for each open session ({pid, sessionId, cwd, name, status})
|
||||
# and its transcript, <sessionId>.jsonl in its projects folder.
|
||||
# - active: its file is there, its process is alive, and a person runs it (kind "interactive"). Holding a claim
|
||||
# alone is not active: a task a session has that has ended still names it, without a live mark.
|
||||
# - working: the file says "busy"; otherwise it is open and waiting at its prompt.
|
||||
# - an update: its last words, the tool call at hand, its plan (the last TodoWrite), read from the transcript's
|
||||
# end; an item it posts and a task it marks are already in the feed and on the task.
|
||||
# - ended: the host no longer lists it.
|
||||
# Left: Codex, Gemini, Kimi and the rest keep no file that says a session is open, so they are in the feed only
|
||||
# by what they post; a session working in a folder that is no project's and that has posted nothing is in no
|
||||
# feed (Shane's own lanes in ~/raea are this case until they `raea show` something); rask claims and the lanes
|
||||
# board are not read.
|
||||
|
||||
@done
|
||||
Scenario: FT3a. One bubble a session, in the projects it is in
|
||||
Given a Claude Code session open on this Mac
|
||||
Then it has one bubble in the feed of each project whose folder it works in or that it has posted to
|
||||
(its posts carry its inbox, claude-code-<the first 8 of its id>, as `raea show` names it), and in the Inbox
|
||||
And a session that is in no project's folder and has posted nothing is in no feed
|
||||
|
||||
@done
|
||||
Scenario: FT3b. It reads as the app's own sessions do, without a Stop
|
||||
Then the bubble says its name and harness, that it is working (and for how long) or waiting at its prompt,
|
||||
the step at hand, its last words, and its plan
|
||||
And there is no Stop: a mark beside its status says where it runs and that it is stopped there
|
||||
|
||||
@done
|
||||
Scenario: FT3c. Its updates come as it goes, and it ends when the session does
|
||||
When it says something new or starts another step
|
||||
Then the same bubble shows it within a few seconds, written only when what it shows has changed
|
||||
When the session is no longer open
|
||||
Then the bubble ends, its last words kept; a session that comes back opens it again
|
||||
|
||||
@done
|
||||
Scenario: FT3d. It ties to the to-do list
|
||||
Then a brief's task that @names the session, and an edit on an item it posted, are its tasks
|
||||
And the bubble names them, and the to-do list shows the session on them with what it last did
|
||||
|
||||
# Status 11-13 (FT3e, FT3f): built for 0.1.4 in raea-feed #25, stacked on #24; neither merged, both wait for Shane.
|
||||
# Shane 11-13, on the cards: "even if i started the chat or session out of raea app i can open up the chat in a
|
||||
# raea chat ui ... show what agent is working on what or any subagents and feel more like i can click to see more
|
||||
# and less rows of info". Checked: e2e/outside.spec.ts 3 of 3 in Chrome, with the host's answers given by the
|
||||
# spec; host/outside-chat.test.ts and host/outside.test.ts on files written as Claude Code writes them;
|
||||
# bridge-resume.test.ts on a test agent that offers fork. Not checked: a fork through the real claude-agent-acp.
|
||||
# Left: other harnesses' transcripts (only Claude Code's is read), and an image a prompt carried.
|
||||
Scenario: FT3e. Open chat opens it as a chat in raea
|
||||
When I press Open chat on its bubble
|
||||
Then its conversation so far opens as one of the workspace's chats: my prompts, its replies and thinking, its
|
||||
tool calls with their results and diffs, and its plan, read from its transcript (the newest 6 MB, saying so
|
||||
when older messages were left out)
|
||||
And a line at the top says where it was started and what writing there does
|
||||
And while it is still open where it runs, what it says next shows in the chat as it says it
|
||||
And opening it starts no agent
|
||||
When I write in that chat
|
||||
Then the agent carries it on in the folder it ran in: a copy of it (forked) while it is still open there, so the
|
||||
one there goes on by itself, or the session itself (resumed) when it has ended
|
||||
And from then on it is raea's chat, and following stops
|
||||
|
||||
Scenario: FT3f. Its bubble says who is on what, folded until I open it
|
||||
Then folded, the bubble says what the session is on (its own title, or the name it was given), what it is
|
||||
doing now, and the subagents it has running
|
||||
When I click the bubble or More, which names what more there is
|
||||
Then it opens to its last message, its plan, its subagents (the running ones with the call each is on, then
|
||||
the latest done, with how many more are done) and the notes of mine it has
|
||||
And Less, or another click, folds it again
|
||||
@@ -438,7 +438,7 @@ Feature: Fingerprint: a person's or a team's sense of good work, learned on thei
|
||||
feed with the fingerprint that judges it, asks first where a head goes against the person's own label on that
|
||||
moment, then where a head sits nearest its flag, one per axis and piece within 4 s, at most ten, as Yes/No
|
||||
questions in one `raea show` item with the moment cut to a clip; `--tally` makes each answer a "postmortem" row,
|
||||
retrains and prints each head's held-out AUC before and after. Archiving a project runs it in the background (raea-feed PR #5, not merged yet)
|
||||
retrains and prints each head's held-out AUC before and after. Archiving a project runs it in the background (raea-feed #5, in the 0.1.2 app)
|
||||
|
||||
Rule: FP8. Teams
|
||||
@needs:FP2d @done
|
||||
@@ -533,7 +533,7 @@ Feature: Fingerprint: a person's or a team's sense of good work, learned on thei
|
||||
notes' rows. `move [--fp CHILD] [--to PARENT] --axis/--source/--project` takes the child's own matching rows up
|
||||
into a fingerprint it extends and retrains both; rows on an axis the parent lacks or the child overrides stay
|
||||
|
||||
@needs:FP14c
|
||||
@needs:FP14c @done
|
||||
Scenario: FP14e. Managing them in the app
|
||||
Then the fingerprint page lists the person's fingerprints as a tree by `extends`, each with its `about`, where it
|
||||
applies, its labels and what it knows; one is shown at a time, and a project's page names the one judging it
|
||||
@@ -546,8 +546,10 @@ Feature: Fingerprint: a person's or a team's sense of good work, learned on thei
|
||||
Settings makes one the default and trains it; headless, the app made client-ads from me in 34 s and trained it
|
||||
from 12 renders in 3m54s (910 rows, 6 axes gating). Since: the switcher is a tree by `extends`, each saying
|
||||
which kinds and tags it judges; "New fingerprint" asks which it judges (`new --kinds --tags`); a project's header
|
||||
names the one `raea fingerprint which` picks, why in its tooltip. Not yet: making one in a project's or
|
||||
workspace's folder from the app (`share` does it from the CLI)
|
||||
names the one `raea fingerprint which` picks, why in its tooltip. 11-13 (raea-feed #8): that name is a menu
|
||||
saying who judges and why, with Keep with this project and Keep with the workspace listing the person's
|
||||
fingerprints; the host runs `share` and `use` there and commits the folder in the repo that holds it.
|
||||
Tests: host/fingerprint-keep.test.ts (the real raea in a throwaway home), e2e/fingerprint-keep.spec.ts
|
||||
|
||||
Rule: FP9. Agents use it, and can't game it
|
||||
@needs:FP3a,FP4b,FP5c
|
||||
@@ -594,14 +596,22 @@ Feature: Fingerprint: a person's or a team's sense of good work, learned on thei
|
||||
followed it left across the frame, a looser box (overlap 0.41). A blind seed in the middle of an app render
|
||||
kept only the note's frame, so only its own window
|
||||
|
||||
@needs:FP11b
|
||||
@needs:FP11b @done
|
||||
Scenario: FP11c. Marks on the sound
|
||||
Given the review player shows a sound's spectrogram under its picture (or in its place, for sound alone)
|
||||
Then a box drawn on it is a note's mark there, kept in 0-1 of the span shown (time) and of the frequencies (mel)
|
||||
And on a defect note on a sound axis, `learn-notes` makes its time the label's span and keeps its band in the row
|
||||
And decided 11-12: not in 0.1.2. The player draws no spectrogram, and raea-feed is fixed at what 0.1.2 ships.
|
||||
Until then a sound note's span (FP11a) is its time label, and the sound heads are per window, so a band
|
||||
would be kept but not yet learned from
|
||||
And decided 11-12: not in 0.1.2; built 11-13 for 0.1.3 (raea-feed #9). The host draws a mel
|
||||
spectrogram (host/spectrum.ts: 22.05 kHz, 64 bands to 11.025 kHz, a column every 25 ms, the loudest 80 dB),
|
||||
the timeline's sound track offers it as Spectrogram (opened tall), and Listen shows it under the waveform.
|
||||
A box dragged on it (with the Comment tool on the timeline, any drag in Listen) opens the moment card naming
|
||||
its span and band in Hz; the note's pin is a time pin over the box's span with one mark {kind: "box", on:
|
||||
"sound", points: [[time, mel], [time, mel]]} in 0-1 of the piece and of the mel scale, drawn again on the
|
||||
spectrogram in its author's hue, and the agent reads it as "Marked on the sound (box, T0 to T1, LO to HI)"
|
||||
(e2e/sound-marks.spec.ts, src/detail/marks.test.ts, host/spectrum.test.ts). `marked` ignores a sound box (it
|
||||
is no place in the frame); `sound_band` reads its band into the reading, and `learn-notes` labels t..to
|
||||
(widened to half a second about its middle when shorter) and keeps a defect's band in the evidence row's
|
||||
`band`. The sound heads are still per window, so the band is kept but not yet learned from
|
||||
|
||||
Rule: FP12. Heatmaps: a picture axis says where, not only whether
|
||||
@needs:FP11b,FP2c @done
|
||||
|
||||
@@ -19,6 +19,12 @@ about a piece, such as a soft picture, dead motion, noise under the voice or a c
|
||||
device**. On top of the axes sit the person's **weighting** across them, an optional **profile** (ranges taken from
|
||||
work they admire) and the **evidence ledger** that every head was trained from.
|
||||
|
||||
The frozen encoders together are the **Edit Embedding Zoo** (Shane, 11-13: the standard name, in the docs, the app
|
||||
and anything we publish): SigLIP 2 for pictures, CLAP for how it sounds, YAMNet for sound events and their timing,
|
||||
EmbeddingGemma 2 for text and Depth Anything 3 for depth. They are pinned, run on the person's device and are the same
|
||||
for every fingerprint. A fingerprint is what a person trains over the zoo: its axes' heads. The zoo itself never
|
||||
changes.
|
||||
|
||||
On day one, an axis's words already give it a zero-shot score. Each label the person adds retrains its head in
|
||||
milliseconds. Whatever can be measured exactly, such as loudness, silence gaps, frozen frames or one thing passing
|
||||
through another, is a check rather than a learned head. A team shares evidence, never media, and each machine
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
@spec
|
||||
Feature: Hardware: controls that feel like instruments, heard on raea's own mixer
|
||||
Shane, 2026-11-14, pointing at SPEC-01 (spec-01.vercel.app, a shadcn registry of controls drawn as hardware, its
|
||||
sounds made with the browser's Web Audio): "i want to have this ui kit installed across the app where relevant with
|
||||
sounds especially for controllers ... wrap the app in <Hardware> ... and have a sound off button in settings. this
|
||||
could be used for so many things and feels aligned with our vibe and brand." Then, on how its sounds would play in
|
||||
raea's window: "why web audio isnt it in a raea engine its rendering wouldnt we use raea tone.js/firewheel?" And:
|
||||
"we would make our own version of it no need to use theirs for real unless it makes sense. we keep dark mode."
|
||||
|
||||
So: raea's own kit, dark, in the idiom SPEC-01 shows (keys that go down and come back, latches, detents, knobs,
|
||||
faders, readouts), with its sounds written in raea/tone and played by raea's mixer on Firewheel. None of SPEC-01's
|
||||
code is taken; it is credited as the inspiration (Apache-2.0, Vercel Labs' ui-sdk).
|
||||
|
||||
What there is to build on (read 11-14):
|
||||
- raea's window has no Web Audio graph on purpose (sdk/ui/src/platform/audio.ts: decodeAudioData only, AudioContext
|
||||
not installed, "so a page that looks for it finds it missing rather than half there"). A web kit's sounds are
|
||||
silent there.
|
||||
- raea/tone (sdk/audio/src/tone) is Tone.js's API on raea's one mixer core: instruments, effects and buses (one of
|
||||
them `ui`) as a graph (`<audio data-tone-graph>`) and events (`<audio data-tone-evs>`). Today only a composition
|
||||
reaches the mixer: a render bounces it (systems/mix offline.rs) and the stage plays it live (systems/mix live.rs,
|
||||
`Live::sync` a frame at a time). A page's own interactions have no way in.
|
||||
- The page's host calls (raea-runtime-js HostCalls; the stage's in engine/page/stage calls.rs), reached from a page
|
||||
as `__raea_engine.call(name, args)`.
|
||||
|
||||
Status, 11-14: HW0 to HW4 built (engine lane `hardware`; the app's raea-feed branch `hardware`, src/hardware). HW0b
|
||||
measured: 200 presses 15 ms apart through Live::fire, 0 late, 200 in the tap (systems/mix tests/fire.rs, ignored as
|
||||
it opens a device); in raea's window, 40 presses on the kit's sheet fired 40 on the page's mixer, 0 late (raea-feed
|
||||
blitz/kit.sh, headless and muted). HW1b: the loudest voice, the primary key, peaks at -22 dB (raea-feed
|
||||
bench/kit-voices.sh). HW2b: the sheet (#/kit, ui-parity screen 27-kit) drawn by raea's window matches Chrome's by eye,
|
||||
and the switches' thumbs measure centred, 2 px all round, in both (Shane 11-14: "slightly off center": a thumb has no
|
||||
skirt, and its groove is shaded evenly, as a well's lit lip read a pixel low); the ui-parity run is still to do (it
|
||||
reads the app while it still shows its loading shapes). Shane 11-14: into 0.1.4. HW5 open.
|
||||
|
||||
Background:
|
||||
Given the engine's part is systems/mix (the mixer) and engine/page/sound (the page's call), the SDK's is
|
||||
sdk/audio/src/tone (fire), and the app's is raea-feed src/hardware
|
||||
|
||||
Rule: HW0. A page plays a sound now, on raea's mixer
|
||||
# Plan (crate or package | file | lines | job)
|
||||
# raea-sys-mix | src/live/fire.rs | 80 | Live::fire: a graph built when it changes, events at the clock's now
|
||||
# raea-page-sound | src/lib.rs | 120 | the page's `sound.fire` call: a mixer of its own on a thread, resting when idle
|
||||
# @raea/audio | src/tone/fire.ts | 80 | fire(play): a page's one-shot, as <Sfx> is a game's, sent to the call
|
||||
|
||||
Scenario: HW0a. sound.fire
|
||||
Given a page in raea's window (the app, a plugin's page, any page the page host shows)
|
||||
When it calls sound.fire with a raea/tone graph and a list of events
|
||||
Then the graph is built on the page's own mixer when it is new or changed, and each event plays at the clock's
|
||||
now plus the mixer's head plus the event's own time: no frame and no timeline stand in between
|
||||
And the call answers at once; it never waits for the sound
|
||||
And RAEA_AUDIO_MUTE=1 silences it as it silences every mixer
|
||||
|
||||
Scenario: HW0b. Heard within a frame of the press
|
||||
Then a fired event reaches the speaker within the mixer's head (two 256-sample blocks and 5 ms: 15.7 ms at
|
||||
48 kHz) of the call, measured on the mixer's own clock (the late-event count stays 0 over 200 fires)
|
||||
|
||||
Scenario: HW0c. Nothing runs while nothing sounds
|
||||
Then the page's mixer opens the device on its first fire, and stops its stream after 10 s with nothing fired
|
||||
(the stage's rest, lightspeed R6); the next fire starts it again
|
||||
|
||||
Scenario: HW0d. fire() in raea/tone
|
||||
Then `fire(play)` runs `play(time)` the way <Sfx> runs a game's one-shot: its triggers become events, keyed so
|
||||
no two fires share one, sent with the graph (only when the graph changed since the last fire) to sound.fire
|
||||
And with no raea engine under the page (a browser) it returns without a sound, and says so once in the console
|
||||
|
||||
Rule: HW1. The kit's voices, in raea/tone
|
||||
Scenario: HW1a. A voice for each kind of touch
|
||||
Then a key going down thocks and coming up clicks lighter, a primary key deeper; a latch catches going down and
|
||||
springs going up; a detent (a knob's step, a switch's position, a wheel's row) ticks; anything on a screen (a
|
||||
readout, a list row) blips; a popup opens with a soft pop; typing clicks, deeper for space and heavier for
|
||||
Enter and Backspace; an outcome chimes (done, warning, error)
|
||||
And each is written with raea/tone's instruments and effects on the `ui` bus, never an audio file
|
||||
And no two presses sound quite alike: each varies its pitch and level a little, by raea/tone's seeded variation
|
||||
|
||||
Scenario: HW1b. Quiet by default
|
||||
Then the kit's loudest voice peaks at least 18 dB under full scale on the ui bus, under any music or voice a
|
||||
stage plays at the same time
|
||||
|
||||
Rule: HW2. The kit, dark, drawn by raea's window
|
||||
Scenario: HW2a. The controls
|
||||
Then the kit has a key (a button), a latch (a key that stays down), a switch and a slide switch, a knob with
|
||||
detents, a fader, a segmented selector, a stepper with its readout, a readout (an LCD-like screen), and a lamp
|
||||
And each is drawn on the app's dark palette (its ground, its raised greys, its ink and its accent), as anodised
|
||||
panels, keycaps and screens; there is no light skin
|
||||
And each works by pointer and by keyboard (arrows step a knob, a fader, a selector; Space and Enter press a key),
|
||||
with a focus ring shown only for the keyboard
|
||||
And each plays its HW1 voice as it moves, and nothing when sound is off (HW4)
|
||||
|
||||
Scenario: HW2b. Drawn the same in raea's window and in Chrome
|
||||
Then every control is drawn with what raea's window paints (no `<input type=range>`, whose thumb the window doesn't
|
||||
move; no SVG for anything a pointer presses; a drag followed by window pointer listeners), and a screenshot of
|
||||
the kit's sheet in a headless raea window matches Chrome's within the ui-parity bar
|
||||
|
||||
Scenario: HW2c. <Hardware>
|
||||
Then the app sits in one <Hardware> root, which installs the kit's sounds and keyboard-only focus once and changes
|
||||
nothing else about how the app looks
|
||||
|
||||
Rule: HW3. Where the kit is used
|
||||
Scenario: HW3a. Controllers
|
||||
Then a controller's fields are the kit's: a toggle is a switch, a choice a segmented selector (a dial past five
|
||||
options), a number a knob or a fader with its readout, and each change sounds as it is made
|
||||
|
||||
Scenario: HW3b. Settings
|
||||
Then Settings' toggles and choices are the kit's switches and selectors
|
||||
|
||||
Scenario: HW3c. The rest of the app, where a control is a control
|
||||
Then the Send keycap, the timeline's sliders and the player's transport use the kit's keys, faders and their
|
||||
voices; lists, menus and text stay the app's own
|
||||
|
||||
Rule: HW4. Sound off
|
||||
Scenario: HW4a. Settings › General › Interface sounds
|
||||
Then one switch turns every interface sound off and on, at once, remembered on this Mac
|
||||
And it is on by default
|
||||
And it never silences a film, a sound or a game: only the interface
|
||||
|
||||
Rule: HW5. Open
|
||||
Scenario: HW5a. Felt on a Mac's trackpad
|
||||
Then a knob's detent, a switch's catch and a fader's end are felt on a Force Touch trackpad (the system's haptic
|
||||
feedback, through a host call), as they are heard
|
||||
|
||||
Scenario: HW5b. A browser hears them too
|
||||
Then the kit's voices are bounced by raea once into small files a browser plays, so the app's page in Chrome (the
|
||||
tutorials' stage on raea.io) clicks as raea's window does
|
||||
@@ -31,6 +31,124 @@ Feature: Lightspeed: raea as fast as anything could be, with the best quality, m
|
||||
And it updates the row here (value, date, commit) and appends a line to the log at the bottom
|
||||
And when an experiment doesn't pay, it records the numbers and reverts the change. A measured no is a result
|
||||
|
||||
Rule: 0.1.4, the performance release (set 2026-11-13: "the v0.1.4 update will be completely performance based")
|
||||
# Seven areas, each with a measured baseline before anything changes. Measured on a clone of a real workspace (9
|
||||
# projects, 21,713 files, a 19 GB media library), the built app headless, a Mac with 64 GB.
|
||||
Scenario: PF1. App start and data loading: seconds if not milliseconds
|
||||
Then the baseline, warm, headless: projects listed 0.61 to 0.67 s after the app is spawned (its host up at
|
||||
0.45 to 0.5 s); a project's feed shown 136 ms after the click with 6 cards, 260 to 282 ms with 41 (about 6 ms
|
||||
a card)
|
||||
And the largest real project's feed (93 cards): its first card 215 ms after the click, settled at 320 ms
|
||||
And the first launch after a new binary: 3.7 s to the projects listed (0.6 s warm)
|
||||
And open: a cold start after a reboot, the window on screen, and a feed of several hundred cards
|
||||
|
||||
Scenario: PF2. Thumbnails: feed items, the library, a project's Source
|
||||
Then a composition's still is `raea play FILE --offscreen --seek N` in a process of its own, two at a time:
|
||||
1.4 s, 1.9 s and 5.0 s for three real compositions (a ray-traced set is the 5 s one)
|
||||
And fixed (raea #141): beside a tsconfig.json, which raea writes into every new project, that play threw before
|
||||
its first frame, so every still there was a failed play and then a render (as slow, and the app's stage and
|
||||
`raea play` did not work at all in such a folder)
|
||||
And faster with PF4's start (raea #147): the same three stills 0.5 s, 1.2 s and 1.2 s warm, and one of the
|
||||
largest project that took 4.05 s as a one-frame render 0.63 s played
|
||||
And open: stills drawn in one long-lived process instead of one each (each pays the engine's start), and the
|
||||
library's tiles on a real library (the test copy has none)
|
||||
|
||||
Scenario: PF3. Video takes the space it needs, no more
|
||||
Then the baseline: 38 GB of video in 1,010 files on this Mac, most at 90 to 100 Mbit/s for 1080p, because every
|
||||
review version and every shot to be joined was rendered at `--quality master`
|
||||
And measured on 1080p24 film footage: default 16 Mbit/s, high 30, master 87; against the master encode the
|
||||
default scores VMAF 99.5 (worst frame 95.8) and high 99.7
|
||||
And fixed in the guides and the skill (raea #143, raea-skills #59, pinned 16ed215): a version made for notes
|
||||
takes no --quality flag, a film delivers at high, master is for delivered motion graphics and type, a
|
||||
replaced version is deleted
|
||||
And open: the app saying what renders take and offering to make old versions smaller; whether the library's
|
||||
copy of a render posted from a project is a clone of it or a second file
|
||||
|
||||
Scenario: PF4. Renders two to three times faster
|
||||
Then the baseline on a real ray-traced film at 1080p: a 61-frame shot is 5.2 to 5.8 s, of which the frames are
|
||||
about 2.2 s (25 to 30 a second: 18 to 20 ms waiting on the GPU and 14 to 22 ms making the frame's rows in
|
||||
JavaScript, one after the other) and the rest is the process starting; the whole 1,666-frame film is 53 s
|
||||
And the two levers that follow from it: a frame's rows made while the GPU draws the one before (they are
|
||||
independent: about 1.5 to 2 times on the frames), and every composition of a file rendered in one process (a
|
||||
film made a shot at a time pays about 3.3 s a shot for nothing: 33 shots, 110 s)
|
||||
And fixed (raea #144): a ray-traced camera's MSAA was turned on again every frame and off again by Bevy with a
|
||||
warning, a line a frame in the render's log
|
||||
And fixed (raea #147), the start: before its first frame a render read the first and last MiB of every picture,
|
||||
sound and video under the edit's folder (to ask for an optimized copy only a video has) and walked the whole
|
||||
folder, .git and node_modules included, for imports from outside it. Time to the first frame of an .mp4, bundle
|
||||
cached: 2.0 s to 0.35 s in a project of 1,234 files, 7.4 s to 0.62 s in one of 10,226; a 60-frame shot 4.7 s
|
||||
to 3.0 s end to end
|
||||
And measured since, what the frames themselves are: flat 2D at 1080p is 254 frames a second with no wait on the
|
||||
GPU; a ray-traced 1080p frame is 18 to 20 ms of GPU and about 5 ms of the scene's sync, so a long ray-traced
|
||||
render is the GPU's. Four ray-traced shots side by side take 7.4 s where in turn they take 11.3 (1.5 times),
|
||||
each frame two to three times slower: the GPU is one, and the window and every other render wait on it, so
|
||||
it is not a default. Two to three times on ray-traced frames is a cheaper trace (fewer pixels or samples
|
||||
traced, then upscaled), which changes the picture and is a rendering decision, not plumbing
|
||||
And measured 11-13 for drafts, where a smaller picture would change nothing that ships: `raea render` has no
|
||||
way to draw a composition smaller than it says it is (--w and --h only fill in a size a composition leaves
|
||||
out: the same 61-frame ray-traced shot with --w 960 --h 540 came out 1920 by 1080 in 4.1 s, against 4.7 s),
|
||||
so a draft (the composition editor's, a 3D scene's kept frames in docs/timeline.feature TL10f) pays for
|
||||
every pixel of the final. A render asked for again with nothing changed is the export cache's: 0.3 s
|
||||
And done 11-13 for drafts, in the SDK and not the engine: `<Composition edit={{ scale }}>` lays the composition
|
||||
out at its own size (useVideoConfig still says it) in a box drawn at that fraction, and registers the smaller
|
||||
size, so a 3D view, a whole-frame camera's or one in a page element's box, traces fewer pixels and a 2D layout
|
||||
written in px keeps every place (a title, a caption bar, a badge and a boxed 3D view drawn at 0.5 match the
|
||||
full-size frame but for softer type). The same 61-frame ray-traced 1080p shot, warm, three passes each: 2.75 s
|
||||
at full size, 1.6 to 1.7 s at 0.5 (1.7 times end to end, about twice on the frames once the start is taken
|
||||
out); the shot frames the same. The app's composition drafts and a scene's kept frames write it in their
|
||||
throwaway source (raea-feed host/edit.ts withDraftScale: the long side at 960 px, never larger, never under a
|
||||
quarter; RAEA_DRAFT_SCALE=1 draws them at full size). What ships is never scaled. It pays where the GPU
|
||||
does the work: the feed's sample room, a light scene, redraws two 3 s ranges in a headless raea window in
|
||||
8.9 s scaled against 9.4 s, since there the time is each render's start and its JavaScript, not pixels
|
||||
And open: the full-size render itself. Two to three times there is the cheaper trace upscaled (Solari at a
|
||||
lower main-pass resolution, Bevy's MainPassResolutionOverride, with MetalFX's denoised scaler taking it to
|
||||
full size: its input is the output's size today and it runs before the forward meshes), a rendering decision
|
||||
with its own picture checks
|
||||
|
||||
Scenario: PF5. What agents lose time on
|
||||
Then fixed in the lane check (tools/agents/check, on this Mac): the CLI surface step tests the raea it rebuilds
|
||||
(it tested an older build on PATH, and stayed failing after its own rebuild), and the skills step reads the feed
|
||||
app at raea-feed's main (it read whatever branch the shared checkout had out): a lane's check now passes with
|
||||
no variables set
|
||||
And fixed (raea #141, in 0.1.3): `raea play` beside a tsconfig.json, which every new project has
|
||||
And fixed in the app (raea-feed #13, not merged): a review sent on an item whose author is named over a
|
||||
connection went to an inbox it doesn't have, so its edits waited for good; and an agent whose session isn't
|
||||
open is started again by the send
|
||||
And open, each seen on 2026-11-13: a render with <Audio> that reaches no sound is refused only after every frame
|
||||
is drawn (53 s on a film; what sounds are known only once the frames are made); `-o DIR` writes every frame
|
||||
as a PNG (4.9 GB for a film) with nothing said of its size; `but commit` with a long message commits nothing
|
||||
and says so only in a hint; main can fail its own L1 after a GitHub merge (two stale generated pages blocked
|
||||
every lane for a morning)
|
||||
And a release's builds, about three hours each and run many times, moved to larger runners with a cache volume
|
||||
and a compile cache: a candidate after a small change should take minutes (the release lane's; rc4 and rc5
|
||||
are the first measured)
|
||||
|
||||
Scenario: PF6. Video playback and looking around a scene
|
||||
Then video (raea #137): frames decoded a quarter second ahead and shown when due, a faster pixel conversion, a
|
||||
small-drawn video drawn from a halving made off the page's thread: 4K30's worst wait between frames 76 ms to
|
||||
39, 4K60 on a page drawing 120 times a second 0 of 1,214 frames passed over
|
||||
And the app's player (raea-feed #13, not merged): the detail view's clock is outside React state, so a playing
|
||||
video's ticks render only what shows the time: the seconds of 60 fps play with a wait of 26 ms or more
|
||||
between frames go from nearly all to about half
|
||||
And a scene looked around (11-13, the feed's sample room live in a headless window, its counter read over
|
||||
5 s): 57 frames a second standing still, 58 while an orbit is dragged without pause (the headless window
|
||||
draws 60 at most)
|
||||
And open: frames still go through the CPU; a heavy or ray-traced scene's rate while orbiting is not measured
|
||||
|
||||
Scenario: PF8. Pages and assets from this Mac open at once
|
||||
Then covered so far by PF1 (a feed) and PF2 (stills)
|
||||
And a project's Source view (Stay: 159 rows), first visit with an empty proxy store, by wall-clock marks in
|
||||
the page: its rows committed 0.59 s after the click; 0.29 s with its views loaded ahead (raea-feed #17: a
|
||||
lazily loaded view waited out React's 300 ms hold on every first open). The 2.4 to 3.8 s written here before
|
||||
was the measuring script: the window's `ui` tool hands out its last 240 frames in order, and a slow poller
|
||||
reads frames seconds old
|
||||
And the host found a project's folder by starting git and `raea workspace --json` (0.1 s) on nearly every
|
||||
request (raea-feed #16 keeps both answers while their files stand): with 54 projects, 52 briefs read at page
|
||||
open went from 4,831 ms for the slowest to 68, a library's files from 1,710 ms to 3
|
||||
And a library's tiles have pictures before its files are indexed, and draw in raea's window (raea-feed #15):
|
||||
60 pictures (463 MB) 3.6 s to make the first time, 0.02 s after
|
||||
And open: an asset's preview and a model's; cold start after a reboot
|
||||
|
||||
Rule: Lightspeed's goals (set 2026-10-19, after the four multi-day levers; the user: "just focus on lightspeed work")
|
||||
Scenario: Who owns what now
|
||||
Then lightspeed owns performance and optimization end to end: it builds its levers itself, not only measures them
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// check: frames 0,45,89
|
||||
import { AbsoluteFill, Composition, registerRoot, useCurrentFrame } from "raea";
|
||||
import { applyAll, empty, end, length, valueAt, type Clip, type Op, type Timeline } from "raea/editor";
|
||||
|
||||
// A timeline made in code and edited by operations, as the feed's editor and an agent's script both edit one: two
|
||||
// shots on the main track and a title over them.
|
||||
const before: Timeline = {
|
||||
...empty(30),
|
||||
tracks: [
|
||||
{ id: "text", kind: "text", clips: [{ id: "title", kind: "text", name: "Title", start: 0, length: 60 }] },
|
||||
{
|
||||
id: "main",
|
||||
kind: "main",
|
||||
clips: [
|
||||
{ id: "a", kind: "video", name: "Shot A", start: 0, length: 90, in: 0, source: 300 },
|
||||
{ id: "b", kind: "video", name: "Shot B", start: 90, length: 90, in: 0, source: 300 },
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// Shot A split at one second, and the title faded in by two keys on its opacity.
|
||||
const first: Op[] = [
|
||||
{ op: "split", at: 30, ids: ["a"] },
|
||||
{ op: "key", id: "title", prop: "opacity", at: 0, value: 0, ease: [0.42, 0, 0.58, 1] },
|
||||
{ op: "key", id: "title", prop: "opacity", at: 20, value: 1 },
|
||||
];
|
||||
const cut = applyAll(before, first);
|
||||
// The half the split made is found where it starts, and played twice as fast: the main track's magnet closes the
|
||||
// gap, so Shot B comes in earlier.
|
||||
const half = cut.timeline.tracks[1].clips.find((c) => c.start === 30)!;
|
||||
const after = applyAll(cut.timeline, [{ op: "set", id: half.id, set: { speed: 2 } }]);
|
||||
// Every operation gives back its inverse: applied last first, they put the timeline back as it was.
|
||||
const undone = applyAll(after.timeline, [...after.inverse, ...cut.inverse]).timeline;
|
||||
|
||||
const SCALE = 5; // px a frame
|
||||
const COLOR: Record<string, string> = { video: "#3d7bd9", text: "#c9853d" };
|
||||
|
||||
function Row({ clips, top, frame }: { clips: Clip[]; top: number; frame: number }) {
|
||||
return (
|
||||
<>
|
||||
{clips.map((c) => {
|
||||
const on = frame >= c.start && frame < end(c);
|
||||
const opacity = typeof valueAt(c.keys?.opacity, frame - c.start) === "number" ? (valueAt(c.keys?.opacity, frame - c.start) as number) : 1;
|
||||
return (
|
||||
<div
|
||||
key={c.id}
|
||||
style={{ position: "absolute", left: 80 + c.start * SCALE, top, width: c.length * SCALE - 4, height: 64, borderRadius: 8, background: COLOR[c.kind] ?? "#777", opacity: on ? Math.max(0.35, opacity) : 0.35, color: "#fff", fontSize: 26, padding: "16px 14px", boxSizing: "border-box", overflow: "hidden", whiteSpace: "nowrap" }}
|
||||
>
|
||||
{c.name}
|
||||
{c.speed && c.speed !== 1 ? ` · ${c.speed}x` : ""}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Edits() {
|
||||
const frame = useCurrentFrame();
|
||||
const label = (y: number, text: string) => <div style={{ position: "absolute", left: 80, top: y, color: "#aaa", fontSize: 28 }}>{text}</div>;
|
||||
return (
|
||||
<AbsoluteFill style={{ background: "#16181c", fontFamily: "sans-serif" }}>
|
||||
{label(100, `Before: ${length(before)} frames`)}
|
||||
<Row clips={before.tracks[0].clips} top={144} frame={frame} />
|
||||
<Row clips={before.tracks[1].clips} top={218} frame={frame} />
|
||||
{label(330, `After ${first.length + 1} edits: ${length(after.timeline)} frames`)}
|
||||
<Row clips={after.timeline.tracks[0].clips} top={374} frame={frame} />
|
||||
<Row clips={after.timeline.tracks[1].clips} top={448} frame={frame} />
|
||||
{label(560, `Undone: ${JSON.stringify(undone) === JSON.stringify(before) ? "as it was" : "changed"}`)}
|
||||
<div style={{ position: "absolute", left: 80 + frame * SCALE, top: 134, width: 3, height: 392, background: "#ff4d4d" }} />
|
||||
</AbsoluteFill>
|
||||
);
|
||||
}
|
||||
|
||||
registerRoot(() => <Composition id="edits" component={Edits} width={1280} height={720} fps={30} durationInFrames={90} />);
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
title: "Check a cut with it"
|
||||
summary: "Score a cut with your fingerprint before it's posted, check that a fix removed a flag instead of hiding it, judge scripts and stills, find things floating in a 3D shot, and compare a cut with work you admire."
|
||||
order: 2
|
||||
sources: ["docs/fingerprint.feature", "apps/fingerprint/src", "systems/fingerprint-use/src", "systems/fingerprint-things/src"]
|
||||
---
|
||||
|
||||
## Score a cut
|
||||
|
||||
```sh
|
||||
raea fingerprint score out/cut.mp4 # the moments it expects a note on, first
|
||||
raea fingerprint score out/cut.mp4 --sheet cut.png # the same on a sheet of frames, with where boxed
|
||||
raea fingerprint score out/cut.mp4 --timeline # the piece second by second, in words
|
||||
raea fingerprint which out/cut.mp4 # which fingerprint judged it, and why
|
||||
```
|
||||
|
||||
`score` names which fingerprint judged the piece, then lists the moments it expects a note on, each in your words. On
|
||||
a picture axis that has learned where, a moment also says where in the frame and, on a render with a layer pass, the
|
||||
layers there ("top right on Floor"). `--json` gives every axis for every window, for a script.
|
||||
|
||||
An axis that **knows** can hold a post back until you've looked. One that is **learning** only advises. Your agents
|
||||
run `score` before they post, fix each moment that holds the cut back, or tell you why they didn't.
|
||||
|
||||
## Check a fix
|
||||
|
||||
```sh
|
||||
raea fingerprint score out/v2.mp4 --was out/v1.mp4
|
||||
```
|
||||
|
||||
For each moment that held v1 back, this says whether v2 fixed it, still has it, or looks **disguised**: nearer the
|
||||
axis's disguised defects than clean work, so the fix hid the defect instead of removing its cause. Only a fixed flag
|
||||
counts as fixed.
|
||||
|
||||
## Scripts, briefs and stills
|
||||
|
||||
A fingerprint reads more than video. A script, a brief or another text file gets EmbeddingGemma 2 rows, one per
|
||||
paragraph, and a still gets the picture columns. Each axis judges only what the file has, so a script is never called
|
||||
blurry. raea's own axes judge pictures, sound and motion. To judge writing, add an axis that reads text to your
|
||||
fingerprint.ts and teach it like any other.
|
||||
|
||||
## Things in a shot
|
||||
|
||||
```sh
|
||||
raea render shot.tsx --layers -o shot.mp4 # the video and its layers (shot.layers)
|
||||
raea render shot.tsx --aov -o shot.aov # its depth, beside it
|
||||
raea fingerprint things shot.mp4 --json > things.json
|
||||
raea check shot.mp4 --things things.json
|
||||
```
|
||||
|
||||
`things` finds a piece's shots, the things in each (a render's layers, and anything marked on its notes) with their
|
||||
depth, and the camera's path. It says where a thing floats, where two pass through each other, where the camera lurches
|
||||
in the middle of a move, and where nothing is on screen. `raea check --things` turns those into findings beside the
|
||||
rest. Floating needs real depth: with the render's `--aov` pass beside it (`shot.aov` for `shot.mp4`) it uses the
|
||||
render's own depth, and without one it estimates depth from the picture, which can't always tell a hanging box from
|
||||
one on the floor.
|
||||
|
||||
## Profiles of work you admire
|
||||
|
||||
```sh
|
||||
raea fingerprint profile golden/*.mp4 --as reels --against others.txt
|
||||
raea fingerprint score cut.mp4 --profile reels
|
||||
```
|
||||
|
||||
A profile takes the ranges your references span: loudness, bass against treble, cuts a minute, motion, brightness,
|
||||
contrast, saturation and sharpness. A cut scored against it hears which measures fall outside, where, and which way
|
||||
to move. The profile checks itself: each reference has to fit the others' ranges more often than unrelated work does,
|
||||
or raea says it doesn't tell this taste apart.
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
title: "Fingerprint: teach raea your eye"
|
||||
summary: "What raea learns about good work from your notes, marks and approvals, on your own computer: the axes it judges, the Fingerprint page, and what it can't judge yet."
|
||||
order: 0
|
||||
sources: ["docs/fingerprint.feature", "docs/fingerprint.md", "apps/fingerprint/src", "systems/fingerprint/src", "systems/fingerprint-use/src", "apps/app/src/fingerprint"]
|
||||
---
|
||||
|
||||
A fingerprint is your sense of good work, as raea has learned it on your own computer. It's a list of axes, the things you
|
||||
notice: blur, a black frame, hiss, clipping, a glow over everything, a frozen picture, and taste axes such as fake,
|
||||
barren or unreadable text. Each axis has a small model trained over the **Edit Embedding Zoo**: the encoders that run
|
||||
on your computer (SigLIP 2 for pictures, CLAP for sound, YAMNet for sound events, EmbeddingGemma 2 for scripts and other
|
||||
text, Depth Anything 3 for depth), so nothing leaves the machine unless you share it. The zoo is the same for everyone
|
||||
and never changes; what you train over it is yours.
|
||||
|
||||
Your agents use it before they post a cut: `raea fingerprint score` lists the moments your fingerprint expects a note
|
||||
on, each named in your words, and the agent fixes them or tells you why it didn't. It tells you the axis and the
|
||||
moment, never a number.
|
||||
|
||||
## In this section
|
||||
|
||||
- [Train your fingerprint](train.md): learning from your own renders, your notes and marks, a box on the part of a
|
||||
sound you mean, and a post-mortem when a project is done.
|
||||
- [Check a cut with it](check.md): scoring a cut, checking a fix, scripts and stills, things in a shot, and profiles
|
||||
of work you admire.
|
||||
- [Projects and teams](projects.md): one fingerprint for each kind of work, which one judges a project, keeping one
|
||||
with a project or workspace, and sharing with a team.
|
||||
|
||||
## The Fingerprint page
|
||||
|
||||
Open **Fingerprint** in the sidebar. The card at the top is your mark, one column of bits for each axis, grouped by
|
||||
sense: pictures, sound and motion. Point at a sense to see its axes and how well each one judges. Below it, every axis
|
||||
says whether it **knows** (it's trusted, and can hold a post back until you've looked), is **learning** (it gives
|
||||
advice), or is still **to learn** (it only has its words). **Can't judge yet** lists what no axis can see, such as
|
||||
whether a piece works as a whole.
|
||||
|
||||
The name in the page's title is a menu of your fingerprints. **Settings** holds what one is for, what it builds on,
|
||||
whether it's your default, and **Learn from renders**.
|
||||
|
||||
A fingerprint's axes are a file you can read and edit, `~/.raea/fingerprints/NAME/fingerprint.ts`, typed by
|
||||
`raea/fingerprint` ([the SDK page](../reference/sdk/fingerprint.md)). Add, remove or reword an axis there; its
|
||||
evidence is raea's to keep. Every command is on [the CLI page](../reference/cli/fingerprint.md).
|
||||
|
||||
## What it can't do yet
|
||||
|
||||
Axes judge two-second moments, so a fingerprint can't say whether a piece works as a whole, or judge story and pace
|
||||
across shots. It can say where in the frame only for blur, glitches and flat, barren surfaces; glow it can only
|
||||
flag. Sound axes judge the whole sound in each moment, so a box's pitch band is kept but not yet learned from. A
|
||||
stylised look or a held shot can read as a defect. And taste axes with only words never hold a post back.
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
title: "Projects and teams"
|
||||
summary: "One fingerprint for each kind of work, which one judges a project and why, keeping one with a project or its workspace from the app, and sharing one with a team."
|
||||
order: 3
|
||||
sources: ["docs/fingerprint.feature", "apps/fingerprint/src", "apps/app/src/fingerprint", "apps/app/host/fingerprint.ts"]
|
||||
---
|
||||
|
||||
## One for each kind of work
|
||||
|
||||
You can keep several fingerprints, each saying what it's for. One can build on another: a client's ads can start from
|
||||
your own and add what that client cares about. It inherits your axes and evidence, counts its own labels twice, and
|
||||
never changes yours.
|
||||
|
||||
```sh
|
||||
raea fingerprint new client-ads --about "Short ads for one brand: pace, type on screen" --extends me
|
||||
```
|
||||
|
||||
## Which one judges a project
|
||||
|
||||
Which one judges a piece is decided by where it lives: the project's fingerprints first, then the workspace's, then
|
||||
your own. At each level, the one whose `applies` matches the piece's kind wins, else that level's default.
|
||||
|
||||
In the app, a project's feed names it beside the project's name at the top: the fingerprint chip. Open it to see which
|
||||
fingerprint judges the project and why. When it's one of yours, **Open** takes you to its Fingerprint page. The chip
|
||||
shows once you have a fingerprint.
|
||||
|
||||
From a terminal:
|
||||
|
||||
```sh
|
||||
raea fingerprint which projects/brand/out/cut.mp4 # which one judges this, and why
|
||||
```
|
||||
|
||||
## Keep one with a project
|
||||
|
||||
The chip's menu has **Keep with this project** and **Keep with the workspace**. Pick one of your fingerprints under
|
||||
either and raea copies it into that folder and commits it, so it travels with the folder's repository: everyone on
|
||||
the team judges the project with the same taste, and the chip names it from then on.
|
||||
|
||||
The same from a terminal:
|
||||
|
||||
```sh
|
||||
raea fingerprint share client-ads --in project projects/brand # copy it into the project
|
||||
raea fingerprint use client-ads --in project projects/brand # and make it the one that judges there
|
||||
```
|
||||
|
||||
Use `--in workspace` for every project in the workspace.
|
||||
|
||||
## Sharing with a team
|
||||
|
||||
Sharing copies the axes and the evidence (embeddings, spans and labels) into the workspace or project, to travel with
|
||||
its repository. It never shares media or trained weights: each teammate's Mac trains its own from everyone's
|
||||
evidence, and each person's evidence sits in its own folder so two people labelling at once never edit the same
|
||||
file. When raea's encoders change, `raea fingerprint reembed FOLDER` moves the evidence to the new ones wherever it
|
||||
finds the media.
|
||||
|
||||
```sh
|
||||
raea fingerprint diff me ana # where two tastes differ, and the moments that show it
|
||||
```
|
||||
|
||||
## Notes teach the one that judged
|
||||
|
||||
Your notes and marks on a piece teach the fingerprint that judged it, so a client's notes stay with the client's
|
||||
fingerprint. When one of its lessons is really yours, move it up:
|
||||
|
||||
```sh
|
||||
raea fingerprint move --fp client-ads --axis glow # its glow labels become yours (me)
|
||||
```
|
||||
@@ -0,0 +1,73 @@
|
||||
---
|
||||
title: "Train your fingerprint"
|
||||
summary: "Teach a fingerprint from your own renders, your notes, marks and approvals, a box on the part of a sound you mean, and a post-mortem when a project is done; and when it trusts an axis."
|
||||
order: 1
|
||||
sources: ["docs/fingerprint.feature", "apps/fingerprint/src", "systems/fingerprint/src", "apps/app/src/fingerprint"]
|
||||
---
|
||||
|
||||
A new fingerprint judges from the words for each axis on day one. Everything after that is evidence: your own work,
|
||||
and what you say about it.
|
||||
|
||||
## From your renders
|
||||
|
||||
To train the mechanical axes, choose **Learn from renders** in the Fingerprint page's Settings, or run:
|
||||
|
||||
```sh
|
||||
raea fingerprint bootstrap ~/renders/*.mp4
|
||||
```
|
||||
|
||||
raea damages moments of your own finished work on purpose (a blur, a black frame, a gap in the sound) and learns the
|
||||
difference, held out by source, so it can't learn a shortcut. Each axis also has disguised versions of its defect, such
|
||||
as a blur that was sharpened afterwards or a freeze hidden under a slow zoom. An axis that misses its disguises stays
|
||||
advice.
|
||||
|
||||
The same run teaches picture axes where a defect sits. It blurs, punches a hole in, greys out or glows one patch of a
|
||||
frame, and learns to find the patch. An axis that finds it 85 times in 100 on renders it didn't learn from says where:
|
||||
`score` then gives the moment's place in the frame, such as "top right", and on a render with a layer pass the layers
|
||||
there, such as "on Floor", and `--sheet` boxes it on the frame.
|
||||
|
||||
## From your reviewing
|
||||
|
||||
Your own reviewing teaches it the rest:
|
||||
|
||||
```sh
|
||||
raea fingerprint teach cut.mp4 --axis blur --at 4.2 --bad # a moment you marked
|
||||
raea fingerprint approve final.mp4 # approved work is clean, except where you left a note
|
||||
raea fingerprint pair v1.mp4 v2.mp4 --axis glow # v2 is better on glow
|
||||
raea fingerprint read projects/stay # read your pinned notes into labels
|
||||
raea fingerprint readings --ask 50 # check 50 of those readings in the app
|
||||
raea fingerprint learn-notes projects/stay # once they read right, your notes become evidence
|
||||
```
|
||||
|
||||
Notes become evidence only after you've checked how they were read: the kind right 45 times in 50 and the axis 40. A
|
||||
note that asks for a creative change goes to the brief, never into an axis. Each project's notes teach the
|
||||
fingerprint that judges that project ([Projects and teams](projects.md)).
|
||||
|
||||
## Point at what you mean
|
||||
|
||||
A note can say exactly what it's about. On the picture, drop a pin and mark, box or lasso the thing you mean.
|
||||
|
||||
On the sound, choose **Spectrogram** on the timeline's sound track (or open the sound in Listen) and, with the Comment
|
||||
tool, drag a box around the part you mean, such as a hiss up high or a hum down low. A sound on its own shows its
|
||||
spectrogram under the waveform, where any drag draws a box. The note keeps the box's time as its span and its pitch
|
||||
band, your agent reads both with the note, and `learn-notes` labels that span and keeps the band in the label. Sound
|
||||
axes still judge the whole sound in each moment, so the band is kept but not yet learned from.
|
||||
|
||||
## When an axis is trusted
|
||||
|
||||
An axis is trusted once it has 16 labels of each kind from 3 projects, ranks real defects above clean work on
|
||||
projects it never saw, and catches its disguises. `raea fingerprint report` says where each one stands. An axis that is
|
||||
still under its bar with 300 labels is **stuck**: more labels won't help it, so `report` names it as one to try on
|
||||
another encoder.
|
||||
|
||||
## Looking back on a project
|
||||
|
||||
When a project is done, a post-mortem asks you what the fingerprint is least sure of:
|
||||
|
||||
```sh
|
||||
raea fingerprint postmortem projects/film # at most ten yes/no questions in the app, each with its moment
|
||||
raea fingerprint postmortem projects/film --tally # your answers become evidence; each head's score before and after
|
||||
```
|
||||
|
||||
It scores every version in the project's feed and first asks where a head disagrees with a label you gave on that
|
||||
moment, then where a head is nearest its flag, one question per axis within four seconds.
|
||||
@@ -14,8 +14,8 @@ the same calls.
|
||||
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**, libraries stay on your computer, and so does their search. Search them from the app, or from a terminal or an
|
||||
agent on the same computer 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
|
||||
@@ -92,7 +92,7 @@ Each hit is a moment: the file's `sha256`, the segment's `t0` and `t1` in second
|
||||
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
|
||||
your words on your computer, 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
|
||||
|
||||
@@ -1,150 +0,0 @@
|
||||
---
|
||||
title: "Fingerprint: teach raea your eye"
|
||||
summary: "What raea learns about good work from your notes, marks and approvals, on your Mac: the axes it judges, how one is trained and trusted, keeping one fingerprint for each kind of work, and sharing one with a team."
|
||||
order: 6
|
||||
sources: ["docs/fingerprint.feature", "docs/fingerprint.md", "apps/fingerprint/src", "systems/fingerprint/src", "systems/fingerprint-use/src", "systems/fingerprint-things/src", "apps/app/src/fingerprint"]
|
||||
---
|
||||
|
||||
A fingerprint is your sense of good work, as raea has learned it on your Mac. It's a list of axes, the things you
|
||||
notice: blur, a black frame, hiss, clipping, a glow over everything, a frozen picture, and taste axes such as fake,
|
||||
barren or unreadable text. Each axis has a small model over encoders that run on your Mac (SigLIP 2 for pictures, CLAP
|
||||
for sound, YAMNet for sound events, EmbeddingGemma 2 for scripts and other text), so nothing leaves the machine unless
|
||||
you share it.
|
||||
|
||||
Your agents use it before they post a cut: `raea fingerprint score` lists the moments your fingerprint expects a note
|
||||
on, each named in your words, and the agent fixes them or tells you why it didn't. It tells you the axis and the
|
||||
moment, never a number.
|
||||
|
||||
## The Fingerprint page
|
||||
|
||||
Open **Fingerprint** in the sidebar. The card at the top is your mark, one column of bits for each axis, grouped by
|
||||
sense: pictures, sound and motion. Point at a sense to see its axes and how well each one judges. Below it, every axis
|
||||
says whether it **knows** (it's trusted, and can hold a post back until you've looked), is **learning** (it gives
|
||||
advice), or is still **to learn** (it only has its words). **Can't judge yet** lists what no axis can see, such as
|
||||
whether a piece works as a whole.
|
||||
|
||||
The name in the page's title is a menu of your fingerprints. **Settings** holds what one is for, what it builds on,
|
||||
whether it's your default, and **Learn from renders**.
|
||||
|
||||
## Training one
|
||||
|
||||
A new fingerprint judges from the words for each axis on day one. To train the mechanical axes, choose **Learn from
|
||||
renders**, or run:
|
||||
|
||||
```sh
|
||||
raea fingerprint bootstrap ~/renders/*.mp4
|
||||
```
|
||||
|
||||
raea damages moments of your own finished work on purpose (a blur, a black frame, a gap in the sound) and learns the
|
||||
difference, held out by source, so it can't learn a shortcut. Each axis also has disguised versions of its defect, such
|
||||
as a blur that was sharpened afterwards or a freeze hidden under a slow zoom. An axis that misses its disguises stays
|
||||
advice.
|
||||
|
||||
The same run teaches picture axes where a defect sits. It blurs, punches a hole in, greys out or glows one patch of a
|
||||
frame, and learns to find the patch. An axis that finds it 85 times in 100 on renders it didn't learn from says where:
|
||||
`score` then gives the moment's place in the frame, such as "top right", and on a render with a layer pass the layers
|
||||
there, such as "on Floor", and `--sheet` boxes it on the frame.
|
||||
|
||||
Your own reviewing teaches it the rest:
|
||||
|
||||
```sh
|
||||
raea fingerprint teach cut.mp4 --axis blur --at 4.2 --bad # a moment you marked
|
||||
raea fingerprint approve final.mp4 # approved work is clean, except where you left a note
|
||||
raea fingerprint pair v1.mp4 v2.mp4 --axis glow # v2 is better on glow
|
||||
raea fingerprint read projects/stay # read your pinned notes into labels
|
||||
raea fingerprint readings --ask 50 # check 50 of those readings in the app
|
||||
```
|
||||
|
||||
Notes become evidence only after you've checked how they were read: the kind right 45 times in 50 and the axis 40. A
|
||||
note that asks for a creative change goes to the brief, never into an axis. An axis is trusted once it has 16 labels of
|
||||
each kind from 3 projects, ranks real defects above clean work on projects it never saw, and catches its disguises.
|
||||
`raea fingerprint report` says where each one stands. An axis that is still under its bar with 300 labels is
|
||||
**stuck**: more labels won't help it, so `report` names it as one to try on another encoder.
|
||||
|
||||
## Scripts, briefs and stills
|
||||
|
||||
A fingerprint reads more than video. A script, a brief or another text file gets EmbeddingGemma 2 rows, one per
|
||||
paragraph, and a still gets the picture columns. Each axis judges only what the file has, so a script is never called
|
||||
blurry. raea's own axes judge pictures, sound and motion. To judge writing, add an axis that reads text to your
|
||||
fingerprint.ts and teach it like any other.
|
||||
|
||||
## Looking back on a project
|
||||
|
||||
When a project is done, a post-mortem asks you what the fingerprint is least sure of:
|
||||
|
||||
```sh
|
||||
raea fingerprint postmortem projects/film # at most ten yes/no questions in the app, each with its moment
|
||||
raea fingerprint postmortem projects/film --tally # your answers become evidence; each head's score before and after
|
||||
```
|
||||
|
||||
It scores every version in the project's feed and first asks where a head disagrees with a label you gave on that
|
||||
moment, then where a head is nearest its flag, one question per axis within four seconds.
|
||||
|
||||
## Things in a shot
|
||||
|
||||
```sh
|
||||
raea render shot.tsx --layers -o shot.mp4 # the video and its layers (shot.layers)
|
||||
raea render shot.tsx --aov -o shot.aov # its depth, beside it
|
||||
raea fingerprint things shot.mp4 --json > things.json
|
||||
raea check shot.mp4 --things things.json
|
||||
```
|
||||
|
||||
`things` finds a piece's shots, the things in each (a render's layers, and anything marked on its notes) with their
|
||||
depth, and the camera's path. It says where a thing floats, where two pass through each other, where the camera lurches
|
||||
in the middle of a move, and where nothing is on screen. `raea check --things` turns those into findings beside the
|
||||
rest. Floating needs real depth: with the render's `--aov` pass beside it (`shot.aov` for `shot.mp4`) it uses the
|
||||
render's own depth, and without one it estimates depth from the picture, which can't always tell a hanging box from
|
||||
one on the floor.
|
||||
|
||||
## One for each kind of work
|
||||
|
||||
You can keep several fingerprints, each saying what it's for. One can build on another: a client's ads can start from
|
||||
your own and add what that client cares about. It inherits your axes and evidence, counts its own labels twice, and
|
||||
never changes yours.
|
||||
|
||||
```sh
|
||||
raea fingerprint new client-ads --about "Short ads for one brand: pace, type on screen" --extends me
|
||||
raea fingerprint which projects/brand/out/cut.mp4 # which one judges this, and why
|
||||
raea fingerprint use client-ads --in project projects/brand
|
||||
```
|
||||
|
||||
Which one judges a piece is decided by where it lives: the project's fingerprints first, then the workspace's, then
|
||||
your own. At each level, the one whose `applies` matches the piece's kind wins, else that level's default.
|
||||
|
||||
Your notes and marks on a piece teach the fingerprint that judged it, so a client's notes stay with the client's
|
||||
fingerprint. When one of its lessons is really yours, move it up:
|
||||
|
||||
```sh
|
||||
raea fingerprint move --fp client-ads --axis glow # its glow labels become yours (me)
|
||||
```
|
||||
|
||||
## Profiles of work you admire
|
||||
|
||||
```sh
|
||||
raea fingerprint profile golden/*.mp4 --as reels --against others.txt
|
||||
raea fingerprint score cut.mp4 --profile reels
|
||||
```
|
||||
|
||||
A profile takes the ranges your references span: loudness, bass against treble, cuts a minute, motion, brightness,
|
||||
contrast, saturation and sharpness. A cut scored against it hears which measures fall outside, where, and which way
|
||||
to move. The profile checks itself: each reference has to fit the others' ranges more often than unrelated work does,
|
||||
or raea says it doesn't tell this taste apart.
|
||||
|
||||
## Sharing with a team
|
||||
|
||||
```sh
|
||||
raea fingerprint share studio --in workspace
|
||||
raea fingerprint diff me ana # where two tastes differ, and the moments that show it
|
||||
```
|
||||
|
||||
Sharing copies the axes and the evidence (embeddings, spans and labels) into the workspace or project, to travel with
|
||||
its repository. It never shares media or trained weights: each teammate's Mac trains its own from everyone's
|
||||
evidence, and each person's evidence sits in its own folder so two people labelling at once never edit the same
|
||||
file. When raea's encoders change, `raea fingerprint reembed FOLDER` moves the evidence to the new ones wherever it
|
||||
finds the media.
|
||||
|
||||
## What it can't do yet
|
||||
|
||||
Axes judge two-second moments, so a fingerprint can't say whether a piece works as a whole, or judge story and pace
|
||||
across shots. It can say where in the frame only for blur, glitches and flat, barren surfaces; glow it can only
|
||||
flag. A stylised look or a held shot can read as a defect. And taste axes with only words never hold a post back.
|
||||
@@ -44,6 +44,13 @@ The raea skill (`raea skill` prints it) is the short version of the same loop; t
|
||||
- [3D scenes](guides/3d.md): cameras, lights, meshes and materials in TSX, drawn by Bevy.
|
||||
- [Apps on the web target or native](guides/apps.md): a React file that runs as a desktop app.
|
||||
|
||||
## Fingerprint
|
||||
|
||||
- [Fingerprint: teach raea your eye](fingerprint/index.md): what raea learns about good work from your notes, on your own computer.
|
||||
- [Train your fingerprint](fingerprint/train.md): your renders, notes and marks, and a box on the part of a sound you mean.
|
||||
- [Check a cut with it](fingerprint/check.md): score a cut before it's posted, and check that a fix really fixed it.
|
||||
- [Projects and teams](fingerprint/projects.md): which fingerprint judges a project, and keeping one with it for the team.
|
||||
|
||||
## Reference
|
||||
|
||||
- [The CLI](reference/cli.md): a page for each of the 43 `raea` verbs, with its forms, where it runs and what each flag does.
|
||||
|
||||
@@ -23,7 +23,7 @@ raea skill --reference sdk
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
raea skill [NAME] [--reference cli|feed|files|sdk] | raea skills install --agent claude|codex|kimi|gemini [--pin MOVE]... [--no-mcp] [--no-hooks] (the agent skill this raea ships, for its version, which raea --version prints: an agent whose copy names another version reads this; install puts raea's skills where that agent reads skills, adds the blender MCP server unless --no-mcp, makes each --pin MOVE a /MOVE of its own, and adds raea's hooks to that agent unless --no-hooks (raea hook AGENT: media opened in the Mac's viewer goes to raea show, and the quick check after a composition is saved); a skill folder that's a link is left as it is)
|
||||
raea skill [NAME] [--reference cli|feed|files|sdk] | raea skills install --agent claude|codex|kimi|gemini|grokbot [--pin MOVE]... [--no-mcp] [--no-hooks] (the agent skill this raea ships, for its version, which raea --version prints: an agent whose copy names another version reads this; install puts raea's skills where that agent reads skills, adds the blender MCP server unless --no-mcp, makes each --pin MOVE a /MOVE of its own, and adds raea's hooks to that agent unless --no-hooks (raea hook AGENT: media opened in the Mac's viewer goes to raea show, and the quick check after a composition is saved); a skill folder that's a link is left as it is; grokbot, the Grok Bot app, keeps its skills on its own computer, so its copy is staged on this Mac (RAEA_GROKBOT_HOME moves it) with the grokbot:// links that finish it in Grok Bot, and gets no hooks or MCP server)
|
||||
```
|
||||
|
||||
Headless: it needs nothing running and opens no window. Takes up to 1 argument besides its flags.
|
||||
@@ -32,7 +32,7 @@ Headless: it needs nothing running and opens no window. Takes up to 1 argument b
|
||||
|
||||
| Flag | Takes | What it does |
|
||||
| --- | --- | --- |
|
||||
| `--agent` | `claude\|codex\|kimi\|gemini` | Used by `skills install`; see [`raea skills`](skills.md). |
|
||||
| `--agent` | `claude\|codex\|kimi\|gemini\|grokbot` | Used by `skills install`; see [`raea skills`](skills.md). |
|
||||
| `--no-hooks` | – | Used by `skills install`; see [`raea skills`](skills.md). |
|
||||
| `--no-mcp` | – | Used by `skills install`; see [`raea skills`](skills.md). |
|
||||
| `--pin` | `MOVE` | Used by `skills install`; see [`raea skills`](skills.md). |
|
||||
|
||||
@@ -26,7 +26,7 @@ raea skills install --agent claude --pin quieter --pin bolder # /quieter and
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
raea skill [NAME] [--reference cli|feed|files|sdk] | raea skills install --agent claude|codex|kimi|gemini [--pin MOVE]... [--no-mcp] [--no-hooks] (the agent skill this raea ships, for its version, which raea --version prints: an agent whose copy names another version reads this; install puts raea's skills where that agent reads skills, adds the blender MCP server unless --no-mcp, makes each --pin MOVE a /MOVE of its own, and adds raea's hooks to that agent unless --no-hooks (raea hook AGENT: media opened in the Mac's viewer goes to raea show, and the quick check after a composition is saved); a skill folder that's a link is left as it is)
|
||||
raea skill [NAME] [--reference cli|feed|files|sdk] | raea skills install --agent claude|codex|kimi|gemini|grokbot [--pin MOVE]... [--no-mcp] [--no-hooks] (the agent skill this raea ships, for its version, which raea --version prints: an agent whose copy names another version reads this; install puts raea's skills where that agent reads skills, adds the blender MCP server unless --no-mcp, makes each --pin MOVE a /MOVE of its own, and adds raea's hooks to that agent unless --no-hooks (raea hook AGENT: media opened in the Mac's viewer goes to raea show, and the quick check after a composition is saved); a skill folder that's a link is left as it is; grokbot, the Grok Bot app, keeps its skills on its own computer, so its copy is staged on this Mac (RAEA_GROKBOT_HOME moves it) with the grokbot:// links that finish it in Grok Bot, and gets no hooks or MCP server)
|
||||
```
|
||||
|
||||
Headless: it needs nothing running and opens no window. Takes up to 1 argument besides its flags.
|
||||
@@ -35,7 +35,7 @@ Headless: it needs nothing running and opens no window. Takes up to 1 argument b
|
||||
|
||||
| Flag | Takes | What it does |
|
||||
| --- | --- | --- |
|
||||
| `--agent` | `claude\|codex\|kimi\|gemini` | Which agent to install for. |
|
||||
| `--agent` | `claude\|codex\|kimi\|gemini\|grokbot` | Which agent to install for. |
|
||||
| `--no-hooks` | – | Leave Claude Code's settings alone: don't add the quick-check hook. |
|
||||
| `--no-mcp` | – | Don't add the Blender MCP server to the agent. |
|
||||
| `--pin` | `MOVE` | Install a note's guide as a skill of its own, so `/MOVE` loads just it (`quieter`, `bolder`, `layout`, `adapt` and the rest). Repeatable. |
|
||||
|
||||
@@ -247,6 +247,7 @@ a split, a cut word or a moved span is a change to this list; the length becomes
|
||||
| Field | Type | What it is |
|
||||
| --- | --- | --- |
|
||||
| `segments` | `readonly (readonly [number, number])[]` | the composition's own frame ranges, [from, to), played one after another |
|
||||
| `scale` | `number` | the composition drawn at this fraction of its size (above 0, at most 1), what is where kept: it is laid out at its width and height (useVideoConfig still says them) and the whole drawn smaller, so a 3D view traces fewer pixels. A draft's, where a smaller picture changes nothing that ships: the app's composition drafts and a scene's kept frames draw at 0.5 |
|
||||
|
||||
### `OpenOptions`
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -31,7 +31,7 @@ The composition, the app, and the specs and notes an agent writes.
|
||||
|
||||
| Import | What it's for | Exports |
|
||||
| --- | --- | --- |
|
||||
| [`raea`](raea.md) | The main entry: compositions, sequences, time, interpolation, springs, footage, sound and words. | 18 components, 8 hooks, 55 functions, 9 values, 91 types |
|
||||
| [`raea`](raea.md) | The main entry: compositions, sequences, time, interpolation, springs, footage, sound and words. | 20 components, 8 hooks, 62 functions, 11 values, 98 types |
|
||||
| [`raea/app`](app.md) | The App, its plugins and schedules, and the registry a video's compositions are kept in. | 1 component, 4 functions, 3 classes, 17 values, 8 types |
|
||||
| [`raea/brief`](brief.md) | The specs an agent writes as data: brief, script, taste, plan and controller, checked against raea's schemas. | 6 functions, 32 types |
|
||||
| [`raea/note`](note.md) | A person's note as a file in the project: their words kept as written, and the asks the agent restates it as. | 1 function, 4 types |
|
||||
@@ -51,16 +51,17 @@ Frames, animation, springs, states and input, and holding a frame until it's rea
|
||||
|
||||
## Video, sound and text
|
||||
|
||||
Footage, pictures, sound, words and colour.
|
||||
Footage, pictures, sound, words and colour, and the timeline they are edited on.
|
||||
|
||||
| Import | What it's for | Exports |
|
||||
| --- | --- | --- |
|
||||
| [`raea/video`](video.md) | Footage and time-shifted sequences: Video, Sequence, Series, Loop and Freeze. | 5 components, 7 types |
|
||||
| [`raea/video`](video.md) | Footage and time-shifted sequences: Video, Sequence, Series, Loop and Freeze. | 5 components, 8 types |
|
||||
| [`raea/audio`](audio.md) | Sound: Audio, the master Mix, speech, sound in 3D space, and a song's energy map. | 6 components, 1 hook, 7 functions, 1 value, 25 types |
|
||||
| [`raea/text`](text.md) | Text in the 3D world, fonts, and time anchored to the words said. | 3 components, 1 hook, 3 functions, 6 types |
|
||||
| [`raea/image`](image.md) | Pictures on the page and in the world, and texture atlases packed from them. | 3 components, 1 class, 5 types |
|
||||
| [`raea/asset`](asset.md) | Files the project holds and assets made for it: staticFile, generated sound and music, and glTF bytes. | 9 functions, 1 value, 8 types |
|
||||
| [`raea/color`](color.md) | Bevy's colour types: Srgba, LinearRgba, Hsla, Oklab, Oklch and the rest, with their conversions. | 2 functions, 7 classes |
|
||||
| [`raea/editor`](editor.md) | The timeline the feed edits a film, a scene or a sound on, as data: tracks, clips, keys and markers, every edit an operation with its inverse, a film's scenes read in (fromRender) and its cut read back out as segments (segmentsOf). No React and no DOM: an agent's script, the app's host and a test use the same model the app's timeline does. | 63 functions, 28 values, 45 types |
|
||||
|
||||
## 3D
|
||||
|
||||
|
||||
@@ -423,8 +423,8 @@ copy together). Rotation in radians, XYZ order, as everywhere.
|
||||
| `onPointerOver` | `(e: Event3d) => void` | the pointer came over the part (bubbles, as the DOM's) |
|
||||
| `onPointerOut` | `(e: Event3d) => void` | the pointer left the part (bubbles) |
|
||||
| `onWheel` | `(e: Event3d) => void` | the wheel turned over the part (`deltaX`, `deltaY`) |
|
||||
| `quat` | `Quat` | Bevy's rotation as it is, a quaternion [x, y, z, w] in Bevy's axes (y up, z toward the viewer), in place of `rotation`: a turn out of the frame's plane too, as a Sprite's Transform takes it (camera/2d_on_ui) |
|
||||
| `opacity` | `number` | 0 to 1 (1 by default) |
|
||||
| `quat` | `Quat` | Bevy's rotation as it is, a quaternion [x, y, z, w] in Bevy's axes (y up, z toward the viewer), in place of `rotation`: a turn out of the frame's plane too, as a Sprite's Transform takes it (camera/2d_on_ui) |
|
||||
|
||||
### `Mesh3dProps`
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ See [Your first video](../../start/first-video.md) for the whole loop, and
|
||||
import { AbsoluteFill, ACTION_KEY, actionsIn, Animate } from "raea"
|
||||
```
|
||||
|
||||
`raea` exports 18 components, 8 hooks, 55 functions, 9 values, 91 types. Source: [sdk/raea/src/index.tsx](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/src/index.tsx).
|
||||
`raea` exports 20 components, 8 hooks, 62 functions, 11 values, 98 types. Source: [sdk/raea/src/index.tsx](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/src/index.tsx).
|
||||
|
||||
## Components
|
||||
|
||||
@@ -52,7 +52,7 @@ A box over the whole of its parent, laid out as a flex column; `style` is merged
|
||||
| `className` | `string` | Tailwind or CSS classes |
|
||||
| `children` | `ReactNode` | what fills it |
|
||||
|
||||
Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx), [ui/images/ui_texture_slice_flip_and_tile](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice_flip_and_tile.tsx), [ui/images/image_node_resizing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node_resizing.tsx), [ui/images/ui_texture_atlas_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas_slice.tsx), [ui/images/ui_texture_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice.tsx), [ui/images/ui_texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx), [ui/layout/grid](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/grid.tsx), [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), and 98 more.
|
||||
Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx), [ui/images/ui_texture_slice_flip_and_tile](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice_flip_and_tile.tsx), [ui/images/image_node_resizing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node_resizing.tsx), [ui/images/ui_texture_atlas_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas_slice.tsx), [ui/images/ui_texture_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice.tsx), [ui/images/ui_texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx), [ui/layout/grid](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/grid.tsx), [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), and 99 more.
|
||||
|
||||
### `Animate`
|
||||
|
||||
@@ -108,7 +108,19 @@ Declares a composition inside the root. It draws nothing itself; a renderer find
|
||||
| `defaultProps` | `P` | the props it's rendered with (JSON-like values only) |
|
||||
| `edit` | `Edit` | a hand edit laid over the composition (docs/craft-system.md, L): written back by the app's timeline |
|
||||
|
||||
Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx), [ui/images/ui_texture_slice_flip_and_tile](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice_flip_and_tile.tsx), [ui/images/image_node_resizing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node_resizing.tsx), [ui/images/ui_texture_atlas_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas_slice.tsx), [ui/images/ui_texture_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice.tsx), [ui/images/ui_texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx), [ui/layout/grid](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/grid.tsx), [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), and 152 more.
|
||||
Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx), [ui/images/ui_texture_slice_flip_and_tile](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice_flip_and_tile.tsx), [ui/images/image_node_resizing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node_resizing.tsx), [ui/images/ui_texture_atlas_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas_slice.tsx), [ui/images/ui_texture_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice.tsx), [ui/images/ui_texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx), [ui/layout/grid](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/grid.tsx), [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), and 153 more.
|
||||
|
||||
### `Effect`
|
||||
|
||||
The picture under it, through the effect, for as long as its <Sequence> runs.
|
||||
|
||||
| Prop | Type | What it does |
|
||||
| --- | --- | --- |
|
||||
| `kind` (required) | `string` | which effect: blur, mono, sepia, vivid, faded, contrast, bright, dark, invert or hue; with `parts`, its own name |
|
||||
| `parts` | `EffectPart[]` | an effect of its own, as CSS filter functions (a plugin's): each [function, value at amount 0, value at amount 1, unit], such as [["blur", 0, 6, "px"], ["saturate", 1, 1.6]] |
|
||||
| `amount` | `number` | how much of it, from 0 (none) to 1 (all, the default) |
|
||||
| `in` | `number` | frames it takes to come on at its part's start (0: on at once) |
|
||||
| `out` | `number` | frames it takes to go off by its part's end (0: off at once) |
|
||||
|
||||
### `Freeze`
|
||||
|
||||
@@ -168,7 +180,7 @@ The master: every sound in the composition brought to `lufs` integrated loudness
|
||||
### `Nudge`
|
||||
|
||||
Places its child: an element gets the move in front of its own transform and the fade times its own opacity; a
|
||||
component, whose box it can't reach, is placed inside a full-frame layer.
|
||||
component, whose box it can't reach, or a part with a mask, is placed inside a full-frame layer.
|
||||
|
||||
| Prop | Type | What it does |
|
||||
| --- | --- | --- |
|
||||
@@ -177,6 +189,13 @@ component, whose box it can't reach, is placed inside a full-frame layer.
|
||||
| `scale` | `number` | how much bigger (2) or smaller (0.5), about its centre |
|
||||
| `rotate` | `number` | a turn, in degrees, about its centre |
|
||||
| `opacity` | `number` | 0 (gone) to 1 (as it was), times its own opacity |
|
||||
| `mirror` | `boolean` | flipped left to right |
|
||||
| `crop` | `[left: number, top: number, right: number, bottom: number]` | how much is cut off its left, top, right and bottom, each a share of that side from 0 to 0.9 |
|
||||
| `mask` | `Mask` | what of it is seen: a shape in shares of the frame (line, mirror, circle, rect, heart, star), turned, feathered or inverted (sdk/video cutout.ts, TL7f) |
|
||||
| `blend` | `Blend` | how it is drawn over what is under it: screen, multiply, overlay and the rest of CSS's blend modes |
|
||||
| `chroma` | `ChromaKey` | a colour taken out of it, as a green screen is: { color, strength, shadow } |
|
||||
| `adjust` | `Adjust` | its brightness, contrast, saturation, exposure, sharpen, highlights, shadows, temperature, tint, fade, vignette and grain, each 0 as shot (sdk/video adjust.ts, TL7g) |
|
||||
| `keys` | `Partial<Record<NudgeProp, NudgeKey[]>>` | any of the above over time: its keys, each [frame, value, ease?], in frames from where this part's time starts (its <Sequence>'s first frame), by the names in NUDGE_KEYED ("mask.x", "chroma.strength", "crop.left" for what is inside a mask, a key or a crop). A keyed property's still value is ignored. |
|
||||
| `children` | `ReactNode` | the part it places: an element, or a component, which moves inside a full-frame layer |
|
||||
|
||||
### `Overlay`
|
||||
@@ -245,6 +264,17 @@ render gives the same element back.
|
||||
|
||||
Also takes the props of [`StaggerProps`](animation.md#staggerprops) (`each`, `grid`, `exitEach`); [`AnimateOwnProps`](animation.md#animateownprops).
|
||||
|
||||
### `Transition`
|
||||
|
||||
Its children, coming in over the part's first frames, going out over its last, and moving by a Combo throughout.
|
||||
|
||||
| Prop | Type | What it does |
|
||||
| --- | --- | --- |
|
||||
| `in` | `TransitionEdge` | over the part's first frames |
|
||||
| `out` | `TransitionEdge` | over the part's last frames |
|
||||
| `combo` | `ComboLoop` | a Combo over the whole part: a cycle every `frames`, from its first frame |
|
||||
| `children` | `ReactNode` | the part it brings in and takes out: what the <Sequence> holds |
|
||||
|
||||
### `Video`
|
||||
|
||||
A video clip in step with the frame; `data-source-time` is the source time (seconds) to show.
|
||||
@@ -253,6 +283,7 @@ A video clip in step with the frame; `data-source-time` is the source time (seco
|
||||
| --- | --- | --- |
|
||||
| `framing` | `"face"` | ours: frame the take on the largest face |
|
||||
| `punchIn` | `number` | ours: multiplies the framing's scale (1.15 is the usual) |
|
||||
| `matte` | `VideoMatte` | ours: its cutout: the mattes made of its file, which it wears as its mask, so what is cut out shows what is under it |
|
||||
|
||||
Also takes the props of [`MediaProps`](video.md#mediaprops).
|
||||
|
||||
@@ -266,7 +297,7 @@ The frame being rendered, counted from the start of the nearest enclosing Sequen
|
||||
function useCurrentFrame(): number
|
||||
```
|
||||
|
||||
Used in: [ui/scroll_and_overflow/overflow_transform](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow_transform.tsx), [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/ui_material](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/ui_material.tsx), [ui/styling/gradients](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/styling/gradients.tsx), [ui/text/text_debug](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/text_debug.tsx), [ui/text/text](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/text.tsx), [ui/text/font_atlas_debug](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/font_atlas_debug.tsx), [3d/fog_volumes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog_volumes.tsx), and 46 more.
|
||||
Used in: [ui/scroll_and_overflow/overflow_transform](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/scroll_and_overflow/overflow_transform.tsx), [ui/render_ui_to_texture](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/render_ui_to_texture.tsx), [ui/ui_material](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/ui_material.tsx), [ui/styling/gradients](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/styling/gradients.tsx), [ui/text/text_debug](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/text_debug.tsx), [ui/text/text](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/text.tsx), [ui/text/font_atlas_debug](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/text/font_atlas_debug.tsx), [3d/fog_volumes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/3d/fog_volumes.tsx), and 47 more.
|
||||
|
||||
### `useGameEvents`
|
||||
|
||||
@@ -323,7 +354,7 @@ function useSong(map: SongMap, options?: UseSongOptions): SongMoment & { song: S
|
||||
|
||||
### `useVideoConfig`
|
||||
|
||||
The settings of the composition being rendered (a Sequence's width and height win inside it).
|
||||
The settings of the composition being rendered (inside a Sequence, its width, height and length win).
|
||||
|
||||
```ts
|
||||
function useVideoConfig(): VideoConfig
|
||||
@@ -397,6 +428,30 @@ Hold the frame until `continueRender(handle)`. `label` names it if it's still op
|
||||
function delayRender(label?: string, options?: { timeoutInMilliseconds?: number; } | undefined): number
|
||||
```
|
||||
|
||||
### `effectAt`
|
||||
|
||||
How much of the effect is on at `frame` of a part `duration` frames long, coming on over `enter` and off over `exit`.
|
||||
|
||||
```ts
|
||||
function effectAt(frame: number, duration: number, enter?: number, exit?: number): number
|
||||
```
|
||||
|
||||
### `effectFilter`
|
||||
|
||||
The CSS filter of `kind` at `amount` (0 to 1, clamped); undefined for a kind raea doesn't draw.
|
||||
|
||||
```ts
|
||||
function effectFilter(kind: string, amount?: number): string | undefined
|
||||
```
|
||||
|
||||
### `effectPartsError`
|
||||
|
||||
Why `parts` isn't an effect's parts, or undefined when it is.
|
||||
|
||||
```ts
|
||||
function effectPartsError(parts: unknown): string | undefined
|
||||
```
|
||||
|
||||
### `fade`
|
||||
|
||||
opacity 0 to 1 over `frames` (6).
|
||||
@@ -545,6 +600,14 @@ Every step at once.
|
||||
function parallel(...steps: Step[]): Group
|
||||
```
|
||||
|
||||
### `partsFilter`
|
||||
|
||||
The CSS filter of an effect given as parts, at `amount` (0 to 1, clamped).
|
||||
|
||||
```ts
|
||||
function partsFilter(parts: EffectPart[], amount?: number): string
|
||||
```
|
||||
|
||||
### `pop`
|
||||
|
||||
scale `from` (0.6), `peak` (1.08) at `frames`/2, 1 at `frames` (8); in over 3 frames.
|
||||
@@ -594,7 +657,7 @@ Names the root component the renderer starts from, and records its compositions.
|
||||
function registerRoot(given: ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentType): void
|
||||
```
|
||||
|
||||
Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx), [ui/images/ui_texture_slice_flip_and_tile](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice_flip_and_tile.tsx), [ui/images/image_node_resizing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node_resizing.tsx), [ui/images/ui_texture_atlas_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas_slice.tsx), [ui/images/ui_texture_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice.tsx), [ui/images/ui_texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx), [ui/layout/grid](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/grid.tsx), [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), and 152 more.
|
||||
Used in: [ui/images/image_node](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node.tsx), [ui/images/ui_texture_slice_flip_and_tile](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice_flip_and_tile.tsx), [ui/images/image_node_resizing](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/image_node_resizing.tsx), [ui/images/ui_texture_atlas_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas_slice.tsx), [ui/images/ui_texture_slice](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_slice.tsx), [ui/images/ui_texture_atlas](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/images/ui_texture_atlas.tsx), [ui/layout/grid](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/grid.tsx), [ui/layout/ghost_nodes](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/bench/bevy-parity/ui/layout/ghost_nodes.tsx), and 153 more.
|
||||
|
||||
### `replayDecider`
|
||||
|
||||
@@ -687,6 +750,30 @@ Where the song is at `t` seconds: a pure function of the map.
|
||||
function songAt(map: SongMap, t: number): SongMoment
|
||||
```
|
||||
|
||||
### `speedLength`
|
||||
|
||||
How many frames `span` source frames take under the curve (points from speedPoints).
|
||||
|
||||
```ts
|
||||
function speedLength(ps: SpeedPoint[], span: number): number
|
||||
```
|
||||
|
||||
### `speedPoints`
|
||||
|
||||
The points checked and in order, one at each end.
|
||||
|
||||
```ts
|
||||
function speedPoints(owner: string, curve: SpeedPoint[]): SpeedPoint[]
|
||||
```
|
||||
|
||||
### `speedSource`
|
||||
|
||||
The source frame, counted from the curve's start, showing `frame` frames in; `span` once the curve has run out.
|
||||
|
||||
```ts
|
||||
function speedSource(ps: SpeedPoint[], span: number, frame: number): number
|
||||
```
|
||||
|
||||
### `spring`
|
||||
|
||||
A damped spring's value at `frame`: from `from` (0) to `to` (1), started `delay` frames late, by its `config`
|
||||
@@ -829,6 +916,12 @@ turn one round. Pass one as `interpolate`'s `easing`.
|
||||
|
||||
Used in: [manual: turntable](https://github.com/shinyobjectz/raea/blob/main/docs/manual/examples/turntable.tsx).
|
||||
|
||||
### `EFFECT_FNS`
|
||||
|
||||
The filter functions a part may name, each with the units it takes.
|
||||
|
||||
### `EFFECTS`
|
||||
|
||||
### `FEED_KEY`
|
||||
|
||||
The prefix of the keys the app hands every panel for what it knows: `feed:transcript` (the conversation's last lines,
|
||||
@@ -1073,6 +1166,28 @@ a split, a cut word or a moved span is a change to this list; the length becomes
|
||||
| Field | Type | What it is |
|
||||
| --- | --- | --- |
|
||||
| `segments` | `readonly (readonly [number, number])[]` | the composition's own frame ranges, [from, to), played one after another |
|
||||
| `scale` | `number` | the composition drawn at this fraction of its size (above 0, at most 1), what is where kept: it is laid out at its width and height (useVideoConfig still says them) and the whole drawn smaller, so a 3D view traces fewer pixels. A draft's, where a smaller picture changes nothing that ships: the app's composition drafts and a scene's kept frames draw at 0.5 |
|
||||
|
||||
### `EffectKind`
|
||||
|
||||
| Field | Type | What it is |
|
||||
| --- | --- | --- |
|
||||
| `kind` (required) | `string` | its name in the composition's code: <Effect kind> |
|
||||
| `title` (required) | `string` | what the person sees |
|
||||
| `filter` (required) | `(amount: number) => string` | the CSS filter at `amount` |
|
||||
|
||||
### `EffectPart`
|
||||
|
||||
An effect as data: each part one CSS filter function, its value going
|
||||
from `from` (amount 0, where it changes nothing) to `to` (amount 1), with its unit: ["blur", 0, 6, "px"].
|
||||
|
||||
```ts
|
||||
type EffectPart = [fn: string, from: number, to: number, unit?: string]
|
||||
```
|
||||
|
||||
### `EffectProps`
|
||||
|
||||
The props of [`Effect`](#effect), tabled there.
|
||||
|
||||
### `ExtrapolateMode`
|
||||
|
||||
@@ -1212,6 +1327,7 @@ The props of [`Loop`](#loop), tabled there.
|
||||
| `fadeIn` | `number` | ours: seconds to ramp the sound in from silence at its start (applied by the renderer at the audio's rate) |
|
||||
| `fadeOut` | `number` | ours: seconds to ramp the sound out to silence by its end: the end of its Sequence or Loop pass, or endAt, whichever comes first (one removed some other way fades out after it's gone) |
|
||||
| `playbackRate` | `number` | how fast it plays (1): 2 is double speed |
|
||||
| `speedCurve` | `SpeedPoint[]` | ours: its speed as a curve over its source, [place, speed] points: the place from 0 (startFrom) to 1 (endAt, which it needs), the speed from 0.1 to 10 and changing in a straight line between two points. Wins over playbackRate; its Sequence is as long as the curve takes (`speedLength`) |
|
||||
| `muted` | `boolean` | play no sound |
|
||||
| `loop` | `boolean` | start again from `startFrom` when it reaches `endAt` |
|
||||
| `bus` | `string` | the bus it plays into: a named channel of the edit's Tone graph (music, sfx, voice, ambience, ui), so it takes that bus's volume, effects and ducking (raea/tone `buses`) |
|
||||
@@ -1569,6 +1685,12 @@ The props of [`SongPlot`](#songplot), tabled there.
|
||||
| `energy` (required) | `number` | its mean energy, 0..1 |
|
||||
| `cuts` (required) | `number` | suggested cuts per bar: 0.25, 0.5, 1, 2 or 4 |
|
||||
|
||||
### `SpeedPoint`
|
||||
|
||||
```ts
|
||||
type SpeedPoint = [place: number, speed: number]
|
||||
```
|
||||
|
||||
### `SpringConfig`
|
||||
|
||||
| Field | Type | What it is |
|
||||
@@ -1686,6 +1808,27 @@ many steps in the state at least (`after`), and what to do on the way (`actions`
|
||||
type TransitionConfig = Target<N> & When<C, E> & { /** steps in the state before this transition may fire (0) */ after?: number; actions?: Actions<C, E>; /** what the transition means: a decider reads it (a model's option description), reports show it */ description?: string; }
|
||||
```
|
||||
|
||||
### `TransitionEdge`
|
||||
|
||||
| Field | Type | What it is |
|
||||
| --- | --- | --- |
|
||||
| `kind` (required) | `TransitionKind` | which transition: fade, slide, wipe or zoom |
|
||||
| `frames` (required) | `number` | how many of the part's frames it takes |
|
||||
|
||||
### `TransitionKind`
|
||||
|
||||
fade: through black. slide: in from the right, out to the left. wipe: uncovered from the left, covered from the
|
||||
left. zoom: grows in from 85%, shrinks out to 85%, fading. A dissolve between two parts that only touch has no
|
||||
frames of the other to mix with, so it is written as a fade.
|
||||
|
||||
```ts
|
||||
type TransitionKind = "fade" | "slide" | "wipe" | "zoom"
|
||||
```
|
||||
|
||||
### `TransitionProps`
|
||||
|
||||
The props of [`Transition`](#transition), tabled there.
|
||||
|
||||
### `TransitionRecord`
|
||||
|
||||
One transition as a row: what a trace keeps and rdb loads (step, machine, from, to, edge, decider, evidence). `from` is
|
||||
|
||||
@@ -320,8 +320,8 @@ The props of [`Ellipse`](#ellipse), tabled there.
|
||||
| `onPointerOver` | `(e: Event3d) => void` | the pointer came over the part (bubbles, as the DOM's) |
|
||||
| `onPointerOut` | `(e: Event3d) => void` | the pointer left the part (bubbles) |
|
||||
| `onWheel` | `(e: Event3d) => void` | the wheel turned over the part (`deltaX`, `deltaY`) |
|
||||
| `quat` | `Quat` | Bevy's rotation as it is, a quaternion [x, y, z, w] in Bevy's axes (y up, z toward the viewer), in place of `rotation`: a turn out of the frame's plane too, as a Sprite's Transform takes it (camera/2d_on_ui) |
|
||||
| `opacity` | `number` | 0 to 1 (1 by default) |
|
||||
| `quat` | `Quat` | Bevy's rotation as it is, a quaternion [x, y, z, w] in Bevy's axes (y up, z toward the viewer), in place of `rotation`: a turn out of the frame's plane too, as a Sprite's Transform takes it (camera/2d_on_ui) |
|
||||
|
||||
### `MeshAttributes`
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ function useLocalTime(caller: string): LocalTime
|
||||
|
||||
### `useVideoConfig`
|
||||
|
||||
The settings of the composition being rendered (a Sequence's width and height win inside it).
|
||||
The settings of the composition being rendered (inside a Sequence, its width, height and length win).
|
||||
|
||||
```ts
|
||||
function useVideoConfig(): VideoConfig
|
||||
@@ -115,6 +115,7 @@ The local time a subtree sees: its own frame, and the composition frame its fram
|
||||
| `origin` (required) | `number` | the composition frame the subtree's frame 0 falls on |
|
||||
| `width` (required) | `number` | width and height a Sequence overrides for its children |
|
||||
| `height` (required) | `number` | in px, what the Sequence gives its children |
|
||||
| `duration` (required) | `number` | frames the subtree runs for from its frame 0, which useVideoConfig reports as durationInFrames: a Sequence's own length cut where its parent's ends, a Loop's one pass, the composition's at the root |
|
||||
|
||||
### `Perception`
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ function Cut() {
|
||||
import { Freeze, Loop, Sequence, Series } from "raea/video"
|
||||
```
|
||||
|
||||
`raea/video` exports 5 components, 7 types. Bevy's counterpart: `raea's own; Bevy has no video crate`. Source: [sdk/raea/src/video.ts](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/src/video.ts).
|
||||
`raea/video` exports 5 components, 8 types. Bevy's counterpart: `raea's own; Bevy has no video crate`. Source: [sdk/raea/src/video.ts](https://github.com/shinyobjectz/raea/blob/main/sdk/raea/src/video.ts).
|
||||
|
||||
## Components
|
||||
|
||||
@@ -93,6 +93,7 @@ A video clip in step with the frame; `data-source-time` is the source time (seco
|
||||
| --- | --- | --- |
|
||||
| `framing` | `"face"` | ours: frame the take on the largest face |
|
||||
| `punchIn` | `number` | ours: multiplies the framing's scale (1.15 is the usual) |
|
||||
| `matte` | `VideoMatte` | ours: its cutout: the mattes made of its file, which it wears as its mask, so what is cut out shows what is under it |
|
||||
|
||||
Also takes the props of [`MediaProps`](#mediaprops).
|
||||
|
||||
@@ -120,6 +121,7 @@ The props of [`Loop`](#loop), tabled there.
|
||||
| `fadeIn` | `number` | ours: seconds to ramp the sound in from silence at its start (applied by the renderer at the audio's rate) |
|
||||
| `fadeOut` | `number` | ours: seconds to ramp the sound out to silence by its end: the end of its Sequence or Loop pass, or endAt, whichever comes first (one removed some other way fades out after it's gone) |
|
||||
| `playbackRate` | `number` | how fast it plays (1): 2 is double speed |
|
||||
| `speedCurve` | `SpeedPoint[]` | ours: its speed as a curve over its source, [place, speed] points: the place from 0 (startFrom) to 1 (endAt, which it needs), the speed from 0.1 to 10 and changing in a straight line between two points. Wins over playbackRate; its Sequence is as long as the curve takes (`speedLength`) |
|
||||
| `muted` | `boolean` | play no sound |
|
||||
| `loop` | `boolean` | start again from `startFrom` when it reaches `endAt` |
|
||||
| `bus` | `string` | the bus it plays into: a named channel of the edit's Tone graph (music, sfx, voice, ambience, ui), so it takes that bus's volume, effects and ducking (raea/tone `buses`) |
|
||||
@@ -150,6 +152,17 @@ The props of [`Sequence`](#sequence), tabled there.
|
||||
| `width` | `number` | the width its children see, px (the parent's by default) |
|
||||
| `durationInFrames` | `number` | how many frames it shows its children (forever by default) |
|
||||
|
||||
### `VideoMatte`
|
||||
|
||||
A clip's mattes: PNGs whose alpha is what is kept, m00001.png on, in one folder of the media folder.
|
||||
|
||||
| Field | Type | What it is |
|
||||
| --- | --- | --- |
|
||||
| `src` (required) | `string` | the folder, as staticFile gives it: staticFile("matte/take-person") |
|
||||
| `fps` (required) | `number` | the file's frame rate: m00001.png is its frame 0 |
|
||||
| `every` | `number` | one matte each `every` frames of the file, held until the next (1, every frame, when left out) |
|
||||
| `count` (required) | `number` | how many mattes there are: past the last, the last is worn |
|
||||
|
||||
### `VideoProps`
|
||||
|
||||
The props of [`Video`](#video), tabled there.
|
||||
|
||||
@@ -62,6 +62,21 @@ curl -fsSL https://raea.io/install | sh
|
||||
|
||||
Then see what changed in [What's new](../whats-new/index.md).
|
||||
|
||||
### The desktop app
|
||||
|
||||
The desktop app looks for a newer raea when it starts and every six hours, and a card in the bottom right corner says
|
||||
when one is out. On the Mac, raea.app downloads and checks the update itself: press **Restart now**, or it switches the
|
||||
next time you quit. On Windows and Linux, **Download** gets the new build, and you install it over this one. Your
|
||||
projects and settings stay as they are.
|
||||
|
||||
To look for an update yourself, open **Settings → General** and press **Check for updates**. From 0.1.3, an update
|
||||
that is waiting also shows as **Update** at the foot of the sidebar.
|
||||
|
||||
On the Mac, drag raea.app into Applications before you open it. Opened straight from Downloads, macOS runs it from a
|
||||
read-only copy, and raea 0.1.1 and 0.1.2 can't replace themselves there: Restart now does nothing. If that happened to
|
||||
you, download raea from [raea.io/download/mac](https://raea.io/download/mac), drag it into Applications and open it
|
||||
from there. From 0.1.3, raea updates wherever it was opened from, and says so if it ever can't.
|
||||
|
||||
## Pick a version
|
||||
|
||||
Set `RAEA_VERSION` to install a particular release instead of the newest:
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
---
|
||||
title: "raea 0.1.2"
|
||||
version: "0.1.2"
|
||||
date: "2026-11-13"
|
||||
summary: "Components that measure as they do in Chrome, a fingerprint of what you judge good, and one timeline for picture and sound in the app's player."
|
||||
sources: ["https://github.com/shinyobjectz/raea/releases/tag/v0.1.2"]
|
||||
---
|
||||
|
||||
raea 0.1.2 lets compositions measure themselves the way a web page does, teaches raea what you judge good, and gives the app's player one timeline for picture and sound.
|
||||
|
||||
**Get the app at [raea.io](https://raea.io)** (a Mac with Apple silicon, Windows 10 or 11, or Linux on x86_64).
|
||||
|
||||
The engine alone:
|
||||
|
||||
```sh
|
||||
curl -fsSL https://raea.io/install | sh
|
||||
```
|
||||
|
||||
On Windows, in PowerShell: `irm https://raea.io/install.ps1 | iex`.
|
||||
|
||||
## What changed since 0.1.1
|
||||
|
||||
**Components that measure, as in Chrome (#54, #13).** Many components written for the web measure before they draw: a title sized to its box, captions wrapped where a line really ends, a caret after the last typed letter. In a composition those reads now answer as Chrome does, from the same layout and font files that draw the frame: `getBoundingClientRect` (through transforms and perspective), `offsetWidth` and the rest, `getComputedStyle`, a ref's children and selectors, `document.createElement`, Range, `document.fonts`, `ResizeObserver`, a canvas's `measureText`, and svg text's lengths. Hold the frame with `delayRender` and `continueRender` until a measure lands. Reads answer in live play too (the app's stage, `raea play`, exported games). In a render the first read in a frame costs about 0.4 ms, and more in the same frame almost nothing. Measured against headless Chrome on snapcn's measuring components, 23 of 33 now land within a pixel (3 before). The manual's new guide, "Web components that measure", lists what answers and what doesn't yet.
|
||||
|
||||
**Text set as Chrome sets it.** Letters set a span each keep their kerning. A `visibility: hidden` word keeps its place and isn't drawn. A web font from `loadFont` is the one measured and drawn at every weight (raea's own Inter drew 500 as 400 and 600 as 700), and it's loaded before your first effect runs. A canvas's `system-ui` is the Mac's system font. An svg `<text>` with letter-spacing lands where Chrome puts it.
|
||||
|
||||
**Canvas, requestAnimationFrame and Image (#55, #56).** Compositions get the web's 2D canvas context, `requestAnimationFrame` (called once per frame drawn, with that frame's time) and `new Image()`.
|
||||
|
||||
**raea learns what you judge good.** `raea fingerprint` keeps a fingerprint of your taste: axes such as blur, glow or a frozen picture, each a small model over encoders that run on your Mac (SigLIP 2 for pictures, CLAP and YAMNet for sound, EmbeddingGemma for scripts). Your notes, approvals and picks between two cuts teach it, and `raea fingerprint score` says where a piece stands on each axis and whether a fix fixed what it claimed (`--was OLD`). `raea fingerprint things` finds a shot's things, their depth and the ground under them, and `raea check --things` reports one floating, passing through another, or a camera that changes speed mid-move. Archiving a project runs a post-mortem. The app has a Fingerprint page: what it knows, what it's learning, and fingerprints of your own for different kinds of work.
|
||||
|
||||
**One timeline in the player.** A video's player in the app is one deck: the picture on top, the sound under it and your comments' pins between them. The picture track shows frames, energy, scenes, captions or checks, and the sound track a waveform, beats or words; what a render hasn't got yet is offered with its verb (Transcribe, Detect). An agent at work has a stop button wherever the app shows it working, a feed or the Inbox can be summed up on its timeline, and a new project waits for you to make the first move.
|
||||
|
||||
**Review links by email.** Under a live review link in the Share panel, type up to 25 addresses and an optional note, and raea mails them the link. Sign-in codes come by email too.
|
||||
|
||||
**Video with alpha (#113).** A VP9 WebM's transparency and a ProRes 4444's are drawn, not refused or made opaque, and `render --alpha` leaves a frame with 3D transparent where nothing is drawn (#114).
|
||||
|
||||
**Projects with room to grow.** A new project has compositions/, components/, controllers/, assets/ and artifacts/, and a workspace has shared/ for what every project imports as `@shared/...`. `raea component add` (raea part's new name, which still works) copies a ready component into the project, or into shared/ with `--shared`.
|
||||
|
||||
**raea's Claude plugin** installs from raea's marketplace and is the raea skill with its two hooks, which run raea locally and send nothing.
|
||||
|
||||
**Fixes**
|
||||
- The Windows app stays open when a video opens: every raea executable on Windows now has an 8 MB main-thread stack, not the 1 MB default (#112).
|
||||
- The Windows app no longer crashes at launch reading a blob: FileReader, fetch's request body and a WebSocket's binary send turn bytes into a string a slice at a time, and a frame's own script is found under the app's folder (#124).
|
||||
- When an agent's Claude sign-in runs out mid-conversation, the app says so and signs you in again there, instead of failing every turn (#111).
|
||||
- On a Retina display the page fills the window instead of a quarter of it (#120, with Treamz), and the window is sharp.
|
||||
- A frame that comes out all black though its page shows something is a warning, said once over its run of frames (#96), and a filter of opacity() alone draws as the layer's opacity (#96).
|
||||
- Dark gradients no longer band in 8-bit H.264: the colour conversion dithers (#87).
|
||||
- canvas `arcTo` draws the corner's short arc, as a browser does (#97).
|
||||
- A Cone takes clicks only across its height (#98).
|
||||
- A mesh's emissive colour changes the frame it's set in live 3D (#106).
|
||||
- `getBoundingClientRect` no longer panics on a removed element and answers a zero rect under `display: none` (#108).
|
||||
- A relayout keeps an inline box's baseline (#109).
|
||||
- `raea check`'s safe-area rule tests a text's letters, not its box; a card that shares one word with a line isn't held to it as a caption; and a missing taste file is a note (#89, #102, with SirSicard).
|
||||
- `raea cut` takes a sound-only take (#89).
|
||||
- A still no longer prints dozens of CommandQueue warnings, and the 3D camera is the shadow origin (#89, #104, with SirSicard).
|
||||
- A fresh `raea init` renders again.
|
||||
- R3F: an opacity outside 0 to 1 is clamped instead of throwing (#117), and three.js 0.180 or later is the peer range (#118), both with Ragulsundaram. The three.js host draws `<Instances>` at each placement.
|
||||
- A ShaderMaterial under Solari lighting draws instead of failing its prepass.
|
||||
- raea's own commits work on a machine whose git has no `user.name`.
|
||||
- `import.meta.url` is set in every module on macOS 15.
|
||||
|
||||
Thank you to everyone who filed issues and sent PRs this round: augusbazan, SirSicard, Ragulsundaram, Treamz, revouwu, kevinschaich, connorads and Razepriv.
|
||||
|
||||
Its binaries are `v0.1.2-rc5`'s, built from 1be8199c8 and checked there.
|
||||
|
||||
## Known missing
|
||||
|
||||
- Of snapcn's measuring components, 10 still don't land within a pixel of Chrome (a font's tracking table, a few transforms' ink); docs/layout-reads.feature lists each. A Range across wrapped lines is one rect, and an element has no `innerHTML`.
|
||||
- `raea fingerprint` doesn't judge how real a sound is yet: it was measured on CC0 and CC BY recordings and didn't clear the bar for every kind of sound.
|
||||
- The Windows and Linux apps don't update themselves yet: download the next version from raea.io.
|
||||
- On Linux, raea needs ALSA, fontconfig and Vulkan (Ubuntu 24.04: `sudo apt install libasound2t64 libfontconfig1 libvulkan1 mesa-vulkan-drivers`).
|
||||
- The OCR half of the reading check runs on the Mac only.
|
||||
- The engine's own binaries aren't notarized. The Mac app is signed and notarized.
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
title: "raea 0.1.3"
|
||||
version: "0.1.3"
|
||||
date: "2026-11-13"
|
||||
summary: "Updates that land, a box on the part of a sound you mean, and a fingerprint kept with the project it judges."
|
||||
sources: ["https://github.com/shinyobjectz/raea/releases/tag/v0.1.3"]
|
||||
---
|
||||
|
||||
raea 0.1.3 makes the app's updates land, puts a 3D scene in the feed for you to walk around in and mark up, gives every feed a to-do list, lets you point at the part of a sound you mean, and keeps a fingerprint with the project it judges.
|
||||
|
||||
**Get the app at [raea.io](https://raea.io)** (a Mac with Apple silicon, Windows 10 or 11, or Linux on x86_64).
|
||||
|
||||
The engine alone:
|
||||
|
||||
```sh
|
||||
curl -fsSL https://raea.io/install | sh
|
||||
```
|
||||
|
||||
On Windows, in PowerShell: `irm https://raea.io/install.ps1 | iex`.
|
||||
|
||||
## What changed since 0.1.2
|
||||
|
||||
**Updates that land.** On a Mac, raea opened straight from Downloads runs from a read-only copy macOS makes, so 0.1.1 couldn't replace itself with 0.1.2 and Restart now did nothing. From 0.1.3 the app replaces the original wherever you opened it, and when an update can't install itself the card says so, with a Download button. The sidebar shows **Update** while one waits, and **Check for updates** is in Settings → General. If you're on 0.1.2 and Restart now did nothing, download 0.1.3 from raea.io once and move it into Applications.
|
||||
|
||||
**A cleaner update card.** It plays a short, silent loop of what's new above its words, with Restart now, What's new beside it, and a close button for later.
|
||||
|
||||
**Scenes in the feed.** Your agent can post a 3D scene, a prop, a character, a model or a splat as a scene, and you look at it from inside: walk around it, scrub its timeline when it moves, and pin a comment to a place in it. Pick a part to move, turn or scale it by hand, change a procedural part's props in its details, draw new parts into the scene, or reshape a part's motion as a path of keys. Every change is written into the scene's own code, with Undo, and your agent reads what you changed and where you pinned. Several files posted together open as a board first.
|
||||
|
||||
**A to-do list in every feed.** The agents button in a feed's header now opens the project's to-do list: its brief's tasks and the edits you've sent on its items, one line each, with who has it and what they last did. Add, check off, reword, drag to reorder and remove, with Undo. The Inbox's list has every project's.
|
||||
|
||||
**Sessions you start outside raea, in the feed.** A Claude Code session you start in a terminal or another app is a bubble in its project's feed while it's open, with its last words, the tool it's on and its plan, and it shows on the tasks it has. Other agents are in the feed by what they post.
|
||||
|
||||
**Point at the part of a sound you mean.** Pick **Spectrogram** on the timeline's sound track (or in Listen) and drag a box around the hiss up high or the hum down low. The note keeps that span of time and that band of pitch, your agent reads both with the note, and `raea fingerprint learn-notes` keeps the band with the label in your fingerprint's evidence. Sound axes still judge the whole sound in each moment, so the band is kept but not yet learned from.
|
||||
|
||||
**Keep a fingerprint with a project.** A project's **judged by** chip is now a menu: it says which fingerprint judges the project and why, and **Keep with this project** or **Keep with the workspace** copies one of yours into that folder and commits it, so your team's raea judges with the same taste.
|
||||
|
||||
**Fingerprint has its own docs.** [raea.io/docs/fingerprint](https://raea.io/docs/fingerprint/) covers training one, checking a cut with it, and keeping one with a project for your team, and the raea skill has a page that teaches your agent the same.
|
||||
|
||||
**Fixes**
|
||||
- Each project's feed shows its own work and nothing else. With more than one workspace on a Mac, a project could show another project's cards, a card could be saved into a project of the same name in another workspace, and a terminal session's bubble could pull in what other sessions posted elsewhere. raea now holds one workspace's projects at a time, saves each card back only to the folder it came from, never makes a project just because something asked for it by name, and fills a session's bubble with its own posts in its own project.
|
||||
- A composition kept beside a `tsconfig.json`, as at a new project's root, plays again: `raea play`, the app's stage and stills drawn by playing stopped before the first frame with "__at is not a function".
|
||||
- A fingerprint judges on every machine. raea now downloads YAMNet, the sound-events model, once like its other models. Before, only some machines had it, so a fingerprint trained on one of them refused a teammate's fresh install.
|
||||
- In raea's window, a graph zoomed past the edge of its canvas no longer takes the clicks meant for the sidebar and header around it.
|
||||
- Inside a `<Sequence>`, `useVideoConfig().durationInFrames` is the Sequence's length (its own, cut where its parent's ends; a Loop's one pass), so an animation scaled to its scene runs over the scene, as in Remotion. If one of your compositions read the composition's length from inside a Sequence, read it outside the Sequence and pass it down. Thanks @Ragulsundaram (#126).
|
||||
- A release's `.sha256` files name their file alone, so `shasum -c` passes on a download (0.1.1's and 0.1.2's named the builder's path; 0.1.2's were re-uploaded).
|
||||
|
||||
**Known**
|
||||
- The Windows app is unsigned, as before: Windows asks once whether to run it.
|
||||
@@ -0,0 +1,200 @@
|
||||
@spec
|
||||
Feature: Plans: a project's plan.org, kept by its agents
|
||||
Shane, 2026-11-14: "create a subagent that can flesh out the skills needed for tasks/plannig to be fully carried out
|
||||
by the agent right now its just blank and even if user doesnt touh it we need to have the againt use and maintain it
|
||||
and actualy use it for project managemtn and make that project managemnt system extensible with the task SDK. as a
|
||||
personal notel i liek or mode for managing projects so id liek to have that eb part of the base layer and make sure
|
||||
it integrates well with typescript/react/jsx correctly and the larger project in a way that is integral to the system"
|
||||
|
||||
"or mode" is Emacs org-mode. A project's plan is one Org file, plan.org. It is the base layer: the app, raea's own
|
||||
agents, agents outside raea (Claude Code in a terminal) and people in Emacs all read and write the same plain text.
|
||||
The to-do list was blank because nothing wrote to it but the composer; now every agent plans in it, marks what it's
|
||||
doing and closes what it made, whether or not the person ever opens it. @raea/task (sdk/task) reads and writes the
|
||||
file without losing a byte, edits it by task id, lets a plugin add keywords, properties, kinds and views, and gives
|
||||
React its hooks and components.
|
||||
|
||||
# Status 11-14: landed for 0.1.4. sdk/task (@raea/task) and this file in raea; the app in raea-feed (tasks-org merged
|
||||
# into integration-014 at 1214a21: vitest 242 files, 1509 tests, e2e todo, outside, messages, primary, heads,
|
||||
# consolidate 36 of 36); the skill in raea-skills #75 (skills/raea/plan.md).
|
||||
# Checked after the review: sdk/task 32 bun tests (org, edit, extend, tools), 35 with its react
|
||||
# tests under the app's vitest; the app's vitest 237 files, 1458 tests (base 229 files, 1403 tests, the same skips),
|
||||
# src/plan/agent.test.ts driving a turn's plan tools end to end on a faked host; tsc -b clean; e2e todo.spec.ts and
|
||||
# outside.spec.ts (7) and messages, primary, heads, consolidate (26) in Chrome; todo.spec.ts (4) and outside.spec.ts
|
||||
# (3) in raea's window (BLITZ_E2E bundle, node blitz/pw-run.mjs). The board (feed/Board.tsx, board/Lanes.tsx,
|
||||
# board/CardSheet.tsx) reads the plan now, but no route mounts it. Not done: `raea project new` writes no plan.org yet
|
||||
# (Rust, engine/cli), so reference/files.md, generated from it, doesn't list one; the page makes it on the first
|
||||
# write. The brief page (BriefView, unmounted) still draws a brief's own ## Tasks. Compositions can't import
|
||||
# @raea/task until sdk/tsconfig.base.json and raea's bundler map it.
|
||||
|
||||
Background:
|
||||
Given the app's code is apps/app (raea-feed), the SDK sdk/task, the skill skills/raea/plan.md in raea-skills
|
||||
And the plan's tests: sdk/task/test/*.test.ts (PL2, PL3, PL5, PL6), apps/app src/plan/plan.test.ts (PL1c, PL4, PL4c,
|
||||
PL5), src/plan/agent.test.ts (PL5a, PL5b), host/plan.test.ts (PL4, PL5), src/feed/todo.test.ts and outside.test.ts
|
||||
(PL4b), e2e/todo.spec.ts (PL4b)
|
||||
|
||||
Rule: PL1. A project's plan is plan.org at the top of its folder
|
||||
# Why there: it's the project's own file, versioned with it in the workspace's repo, found by anyone who opens the
|
||||
# folder (a person, Emacs, an agent in a terminal). Not under .raea/, which is raea's state, not the person's. One
|
||||
# file a project: the Inbox reads each project's in turn.
|
||||
|
||||
@done
|
||||
Scenario: PL1a. The file says its title and raea's keywords
|
||||
Given a project with no plan.org
|
||||
When anything adds a task to it (the to-do list, the composer, an agent's plan_add)
|
||||
Then <project>/plan.org is made, starting "#+TITLE: <project's name>" and "#+TODO: TODO MAKING REVIEW | DONE DROPPED"
|
||||
And an Org reader (Emacs) cycles the same keywords: TODO, MAKING and REVIEW are open, DONE and DROPPED closed
|
||||
And a keyword written into a plan whose #+TODO: lines don't name it (MAKING in a file written by hand, a plugin's
|
||||
SHOT) adds its sequence's #+TODO: line to the head, so Emacs cycles it too; Org's own TODO and DONE need none
|
||||
|
||||
@done
|
||||
Scenario: PL1b. The Org it uses
|
||||
Given a plan.org
|
||||
Then a headline with a keyword is a task; a headline with none is a heading: a stage that groups the tasks under it
|
||||
And a task may carry a priority ([#A]), tags (:look:sound:; a dash is written _), a planning line (SCHEDULED,
|
||||
DEADLINE, CLOSED), a PROPERTIES drawer, checkboxes (- [ ], - [X]), a progress cookie ([2/5] or [40%]) and links
|
||||
And its properties are :ID: (t- and eight letters and digits), :ITEM: (the feed item it stands on), :AGENT: (who
|
||||
has it), :FROM: (what asked for it), :KIND: and :VERB:; any other property is kept as written
|
||||
And links name feed items and tasks by id: [[item:i-door-2]], [[id:t-ab12cd34]]
|
||||
And a subtask is a task under a task; its parent's cookie counts its subtasks, or with none its checkboxes
|
||||
|
||||
@done
|
||||
Scenario: PL1c. Everything is linked by id, never by name
|
||||
Given a task typed with "@grade #look due 11-20 → i-hall" (the to-do list, the composer)
|
||||
Then :AGENT: holds the agent's id; an @name no agent has yet is kept as @name, and shows that name
|
||||
And :ITEM: holds the item's id, the tags are the task's tags, and DEADLINE is that day this year
|
||||
And a task the composer writes for a message has :FROM: the message's id; one for a comment, ITEM#COMMENT
|
||||
|
||||
Rule: PL2. @raea/task reads a plan without losing a byte
|
||||
@done
|
||||
Scenario: PL2a. A round trip changes nothing
|
||||
Given any text, Org or not: drawers it doesn't know, #+BEGIN blocks, tables, CRLF endings, tabs, no final newline
|
||||
When it's read and printed with no edits
|
||||
Then the text is the same, byte for byte
|
||||
And a planning line with a stamp it can't wholly read (a range of days, a habit's .+2d/3d) is still the planning
|
||||
line: the drawer under it, and its :ID:, are read, and the part it couldn't read is written back as it was
|
||||
|
||||
@done
|
||||
Scenario: PL2b. A plan as values
|
||||
Given a plan.org
|
||||
Then readPlan gives every headline as an entry and the ones with a keyword as tasks, each with its state (todo,
|
||||
making, review, done, dropped, whatever its keyword is called), priority, tags and inherited tags, dates,
|
||||
properties, item, agents, from, parent and children, its stage, checkboxes, progress, links and body
|
||||
And a plan's own #+TODO: lines add keywords; a word a plugin defined keeps its plugin's state
|
||||
|
||||
@done
|
||||
Scenario: PL2c. A changed entry is written again part by part
|
||||
Given an edit that changes one task's keyword
|
||||
Then only its headline line is written again; its drawer, body and every other entry are as they were
|
||||
And the headline keeps its own spacing and its tags end where they ended, as Org's org-todo leaves them; a
|
||||
planning line written again keeps its parts' order, with a new CLOSED first
|
||||
|
||||
Rule: PL3. Every change is an edit by task id
|
||||
@done
|
||||
Scenario: PL3a. The edits
|
||||
Then applyEdits(text, edits) makes add, set, state, move, remove and check, in order, each naming its task by
|
||||
:ID: (or #N, its place among the headlines, for one that has no id yet)
|
||||
And add goes under a heading by its words (made when there's none), under a task (a subtask), or before or
|
||||
after a task; with none of them, at the end
|
||||
And every task is given an :ID: it lacks, and every progress cookie counts again
|
||||
|
||||
@done
|
||||
Scenario: PL3b. Closing stamps CLOSED; reopening takes it off
|
||||
When a task's state becomes done or dropped
|
||||
Then its planning line gets CLOSED: [YYYY-MM-DD Day HH:MM], as Org's org-log-done does
|
||||
And opening it again removes CLOSED
|
||||
|
||||
@done
|
||||
Scenario: PL3c. A wrong edit changes nothing
|
||||
When an edit names a task that isn't there (under: a task id included, which never becomes a stage heading), a
|
||||
day that isn't one, a keyword the plan doesn't know or a move into the task's own subtree
|
||||
Then applyEdits throws, saying what's wrong and how to find the right id, and the text is as it was
|
||||
|
||||
Rule: PL4. The app keeps its tasks in the plan
|
||||
@done
|
||||
Scenario: PL4a. The host reads and writes plan.org whole
|
||||
Given POST /host/plan {op: read | apply | put, workspace, project}
|
||||
Then read answers the text and a stamp (same: true when the page's stamp still holds); a read for an agent
|
||||
(name: true: its turn, its plan_read) first gives each task written without an :ID: one, and writes it
|
||||
And apply makes the edits on the file (or on a new plan) and writes it through a temporary file, renamed over,
|
||||
answering with the text they were made on; edits naming a task by its place (#N) carry the text that place
|
||||
was counted in, and are refused when the file has changed since
|
||||
And put writes an older text back for Undo only while the file is still the text the page last saw
|
||||
And the e2e host (RAEA_FEED_KEEP=0) keeps nothing: the page's plan is the plan
|
||||
|
||||
@done
|
||||
Scenario: PL4b. The to-do list, the composer and raea's own work write plan edits
|
||||
Given the to-do list (feed/TodoPanel.tsx) open on a project or the Inbox
|
||||
Then its rows are the plan's tasks as written (subtasks too) and the edits sent on the project's items
|
||||
And a task linked to an item stands where the item does (the work is the truth)
|
||||
And add, check off, reword, reorder and remove are plan edits made at once in the page and then on the file
|
||||
And Undo puts the text back only while the plan hasn't changed since ("The plan has changed since: nothing
|
||||
undone"), and puts back the file as the edit found it, so a task another writer added before the edit stays
|
||||
And the list reads the plan again every few seconds and on focus, so an edit in Emacs or a terminal shows; an
|
||||
agent's turn and its plan_read read it again first
|
||||
And a message sent in the composer is a task in the plan: after the last task carrying the view's tags, held by the
|
||||
agent it went to, :FROM: the message's id
|
||||
And raea's shaping, storyboards, directions and renders are its tasks under Plan and Make, each :ITEM: the card it
|
||||
waits on; a critique's gate is "<title> passes check and critique" with :ITEM: the newest critique
|
||||
And an item carries the tags of the tasks linked to it, a workflow field places a channel by its plan's tasks, and
|
||||
a session outside raea holds the tasks whose :AGENT: is @its-name or its inbox
|
||||
And the board (feed/Board.tsx, board/Lanes.tsx, board/CardSheet.tsx) reads and edits the plan the same way, by
|
||||
task id; no route mounts it yet
|
||||
|
||||
@done
|
||||
Scenario: PL4c. A brief's tasks move into the plan once
|
||||
Given a project whose brief.md still has ## Tasks (every brief before this, and the starter brief's "Write the plan")
|
||||
When the page has read its kept brief
|
||||
Then each task is added to the plan with its mark as its keyword, its ### stage as its heading, its @agents by id,
|
||||
its #tags, its due day as DEADLINE, its → item as :ITEM: and its craft verb as :VERB:
|
||||
And the task lines, the stages and an emptied ## Tasks leave the brief; everything else in it stays
|
||||
And a brief the plan can't take (the host refused the write) keeps its tasks, and is tried again next load
|
||||
And each task's id comes from its stage, its words and which of the same words it is, so a brief moved twice (two
|
||||
pages open on it, a reload before the brief was saved) adds nothing the second time
|
||||
|
||||
@done
|
||||
Scenario: PL4d. Comment tasks stay where they are
|
||||
Given an edit sent on an item (model/tasks.ts, raea show --working/--done)
|
||||
Then it is not copied into the plan; it shows in the same to-do list, under the plan's tasks, as it did
|
||||
|
||||
Rule: PL5. Agents use and maintain the plan, whether the person opens it or not
|
||||
@done
|
||||
Scenario: PL5a. The plan tools
|
||||
Given an agent the raea app launches (the feed MCP server, apps/app host/acp/feed-mcp.ts)
|
||||
Then it has plan_read (the open tasks by id; full: the whole file), plan_add (tasks under a stage or a task,
|
||||
held by the agent unless it names others), plan_update (mark, tick or add a checkbox, change fields, move,
|
||||
remove) and plan_close (DONE with CLOSED and the item it made, or dropped)
|
||||
And the page answers them through its plans (@raea/task answerPlanTool), a headless run (host/acp/memory.ts) on
|
||||
the folder's plan.org; a session with no project has no plan, and says so
|
||||
|
||||
@done
|
||||
Scenario: PL5b. Every turn carries the plan
|
||||
Given an agent's turn in a project (src/acp/session.ts prompt)
|
||||
Then the prompt carries raea://plan/<project>: the rule to keep the plan, the task this message is (by :FROM:),
|
||||
and the open tasks by id under their stages (planDigest)
|
||||
And the rule: plan work of more than one step first, mark a task MAKING as you start it and REVIEW when it waits
|
||||
on the person, close it as you finish with the item it made, add what's left, drop rather than remove
|
||||
And every task it names has an id: a task written without one is given one before the plan is read for the turn
|
||||
And an agent launched without the plan tools is told to keep plan.org as text; a message whose task is already
|
||||
closed says so, rather than asking for it to be marked
|
||||
|
||||
Scenario: PL5c. An agent outside raea keeps the same file
|
||||
Given Claude Code in a terminal in the project's folder, with the raea skill
|
||||
Then it opens plan.org (skills/raea/plan.md), plans and marks there as plain Org text, keeping each :ID:
|
||||
And the person sees its changes in the to-do list within a few seconds
|
||||
|
||||
Rule: PL6. A plugin extends plans; React and raea's window read them
|
||||
@done
|
||||
Scenario: PL6a. Keywords, properties, kinds and views
|
||||
Then defineKeywords adds a sequence ("SHOT LIT GRADED | APPROVED") with each word's state; defineProperty a
|
||||
property with a check; definePlanKind a kind (its keywords, required properties, a check, defaults an add
|
||||
starts with; a new task of the kind starts at its sequence's first word); defineView a view any page can
|
||||
build (view(plan, name)); createRegistry one of a plugin's own
|
||||
And checkPlan says what's wrong by those rules: ids used twice, failing properties, unknown kinds, missing
|
||||
properties, keywords outside a kind's sequence
|
||||
And board, agenda and outline are the views raea ships
|
||||
|
||||
@done
|
||||
Scenario: PL6b. React
|
||||
Then usePlan(text or source) gives the plan, its text and edit; useView a registered view; TaskLine, PlanOutline,
|
||||
Agenda and BoardLanes draw them, with toggled for a checkbox's edit
|
||||
And none of it uses a dynamic import or dangerouslySetInnerHTML, so raea's window bundle (one IIFE) holds it
|
||||
@@ -247,3 +247,15 @@ Feature: React Three Fiber both ways: an R3F scene drawn by raea, a raea composi
|
||||
facing that light or sideways, as the hemisphere light is), and its constant band is scaled as three's
|
||||
irradiance is (0.886, where 0.282 made it a third as bright)
|
||||
And in-approx: SSIM 0.9848 (Phong's F0 is held at Bevy's highest, 0.16, so its orange highlight glints less)
|
||||
|
||||
Scenario: R3F15. What an R3F scene throws is the composition's error (#131)
|
||||
Given an <R3F> whose scene throws: rendering a component, in an effect, in a ref
|
||||
Then the frame throws it out of the <R3F> drawing it (src/input/session.ts: the scene under raea's own error
|
||||
boundary), so the render is refused naming it, exactly as a throw outside R3F is: "REFUSED the composition threw
|
||||
at frame 0: Error: ...", exit 1
|
||||
And never as R3F's own root reported it (reportError, else a stack without its message), the scene drawing nothing
|
||||
and the render ending with 0 errors
|
||||
And three's PMREMGenerator makes no GPU cube map in raea (src/input/pmrem.ts): fromEquirectangular of a panorama
|
||||
raea loads is that panorama, lighting the scene as scene.environment does; fromScene (RoomEnvironment) and
|
||||
fromCubemap are left out with a warning naming them, the scene drawn without them
|
||||
And test/errors.test.tsx holds it
|
||||
@@ -0,0 +1,294 @@
|
||||
@spec
|
||||
Feature: Scene: a feed item that is raea 3D looked at from inside
|
||||
Shane, 2026-11-13: "create one new feed 'scene' which allow you to look inside a raea 3d scene and a 'storyboard' of
|
||||
them or a grid of props, characters or anything you might want to inspect, comment on or anything. this is critical
|
||||
that this is a highly intentional but minimalist way to inspect a scene with a timeline unless its just static or a
|
||||
prop and be able to actually move around in the scene, make comments in 3d space, and possibly move, rotate and
|
||||
scale objects in the scene unless they are procedural to which we might need an item details panel that has
|
||||
components that are procedural show up with those props. A big part of this is being able to highlight a problem
|
||||
with the mesh, maybe how the shader looks or a clipping or artifact problem. being able to even stage the scene by
|
||||
drawing components in 3d space or adjust motion trajectories like i would a spline." Later the same day: "timeline
|
||||
should be same sdk and components we use for watch", and it is for v0.1.4.
|
||||
|
||||
What there was (read 11-13): a 3D scene reached the feed only as a render (watch), a still (look) or a game (play).
|
||||
The preview pages (docs/preview.feature) had the pieces under them: the stage picks 3D parts and answers where
|
||||
points of the scene are on the picture, a free camera, a part's JSX read and set where it is written. None of it was
|
||||
a thing an agent could post for the person to walk around in, and nothing moved a part, drew one or touched motion.
|
||||
|
||||
The item:
|
||||
- `scene` is a feed item type. Its entries are files the stage can open: a 3D composition's .tsx, a component's
|
||||
.tsx (a prop, a character), a model, a splat. One entry opens straight into the inspector; several are a board
|
||||
first.
|
||||
- The file is the document. Every change made in the inspector is written into the scene's own code, in the form
|
||||
it is already written in, with Undo. Nothing is kept beside it.
|
||||
- Only what matters now is on the picture: the scene, the one toolbar, and the timeline when time is part of it.
|
||||
A picked part brings its card; a tool brings its own marks. Cruft is clutter (Shane, 11-13): everything a
|
||||
person can do is a tool in the side toolbar, where they look for it, and what a thing is is said in its tooltip,
|
||||
not in words on the picture.
|
||||
|
||||
Background:
|
||||
Given the app's code is apps/app (raea-feed): src/scene, src/detail/views/Scene.tsx, host/scene, samples/scene
|
||||
And the inspector is built on stage.show, stage.pick, stage.view, stage.locate, stage.seek and stage.play as
|
||||
docs/preview.feature PV1 left them, and on three calls added for it (raea-sys-hold, raea-runtime-live
|
||||
pick3d.rs, raea-page-stage): stage.part (where a part stands), stage.hold (a part drawn where a drag has it)
|
||||
and stage.wire (wireframe). On a raea without them it still works: handles from the code's numbers, no live
|
||||
drag, and Wireframe says it can't yet
|
||||
And everything the inspector knows of the camera is where points of the scene are on the picture (stage.locate):
|
||||
a plane of the scene is mapped to the picture by a homography from four of its points (src/scene/math.ts), so a
|
||||
drag is read in true metres from the scene's own camera as from a free one, whatever lens the scene wrote
|
||||
|
||||
Rule: SF1. The item, its board and how it is posted
|
||||
# Status 11-13: built on raea-feed branch scene. feed_post { type: "scene", file, files?, names? } (host/acp/hub.ts
|
||||
# scenePost: each file stays where it is and is checked to be one the stage opens); `raea show` posts models, or
|
||||
# several 3D files, as a scene (host/show.ts typeOf); the built-in world has one (i-set: samples/scene room.tsx,
|
||||
# crate.tsx, lamp.tsx). Checked in Chrome (e2e/scene.spec.ts) and in raea's headless window: the card's stills, the
|
||||
# board, an entry opened, Esc back to the board and then the feed.
|
||||
|
||||
@done
|
||||
Scenario: SF1a. One scene, or a board of them
|
||||
Given a scene item with one entry
|
||||
Then it opens in the inspector
|
||||
Given one with several (a storyboard's shots, a grid of props or characters)
|
||||
Then it opens on a board: each entry's still, its name, what the poster called it, and its open comments' count;
|
||||
shots are numbered in order
|
||||
And a click opens an entry, B or Esc goes back to the board, Esc again to the feed
|
||||
And the feed's card is the first four stills
|
||||
|
||||
@done
|
||||
Scenario: SF1b. Posting one
|
||||
Then an agent posts it with feed_post type scene (file, and files for a board, names for what each is called)
|
||||
And `raea show` of a model, or of several 3D files, shows them as a scene
|
||||
And an item written into a project's .raea/feed with type scene and entries is drawn the same
|
||||
|
||||
Rule: SF2. Looking around, with a timeline only when there is time
|
||||
# Status 11-13: built (src/scene/Inspector.tsx; the camera is an orbit about a target, math.ts turned, slid,
|
||||
# dollied, walked, framed, between). Checked in the headless window on the sample room: a drag turned the view, the
|
||||
# wheel moved out, F came back, a timed scene played and a press on the strip went to 0:01.5 with the ball mid-arc;
|
||||
# a prop alone had no strip.
|
||||
|
||||
@done
|
||||
Scenario: SF2a. Moving through the scene
|
||||
When the pointer is at rest (no other tool on)
|
||||
Then a drag turns the view about what it looks at, Shift-drag slides it, the wheel moves in and out, the arrow
|
||||
keys walk along the ground the way the camera faces, Page Up and Page Down rise and sink
|
||||
And Alt-drag or the right button does the same from any tool
|
||||
And F frames the picked part, or with none goes back to the scene's own camera; a double click does too
|
||||
And the scene opens on its own camera, as its author framed it
|
||||
|
||||
@done
|
||||
Scenario: SF2d. The tools' bar
|
||||
Then the side toolbar holds every tool: Look, Comment, Draw, Path, Check, Wireframe, Quality, and Board on an
|
||||
item with several entries; Move, Rotate and Scale stand in it only while a part a hand can change is picked
|
||||
And each says what it does and its key in its tooltip, as do the handles, the keys, the card's rows and buttons
|
||||
and the kinds of problem a comment can mark
|
||||
|
||||
@done
|
||||
Scenario: SF2e. The view has a toolbar of its own
|
||||
# Shane, 11-13: "lets have separated toolbars for movement controls and maybe some kind of hint if movement
|
||||
# controls have a shortcut by putting it in the tooltip". src/scene/NavBar.tsx, on the stage's right edge.
|
||||
Then across from the tools is the view's bar: Orbit (1), Pan (2) and Zoom (3) set what a plain drag does, Frame
|
||||
(F) goes onto the picked part or the whole scene, and the scene's camera (0) goes back to the shot as written
|
||||
And each tooltip says its key and the gesture that does the same from any mode (Shift-drag slides, scrolling
|
||||
moves in and out, the arrows walk)
|
||||
|
||||
@done
|
||||
Scenario: SF2b. The timeline is the watch view's own
|
||||
Given a scene whose composition has a length
|
||||
Then under the picture is the feed's one timeline (detail/blocks/Filmstrip.tsx, as under a render): play and the
|
||||
time on its row, the playhead, the comments' marks at their moments, a press or a drag to seek
|
||||
And its lanes are the scene's own frames, cuts and sound, from a render of the scene as it is now (host/scene
|
||||
film: kept by the file's state, made in the background a moment after it is live and after each change, not
|
||||
while this Mac is short of memory); the strip keeps one height before and after it arrives
|
||||
Given a still scene, a prop or a model
|
||||
Then there is no timeline
|
||||
|
||||
@done
|
||||
Scenario: SF2c. A prop or a model alone
|
||||
Then a component opens alone under plain light from the front three-quarter (its own camera and lights when it
|
||||
brings them), framed by what is drawn; a model as its preview page shows it
|
||||
|
||||
Rule: SF3. Comments in the scene's space
|
||||
# Status 11-13: built (src/scene/Pins.tsx; model/types.ts Pin.space; model/pin.ts spaceLines). A pin is a place
|
||||
# pin with `space`: the point in the scene's space, the part's stamp, a radius, what it marks, the view it was
|
||||
# written from, a path. Checked in the headless window: a comment on the table top marked Shader posted as an
|
||||
# edit, its pin stayed on the surface through a turn and a move out, and its mark stood at 0:00 on the timeline. A
|
||||
# drag marked a region as Artifact (its ring drawn on the table); opened from its mark after a seek to 0:01.5 it
|
||||
# went back to 0:00 with its thread open, and Esc closed the thread and stayed in the entry. A path of three
|
||||
# points posted as a comment.
|
||||
|
||||
@done
|
||||
Scenario: SF3a. A note on a point of a surface
|
||||
When Comment is on and I click a part
|
||||
Then the feed's own composer opens beside the point, and the comment is pinned to that point of that part
|
||||
And its pin is drawn where the point is from any camera and at any frame; away from its moment it is fainter
|
||||
And the agent reads where it is in the scene's space, on which part and where that part is written
|
||||
|
||||
@done
|
||||
Scenario: SF3b. What it marks
|
||||
Then the composer offers Mesh, Shader, Clipping and Artifact, and the comment carries the one chosen: the agent
|
||||
is told which kind of problem it is
|
||||
And a drag instead of a click marks a region: a ring about the point, its radius in metres
|
||||
|
||||
@done
|
||||
Scenario: SF3c. A comment opened
|
||||
When a comment is opened from its pin, the notes or the timeline
|
||||
Then the scene goes to its entry and its moment, and the view moves to the one it was written from (the scene's
|
||||
own camera when it was written from that)
|
||||
And Esc closes the comment first, then the entry
|
||||
|
||||
@done
|
||||
Scenario: SF3d. What raea itself measures
|
||||
When Check is pressed
|
||||
Then raea's scene lint (docs/scene.feature) runs on the frame shown and says what floats, sinks or clips
|
||||
|
||||
@done
|
||||
Scenario: SF3e. Seeing what a mesh is made of
|
||||
When Wireframe is on
|
||||
Then every mesh is drawn as its edges over its shading (Bevy's wireframe pass, on the stage's scenes only: a
|
||||
render's graph never has it), through play, a seek and a change to the code
|
||||
|
||||
Rule: SF4. Moving, turning and scaling a part by hand
|
||||
# Status 11-13: built (src/scene/Gizmo.tsx; host/scene/place.ts). Both forms raea scenes are written in are read
|
||||
# and written: Bevy's Transform chain (fromXyz, withRotation(Quat.fromEuler("XYZ", ...)), withScale; a lookingAt
|
||||
# kept last) and position/rotation/scale props; a part with none gets its tag's form and the imports it needs.
|
||||
# Checked in the headless window (blitz/scene.mjs): the crate's x handle dragged 66 px wrote fromXyz(2.3878, 0.35,
|
||||
# -1.2) with its rotation untouched, the stage drew it there, and Undo put the file back to the byte. By hand
|
||||
# after: the y ring turned it to Quat.fromEuler("XYZ", 0, 0.106, 0), the y handle scaled it to withScale([1,
|
||||
# 1.4656, 1]), and two Undos put the line back. The handles are elements over the picture and a drag is followed
|
||||
# on the window: raea's window draws an inline SVG as a picture, so its shapes take no pointer. host/scene: 15 tests.
|
||||
|
||||
@done
|
||||
Scenario: SF4a. Handles on a part placed by numbers
|
||||
When I click a part whose position is written as numbers
|
||||
Then Move (G), Turn (R) and Scale (S) are in the toolbar, and three axes stand from where it stands: a drag
|
||||
along one moves it along that axis, the middle slides it over the ground; Turn's rings turn it about an axis,
|
||||
Scale's handles size it; Shift snaps (10 cm, 15 degrees, a tenth)
|
||||
And while it is dragged its outline and the amount show; on release the new placement is written into its JSX
|
||||
in the form it is in, and the stage shows it
|
||||
And its card has the same numbers to type over, and Undo
|
||||
|
||||
@done
|
||||
Scenario: SF4c. The part follows the drag
|
||||
# checked in the built app's headless window: mid-drag the jar stood 43.2 cm along x with its card still
|
||||
# reading its old numbers, and the release wrote them
|
||||
Then while a handle is dragged the part itself is drawn where the drag has it (the stage holds it there;
|
||||
nothing is written), its outline and handles with it, and the amount beside it
|
||||
And the release writes it; a drag let go where it began writes nothing and the part goes back
|
||||
|
||||
@done
|
||||
Scenario: SF4d. A part inside a group that moves or turns it
|
||||
# the sample's jar on a trolley turned 0.7 rad: a 43.25 cm drag along the world's x wrote (-0.1308, 0.65,
|
||||
# -0.2786) from (0.2, 0.65, 0), that step turned back by the trolley's turn
|
||||
Then its handles stand on it where it is drawn (the stage says where a part stands)
|
||||
And a step in the world is written as the step in the space its code counts in: raea's groups are worked into
|
||||
each part's own place before the engine sees them, so that space is read from the part's turn and size in the
|
||||
world against those its code writes
|
||||
|
||||
@done
|
||||
Scenario: SF4b. A part placed by code has no handles
|
||||
Given a part whose position is computed (a frame's arithmetic, a spring, a prop, a loop's index)
|
||||
Then its card shows that code, Move is off and says why, and it is changed through its props (SF5)
|
||||
And a channel that is still numbers (a computed position with a plain scale) keeps its handle
|
||||
|
||||
Rule: SF5. The details of what is picked: a procedural part's props
|
||||
# Status 11-13: built (src/scene/Details.tsx; host/scene/routes.ts read, prop, default). A pick's stamp names the
|
||||
# components it was drawn in (its uses); each use's own element is read where it is written. Checked in the
|
||||
# headless window: a cone of the sample's row showed "Drawn by Cones" with count, gap and z; count typed to 6
|
||||
# wrote <Cones count={6}> and six cones stood; the crate prop alone showed size and color.
|
||||
|
||||
@done
|
||||
Scenario: SF5a. The card
|
||||
When a part is picked
|
||||
Then one card over the picture says its name, where it is written, where it stands, and its own props
|
||||
And nothing else is there until something is picked
|
||||
|
||||
@done
|
||||
Scenario: SF5b. Drawn by a component
|
||||
Given a part a component draws (a row, a scattering, a rig)
|
||||
Then the card lists each component it was drawn in, nearest first, with the props it was given where it is
|
||||
used, as controls; a change is written there and the stage shows it
|
||||
And a prop looked at alone lists its own props, a change writing its default
|
||||
|
||||
Rule: SF6. Staging: drawing parts into the scene
|
||||
# Status 11-13: built (host/scene/draw.ts; Inspector.tsx Draw). Checked in the headless window: a footprint
|
||||
# dragged on the floor wrote a <Mesh3d name="box"> with its Cuboid and material after the floor's element, the
|
||||
# imports added, standing on the floor; it was picked with its handles, and Remove took it out whole.
|
||||
|
||||
@done
|
||||
Scenario: SF6a. A primitive laid out on a surface
|
||||
When Draw is on and I drag on a surface
|
||||
Then a box, sphere, cylinder, cone or plane is laid out on the level through that point, its size shown as it
|
||||
is dragged
|
||||
And on release it is an element in the scene's file, among the scene's own top-level parts, written as raea 3D
|
||||
is written by hand; it is picked, to be moved, sized or removed
|
||||
|
||||
Rule: SF7. Motion as a path of keys
|
||||
# Status 11-13: built (src/scene/MotionPath.tsx; host/scene/motion.ts). A part's declared motion is its animate
|
||||
# tracks on x, y and z (raea/animation track, or plain keys). Checked in the headless window: the sample's ball
|
||||
# showed its path through keys 0, 45 and 90; the key at 45 dragged over the ground wrote 45: 0.8614 on x and
|
||||
# 45: 2.4329 on z and left y.
|
||||
|
||||
@done
|
||||
Scenario: SF7a. Keys moved as a spline's points
|
||||
Given a picked part whose animate declares x, y or z tracks with numbers
|
||||
Then its path is drawn through the scene as the tracks travel it, with a key at each keyed frame
|
||||
And a drag slides a key over the ground under it, with Shift straight up and down; the release writes that
|
||||
frame's values; a click on a key goes to its frame; the card adds a key at the frame shown
|
||||
|
||||
@done
|
||||
Scenario: SF7b. Motion that isn't keys is drawn on
|
||||
Given motion worked out in code
|
||||
Then Path draws a line through the scene (points on its surfaces), posted as a comment the agent reads as the
|
||||
points to move along
|
||||
|
||||
Rule: SF9. Light on the machine, and lighter when it must be
|
||||
# Status 11-13: built (src/scene/quality.ts, useLocated.ts stir; host/scene/routes.ts pressure). Shane, 11-13:
|
||||
# "make sure its highly performant and has ways to help kick back down preview rendering if swapping or
|
||||
# something". Measured in the headless window on the sample room (the window's whole process group): 3.2 GB at
|
||||
# the feed, 3.6 GB after blitz/scene.mjs (five reopenings), 3.7 GB after eight size changes and eight seconds of
|
||||
# play. At half size a part was picked and its handles stood on it. The rules for stepping down are tested
|
||||
# (quality.test.ts); a step down from real memory pressure was not seen live. Found and fixed on the way: a status
|
||||
# read while the stage was reopening a file said "playing", and the reopening after it played on by itself
|
||||
# (src/preview/stage.ts).
|
||||
|
||||
@done
|
||||
Scenario: SF9a. Quality
|
||||
Then Quality in the toolbar draws the scene at its own size, a half or a quarter: the same scene from the same
|
||||
camera, every pick, pin and handle working on it
|
||||
And on Auto it steps down by itself when this Mac is short of memory (the system's memory pressure, read by the
|
||||
host) or when the scene plays under half its frame rate for two seconds, and says why once, in a line over
|
||||
the toolbar and in the tool's tooltip
|
||||
|
||||
@done
|
||||
Scenario: SF9b. Nothing runs that nothing needs
|
||||
Then what is drawn over the picture follows it closely only while something changes (the camera, the clock, a
|
||||
drag, a write being drawn) and looks in now and then while it stands still
|
||||
And nothing is outlined under the pointer while the scene plays
|
||||
And while a scene is opening the host draws no stills beside it
|
||||
And a write keeps the picture, the handles and the pins where they are while the stage opens the file again,
|
||||
on the frame it stood on
|
||||
|
||||
Rule: SF10. What goes to the agent
|
||||
# Status 11-13: built (model/types.ts SceneItem.byHand; model/pin.ts byHandLines, spaceLines; store.tsx
|
||||
# sendComments). Shane, 11-13: "are we really going to count every single edit that was made? are we counting the
|
||||
# diffs?" No. model/pin.test.ts: 3 tests. The feed's send keycap (every item) reads "Send" with the count as a
|
||||
# badge: "Send 1 edit" ran together as "Send 1edit" in raea's window.
|
||||
|
||||
@done
|
||||
Scenario: SF10a. Comments are the edits; changes by hand are already made
|
||||
Then the count on Send is the comments marked as edits for the agent, as on every item
|
||||
And a part moved, turned, scaled, drawn or removed, a key dragged and a prop set are written when they are made:
|
||||
never counted, never waiting
|
||||
And the next round sent carries one line a thing changed by hand, for the agent to keep, and then forgets them
|
||||
And each comment in a scene tells the agent its point in the scene's space, the part and where it is written
|
||||
|
||||
Rule: SF8. Open
|
||||
# Status 11-13: SF8e done for 0.1.3 (Shane: the scene feed ships in 0.1.3, not 0.1.4). raea-feed #10 merged
|
||||
# (24b2eb5) with raea-skills #58 (faa9938: collaborate.md's row, reference/feed.md regenerated), and raea pins it
|
||||
# (#133, 2cb213634); SKILLS_STRICT=1 tools/skills.sh check passes against the app at raea-feed main.
|
||||
@done
|
||||
Scenario: SF8e. Taught to agents
|
||||
# feed_post's type list is in the generated skills reference. Teaching `scene` is a change to raea-skills
|
||||
# (skills/raea/collaborate.md's "When you need to..." table, and reference/feed.md regenerated), which is public
|
||||
# and merges by PR, with the merge of raea-feed's branch scene
|
||||
Then the raea skill says when to post a scene and what the person can do with it
|
||||
@@ -0,0 +1,875 @@
|
||||
@spec
|
||||
Feature: The timeline SDK (0.1.5): CapCut's timeline, on the composition, in the feed, open to extension
|
||||
Shane, 2026-11-13 (goal, launching alongside the character SDK): "the goal with the timeline sdk is to provide
|
||||
agents pushing feed items or controllers / things we might want to be able to edit directly with timeline based
|
||||
adjustment which includes full on video editing in the feed watch/scene items if any components or compositions are
|
||||
in the sequence, text, effects, transitions etc. the goal should be to actually open and explore every inch and
|
||||
aspect of how capcut timeline works and basically do the exact same thing. we want full editing ability and to
|
||||
remove the timeline 'comments' as we can just do that in the viewer at whatever timecode im at ... the switcher on
|
||||
the left for video/audio and we should basically allow those to expand; we also can add some way of allowing for
|
||||
keyframes, changing the way you make bezier curves and things. the idea is that we provide the framework and parity
|
||||
functionality and feel to capcut while allowing it to be extended. This also means live editing buffering and
|
||||
playback of whole sequences, 3d scenes, etc need to be done to include buffering, caching, smart cache clearing,
|
||||
etc. these changes in the timeline are not suggestions they are actual edits sent to the agent. these should be
|
||||
deeply connected to the watch, listen, and scene feed experiences."
|
||||
|
||||
What there is to build on (read 11-13):
|
||||
- docs/editing.feature E1 to E5: the composition's file is the document, a change is a change to its code made at
|
||||
once, the working version (NAME-vN.tsx), a <Sequence>'s span edited on a strip (host/sequences.ts), the engine's
|
||||
stage playing the working file live (E4a), an agent editing through the same operations (editor_edit, E5a).
|
||||
- raea-feed src/detail: the viewer's strip (blocks/Filmstrip.tsx: two tracks, a kind picker in each track's
|
||||
gutter, plugins' lanes, the comments' pins and a comment card on the strip), the hand editor (timeline/Editor.tsx,
|
||||
Strip.tsx: cuts over the render, parts retimed, undo and redo), the composition editor (src/compositions).
|
||||
- raea-feed PR #18 (11-13): a scrubber that only seeks, the strip collapsed to it, a resize handle on its top edge.
|
||||
- The proxy store (host/preview/proxies.ts: light copies, thumbnails, peaks, a size limit and a sweep), the export
|
||||
and bundle caches (runtime/bundle cache.rs), rr3's shot segments (docs/rerender.feature, behind RAEA_SEGMENTS=1).
|
||||
|
||||
CapCut's desktop timeline, as its own help pages and guides describe it (read 11-13; no CapCut code is read or
|
||||
copied, and no other editor's under a licence that forbids it: docs/editing.feature's note on react-video-editor-pro):
|
||||
- Above the timeline, left: the pointer's mode (Select A, Split B, select everything left [ or right ]), undo and
|
||||
redo, Split (Cmd+B; Cmd+Shift+B every track), Delete left Q and Delete right W (of the playhead, on the picked
|
||||
clip, the gap closed), a marker M, Delete, and for a picked clip Freeze, Reverse, Mirror, Rotate, Crop.
|
||||
Right: record a voice, the main track magnet P, auto snapping N, linkage ~, the preview axis S (the frame under
|
||||
the pointer), fit Shift+Z, and zoom (Cmd +/-, Cmd+scroll; Option+scroll scrolls sideways).
|
||||
- Tracks: one main track that never holds a gap while its magnet is on (a clip dropped between two moves the rest;
|
||||
off, a clip dragged over others becomes an overlay on a track above); overlay picture tracks above it; text,
|
||||
sticker, effect, filter and adjustment tracks above those; sound tracks below. Each track's head locks it, hides
|
||||
it (eye) or mutes it (speaker).
|
||||
- A clip: picked by a click, several by Cmd+click or a box; moved by a drag, trimmed by its edges (back out again
|
||||
to the source's end), split, deleted, duplicated, copied and pasted, its attributes pasted onto another
|
||||
(Cmd+Shift+C/V), disabled (V), grouped (Cmd+G), made a compound clip (Option+G), its sound extracted
|
||||
(Cmd+Shift+S). I and O mark a range.
|
||||
- Moving in time: Space, Left/Right a frame, Shift+Left/Right several, Up/Down the cut before or after, Home/End.
|
||||
- Keyframes: a diamond beside each property in the inspector stores its value at the playhead; a second, later
|
||||
one with another value animates between them; the diamonds show on the clip; a graph shapes the change (linear,
|
||||
ease in, out, both, or a curve dragged by hand). Position, scale, rotation, opacity, colour, volume.
|
||||
- Speed: constant, or a curve of points from 0.1x to 10x with presets (Montage, Hero, Bullet, Jump cut, Flash in,
|
||||
Flash out) and a custom one; the clip's length follows.
|
||||
- A transition sits on the cut between two clips that touch; its length is dragged. Effects, filters and
|
||||
adjustments are clips on their own tracks, over the span they cover.
|
||||
- Sound: the waveform on the clip, a volume line, fade in and fade out as lengths at the clip's ends, beat markers
|
||||
on the waveform that edges snap to.
|
||||
- Playing while editing: lighter copies of heavy media (Proxy, 540 or 720 lines), a lower preview quality, parts
|
||||
that were worked out kept (the cache: its size shown, cleared by hand or on a schedule), all remade when needed;
|
||||
an export always reads the originals.
|
||||
- The inspector beside the player (read 11-14), its tabs by the picked clip's kind. Video: Basic (position, scale,
|
||||
rotation, opacity, blend mode, stabilise), Mask (line, mirror, circle, rectangle, heart, star; position, size,
|
||||
rotation, feather, round corners, invert), Cutout (auto cutout of a person, a custom cutout brushed, chroma key
|
||||
with its colour picked from the picture, strength and shadow), Retouch. Animation: In, Out, Combo. Speed:
|
||||
constant and curve. Adjust: brightness, contrast, saturation, exposure, sharpen, highlights, shadows,
|
||||
temperature, tint, fade, vignette, grain. Audio: volume, fades, noise reduction, voice changer. Text: font,
|
||||
style, effects, bubbles, animation, and its words read aloud.
|
||||
Here 11-14: Basic (TL3h, TL5) with stabilise (TL7k, a film's footage and a composition's <Video>), auto cutout
|
||||
of a person or the subject (TL7l, a film's footage or a composition's <Video>, on a Mac) and a custom one brushed on the picture (TL7m), Retouch (TL7n: smooth, brighten, slim face and bigger eyes, a film's footage, a file from Media or a composition's <Video>, on a Mac), Mask, chroma key and Blend (TL7f) with the key's colour picked from
|
||||
the picture (TL7h) and the mask's handles dragged there (TL7i), Animation (TL7d, TL7e), Speed (TL6), Audio's
|
||||
volume and fades (TL8a) and its noise reduction and voice changer (TL8d, a film's sounds and a composition's
|
||||
<Audio>), Text's words, styles and captions (TL7c) and its words read aloud (TL7j), Adjust as effect clips
|
||||
over a span (TL7b, raea's ten) and as the clip's own twelve sliders (TL7g, on the film and on a file from Media
|
||||
over it), every number of these keyed (TL5a).
|
||||
|
||||
The model this file sets:
|
||||
1. One timeline model, in an SDK (sdk/timeline, TypeScript, no React, no DOM): tracks, clips, keys, markers, and
|
||||
the operations on them, each a pure function from a timeline to the next. The app's strip draws it and the
|
||||
host writes it; an agent reads and writes the same model. It replaces the strip's own cut and parts.
|
||||
2. The composition's file is still the document (docs/editing.feature): a timeline is read from a composition's
|
||||
tree, and each operation is also a code edit to the working version. What the code can't express as written
|
||||
(a span set by an expression) is shown locked, with why.
|
||||
3. An operation made by the person is an edit, applied at once, and sent to the item's agent as the edit that
|
||||
was made, never as a note asking for it.
|
||||
4. Parity first, in function and feel: CapCut's tools, keys, magnet, snapping and gestures, at 60 frames a second
|
||||
under the pointer. Then the points where it is extended: a kind of track, a kind of clip, a property and its
|
||||
editor, an easing, a transition, an effect, a lane, a tool, each a plugin's contribution.
|
||||
5. Comments are the viewer's. The timeline takes no comment and opens no comment card; a comment made on the
|
||||
picture at a moment shows as a marker on the timeline, which opens it.
|
||||
6. The picture under an edit is the engine playing the working file (E4a) where there is a stage, with what was
|
||||
drawn kept: a range's frames are kept by what draws them, an edit drops only the ranges it changed, and the
|
||||
store keeps itself under a size the person sets.
|
||||
|
||||
Status, 11-13 (the first day). On raea main: sdk/timeline (model, ops with inverses, compound clips, keys and
|
||||
bezier easing, speed curves, freeze frames and reversed footage, snapping, the frame store's decisions, live
|
||||
playback's mapping, readers and writers for a composition's sequences (its footage and sound, its text, its
|
||||
effects, a recording, a project's file), a film's scenes and a sound's tracks, the palette a plugin adds to, a clip's cutout and Adjust; 106
|
||||
tests), and in
|
||||
sdk/video <Nudge keys mask blend chroma adjust> (keys for the placement and, by a dotted name, a mask's, a key's, a
|
||||
crop's and an adjustment's numbers; cutout.ts: a mask's six shapes, CSS's blend modes, a chroma key; adjust.ts:
|
||||
CapCut's twelve adjustments as one SVG filter and a vignette layer), <Transition in out combo> (fade, slide, wipe, zoom; a Combo's seven waves), <Effect kind amount in out> (blur, mono,
|
||||
sepia, vivid, faded, contrast, bright, dark, invert, hue: a filter on the picture under it) and a <Video>'s or
|
||||
an <Audio>'s speedCurve (the mixer carries its sound through the changing rate as one voice). In raea-feed, draft
|
||||
PR #19: the new timeline is the timeline (localStorage raea.timeline-sdk = 0 brings the old strip back); 49 browser
|
||||
tests in Chrome, all passing; in a headless raea window 47 of the 49 pass and two skip themselves there with their
|
||||
reason (the voice test, which would ask for this Mac's microphone, and TL10d, whose film the window decodes itself,
|
||||
so no route can hold its data), among them TL9c, an agent's edits, a composition's every edit, freeze and reverse, mirror and
|
||||
crop, effects, groups and compounds, the posted item's, a plugin's effect, text style, tool and snap grid, saved
|
||||
curves, Settings' kept frames, both kinds of sound taken out, the switcher, the export range, media added, the
|
||||
Option keys, captions made from what is said, a clip's In, Out and Combo, and its mask, blend and chroma key (whose
|
||||
sliders are a track of their own, as the volume's is: the window doesn't move a range input), their numbers and the
|
||||
crop's sides keyed (TL5a), its own Adjust (TL7g), its key's colour picked from the picture (TL7h: read from the
|
||||
clip's file by the host, since the window has no canvas to read), its mask's handles dragged there (TL7i), and a file
|
||||
from Media over the film with its own vignette and its key's colour picked from its own file, a text's words
|
||||
read aloud onto a sound track (TL7j), and a sound's noise reduced and its voice changed (TL8d: its menu is made
|
||||
again after each try, since the window keeps a picked option shown when the clip's didn't change), footage held
|
||||
steady (TL7k), footage cut out (TL7l; its pixels are compared in Chrome only, which can screenshot an
|
||||
element) and cut out by what is brushed over it (TL7m: the strokes painted with the window's own pointer), and footage retouched (TL7n: the copy put in the clip's place at the playhead's second and wearing its mask; that it has the frame and the film's picture goes are checked in Chrome only, which plays the copy). The window runner (blitz/pw.mjs) answers routes one at a time in the order asked, keeps a reload's
|
||||
address and each test's storage, and has keyboard down and up, toBeFocused and waitForResponse. The timeline's keys
|
||||
follow the pointer over it, not :hover, which raea's window doesn't match for a script, so there they only worked
|
||||
after a click in the timeline:
|
||||
built TL0a-d, TL1a-b, TL1c (the switcher on the left of each track, picking what its clips show: the
|
||||
frames, the energy, the waveform, the spectrogram, the words said, with Transcribe offered until
|
||||
there are words; only what the film has is offered, each clip draws its own stretch of the film,
|
||||
and the choice is kept by the track's kind for the next film; a sound in Listen the same; a clip
|
||||
of one of the project's files, a sound track's or one added from Media, draws its own file's
|
||||
loudness, read once on the host (/host/asset-peaks); a plugin's lane as a row under the tracks;
|
||||
collapse and the top edge's resize),
|
||||
TL1d (the poster on the main track's head: a click makes the playhead's frame the poster),
|
||||
TL2a-e, TL2f (I and O in either order, Shift+X around the picked clips, its ends dragged on the
|
||||
ruler, Option+X or the × beside Export clearing it; kept with the item; Export says the span and
|
||||
the host cuts only it with raea media trim, raea's encoder signing it as every export: a real
|
||||
render's 1 s to 2.5 s came out 1.5 s, 90 frames and its sound), TL3a-g (and TL3b's Option-drag,
|
||||
leaving the clip and putting a copy down), TL3h (freeze and reverse played live from the film's own
|
||||
frames; mirror,
|
||||
rotate and crop shown on the player at once, as are a clip's keyed scale, place, turn and opacity),
|
||||
TL3i, TL3j (Media in the bar, Cmd+I: the project's footage, stills and sounds, each added at the
|
||||
playhead as long as its file, a still 3 s; on a film cut here footage and stills go over the
|
||||
picture, drawn on the player where they are on, a sound on a sound track), TL4a-b, TL4c (and a clip's own sound taken out with Cmd+Shift+S: the SDK's extract
|
||||
operation, a sound clip over the same span from the same place in the file, the footage marked
|
||||
muted; in a composition the host mutes the <Video> and writes an <Audio> of its file beside it, read
|
||||
back as clips; in a film cut here the player is silent over that footage and the sound plays from
|
||||
its place in the film wherever it is moved), TL5a-b, TL5c (and a curve shaped by hand saved by name for the workspace: kept as
|
||||
timeline/curves.json in its folder, a preset in every timeline there, forgotten by its ×), TL6a-b
|
||||
(and Option on a clip's edge changing its speed, Cmd+R to the speed, Shift+B to its curve),
|
||||
TL7a, TL7b for raea's ten effects (an effect is a clip of its own,
|
||||
shown on the player where it is on), TL7c (text added with T or in a style from the bar, drawn over a
|
||||
film where it is on, renamed by a double-click, a caption split at the caret with Enter; raea's
|
||||
four text styles and a plugin's, as data; and captions made from what is said, CapCut's auto
|
||||
captions: Captions in the bar transcribes the film first when it has no words yet, then puts the
|
||||
words, where the edited cut now says them (sdk/timeline captions.ts heard: a scene taken out takes
|
||||
its words, a duplicated one says them twice, a curved, reversed or frozen clip none), in lines (a
|
||||
sentence's end, a pause of 0.6 s, seven words or 42 characters end one) as text clips in the
|
||||
caption style on a Captions track of their own: one edit (the `captions` operation), undone
|
||||
whole, drawn over the film, told to the agent as one line with every caption's words and
|
||||
timecodes, and in a composition each line a sequence of words), TL7d's In and Out (a picked
|
||||
clip's own animation at each end, CapCut's Animation tab: fade, slide, wipe, zoom or a plugin's,
|
||||
and its frames, in the clip's row; a ramp on the clip; the film's picture and words over it show it
|
||||
at once, drawn by sdk/video edges.ts, the table <Transition> now draws from too; split, each half
|
||||
keeps its own end's; never longer than the clip; in a composition the sequence's <Transition>
|
||||
edge, taken off with no frames, read back as the clip's own where no cut's transition takes it;
|
||||
Send says how it comes in or goes out), TL7e (a Combo: seven of raea's, as waves in sdk/video
|
||||
edges.ts, and a plugin's as data; its cycle starts at the clip's length, playing once, and loops
|
||||
when shorter; with the In and Out at once on the film's picture and words; a line with a tick a
|
||||
cycle on the clip; <Transition combo> in a composition, written and read back), TL7f (a mask, a
|
||||
blend and a chroma key: the row's blend menu, and a mask and a key panel; a mask an SVG mask image
|
||||
laid over the frame, feathered by a blur, inverted by mask-composite; a blend CSS's mix-blend-mode;
|
||||
a key an SVG colour-matrix filter whose alpha falls as a colour's share of the key's hue rises; drawn
|
||||
by sdk/video cutout.ts in the preview and in <Nudge>, and by raea's renderer as Chrome draws them,
|
||||
seen on a render of a keyed green panel, a feathered heart, an inverted turned star and a screen
|
||||
blend; an SVG <mask> to invert overran Vello's buffers, so it isn't used; a clip's cutout is its
|
||||
props, a preset's to set later; Send says all three as they stand), TL7g (the clip's own twelve
|
||||
Adjust sliders, one SVG filter after its key and a vignette layer, by sdk/video adjust.ts in the
|
||||
preview and in <Nudge adjust>; raea's renderer within 0.4% RMSE of Chrome on a probe), TL7h (the
|
||||
key's colour picked from the picture: a press on the film or a file over it, undone through its
|
||||
placement, read by the host from the clip's file where the player is, a small patch's mean), TL7i
|
||||
(the mask's outline and CapCut's handles on the picture through the clip's placement: move, width,
|
||||
height, corner, turn, feather, round; a drag shown as it moves and one edit when let go, keyed
|
||||
numbers keyed), TL7j (a text's words read aloud: raea gen speech on the host, kept under
|
||||
media/speech by the words' hash, a sound clip from the text's start; a real line 8.4 s to make,
|
||||
43 ms read again), a plugin's effects as data (timeline.effects in its manifest: parts
|
||||
of CSS filter functions, drawn by <Effect parts> and by the preview alike), TL8a
|
||||
(waveform, level line, fades; Cmd+. and Cmd+, step the level by 0.1 dB, or key it at the
|
||||
playhead when it is keyed), TL8b's beats as ticks that edges snap to, each turned off by a
|
||||
click, TL8c (Record from the playhead, the picture playing; the recording a clip named by what was
|
||||
said, its file in the project's attachments), TL8d (a sound's noise reduced and its voice
|
||||
changed: host/dsp.ts in TypeScript, an FFT and Hann overlap-add, the noise's floor from the quietest
|
||||
tenth, a phase vocoder for pitch, biquads for the bands, a delay line for the echo; on made sounds hiss
|
||||
down 16 dB with the tone within 0.04 dB, 3 minutes in 2.3 s; on a real voice the chipmunk moves its
|
||||
spectral centroid x1.46 and deep x0.77, each setting 25-73 ms for 1.2 s, kept under media/voice and
|
||||
read again in under 1 ms; each voice's copy as loud as its source short of clipping, where on a line
|
||||
with pauses they had moved it -12.5 dB (robot) to +8.6 dB (megaphone); in a composition, an <Audio>'s
|
||||
copy made from its own file and kept in its media folder's voice/, the <Audio> playing it and saying
|
||||
what it was made from and how (data-voice-of, data-denoise, data-voice), both off its src as it was;
|
||||
raea renders it, a scratch composition's line at 105 Hz voiced, 140 its own), TL7k (footage held steady: host/shake.ts in TypeScript on 320 px
|
||||
grey frames from `raea media still`, eight at a time; the window over a block read again where
|
||||
the first reading put the move, since a fixed window reads big moves short; the path smoothed by
|
||||
a Gaussian-weighted line, so a pan stays a pan to the clip's ends; on a shaky clip made from a real
|
||||
frame along a known path, the shake 21 px down to 0.23 and its turn 0.54 deg to 0.03, a 1 Hz sway
|
||||
12 px kept to 5.4 at Minimal cut and held to 2.9 at Most stable, zoom 1.05 to 1.06, 34 ms a frame
|
||||
read and the kept file read again in 28 ms; in a composition, its <Video>'s whole file read, the moves kept in its
|
||||
media folder's steady/ and a steadied copy rendered by raea beside them (a composition playing the file
|
||||
with each frame's move as the player wears it), which the <Video> plays, saying what it was made from
|
||||
(data-steady-of, data-steady), off its src as it was; a 2 s clip shaken along a known path steadied in
|
||||
3.4 s, its frame-to-frame shake 7.49 px to 2.12 at 320 px, a copy with no moves its file's every frame), TL7l (footage cut out, CapCut's Auto cutout: Apple's
|
||||
Vision on the host through osascript's JavaScript, its person segmentation (macOS 12) or its
|
||||
subject mask (macOS 14), each frame of the part the clip shows as a 512 px matte PNG under
|
||||
media/matte, 120 frames a run, its index written last; the player wears the frame's matte as the
|
||||
top layer of its mask, intersected with the clip's own shape, and fetches the next 12 ahead; on a
|
||||
real clip a person 97 ms a frame and 73 KB, the subject 79 ms and 33 KB, hair kept; in Chrome a
|
||||
matte clear on its left leaves that quarter of the picture flat and the right as it was), TL7m
|
||||
(footage cut out by what is brushed over it, CapCut's Custom cutout: Brushed… in the cutout menu
|
||||
opens a brush on the picture, keep and erase, its width a share of the frame's, a stroke undone or
|
||||
all cleared; a stroke's points undone through the clip's placement and thinned by Ramer-Douglas-Peucker
|
||||
to what it needs; Cut out sends them with the second under the playhead, and the host matted from
|
||||
that frame to the clip's end and back to its start: Vision's subject mask tells the picture's things
|
||||
apart, those under more keep than erase strokes are kept, and on each frame after, those lying 30% or
|
||||
more in the matte before it, or holding 30% of it, a frame Vision sees nothing in holding the matte
|
||||
before for up to 3 frames; overlaps read as CIAreaAverage means undone from sRGB, a 25% square read
|
||||
0.2502; on two subjects side by side a stroke on either kept only it, both kept both, an erase took
|
||||
one out, a stroke on the sky said nothing is under it; a real clip 90 frames in 11.9 s, the cat
|
||||
followed through all of them; the strokes kept in the clip's props as JSON, there to brush again; in a
|
||||
composition, the whole of what its <Video> plays (its file, or its retouched or steadied copy) matted
|
||||
into its media folder's matte/, and the <Video> wears them by raea's new Video matte prop (matte={{ src:
|
||||
staticFile(folder), fps, every, count }}: the matte its source time is on, as its mask-image, sized as
|
||||
its objectFit sizes the picture), saying what they are of (data-matte; brushed, data-brush-at and
|
||||
data-brush-strokes), off its props as they were; while it wears them, Stabilise and Retouch are refused,
|
||||
since what it plays would change under them. A composition's strokes are on its frame, which is the
|
||||
<Video>'s picture only when the <Video> fills it. A real 3 s face clip's person matted in 9.1 s, and
|
||||
raea's render of the edited composition keeps on each frame what that frame's matte keeps (overlap 0.92
|
||||
at least, 0.972 on average; its own matte over the one 15 frames away on 88 of 90 frames), where the
|
||||
uncut composition's overlap is 0.53),
|
||||
TL7n (footage retouched, CapCut's Retouch: four sliders, smooth, brighten, slim face and bigger eyes, set
|
||||
then applied; the host reads each frame of the part the clip shows (`raea media still`, as wide as the
|
||||
picture up to 1280 px), finds its faces and their landmarks with Vision's face landmarks (up to 4 a
|
||||
frame) and retouches them with Core Image through osascript's JavaScript: the skin a mask of the jaw's
|
||||
line closed by an arc over the forehead, less the eyes, brows and lips, feathered; smooth a blur
|
||||
blended in only where the picture differs little from it, so a lash line or a nostril stays sharp;
|
||||
brighten an exposure lift through the mask; bigger eyes a bump at each eye; slim a warp kernel drawing
|
||||
the cheeks and jaw toward the face's middle. Two Core Image traps found on the way: an image read
|
||||
straight from a bitmap comes out blank from a render with a warp kernel in it (the mask is made from
|
||||
its TIFF data), and a blur under a warp whose region callback is JavaScript renders without the
|
||||
blur's branch (what is under the warp is made pixels first). Frames go to `raea media encode` with
|
||||
the part's own sound (`raea media audio`) under them, signed, as media/retouch/<file>-<key>.mp4, in
|
||||
runs of 48 split over two Vision processes; no face in the clip is said and nothing kept. The player
|
||||
shows the copy over a film's picture in its box, wearing the look copied off it as it changes, and
|
||||
hides the film's picture only once the copy has the frame under the playhead (a copy loading shows
|
||||
the film as shot); a clip coming on within a second has its copy loaded ahead; a file from Media plays
|
||||
the copy, which carries its sound, instead of its file. On a 720 x 1280 talking-head clip 90 frames
|
||||
in 10.9 s, a face found on every one; asked again, the kept copy in 24 ms; in a composition, its
|
||||
<Video>'s whole file retouched into its media folder's retouch/ (its steadied copy when it is held
|
||||
steady: the retouch over the steadying, and Stabilise refused while Retouch is on, since what is under
|
||||
it would change), which the <Video> plays, saying what it was made from and by how much
|
||||
(data-retouch-of, data-retouch-smooth, -brighten, -slim and -eyes), off its src as it was; a real 3 s
|
||||
face clip in 4.3 s, a face on all 90 frames, and raea's render of the edited composition is the copy's
|
||||
own frame, 0 apart, where the file's is 1.4 (4.9 over the face). Copies, moves and mattes are read and
|
||||
made at the rate the frames' times sit on (the probe's frame_rate) where it is within 1% of the
|
||||
average: that clip's 30/1 probed 29.97 on average, and a copy made at that drew its frame 44 at the
|
||||
composition's 45; each is named by that rate too, so a copy made at the old one isn't read again),
|
||||
TL11a for easings, speed curves, transitions, effects, text styles, tools (presets put
|
||||
on the picked clips) and snap grids as data (a clip let go 6 px past a plugin grid's mark lands on
|
||||
it, under a browser test with the plugin installed; each e2e run now starts with no plugins
|
||||
installed, since an earlier run's grids had stayed approved and snapped a run whose plugin had none),
|
||||
TL9c (an agent's editor_edit made as raea/editor operations on the open timeline, which
|
||||
editor_selection gives by clip id: one step in the person's history, undo taking it back, Send
|
||||
telling it as the agent's own, the clips it touched ringing and the bar saying what it did), TL9d
|
||||
(an item's own timeline: an edit kept in the item's data, Send telling its agent), TL10d (below),
|
||||
TL10e (a composition's drafts and a scene's ranges kept in the proxy store, <store>/drafts and
|
||||
<store>/scene-frames, under its one limit with the copies: one line by last play across all of
|
||||
them, so a draft played an hour ago goes before a still looked at a minute ago; Settings › Light
|
||||
copies lists drafts of edits and scene ranges with their sizes and Clear takes them; finishing or
|
||||
discarding a sitting forgets its drafts at once, and any ranges of the discarded version; kept
|
||||
frames whose file is gone go at the next sweep, as a copy whose source is gone does. Seen on a real
|
||||
host on its own port: 1 draft and 2 ranges listed as 15,000 bytes, Clear freeing all three), TL11b (the model as raea/editor, with its reference page and an example), TL12a-b, TL14a-c (a
|
||||
scene's timeline as long as the scene, past its last sequence)
|
||||
in code a composition's sequences: move, trim, split, delete (E3), keys on x, y, scale, rotate and opacity
|
||||
(TL5d), its still placement as its <Nudge>'s props, mirror and crop among them (TL3h), and its mask,
|
||||
blend and chroma key (TL7f: mask={{ kind, x, y, w, h, rotate, feather, round, invert }},
|
||||
blend="screen", chroma={{ color, strength, shadow }}, plain values only, any other the code's), a speed or a
|
||||
speed curve for a sequence that holds footage, split in two with it (TL6a-b), a transition on a cut
|
||||
(TL7a), an effect as a sequence holding an <Effect>, its kind and amount (TL7b), a sequence of
|
||||
words as a text clip, its words rewritten, words added as a new sequence (TL7c), a <Video>'s or an
|
||||
<Audio>'s level (TL8a), a recording as a sequence holding an <Audio> of its file (TL8c), a
|
||||
project's file as a sequence holding a <Video>, <Img> or <Audio> of it, named by its path in
|
||||
the composition's media folder (cloned into media/added/ first when it is elsewhere in the
|
||||
project), in at the nearest cut with the main track moving on and the composition growing (TL3j); each
|
||||
written into the working version the moment it is made, its draft played over the picture (TL9a,
|
||||
TL10d), finished and posted on Send with the agent told (TL9b: followed to the wire, a cutout's
|
||||
Send finishes the version on the host and then posts the item's own session, Cutter on Kimi in
|
||||
p-tutorial, a prompt holding the cutout's words, and nothing before Send; with the composition's
|
||||
tell skipped no prompt goes out. Live on Claude over ACP, nothing mocked between page and agent,
|
||||
the agent's first act was a search for "the v2 composition and matte"). A scene's sequences: move, trim,
|
||||
split, delete written into the scene's own file, which the stage opens again (TL14c). A sound's
|
||||
clips: span, place in the file, level (TL14b). An <Audio>'s sound from its copy with its noise
|
||||
reduced or its voice changed: its src the copy, and data-voice-of, data-denoise and data-voice (TL8d).
|
||||
A <Video>'s footage from its steadied copy: its src the copy, and data-steady-of and data-steady (TL7k);
|
||||
from its retouched copy, over the steadied one when both: data-retouch-of and the amounts (TL7n). A
|
||||
<Video> cut out: its matte prop and data-matte, brushed with data-brush-at and data-brush-strokes (TL7l,
|
||||
TL7m)
|
||||
plays TL10a for a film's own frames: cuts, moves, trims, speeds, freezes and reversed footage at once, the
|
||||
player's buffer on the ruler. TL10f: a timed 3D scene's frames are drawn ahead by the host a few
|
||||
seconds at a time at draft quality and kept by range, each range under what it is drawn from (the
|
||||
code outside the scene's sequences and the sequences on in it), so an edit to one sequence draws
|
||||
again only the ranges it is on and an undo plays what it had; the store stays under its one
|
||||
limit (TL10e), the least recently played going first, and beside the switch the
|
||||
scene's kept frames say what they take and are cleared by a click; the scene's timeline
|
||||
shows what is kept, and Play runs it over the stage from the scene's own camera. TL10d: where play
|
||||
reaches a range not kept yet while the frames are being drawn, the picture holds on it saying
|
||||
Buffering until a second from it is kept (with nothing being drawn, the live stage plays on), and
|
||||
a film that runs out of data says Buffering… over the picture. Seen in a headless raea window on
|
||||
the real host: the sample room drawn, kept, and played at its own rate; a 9 s copy of it opened
|
||||
again with every range kept at once (0.5 s); a sequence dragged across two of its three ranges
|
||||
drew those two again (9.4 s) and left every kept file as it was; and with nothing kept and Play
|
||||
pressed at once, Buffering to 7.7 s, the first range played, Buffering again at its end (11.0 s)
|
||||
until the next was kept (13.5 s)
|
||||
decided TL10b, c and e in the SDK (which ranges an edit changes, a range's key, what goes first); a
|
||||
composition's drafts are kept by their source, so an undo plays its draft again at once (and under
|
||||
the store's one limit since TL10e); beside a composition's timeline the
|
||||
kept drafts say what they take and are cleared by a click. Drafts and a scene's kept frames are
|
||||
drawn smaller than they ship and laid out as they ship (raea's <Composition edit={{ scale }}>, the
|
||||
long side at 960 px; docs/lightspeed.feature PF4): a ray-traced 1080p shot's draft 2.75 s at full
|
||||
size, 1.7 s scaled
|
||||
not built TL13a's drag at the window's rate with 400 clips, though close (measured below: Chrome keeps it;
|
||||
raea's window drew 35 frames a second, bound by the page host's frame after a step: Stylo's restyle,
|
||||
which Blitz widened to the changed element's parent's whole subtree, paint, and every element's rect
|
||||
taken each frame). raea-page-host now restyles finely by default (vendor/blitz-dom mutator.rs: what
|
||||
the snapshot's invalidation finds, the changed attribute named in the snapshot even when it was
|
||||
added, and each ancestor itself for `:has()`; RAEA_FINE_RESTYLE=0 for Blitz's own way), and a rect
|
||||
with no transform above it is answered without matrix math. ui-parity with it: 269/271, the same
|
||||
two cases failing as without (p15-media canvas-text, img-downscale); before the snapshot and :has()
|
||||
fixes it was 266. The app's timeline suite in a headless window with it: 53 of 54 pass, TL10d
|
||||
skipping itself there. Measured 11-14 in a headless window, three rounds alternating: the drag 38-41
|
||||
fps without, 48-50 with, against the window's still rate of 52-55, so about 90% of it; a pick
|
||||
42-62 ms and a split 46-63 ms. A sync of the twins that keeps their boxes on each pointer move
|
||||
(RAEA_TWIN_SYNC_LIGHT=1, a trial, off) gained nothing, again in four interleaved rounds with the fine
|
||||
restyle (drag over still 0.62-0.67 with it, 0.65-0.67 without). Under another session's load the
|
||||
drag held the same share of the still rate with the :has() fix as without (0.66-0.72 each, four
|
||||
rounds). Where a drag's frame goes now (a macOS sample of the page host's main thread with the fine
|
||||
restyle, 365 samples): the page's JavaScript for the pointer event 18%, paint 18%, the snapshot of
|
||||
every element's box for the page's JS 11%, the twins' boxes taken again before each event 7% and
|
||||
each frame 5%, Stylo's restyle 2.5% (28% before). The drag adds about 2 ms to a still frame of 18-19
|
||||
ms, so what is left is mostly the still frame: every element's box taken twice a frame and the page
|
||||
painted whole, with nothing changed; an incremental snapshot and paint would be the next step.
|
||||
Drawing only the clips in view would draw none fewer: at its opening fit all 12 tracks and all 400
|
||||
clips are on screen at once.
|
||||
TL13a's stage clause is met (an edit on the scene's stage by 88 ms, median, TL13b). The
|
||||
skills guide's note on an item's `timeline` field waits for PR #19 to merge
|
||||
|
||||
Background:
|
||||
Given the SDK is sdk/timeline in raea, the app's side is raea-feed src/detail (timeline, strip, blocks), the
|
||||
host's is raea-feed host (sequences.ts, edit.ts, preview/proxies.ts) and the engine's stage is engine/page/stage
|
||||
And every scenario below is a task (docs/agents.md "Tasks: rask"); a status line under a rule says what is built
|
||||
|
||||
Rule: TL0. One model: tracks, clips, keys, markers
|
||||
# Plan (crate or package | file | lines | job)
|
||||
# sdk/timeline | src/model.ts | 150 | Timeline, Track, Clip, Key, Marker, Ease; ids; frames as integers
|
||||
# sdk/timeline | src/ops.ts | 300 | every operation as (timeline, op) -> timeline; inverse for undo
|
||||
# sdk/timeline | src/snap.ts | 120 | what an edge snaps to, and the magnet's closing of gaps
|
||||
# sdk/timeline | src/keys.ts | 160 | a property's value at a frame; cubic bezier easing; presets
|
||||
# sdk/timeline | src/speed.ts | 120 | a speed curve's source time at an output time, and its length
|
||||
# sdk/timeline | src/read.ts | 200 | a timeline from a composition's read tree (host/sequences.ts' rows)
|
||||
# sdk/timeline | src/edits.ts | 200 | an operation as code edits to the working version
|
||||
|
||||
Scenario: TL0a. Time is whole frames
|
||||
Given a timeline at 30 frames a second
|
||||
Then every clip's start, length and trim, every key and every marker is a whole number of frames
|
||||
And a timecode is drawn from frames (mm:ss:ff), never the other way
|
||||
|
||||
Scenario: TL0b. An operation is a pure function with an inverse
|
||||
Given any timeline and any operation that applies to it
|
||||
Then applying the operation and then its inverse gives the timeline back, to the frame
|
||||
And an operation that can't apply (a locked track, a clip trimmed past its source) is refused with its reason
|
||||
|
||||
Scenario: TL0c. A timeline is read from a composition
|
||||
Given a composition with sequences, a <Video>, an <Audio>, a component and a <Series>
|
||||
Then each is a clip with its span, on a track by its kind and its depth in the tree, and names its element
|
||||
(file:line:col, docs/editing.feature E2)
|
||||
And a span written as an expression is a clip marked locked, with "set in code"
|
||||
|
||||
Scenario: TL0d. A feed item or a controller declares a timeline
|
||||
Given an agent posts a feed item, or a controller has a field, that carries a timeline (tracks of clips over
|
||||
anything with a time: a film, a song, a scene's animation, a schedule)
|
||||
Then the app draws it with the same strip and tools, and its operations go back to the agent as TL9 says
|
||||
|
||||
Rule: TL1. Tracks: a main track, overlays above, sound below, each with a head
|
||||
Scenario: TL1a. Tracks by kind, in CapCut's order
|
||||
Then from the top: effect and adjustment tracks, text tracks, overlay picture tracks, the main track, sound tracks
|
||||
And a new clip of a kind with no free track makes one in its place in that order
|
||||
|
||||
Scenario: TL1b. A track's head
|
||||
Then each track's head has its kind's icon and name, a lock, an eye (picture) or a speaker (sound)
|
||||
And a locked track's clips can't be picked or changed, a hidden one isn't drawn in the picture, a muted one isn't heard
|
||||
And these are edits like any other (TL9): the composition is drawn that way until they are turned back
|
||||
|
||||
Scenario: TL1c. Tracks expand
|
||||
Given the switcher on the left of a track (what it shows: frames, waveform, spectrogram, words, a plugin's lane)
|
||||
When I drag a track's lower edge, or double-click its head
|
||||
Then that track alone grows or shrinks, from a line to tall, and what it shows gains detail with its height
|
||||
And the whole timeline still resizes from its top edge and collapses to its scrubber (raea-feed PR #18)
|
||||
|
||||
Scenario: TL1d. The main track's cover and the first frame
|
||||
Then the main track's head shows the film's poster, and picking it sets the frame used as the item's poster
|
||||
|
||||
Rule: TL2. Moving through time
|
||||
Scenario: TL2a. The ruler and the playhead
|
||||
Then a ruler over the tracks marks time at the zoom's scale (frames, seconds, tens of seconds)
|
||||
And a press or a drag on the ruler or the scrubber moves the playhead and nothing else
|
||||
|
||||
Scenario: TL2b. Keys, as CapCut's
|
||||
Then Space plays and pauses; Left and Right step a frame; Shift+Left and Shift+Right step ten
|
||||
And Up and Down go to the cut before and after; Home and End to the first and last frame
|
||||
And every key is listed in one place (the app's shortcuts), can be changed there, and shows in its button's tooltip
|
||||
|
||||
Scenario: TL2c. Zoom and scroll
|
||||
Then Cmd+= and Cmd+- zoom about the playhead, Cmd+scroll about the pointer, Shift+Z fits the whole timeline
|
||||
And scroll moves through the tracks, Option+scroll (and a sideways scroll) through time
|
||||
And the zoom goes from the whole film in the strip's width to one frame at 12 px or more
|
||||
|
||||
Scenario: TL2d. The preview axis
|
||||
Given the preview axis is on (S)
|
||||
When the pointer moves over the tracks
|
||||
Then the picture shows the frame under the pointer without moving the playhead, and goes back when it leaves
|
||||
|
||||
Scenario: TL2e. Markers
|
||||
When I press M
|
||||
Then a marker is at the playhead (on the picked clip if one is picked, else on the timeline), which I can name,
|
||||
colour, drag and delete, and which edges snap to
|
||||
|
||||
Scenario: TL2f. A range marked for export
|
||||
When I press I at one place and O at another (in either order), or Shift+X with a clip picked (CapCut's
|
||||
"select an area by clip"; capcut.com/help/export-clip-of-video)
|
||||
Then the span between them is marked on the ruler, its ends dragged, and Option+X clears it
|
||||
And an export of the item renders only that span, all its tracks; with none marked it is the whole timeline
|
||||
And the range is how the timeline is seen, not an edit: it isn't sent, and it is kept with the item's timeline
|
||||
until it is cleared, so a later export isn't cut short without it showing
|
||||
|
||||
Rule: TL3. Clips: pick, move, trim, split, delete
|
||||
Scenario: TL3a. Picking
|
||||
Then a click picks a clip, Cmd+click adds or removes one, a box dragged from empty track picks what it touches
|
||||
And [ and ] pick every clip left or right of the playhead; Cmd+A all; Escape none
|
||||
And what is picked is what the viewer's inspector shows and what editor_selection tells the agent
|
||||
|
||||
Scenario: TL3b. Moving
|
||||
When I drag a clip (or the picked clips together)
|
||||
Then it moves in time on its track, or to another track that takes its kind, snapping as TL4 says
|
||||
And Option held while dragging leaves a copy behind
|
||||
|
||||
Scenario: TL3c. Trimming
|
||||
When I drag a clip's edge
|
||||
Then its start or end moves and, for media, its place in the source with it, never past the source's own ends
|
||||
And a trimmed edge can be dragged back out to what was there
|
||||
|
||||
Scenario: TL3d. Splitting
|
||||
Then Cmd+B splits the picked clips at the playhead (every clip under it when none is picked)
|
||||
And Cmd+Shift+B splits every track; B makes each click a split until A; a split clip's keys stay at their frames
|
||||
|
||||
Scenario: TL3e. Delete, delete left, delete right
|
||||
Then Delete removes the picked clips; on the main track with the magnet on, the gap closes
|
||||
And Q removes what is left of the playhead on the picked clip, W what is right of it, the gap closed
|
||||
And Shift+Delete closes the gap on any track
|
||||
|
||||
Scenario: TL3f. Copy, paste, duplicate, attributes
|
||||
Then Cmd+C, Cmd+X and Cmd+V copy, cut and paste clips at the playhead on their tracks; Cmd+D duplicates after
|
||||
And Cmd+Shift+C and Cmd+Shift+V copy a clip's properties, keys and effects onto the picked ones
|
||||
|
||||
Scenario: TL3g. Disable, group, compound
|
||||
Then V turns the picked clips off and on (drawn dimmed, left out of the picture and the sound)
|
||||
And Cmd+G groups clips so they pick and move as one; Cmd+Shift+G lets them go
|
||||
And Option+G makes the picked clips one compound clip (in code, one component holding them), opened by a
|
||||
double-click to edit inside; Option+Shift+G puts them back
|
||||
|
||||
Scenario: TL3h. Freeze, reverse, mirror, rotate, crop
|
||||
Then with a picture clip picked the bar offers Freeze (a still of the playhead's frame, 3 s, inserted there),
|
||||
Reverse, Mirror, Rotate (90 degrees) and Crop, each an edit to that clip's element
|
||||
|
||||
Scenario: TL3i. Undo and redo
|
||||
Then Cmd+Z and Cmd+Shift+Z step through every operation, the person's and the agent's (E5a), one history
|
||||
And a drag is one step however many frames it crossed
|
||||
|
||||
Scenario: TL3j. The project's media, added at the playhead
|
||||
Given the project's footage, stills and sounds (the files its Source page's Assets tab lists)
|
||||
When I open Media in the bar and press a file's +, as CapCut's media panel adds one
|
||||
Then it is a clip at the playhead as long as its file (a still 3 s, CapCut's default): footage and stills on
|
||||
the main track, a sound on a sound track
|
||||
And in a composition it is a sequence holding a <Video>, an <Img> or an <Audio> of the file, named by its path
|
||||
in the composition's media folder (a file elsewhere in the project copied into media/added/ first, since a
|
||||
render reads that folder alone); on the main track with the magnet on, the clips after it move on by its
|
||||
length and it is drawn under what was over them
|
||||
And in a film cut here it goes over the picture on an overlay track (the film's own cut is its scenes) and
|
||||
plays there, a sound plays where it is placed, and Send tells the agent which file went where
|
||||
|
||||
Rule: TL4. The magnet, snapping and linkage
|
||||
Scenario: TL4a. The main track's magnet (P)
|
||||
Given the magnet is on
|
||||
Then the main track has no gap: a clip removed closes it, a clip dropped between two moves the later ones on
|
||||
And a clip dragged past its neighbour's middle swaps places with it
|
||||
Given it is off
|
||||
Then clips stay where they are, a gap is allowed, and a clip dropped over another goes to a track above
|
||||
|
||||
Scenario: TL4b. Snapping (N)
|
||||
Then a dragged clip's edges, a trimmed edge and the playhead snap within 8 px to clip edges on every track,
|
||||
the playhead, markers, beats and the film's ends, with a line drawn where it snapped
|
||||
And Cmd held while dragging turns snapping off for that drag
|
||||
|
||||
Scenario: TL4c. Linkage (~)
|
||||
Given linkage is on
|
||||
Then what sits over a main-track clip (text, effects, overlays that start inside its span) moves, is split's
|
||||
left or right part, and is deleted with it
|
||||
And a video clip's own sound moves with it until Cmd+Shift+S extracts it to a sound track
|
||||
|
||||
Rule: TL5. Keyframes and curves
|
||||
Scenario: TL5a. A key is a property's value at a frame
|
||||
Given a clip is picked and the playhead is inside it
|
||||
When I press the diamond beside a property (position, scale, rotation, opacity, volume, any prop its element
|
||||
declares as a number, a colour or a point)
|
||||
Then that property has a key there; changing the value at another frame adds a key there
|
||||
And between two keys the value follows the first key's ease; before the first and after the last it holds
|
||||
And the numbers inside a mask (its centre, size, turn, feather, corners), a chroma key (strength, shadow) and a
|
||||
crop (each side) have their keys beside them in their panels, as the placement's are in the row, and the
|
||||
picture follows them as it plays; in a composition they are the <Nudge keys> of a dotted name ("mask.feather",
|
||||
"chroma.strength", "crop.left"), a curve that overshoots held inside what the value can be
|
||||
|
||||
Scenario: TL5b. Keys on the clip
|
||||
Then a clip with keys shows them as diamonds along it (Option+K shows or hides a row a property)
|
||||
And a diamond is dragged in time, copied, deleted; a click on one moves the playhead to it
|
||||
And the diamond beside the property steps to the key before and after
|
||||
|
||||
Scenario: TL5c. Easing is a cubic bezier, edited by hand
|
||||
When I open a span between two keys
|
||||
Then a graph shows its curve with two handles; dragging them changes it; the picture plays it as I drag
|
||||
And presets fill it (linear, ease in, ease out, ease in-out, hold, and those a plugin adds), and a curve I made
|
||||
can be saved by name for the workspace
|
||||
And in code a key's ease is its four numbers ([x1, y1, x2, y2]), "linear" or "hold"
|
||||
|
||||
Scenario: TL5d. Keys in code
|
||||
Then a property with keys is written on its element as one readable prop (keys={{ scale: [[0, 1], [45, 1.15,
|
||||
[0.2, 0, 0, 1]]] }} through one wrapper, as <Nudge> is for a still value), re-written in place on each change
|
||||
And a property animated by the composition's own code (interpolate, spring) is shown as a curve that can be
|
||||
read but not dragged, with "set in code"
|
||||
|
||||
Rule: TL6. Speed
|
||||
Scenario: TL6a. A constant speed
|
||||
When I set a picked clip's speed (Cmd+R) from 0.1x to 100x, or drag its edge with Option held
|
||||
Then its length follows, its sound keeps its pitch unless I say otherwise, and the magnet closes or opens the gap
|
||||
|
||||
Scenario: TL6b. A speed curve
|
||||
When I choose Curve (Shift+B)
|
||||
Then the clip has points from 0.1x to 10x over its source, with the presets Montage, Hero, Bullet, Jump cut,
|
||||
Flash in and Flash out, and a custom one whose points I drag, add and remove
|
||||
And the clip's length is the curve's, and a line over the clip shows where it is fast and slow
|
||||
|
||||
Rule: TL7. Transitions, effects, text
|
||||
Scenario: TL7a. A transition sits on a cut
|
||||
Given two clips that touch on one track
|
||||
When I drop a transition on their cut (or pick one from the cut's own button)
|
||||
Then it is drawn across the cut, its length dragged from either end, within what both clips have beyond the cut
|
||||
And it is a component both clips' elements are wrapped by in code, one a plugin can add
|
||||
|
||||
Scenario: TL7b. Effects, filters and adjustments are clips
|
||||
Then each is a clip on a track above the picture, covering the span it applies to, trimmed and keyed like any other
|
||||
And with linkage on it follows the main-track clip under its start
|
||||
|
||||
Scenario: TL7c. Text and captions
|
||||
Then a text is a clip on a text track; double-click edits its words in the picture; Enter splits a caption in two
|
||||
And captions made from the words (the transcript) are clips on a caption track, each moved, trimmed and edited
|
||||
|
||||
Scenario: TL7d. A clip's own In and Out animations
|
||||
Given a clip of footage, a still or text picked
|
||||
When I give it an In animation or an Out animation (CapCut's Animation tab: fade, slide, wipe, zoom, or a
|
||||
plugin's transition) and how many frames it takes
|
||||
Then it plays over the clip's own first or last frames, drawn as a ramp at that end of the clip, and the picture
|
||||
shows it at once
|
||||
And split, the first part keeps the In and the second the Out; it is never longer than the clip
|
||||
And in a composition it is the sequence's own <Transition in out>, the same component a cut's transition writes,
|
||||
and read back from it as the clip's own wherever no cut's transition takes it
|
||||
|
||||
Scenario: TL7e. A clip's Combo animation
|
||||
Given a clip of footage, a still or text picked
|
||||
When I give it a Combo (CapCut's third kind: pulse, sway, float, shake, swing, spin, flicker, or a plugin's)
|
||||
Then it moves over the clip's whole length, a cycle every so many frames: the clip's own length (what it starts
|
||||
at) plays it once, as CapCut's Combo does, and fewer loop it, as CapCut's text Loop does
|
||||
And it plays with the clip's In and Out at once, drawn as a line along the clip with a tick at each cycle
|
||||
And a Combo is data, a wave of the clip's x, y, scale, rotate and opacity over one cycle, so a plugin adds one in
|
||||
its manifest and the preview draws it
|
||||
And in a composition it is the sequence's <Transition combo>, written and read back
|
||||
|
||||
Scenario: TL7f. A clip's mask, blend and chroma key
|
||||
Given a clip of footage or a still picked
|
||||
When I give it a mask (CapCut's Mask tab: a line, a mirror band, a circle, a rectangle, a heart or a star)
|
||||
Then the picture is seen through it at once: a shape that starts round in the middle of the film, moved and
|
||||
sized in shares of the frame, turned, its edge feathered, a rectangle's corners rounded, or inverted to keep
|
||||
what is outside it
|
||||
When I give it a blend (Basic's Blend: darken, screen, overlay, multiply, lighten, hard and soft light, colour
|
||||
burn and dodge, add, difference, exclusion)
|
||||
Then it is drawn onto what is under it by that mode
|
||||
When I key a colour out of it (Cutout's Chroma key: a green or blue screen, or a colour typed, its strength and
|
||||
its shadow)
|
||||
Then that colour's hue goes from the picture, the screen's shadows let through half seen as far as the shadow
|
||||
says; a grey, which has no hue to key by, is refused in words
|
||||
And in a composition each is a prop of the sequence's <Nudge> (mask, blend, chroma), written and read back,
|
||||
and raea's renderer draws them as the preview does
|
||||
|
||||
Scenario: TL7g. A clip's own Adjust
|
||||
Given a clip of footage or a still picked
|
||||
When I adjust it (CapCut's Adjust tab: brightness, contrast, saturation, exposure, sharpen, highlights, shadows,
|
||||
temperature, tint, fade, vignette, grain), each a slider from as shot, keyed as any number is (TL5a)
|
||||
Then the picture shows it at once, under the effects over it, after its chroma key; a file from Media over the
|
||||
film shows its own, its vignette over its own picture where that sits in the frame
|
||||
And in a composition it is the sequence's <Nudge adjust>, written and read back: its tone one curve read through
|
||||
a table, its colour two colour matrices, sharpen a convolution, grain a noise whose seed is the frame, and a
|
||||
vignette a darkening laid over the part's frame; raea's renderer draws them as Chrome does (11-14 probe: tone,
|
||||
colour, sharpen and vignette within 0.4% RMSE of Chrome, grain the same strength, its noise its own)
|
||||
And Send tells the agent the adjustments as they now stand
|
||||
|
||||
Scenario: TL7h. The key's colour picked from the picture
|
||||
Given a clip of footage or a still picked, its chroma key open
|
||||
When I press pick and then press on the picture (CapCut's picker: a crosshair, a ring under the pointer)
|
||||
Then the key's colour is the clip's own at that point: read from its file where the player is in it, before its
|
||||
key, the mean of a small round patch so one noisy pixel doesn't set it, wherever the clip is placed, turned,
|
||||
scaled or mirrored on the film; a press off its picture is said, not read
|
||||
And the key takes it at once as a typed colour would, and the press leaves no comment and doesn't play
|
||||
And Esc, or pick again, stops picking and keeps the clip picked
|
||||
And the picture is read by the host from the file, not from the screen (raea's window has no canvas to read),
|
||||
so it is the same colour in raea's window and in Chrome
|
||||
|
||||
Scenario: TL7i. A mask's handles dragged on the picture
|
||||
Given a clip with a mask picked, its mask panel open and the playhead on it
|
||||
Then the mask's outline is drawn on the picture where it is, through the clip's placement, with CapCut's
|
||||
handles at a constant size: the shape itself to move it, an edge's for its width or its height, a corner's for
|
||||
both in proportion, a turn handle under it, a feather handle over it that runs out as the edge softens, and a
|
||||
rectangle's corner rounding along its top edge (a line has its turn and feather; a mirror's band its height)
|
||||
When I drag one
|
||||
Then the picture's mask follows as it moves and it is one edit when let go, the panel's numbers with it: a number
|
||||
keyed (TL5a) takes a key at the playhead, the rest a still value
|
||||
And a press on them leaves no comment and doesn't play
|
||||
|
||||
Scenario: TL7j. A text's words read aloud
|
||||
Given a text clip picked, in a film or a composition with a project
|
||||
When I press read aloud (CapCut's text to speech)
|
||||
Then its words are made into a voice on the host (raea gen speech: narration through raea's API, about a cent a
|
||||
line) and kept as a sound file of the project's, media/speech/ by the words and their hash, so the same words
|
||||
read again are the kept file and cost nothing
|
||||
And the voice is a sound clip on a sound track from where the text starts, as long as the voice, named by the
|
||||
words, as a file from Media is (TL3j); in a composition it is the host's edit, as that is
|
||||
And what goes wrong (no words, too many, no credit) is said beside the button, and nothing is added
|
||||
|
||||
Scenario: TL7k. Footage held steady
|
||||
Given a footage clip picked in a film cut here (one of the film's scenes, or footage of the project's over it)
|
||||
When I pick a level in Stabilise (CapCut's: Minimal cut, Recommended, Most stable)
|
||||
Then the host reads the part of its file the clip shows, small and grey, and finds each frame's move from the
|
||||
one before (a grid of blocks by phase correlation, fitted as one shift and turn, a thing moving across the
|
||||
picture left out); the moves add up to the camera's path, smoothed by the level (a slow sway kept at Minimal
|
||||
cut, held at Most stable), and the difference is the move for each frame with one zoom that keeps the frame's
|
||||
edges out of sight, kept as a file of the project's under media/stabilise by its file, frames and level
|
||||
And the player wears the moves under the clip's own placement, so its position, scale, turn and keys move the
|
||||
steadied picture, and the zoom is said in the row
|
||||
And not stabilised, it is as shot; what goes wrong is said beside the level, and nothing changes
|
||||
And the agent is told the level, the file of moves and what is in it, and the zoom (TL9b)
|
||||
|
||||
Scenario: TL7l. Footage cut out
|
||||
Given a footage clip picked in a film cut here (one of the film's scenes, or footage of the project's over it)
|
||||
When I pick what to keep in Auto cutout (CapCut's: a person, or the picture's subject, whatever it is)
|
||||
Then the host has the Mac's own vision models matte each frame of the part of its file the clip shows (no
|
||||
model downloaded, nothing sent anywhere), each a PNG whose alpha is what is kept, kept under media/matte by
|
||||
its file, frames and kind, so the same cutout asked again is read, not made
|
||||
And the player wears each frame's matte as it plays, cut into the clip's own mask (TL7f) and never adding to
|
||||
it, the next mattes fetched before they are worn; a part cut out shows what is under the clip
|
||||
And a long clip is matted every second or third frame, at most 900 mattes, each worn until the next
|
||||
And off, the picture is whole; what goes wrong (not a Mac, a subject cutout before macOS 14, a file with no
|
||||
moving picture) is said beside the menu, and nothing changes
|
||||
And the agent is told what is kept, by what, and where the mattes are and which frame each is (TL9b)
|
||||
|
||||
Scenario: TL7m. Footage cut out by what is brushed over it
|
||||
Given a footage clip picked in a film cut here, at a frame where what I want shows well
|
||||
When I pick Brushed in its cutout menu (CapCut's Custom cutout)
|
||||
Then a brush is on the picture, through the clip's placement: I brush over what to keep, and with the eraser
|
||||
over what to take out, at a width I set; a stroke can be taken back, or all of them, and brushing neither
|
||||
plays nor leaves a note
|
||||
And Cut out has the host find, on that frame, the things in the picture my strokes are over (the Mac's own
|
||||
vision models telling them apart), and follow them to the clip's end and back to its start, each frame's
|
||||
kept as TL7l keeps its mattes; nothing under what I kept is said, and the strokes stay to brush again
|
||||
And the player wears them as TL7l says, and Brushed opened again shows the strokes it was cut out by
|
||||
And the agent is told when it was brushed, its strokes, and where the mattes are (TL9b)
|
||||
|
||||
Scenario: TL7n. Footage retouched
|
||||
Given a footage clip picked in a film cut here, a person's face in it
|
||||
When I open its Retouch (CapCut's Retouch) and set smooth, brighten, slim face and bigger eyes, and apply
|
||||
Then the host finds the faces on each frame of the part of its file the clip shows and retouches them (the
|
||||
skin smoothed with its edges kept, brightened, the cheeks and jaw drawn in, the eyes made bigger), and keeps
|
||||
the frames, with that part's own sound under them, as one copy of the project's, named by its source, part
|
||||
and amounts, so the same retouch asked again is read, not made
|
||||
And the player shows the copy in the clip's place, in step with the playhead and wearing everything the clip's
|
||||
picture wears (its placement, mask, cutout, Adjust); the clip's picture goes only once the copy has the frame
|
||||
under the playhead, and a clip coming on next has its copy loaded before it does
|
||||
And applied again with other amounts it is a new copy; off, the picture as shot; what goes wrong (not a Mac, no
|
||||
face in it, longer than a minute) is said beside the sliders, and nothing changes
|
||||
And the agent is told the amounts, and where the copy is and the part of the file it holds (TL9b)
|
||||
|
||||
Rule: TL8. Sound
|
||||
Scenario: TL8a. The waveform, the volume line and fades
|
||||
Then a sound clip draws its waveform; a line across it is its volume, dragged up and down (Cmd+. and Cmd+,
|
||||
0.1 dB); a handle at each top corner drags a fade in and a fade out, drawn as the waveform's slope
|
||||
And volume takes keys as TL5 says
|
||||
|
||||
Scenario: TL8b. Beats
|
||||
When I ask for a sound clip's beats
|
||||
Then they are marked along it (the bed's beat map where raea made the music, else found from the sound), each
|
||||
can be turned off, and edges snap to them (TL4b)
|
||||
|
||||
Scenario: TL8c. A voice recorded onto the timeline
|
||||
When I press record and speak
|
||||
Then the take is a sound clip from the playhead on a sound track, and a file in the project
|
||||
|
||||
Scenario: TL8d. A sound's noise reduced and its voice changed
|
||||
Given a sound clip picked in a film cut here (a recording, a sound file of the project's, or the film's own
|
||||
sound taken out of its footage)
|
||||
When I press reduce noise, or pick a voice (CapCut's voice changer: chipmunk, deep, robot, telephone,
|
||||
megaphone, echo), or both
|
||||
Then the host makes a copy of the clip's own sound, never of a copy, with that done to it (its steady noise
|
||||
found in its quietest tenth and turned down per frequency; the voice by a phase vocoder, a filter or a delay),
|
||||
mono and as long as its own, kept under the project's media/voice by its file, size, time and settings, so
|
||||
asking again is the kept file
|
||||
And the clip plays the copy from where it played its own, and says so with a mark on it
|
||||
And both turned off, it plays its own sound again
|
||||
And what goes wrong (no sound here, longer than 20 minutes) is said beside the controls, and nothing changes
|
||||
And the agent is told what was done and the file it now plays (TL9b)
|
||||
|
||||
Rule: TL9. An edit is an edit, and the agent gets it as one
|
||||
Scenario: TL9a. Applied at once, to the working version
|
||||
When I make any operation above
|
||||
Then the working version's code is changed by it (docs/editing.feature E1a) and the picture shows it (TL10)
|
||||
And nothing asks me to confirm, and nothing is held as a suggestion
|
||||
|
||||
Scenario: TL9b. Sent to the agent as what was done
|
||||
Given the item's agent has a session (or is started for it, as a note's send does)
|
||||
When my sitting's edits are sent (when I leave the editor, press Send, or pause a while)
|
||||
Then the agent receives them as edits already made: the operations in order, each with the clip's element, the
|
||||
frames before and after, and the file and lines changed, with the version they made
|
||||
And its prompt says they are done and not to be redone or undone, and what is its to do next (render, check,
|
||||
carry the change to what depends on it)
|
||||
|
||||
Scenario: TL9c. The agent's edits are operations too
|
||||
When an agent changes the timeline (editor_edit, or the SDK's operations from its own code)
|
||||
Then they land in the open sitting's history as mine do, and I see each one happen
|
||||
|
||||
Scenario: TL9d. A timeline with no composition behind it
|
||||
Given a feed item or a controller whose timeline is its own data (TL0d)
|
||||
Then an operation changes that data where it is kept and is sent to its agent the same way
|
||||
|
||||
Rule: TL10. Playing while editing: buffer, cache, and clearing it
|
||||
Scenario: TL10a. The engine plays the working file
|
||||
Given a stage (the raea app)
|
||||
Then the picture is the engine drawing the working version at the playhead, for 2D, 3D and ray-traced scenes
|
||||
And a change shows on the next frame; no render stands between an edit and the picture (E4a)
|
||||
|
||||
Scenario: TL10b. Frames drawn are kept, by what draws them
|
||||
Then a range of frames the stage has drawn is kept (in memory near the playhead, on disk beyond it) under a key
|
||||
of everything that draws it: the clips over it, their props and keys, the media's own fingerprints
|
||||
And playing a kept range shows its frames without drawing them again, at the film's own rate
|
||||
And a bar over the ruler shows which ranges are kept and which are being drawn
|
||||
|
||||
Scenario: TL10c. An edit drops only what it changed
|
||||
When I move a clip from 2:00-2:05 to 2:10-2:15
|
||||
Then the kept frames of 2:00-2:05 and 2:10-2:15 are dropped and every other range plays from the store
|
||||
|
||||
Scenario: TL10d. Buffering ahead
|
||||
Given a part of the film that can't be drawn at its rate (a ray-traced scene, a 4K clip)
|
||||
Then while paused, and while playing ahead of the playhead, the stage draws and keeps what comes next
|
||||
And heavy media plays from its light copy while editing (the proxy store), and an export reads the originals
|
||||
And when playing reaches a frame that isn't ready, the picture holds and says "Buffering" until 1 s is ready
|
||||
|
||||
Scenario: TL10e. The store keeps itself small
|
||||
Then the kept frames live in the proxy store, under its one size limit, shown in Settings with what holds it
|
||||
And the least recently played ranges go first; a version that was closed or discarded goes at once; nothing a
|
||||
person made by hand is ever in it
|
||||
And clearing it by hand costs only time: everything in it is made again when needed
|
||||
|
||||
Scenario: TL10f. Whole sequences and scenes
|
||||
Then a Scene item's animation and a film's 3D shots play, scrub and cache the same way
|
||||
And a sequence of several compositions plays through its cuts without a gap or a reload
|
||||
|
||||
Rule: TL11. The framework: every part can be added to
|
||||
Scenario: TL11a. Contribution points
|
||||
Then a plugin (plugins/manifest.ts) can add: a kind of track, a kind of clip and how it draws on the strip, a
|
||||
property and its editor in the inspector, an easing preset, a speed preset, a transition, an effect, a lane,
|
||||
a tool in the bar with its key, and a snapping target
|
||||
And raea's own tracks, clips, easings and transitions are registered through the same points
|
||||
|
||||
@done
|
||||
Scenario: TL11b. The SDK alone
|
||||
# Status 11-13: built. The model is one import, `raea/editor` (sdk/raea/src/editor.ts re-exports sdk/timeline;
|
||||
# raea/timeline was already the video Sequence module), resolved by a bundle as @raea/timeline. Its reference page
|
||||
# is docs/manual/reference/sdk/editor.md, every type and field documented (the manual-ref gate fails on one
|
||||
# without), with docs/manual/examples/edits.tsx as its example: a timeline built in code, split, keyed, sped up
|
||||
# and undone by the inverses, rendered (180 frames to 150, then "as it was"). The skills' SDK reference lists it
|
||||
# (tools/skills.sh now follows export *, raea-skills #65) and motion/footage teaches it (raea-skills #64)
|
||||
Then sdk/timeline has no React and no DOM: an agent's script, the host and a test use it as the app does
|
||||
And its reference page lists every type and operation with an example, in the skills reference
|
||||
|
||||
Rule: TL12. Comments leave the timeline
|
||||
Scenario: TL12a. No comment is made on the timeline
|
||||
Then a press on the tracks never opens a comment card, with any tool on, and the strip's menu has no Comment item
|
||||
And Comment in the viewer pins a comment on the picture at the playhead's time, as it does now
|
||||
|
||||
Scenario: TL12b. A comment shows as a marker
|
||||
Then each comment with a time shows as a marker on the ruler in its author's hue; a click opens it in the viewer
|
||||
|
||||
Rule: TL13. Feel
|
||||
Scenario: TL13a. Under the pointer
|
||||
Then a drag, a trim and a scrub draw at the window's rate with 400 clips on 12 tracks, the dragged clip never
|
||||
more than a frame behind the pointer
|
||||
And a pick shows within 50 ms, a split within 100 ms, and the picture follows an edit within 100 ms where the
|
||||
stage plays it
|
||||
|
||||
Scenario: TL13b. Measured, as 0.1.4's were
|
||||
Then each number above has a harness and a before and after in this file, in a headless window
|
||||
# 11-13, raea-feed e2e/timeline-perf.spec.ts (PERF=1), headless Chrome on the M5 Pro, an item's own timeline
|
||||
# of 400 clips on 12 tracks, three runs:
|
||||
# a pick drawn 9, 10, 13 ms (the bar: 50 ms)
|
||||
# a split drawn 24, 26, 27 ms (the bar: 100 ms; 12 clips cut at once)
|
||||
# a 2 s drag 63 to 65 frames a second; a frame's median 14.2 to 14.8 ms, its 95th centile 27 ms,
|
||||
# its worst 34 to 49 ms: one frame in twenty is a frame late
|
||||
# The same in a headless raea window (blitz/pw-run.mjs, RAEA_PAGE_FPS=120), after each clip's and each
|
||||
# track's drawing was kept while nothing it shows changes (Chrome's drag went to 68 to 71 frames a second):
|
||||
# a pick drawn 45 to 59 ms (at the bar, not under it)
|
||||
# a split drawn 59 to 64 ms
|
||||
# a 2 s drag 27 to 31 frames a second, a frame's median 31 to 36 ms: not the window's rate
|
||||
# nothing moving 63 frames a second; the pointer moving over it, 61
|
||||
# and with 48 clips in place of 400: nothing moving 106 frames a second, a drag 56, a pick 39 ms. So in the
|
||||
# window both scale with the clips on screen: what the window draws each frame (16 ms for 400 clips, 9 for
|
||||
# 48) and what a drag step adds to it (about 18 ms, 8 with 48). Keeping the clips' drawings did not move the
|
||||
# window's numbers, so the step's cost there is not React's work on the clips: it is not yet told apart
|
||||
# between the operation itself (snapping and settling 400 clips) and the window laying the moved clips out.
|
||||
# Told apart since (the measurement times a step's operation and React's commit of it): a drag step asked
|
||||
# the page what was under the pointer (document.elementFromPoint, for the track a clip is carried to), which
|
||||
# in raea's window took 7.7 ms a step (0.2 ms in Chrome). The tracks' places are now read once when a clip
|
||||
# is first carried: the operation is 0.1 ms a step, its commit 2.5 ms, and the window's drag 35 to 37 frames
|
||||
# a second (a frame's median 24 to 26 ms), with nothing moving 80. What is left is the window's: a frame
|
||||
# after any change to the page costs about twice a still one with 400 clips on screen (a clip placed by a
|
||||
# transform instead of its left edge made no difference), so the rest is the engine's layout, not the app's.
|
||||
# 11-14, told apart further (PERF_LISTENERS times the window's host calls and splits a pointermove at the
|
||||
# handler and React's commit; a copy of sdk/ui timed inside built the bundle; PERF_SAMPLE takes a macOS sample
|
||||
# of raea-page-host): of a move's 10 ms in the page, 9.5 went to finding its target, every element hit-tested
|
||||
# in JavaScript, since the clip held no capture. A clip carried over its neighbour is shown on a track with
|
||||
# room for the step, its element made again there, and the capture went with the old one (in Chrome too: a
|
||||
# release over an empty stretch of track never lifted the drag). The clip's new element takes it back now: a
|
||||
# move costs the page 2.3 ms (React's commit 1.8), every move makes a step (67 of 68, against 31 of 62), and
|
||||
# the drag still draws 33 to 35 frames a second, with nothing moving 71 to 77. The host's main thread through
|
||||
# the drag: Stylo's restyle 28%, paint 15%, the page's JavaScript 14%, layout_out 11% (each element's rect
|
||||
# with its ancestors' transforms, every frame, to send the snapshot when it changed), waiting on the render
|
||||
# world 11%. Blitz's set_attribute adds restyle_subtree() to the element and its parent (an upstream TODO)
|
||||
# on top of the snapshot Stylo already diffs, so a clip's left restyled every clip on its track;
|
||||
# RAEA_FINE_RESTYLE=1 leaves it to the snapshot's invalidation (vendor/blitz-dom, off by default), waiting on
|
||||
# a release build of raea-page-host, which the disk had no room for, to be measured and run against ui-parity.
|
||||
# The picture following an edit, 11-14 (raea-feed b7e1514, blitz/scene-timeline.sh: the feed's sample room with
|
||||
# its crate in a sequence, the playhead in the crate's span, the crate's sequence carried off it and back, in a
|
||||
# headless 960x620 window). Before, the stage showed an edit only when the file written with it opened again,
|
||||
# about 1,050 ms after the release. Now the edit goes to the stage as props as it is let go (__raeaSequences:
|
||||
# each named sequence's start and length, which a Sequence takes over its own until that file has opened),
|
||||
# and a paused stage seeks its frame again so it draws them. Captures run back to back through each edit; the
|
||||
# first with the change came back within, over 16 edits:
|
||||
# 81 to 113 ms, median 88 (each counts the capture's own read back, about 78 ms, so the change is sooner)
|
||||
# and 15 of the 16 within 100 ms. The playhead kept its frame through every reopening (one pixel, 678, in all
|
||||
# 16), where it used to jump back to frame 0 and then to its frame; a clip cut where the composition ends kept
|
||||
# the length its code says when carried back (54 frames before, 60 now). Left to the engine: a paused stage
|
||||
# doesn't draw props set on it until something steps it (Live::set_props; the app seeks to work around it),
|
||||
# and the file opened again holds the stage's thread about a second, a hitch when it is playing.
|
||||
# Not yet: RAEA_FINE_RESTYLE measured, and layout_out and paint skipping what didn't change.
|
||||
|
||||
Rule: TL14. Watch, Listen and Scene are one timeline
|
||||
Scenario: TL14a. Watch
|
||||
Then a film in the feed opens with the timeline under it: the render's own reference (frames, waveform,
|
||||
words) when it has no composition, the composition's tracks when it has, edited in place (no separate editor)
|
||||
|
||||
Scenario: TL14b. Listen
|
||||
Then a sound in the feed has the same timeline: its stems as sound tracks, notes and parts as clips where
|
||||
raea made the music, with TL8's tools
|
||||
|
||||
Scenario: TL14c. Scene
|
||||
Then a 3D scene in the feed has the same timeline: its animation clips, cameras' cuts and keyed props as
|
||||
tracks, the stage as its picture, with TL5's keys on any animatable prop
|
||||
@@ -43,6 +43,26 @@ impl EditResolve {
|
||||
let imp = named.canonicalize().map(raea_io_home::plain).unwrap_or_else(|_| named.to_path_buf());
|
||||
imp.starts_with(&self.0.work) && !imp.components().any(|c| c.as_os_str() == "node_modules")
|
||||
}
|
||||
|
||||
/// A package's import of the SDK by its names ("raea", "raea/<module>", "@raea/<package>"): the work folder's copy
|
||||
/// of that module, where the edit's own imports of it were pointed (runtime/bundle's rewrite_into: sdk/raea/src's
|
||||
/// files at motion/, a package's at <package>/ beside it), so a package and the composition share one SDK and its
|
||||
/// hooks read the Clock the engine drives. A package isn't rewritten, so its import resolved nothing from its own
|
||||
/// folder and Rolldown left `raea` an outside global: "Can't find variable: raea" before the first frame (#151)
|
||||
fn sdk_copy(&self, spec: &str) -> Option<PathBuf> {
|
||||
if !(spec == "raea" || spec.starts_with("raea/") || spec.starts_with("@raea/")) {
|
||||
return None;
|
||||
}
|
||||
// sdk/react/js's grandparent
|
||||
let sdk = self.0.js.ancestors().nth(2)?;
|
||||
let f = raea_io_home::sdk::resolve(sdk, spec)?;
|
||||
let mut parts = f.strip_prefix(sdk).ok()?.components();
|
||||
let pkg = parts.next()?.as_os_str().to_string_lossy().into_owned();
|
||||
// its src/
|
||||
parts.next()?;
|
||||
let copy = self.0.work.join(if pkg == "raea" { "motion" } else { pkg.as_str() }).join(parts.as_path());
|
||||
copy.is_file().then_some(copy)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -128,6 +148,12 @@ impl Plugin for EditResolve {
|
||||
}
|
||||
}
|
||||
}
|
||||
// a package importing the SDK: the copy the edit's own sources use (the edit's own were pointed at it already)
|
||||
if !self.from_edit(imp) {
|
||||
if let Some(f) = self.sdk_copy(spec) {
|
||||
return Ok(Some(HookResolveIdOutput::from_id(f.to_string_lossy().as_ref())));
|
||||
}
|
||||
}
|
||||
let bare = spec.starts_with('@') || spec.starts_with(|c: char| c.is_ascii_lowercase());
|
||||
if !bare || spec.starts_with("@raea/") || spec.contains(':') {
|
||||
return Ok(None);
|
||||
|
||||
@@ -212,3 +212,44 @@ fn bundles_a_composition_with_the_persons_plugins() {
|
||||
assert!(b.js.contains("EDIT_BOTH") && !b.js.contains("PLUGIN_BOTH"), "the edit's own copy first");
|
||||
let _ = std::fs::remove_dir_all(&d);
|
||||
}
|
||||
|
||||
/// A package that imports the SDK ("raea", "raea/<module>") gets the work folder's copy of it, the one the edit's own
|
||||
/// sources were pointed at, so the package's hooks read the same Clock (#151: a package in the project's node_modules
|
||||
/// importing `raea` was refused, "Can't find variable: raea", while the same file imported by a relative path drew).
|
||||
#[test]
|
||||
fn a_package_importing_the_sdk_gets_the_work_folders_copy() {
|
||||
let d = std::env::temp_dir().join(format!("raea-bundle-pkg-sdk-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&d);
|
||||
let w = |p: &str, s: &str| {
|
||||
let f = d.join(p);
|
||||
std::fs::create_dir_all(f.parent().unwrap()).unwrap();
|
||||
std::fs::write(f, s).unwrap();
|
||||
};
|
||||
// raea's home: the SDK's sources and their names, the engine's node_modules under sdk/react/js
|
||||
w("home/sdk/tsconfig.base.json", r#"{ "compilerOptions": { "paths": { "raea": ["./raea/src/prelude.ts"], "raea/clock": ["./app/src/clock.tsx"], "raea/*": ["./raea/src/*"], "@raea/app": ["./app/src/index.ts"], "@raea/app/*": ["./app/src/*"] } } }"#);
|
||||
w("home/sdk/raea/src/prelude.ts", "export const prelude = 'SDK_ORIGINAL_PRELUDE';\n");
|
||||
w("home/sdk/raea/src/easing.ts", "export const easing = 'SDK_ORIGINAL_EASING';\n");
|
||||
w("home/sdk/app/src/clock.tsx", "export const clock = 'SDK_ORIGINAL_CLOCK';\n");
|
||||
w("home/sdk/react/js/node_modules/react/package.json", r#"{ "name": "react", "main": "index.js" }"#);
|
||||
w("home/sdk/react/js/node_modules/react/index.js", "export const version = 'ENGINE_REACT';\n");
|
||||
// the work folder raea makes: the SDK copied (motion/ and app/), the edit's source copied with its imports pointed
|
||||
w("work/motion/prelude.ts", "export const prelude = 'WORK_PRELUDE';\n");
|
||||
w("work/motion/easing.ts", "export const easing = 'WORK_EASING';\n");
|
||||
w("work/app/clock.tsx", "export const clock = 'WORK_CLOCK';\n");
|
||||
w("work/src/edit.tsx", "import { prelude } from '../motion/prelude';\nimport { bar } from 'vk-parts';\n(globalThis as any).out = [prelude, bar];\n");
|
||||
w("work/entry.ts", "import './src/edit.tsx';\n");
|
||||
// the edit's own package, importing the SDK by its names
|
||||
w("edit/node_modules/vk-parts/package.json", r#"{ "name": "vk-parts", "version": "0.0.1", "main": "index.tsx", "peerDependencies": { "raea": "*" } }"#);
|
||||
w("edit/node_modules/vk-parts/index.tsx", "import { prelude } from 'raea';\nimport { clock } from 'raea/clock';\nimport { easing } from 'raea/easing';\nexport const bar = [prelude, clock, easing].join(' ');\n");
|
||||
#[cfg(unix)]
|
||||
std::os::unix::fs::symlink(d.join("home/sdk/react/js/node_modules"), d.join("work/node_modules")).unwrap();
|
||||
let edit = raea_bundle::edit::Edit { dir: d.join("edit"), js: d.join("home/sdk/react/js"), work: d.join("work") };
|
||||
let b = raea_bundle::bundle_with(&d.join("work/entry.ts"), raea_bundle::Options { edit: Some(edit), ..Default::default() }).expect("bundles");
|
||||
for want in ["WORK_PRELUDE", "WORK_CLOCK", "WORK_EASING"] {
|
||||
assert!(b.js.contains(want), "{want}: the package's SDK import is the work folder's copy: {}", b.js);
|
||||
}
|
||||
assert!(!b.js.contains("SDK_ORIGINAL"), "one SDK, the copy, not its sources: {}", b.js);
|
||||
// one copy of each module for the edit and the package alike
|
||||
assert_eq!(b.js.matches("WORK_PRELUDE").count(), 1, "{}", b.js);
|
||||
let _ = std::fs::remove_dir_all(&d);
|
||||
}
|
||||
@@ -64,7 +64,7 @@ pub fn context(project: Option<&str>) -> R<String> {
|
||||
let dir = brief_path.parent().unwrap_or(Path::new(".")).to_path_buf();
|
||||
let taste_dir = raea_app_direction::check::taste_dir();
|
||||
// a cheap doctor (file reads and git config): CONTEXT_STALE when this project or the agent's skill is from another raea
|
||||
let stale = raea_app_workspace::doctor::findings(&dir, &skill::agents(), &skill::version());
|
||||
let stale = raea_app_workspace::doctor::findings(&dir, &tools::agent_skills::agents(), &skill::version());
|
||||
let stale = match stale.first() {
|
||||
Some(f) => format!("CONTEXT_STALE raea doctor finds {} thing(s), first: {} (raea doctor --fix)\n\n", stale.len(), f.says),
|
||||
None => String::new(),
|
||||
@@ -82,7 +82,7 @@ pub fn next(args: &[String]) -> R<String> {
|
||||
let brief_path = brief_at(args.first().map(String::as_str).unwrap_or("."))?;
|
||||
let l = spec::load_brief_ts(&brief_path)?;
|
||||
let dir = brief_path.parent().unwrap_or(Path::new(".")).to_path_buf();
|
||||
let stale = raea_app_workspace::doctor::findings(&dir, &skill::agents(), &skill::version()).len();
|
||||
let stale = raea_app_workspace::doctor::findings(&dir, &tools::agent_skills::agents(), &skill::version()).len();
|
||||
Ok(raea_app_workspace::next::text(&dir, &raea_app_workspace::next::Brief { needs: l.missing, modes: l.modes }, stale))
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,10 @@ raea show [--title T] --question Q1 [--preview FILE] --choice A [--preview FILE]
|
||||
It lands in the person's feed with a notice and the window stays where they are; --open brings the window up on it
|
||||
(only when they're waiting on it).
|
||||
FILE: stills (several make a storyboard), a video, a sound, a NAME.script.ts or .md, or a .tsx (an interactive
|
||||
artifact; one of the project's compositions opens in its editor). P: the project's id, title or Workspace/project;
|
||||
else the one this folder is in. Who's showing it: --as NAME [--role ROLE] [--inbox NAME], else your harness's.
|
||||
artifact; one of the project's compositions opens in its editor). P: Workspace/id (ids as raea workspace --json
|
||||
lists them), a folder in the project, or a Copy reference from the app; a title only when it's the only one and
|
||||
this folder isn't in another project. Else the one this folder is in. Who's showing it: --as NAME [--role ROLE]
|
||||
[--inbox NAME], else your harness's.
|
||||
raea show --on ITEM --working ID... [--ask TEXT]... [--status S [--states S1,S2...]] | --done ID... [--note LINE] [--sub NAME]
|
||||
raea show --on ITEM --working ID --sign N --clip FILE --render HASH
|
||||
raea show FILE... --replaces ITEM --done ID...
|
||||
|
||||
+10
-34
@@ -4,32 +4,12 @@
|
||||
//! `raea --version` the agent reads `raea skill` instead.
|
||||
use super::*;
|
||||
|
||||
pub const USAGE: &str = "raea skill [NAME] [--reference cli|feed|files|sdk] | raea skills install --agent claude|codex|kimi|gemini [--pin MOVE]... [--no-mcp] [--no-hooks] (the agent skill this raea ships, for its version, which raea --version prints: an agent whose copy names another version reads this; install puts raea's skills where that agent reads skills, adds the blender MCP server unless --no-mcp, makes each --pin MOVE a /MOVE of its own, and adds raea's hooks to that agent unless --no-hooks (raea hook AGENT: media opened in the Mac's viewer goes to raea show, and the quick check after a composition is saved); a skill folder that's a link is left as it is)";
|
||||
|
||||
/// Where each agent reads a person's skills, one folder per skill holding SKILL.md. Checked by hand on 11-05:
|
||||
/// claude: ~/.claude/skills (Claude Code's docs); codex: ~/.agents/skills (developers.openai.com/codex/skills, the user
|
||||
/// scope; older builds read ~/.codex/skills); kimi: $KIMI_CODE_HOME/skills, else ~/.kimi-code/skills (kimi 2.3.3's own
|
||||
/// binary; it also reads ~/.agents/skills and ~/.claude/skills); gemini: ~/.gemini/skills (geminicli.com/docs/cli/skills).
|
||||
fn target(agent: &str) -> R<PathBuf> {
|
||||
let home = tools::agent_mcp::user_home()?;
|
||||
Ok(match agent {
|
||||
"claude" => home.join(".claude/skills"),
|
||||
"codex" => home.join(".agents/skills"),
|
||||
"kimi" => std::env::var_os("KIMI_CODE_HOME").filter(|v| !v.is_empty()).map(PathBuf::from).unwrap_or_else(|| home.join(".kimi-code")).join("skills"),
|
||||
"gemini" => home.join(".gemini/skills"),
|
||||
a => return Err(format!("no agent {a:?}: claude, codex, kimi or gemini")),
|
||||
})
|
||||
}
|
||||
|
||||
/// Each agent and the folder it reads skills from, for `raea doctor` (an agent with no folder is skipped).
|
||||
pub fn agents() -> Vec<(&'static str, PathBuf)> {
|
||||
["claude", "codex", "kimi", "gemini"].into_iter().filter_map(|a| target(a).ok().map(|t| (a, t))).collect()
|
||||
}
|
||||
pub const USAGE: &str = "raea skill [NAME] [--reference cli|feed|files|sdk] | raea skills install --agent claude|codex|kimi|gemini|grokbot [--pin MOVE]... [--no-mcp] [--no-hooks] (the agent skill this raea ships, for its version, which raea --version prints: an agent whose copy names another version reads this; install puts raea's skills where that agent reads skills, adds the blender MCP server unless --no-mcp, makes each --pin MOVE a /MOVE of its own, and adds raea's hooks to that agent unless --no-hooks (raea hook AGENT: media opened in the Mac's viewer goes to raea show, and the quick check after a composition is saved); a skill folder that's a link is left as it is; grokbot, the Grok Bot app, keeps its skills on its own computer, so its copy is staged on this Mac (RAEA_GROKBOT_HOME moves it) with the grokbot:// links that finish it in Grok Bot, and gets no hooks or MCP server)";
|
||||
|
||||
/// `raea doctor [--fix] [DIR]` (SK10): what doesn't match this raea, an agent's skill reinstalled by --fix.
|
||||
pub fn doctor(args: &[String]) -> R<String> {
|
||||
let again = |agent: &str| install(&["install".into(), "--agent".into(), agent.into(), "--no-mcp".into()]);
|
||||
raea_app_workspace::doctor::doctor(args, &agents(), &version(), &again)
|
||||
raea_app_workspace::doctor::doctor(args, &tools::agent_skills::agents(), &version(), &again)
|
||||
}
|
||||
|
||||
/// This raea's version: the release's (share/raea/VERSION), or the crate's for a build from a checkout.
|
||||
@@ -102,14 +82,14 @@ fn copy(from: &Path, to: &Path) -> R<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// `raea skills install --agent claude|codex|kimi|gemini`: raea's skills, stamped with this version, where that agent
|
||||
/// reads them; each replaces the copy that was there, but a link (a checkout of raea-skills) is the person's to keep.
|
||||
/// `raea skills install --agent claude|codex|kimi|gemini|grokbot`: raea's skills, stamped with this version, where that
|
||||
/// agent reads them; each replaces the copy that was there, but a link (a checkout of raea-skills) is the person's to keep.
|
||||
pub fn install(args: &[String]) -> R<String> {
|
||||
if args.first().map(String::as_str) != Some("install") {
|
||||
return Err(format!("usage: {USAGE}"));
|
||||
}
|
||||
let agent = args.iter().position(|a| a == "--agent").and_then(|i| args.get(i + 1)).ok_or("which agent: --agent claude|codex|kimi|gemini")?;
|
||||
let to = target(agent)?;
|
||||
let agent = args.iter().position(|a| a == "--agent").and_then(|i| args.get(i + 1)).ok_or("which agent: --agent claude|codex|kimi|gemini|grokbot")?;
|
||||
let to = tools::agent_skills::folder(agent)?;
|
||||
let (from, v) = (shipped()?, version());
|
||||
let mut out = String::new();
|
||||
for name in installed_names()? {
|
||||
@@ -133,6 +113,8 @@ pub fn install(args: &[String]) -> R<String> {
|
||||
out += &tools::agent_mcp::pin(&to, m, &v)?;
|
||||
}
|
||||
}
|
||||
// Grok Bot (SK13): no hooks or MCP server; its copy gets a preface and the links that finish it (agent_grokbot.rs)
|
||||
if agent == "grokbot" { return tools::agent_grokbot::stage(&to, out); }
|
||||
// every agent's hooks (A5d, SK10), in its own config: --no-hooks leaves it alone
|
||||
if !args.iter().any(|a| a == "--no-hooks") { out += &tools::agent_hooks::install(agent)?; }
|
||||
// the MCP servers raea offers (SK11): blender, for a running Blender; --no-mcp leaves the agent's servers alone
|
||||
@@ -162,13 +144,7 @@ mod tests {
|
||||
assert!(skill(&["raea-bevy".into()]).unwrap_err().contains("3d.md") && installed_names().unwrap() == ["raea"]);
|
||||
assert!(skill(&["../x".into()]).is_err());
|
||||
assert!(skill(&["--reference".into(), "../../x".into()]).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn install_targets_each_agents_folder() {
|
||||
assert!(target("claude").unwrap().ends_with(".claude/skills"));
|
||||
assert!(target("codex").unwrap().ends_with(".agents/skills"));
|
||||
assert!(target("gemini").unwrap().ends_with(".gemini/skills"));
|
||||
assert!(target("cursor").is_err());
|
||||
// Grok Bot's Add new skill takes a file of at most 256 KB: the shipped SKILL.md with its preface fits
|
||||
assert!(tools::agent_grokbot::with_preface(&core, Path::new("/h")).len() < tools::agent_grokbot::MAX_SKILL);
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,8 @@ image = { version = "0.25", default-features = false, features = ["png"] }
|
||||
serde_json = "1"
|
||||
# the live stage: <img data-raea-stage> (raea-page-stage)
|
||||
raea-page-stage = { path = "../stage" }
|
||||
# a page's interaction sounds: sound.fire (raea-page-sound, docs/hardware.feature HW0)
|
||||
raea-page-sound = { path = "../sound" }
|
||||
# Rune layers in the page: what's under a data-raea-renderer="rune" element drawn by Rune on this device (T6c)
|
||||
raea-rune-slots = { path = "../../rune/slots" }
|
||||
# the window build turns bevy_winit on for every Bevy app in the process; the stage's engine is told to leave it out (main.rs)
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
//! it, bevy_ui's kinds. --root: where the page's own-origin fetches are read from (RAEA_PAGE_ROOT). --size: the
|
||||
//! window, default 1440x900. RAEA_PAGE_BRP_PORT (default: a free one), RAEA_PAGE_MCP_PORT (default 7477; 0: none),
|
||||
//! RAEA_PAGE_PICK=0: the page's pointers and keys dispatched by the host (page::input) instead of through raea-page's
|
||||
//! picking route, the default. The page's `<img data-raea-stage>` plays a composition live (raea-page-stage).
|
||||
//! picking route, the default. RAEA_FINE_RESTYLE=0: an attribute change restyles its element's parent's whole subtree
|
||||
//! (Blitz's own way; the host's default is the fine restyle, docs/timeline.feature TL13a). The page's
|
||||
//! `<img data-raea-stage>` plays a composition live (raea-page-stage).
|
||||
//! --chrome inset: the page under a transparent title bar, its title area moving the window (raea-page-window).
|
||||
//! --window (built with the `window` feature): on screen, a window of its own that closes the app (raea's desktop app;
|
||||
//! RAEA_PAGE_HOST sends the page's /host/* to the feed's host: raea-page-net).
|
||||
@@ -63,6 +65,14 @@ fn main() {
|
||||
eprintln!("raea-page-host: {e}");
|
||||
std::process::exit(2);
|
||||
});
|
||||
// a page's attribute set or cleared restyles what Stylo's invalidation finds, and each ancestor itself, not the
|
||||
// element's parent's whole subtree (vendor/blitz-dom mutator.rs): ui-parity's 271 cases come out the same case by
|
||||
// case, and a 400-clip timeline drag in raea feed's window went from 38-41 to 48-50 frames a second
|
||||
// (docs/timeline.feature TL13a). RAEA_FINE_RESTYLE=0 restyles the parent's whole subtree, as before. Set here,
|
||||
// before any thread starts, as --root's RAEA_PAGE_ROOT is.
|
||||
if std::env::var_os("RAEA_FINE_RESTYLE").is_none() {
|
||||
unsafe { std::env::set_var("RAEA_FINE_RESTYLE", "1") }
|
||||
}
|
||||
// headless (the benches, raea app check): the system's clipboard, files, dialogs and browser stay untouched (T2d)
|
||||
if !a.window {
|
||||
raea_io_os::set_headless();
|
||||
@@ -97,11 +107,16 @@ fn main() {
|
||||
);
|
||||
// on screen, bevy_winit's event loop is the runner (a ScheduleRunner here replaced it: no window, 11-04)
|
||||
if !a.window && !app.is_plugin_added::<ScheduleRunnerPlugin>() {
|
||||
app.add_plugins(ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(1.0 / 60.0)));
|
||||
// 60 frames a second, as most screens; RAEA_PAGE_FPS stands in for another screen's rate (a 120 Hz one, to
|
||||
// measure how a 60 fps video plays where the window draws twice a frame)
|
||||
let fps = std::env::var("RAEA_PAGE_FPS").ok().and_then(|v| v.parse::<f64>().ok()).filter(|f| (1.0..=480.0).contains(f)).unwrap_or(60.0);
|
||||
app.add_plugins(ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(1.0 / fps)));
|
||||
}
|
||||
app.add_plugins(HostPlugin { size: a.size, double_click: Duration::from_millis(500), picking })
|
||||
.add_plugins(brp::plugins(brp::port(), |r| r))
|
||||
.add_plugins(stage::StagePlugin)
|
||||
// a page's interaction sounds, fired on a mixer of its own (docs/hardware.feature HW0)
|
||||
.add_plugins(raea_page_sound::PageSoundPlugin)
|
||||
// the clipboard, links, notifications, the dock badge, raea:// links and the chrome (raea-page-window)
|
||||
.add_plugins(raea_page_window::DesktopPlugin { chrome: a.chrome, live: a.window });
|
||||
raea_page_host::page_plugins(&mut app, picking);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "raea-page-sound"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
license = "FSL-1.1-ALv2"
|
||||
publish = false
|
||||
description = "A page's interaction sounds: the sound.fire host call, raea/tone events played now on a mixer of the page's own (docs/hardware.feature HW0)"
|
||||
|
||||
[dependencies]
|
||||
bevy = { version = "=0.20.0", default-features = false, features = ["std"] }
|
||||
raea-runtime-js = { path = "../../../runtime/js" }
|
||||
raea-sys-mix = { path = "../../../systems/mix" }
|
||||
serde_json = "1"
|
||||
@@ -0,0 +1,111 @@
|
||||
//! A page's interaction sounds (docs/hardware.feature HW0): raea/tone events a page fires, played now on a mixer of
|
||||
//! the page's own, the same mixer core (Firewheel) a render bounces and the stage plays. raea's window has no Web Audio
|
||||
//! graph (sdk/ui/src/platform/audio.ts), so this is how a page in it is heard:
|
||||
//!
|
||||
//! sound.fire {graph?: string, evs: [..]} -> null
|
||||
//! sound.report {} -> {fired, late}
|
||||
//!
|
||||
//! `graph` is raea/tone's graph JSON (as `<audio data-tone-graph>` holds it), sent when it changed; `evs` are its events,
|
||||
//! each at its own time ("t", seconds) after now. The call answers at once; the mixer runs on a thread of its own,
|
||||
//! opens the device on the first fire and stops its stream after IDLE with nothing fired (the stage's rest).
|
||||
|
||||
use std::sync::mpsc::{Receiver, RecvTimeoutError, Sender, channel};
|
||||
use std::sync::{Mutex, OnceLock};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use bevy::prelude::*;
|
||||
use raea_runtime_js::calls::HostCalls;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
/// How long the mixer runs with nothing fired before its stream stops.
|
||||
const IDLE: Duration = Duration::from_secs(10);
|
||||
|
||||
enum Msg {
|
||||
Fire(Option<String>, Vec<Value>),
|
||||
Report(Sender<Value>),
|
||||
}
|
||||
|
||||
/// The mixer's thread, started by the first call.
|
||||
fn mixer() -> &'static Mutex<Sender<Msg>> {
|
||||
static TX: OnceLock<Mutex<Sender<Msg>>> = OnceLock::new();
|
||||
TX.get_or_init(|| {
|
||||
let (tx, rx) = channel();
|
||||
let _ = std::thread::Builder::new().name("raea page sound".into()).spawn(move || run(rx));
|
||||
Mutex::new(tx)
|
||||
})
|
||||
}
|
||||
|
||||
fn run(rx: Receiver<Msg>) {
|
||||
let mut live: Option<raea_sys_mix::live::Live> = None;
|
||||
let mut failed = false;
|
||||
let (mut fired, mut last) = (0u64, Instant::now());
|
||||
loop {
|
||||
match rx.recv_timeout(Duration::from_millis(100)) {
|
||||
Ok(Msg::Fire(graph, evs)) => {
|
||||
if live.is_none() && !failed {
|
||||
match raea_sys_mix::live::Live::open() {
|
||||
Ok(l) => live = Some(l),
|
||||
Err(e) => {
|
||||
failed = true;
|
||||
eprintln!("raea page sound: no output device, the page's sounds stay silent ({e})");
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(l) = live.as_mut() {
|
||||
l.fire(graph.as_deref(), &evs);
|
||||
fired += 1;
|
||||
last = Instant::now();
|
||||
}
|
||||
}
|
||||
Ok(Msg::Report(back)) => {
|
||||
let late = live.as_ref().map_or(0, |l| l.late_events());
|
||||
let _ = back.send(json!({ "fired": fired, "late": late }));
|
||||
}
|
||||
Err(RecvTimeoutError::Timeout) => {
|
||||
if let Some(l) = live.as_mut() {
|
||||
l.tend();
|
||||
if last.elapsed() > IDLE {
|
||||
l.rest();
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(RecvTimeoutError::Disconnected) => return,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn send(m: Msg) -> Result<(), String> {
|
||||
mixer().lock().map_err(|_| "the page's mixer stopped".to_string())?.send(m).map_err(|_| "the page's mixer stopped".to_string())
|
||||
}
|
||||
|
||||
/// The calls, onto the page's HostCalls.
|
||||
fn calls(mut calls: ResMut<HostCalls>) {
|
||||
calls
|
||||
.on("sound.fire", |_w, a, answer| {
|
||||
let graph = a.get("graph").and_then(Value::as_str).map(str::to_string);
|
||||
let evs = a.get("evs").and_then(Value::as_array).cloned().unwrap_or_default();
|
||||
match send(Msg::Fire(graph, evs)) {
|
||||
Ok(()) => answer.ok(Value::Null),
|
||||
Err(e) => answer.err(e),
|
||||
}
|
||||
})
|
||||
.on("sound.report", |_w, _a, answer| {
|
||||
let (tx, rx) = channel();
|
||||
if let Err(e) = send(Msg::Report(tx)) {
|
||||
return answer.err(e);
|
||||
}
|
||||
std::thread::spawn(move || match rx.recv_timeout(Duration::from_secs(2)) {
|
||||
Ok(v) => answer.ok(v),
|
||||
Err(_) => answer.err("the page's mixer didn't answer"),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/// The page's sound calls (HW0a).
|
||||
pub struct PageSoundPlugin;
|
||||
|
||||
impl Plugin for PageSoundPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.init_resource::<HostCalls>().add_systems(Startup, calls);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,21 @@ pub(super) fn settle(answer: raea_runtime_js::calls::Answer, r: Result<Value, St
|
||||
}
|
||||
}
|
||||
|
||||
/// A call for the stage's thread to answer; `idle` is the answer while the stage shows nothing.
|
||||
fn ask(w: &World, answer: raea_runtime_js::calls::Answer, idle: Value, cmd: impl FnOnce(raea_runtime_js::calls::Answer) -> Cmd) {
|
||||
let tx = w.resource::<Stage>().tx.lock().unwrap().clone();
|
||||
if let Some(tx) = tx {
|
||||
let _ = tx.send(cmd(answer));
|
||||
return;
|
||||
}
|
||||
answer.ok(idle)
|
||||
}
|
||||
|
||||
/// An argument that is exactly N numbers.
|
||||
fn numbers<const N: usize>(a: &Value, k: &str) -> Option<[f32; N]> {
|
||||
serde_json::from_value::<Vec<f32>>(a.get(k)?.clone()).ok()?.try_into().ok()
|
||||
}
|
||||
|
||||
/// The page's host calls (the module's list).
|
||||
pub(super) fn calls(mut calls: ResMut<HostCalls>) {
|
||||
let num = |a: &Value, k: &str| a.get(k).and_then(Value::as_f64);
|
||||
@@ -86,6 +101,20 @@ pub(super) fn calls(mut calls: ResMut<HostCalls>) {
|
||||
None => answer.err("the stage shows nothing"),
|
||||
}
|
||||
})
|
||||
.on("stage.part", move |w, a, answer| ask(w, answer, Value::Null, |to| Cmd::Part(a["key"].as_str().unwrap_or_default().to_string(), to)))
|
||||
.on("stage.hold", move |w, a, answer| {
|
||||
let place = match (a["release"] == true, numbers(&a, "translation"), numbers(&a, "rotation"), numbers(&a, "scale")) {
|
||||
(true, ..) => None,
|
||||
(_, Some(t), Some(r), Some(s)) => Some((t, r, s)),
|
||||
_ => return answer.err("stage.hold takes a key with translation [x, y, z], rotation [x, y, z, w] and scale [x, y, z], or release: true"),
|
||||
};
|
||||
let key = a.get("key").and_then(Value::as_str).unwrap_or_default().to_string();
|
||||
ask(w, answer, json!(false), |to| Cmd::Hold(key, place, to))
|
||||
})
|
||||
.on("stage.wire", move |w, a, answer| {
|
||||
let on = a.get("on").and_then(Value::as_bool).unwrap_or(true);
|
||||
ask(w, answer, json!(false), |to| Cmd::Wire(on, to))
|
||||
})
|
||||
.on("stage.inspect", move |w, a, answer| {
|
||||
let id = a.get("id").and_then(Value::as_u64).unwrap_or(0);
|
||||
let tx = w.resource::<Stage>().tx.lock().unwrap().clone();
|
||||
|
||||
@@ -24,6 +24,13 @@
|
||||
//! note's pin follow what they are on)
|
||||
//! stage.props {props} the composition's props set over its defaults as it plays (PV4b): the frame it is on is
|
||||
//! drawn again with them; nothing is reopened or written
|
||||
//! stage.part {key} the part that key names as it stands now ({entity_key, placed}), or null
|
||||
//! (docs/scene-feed.feature SF4c); a pick's part carries the same `placed`: {local,
|
||||
//! world: {translation, rotation [x, y, z, w], scale}, parent: 16 numbers | null}
|
||||
//! stage.hold {key, translation, rotation, scale} | {key, release: true}
|
||||
//! that part drawn at a place in its parent's space until it is let go of: a drag
|
||||
//! as it looks while it is dragged; nothing is written
|
||||
//! stage.wire {on} every mesh drawn as its edges over its shading (SF3e); answers whether it can
|
||||
//! stage.inspect {id} that element as it is now (its owner, kind, box, props, text), or null once it's gone
|
||||
//! stage.tweak {changes} [{owner, kind, prop, value}]: the props written into the composition as its next
|
||||
//! version (raea-sys-tweak), which the stage then shows at the same frame, its input replayed
|
||||
@@ -69,6 +76,12 @@ enum Cmd {
|
||||
Locate(Vec<String>, Vec<[f32; 3]>, Answer),
|
||||
/// props over the composition's defaults, from now
|
||||
Props(Value, Answer),
|
||||
/// a part by its key, as it stands now
|
||||
Part(String, Answer),
|
||||
/// a part held at a place in its parent's space (None: let go of)
|
||||
Hold(String, Option<([f32; 3], [f32; 4], [f32; 3])>, Answer),
|
||||
/// the scene as wireframe, or as it is
|
||||
Wire(bool, Answer),
|
||||
/// an element as it is now, by id
|
||||
Inspect(u64, Answer),
|
||||
/// props written into the next version, which then plays from the same frame
|
||||
@@ -144,6 +157,8 @@ impl Plugin for StagePlugin {
|
||||
// SAFETY: the app is being built on its main thread; the stage's thread starts at the first show
|
||||
unsafe { std::env::set_var("RAEA_SOURCE_STAMPS", "1") };
|
||||
}
|
||||
// the stage's scenes can be drawn as wireframe (docs/scene-feed.feature SF3e): asked for before any opens
|
||||
raea_runtime_live::want_wire();
|
||||
app.insert_resource(stage)
|
||||
.init_resource::<HostCalls>()
|
||||
.add_plugins(ExtractResourcePlugin::<Stage>::default())
|
||||
@@ -214,6 +229,8 @@ fn run(rx: Receiver<Cmd>, status: Arc<Mutex<Status>>, slot: Arc<Mutex<Painted>>)
|
||||
};
|
||||
// paused: the frames asked for and not yet stepped (at most 4 a turn, as playing)
|
||||
let mut steps = 0i64;
|
||||
// the scene shown as wireframe (stage.wire), and a file just opened that hasn't taken it yet
|
||||
let (mut wire, mut rewire) = (false, false);
|
||||
// RAEA_STAGE_TRACE=1: each frame stepped and its keys, on stderr
|
||||
let trace = std::env::var("RAEA_STAGE_TRACE").as_deref() == Ok("1");
|
||||
// the stage's size, which the page's points are in
|
||||
@@ -256,6 +273,7 @@ fn run(rx: Receiver<Cmd>, status: Arc<Mutex<Status>>, slot: Arc<Mutex<Painted>>)
|
||||
Ok(l) => {
|
||||
status.lock().unwrap().fps = l.fps;
|
||||
live = Some(l);
|
||||
rewire = wire;
|
||||
}
|
||||
Err(e) => set_error(e),
|
||||
}
|
||||
@@ -328,6 +346,18 @@ fn run(rx: Receiver<Cmd>, status: Arc<Mutex<Status>>, slot: Arc<Mutex<Painted>>)
|
||||
}
|
||||
None => answer.ok(Value::Null),
|
||||
},
|
||||
Some(Cmd::Part(key, answer)) => answer.ok(live.as_mut().and_then(|l| l.part(&key)).unwrap_or(Value::Null)),
|
||||
Some(Cmd::Hold(key, to, answer)) => {
|
||||
let held = live.as_mut().is_some_and(|l| l.hold(&key, to));
|
||||
repaint |= held;
|
||||
answer.ok(json!(held));
|
||||
}
|
||||
Some(Cmd::Wire(on, answer)) => {
|
||||
wire = on;
|
||||
let can = live.as_mut().is_some_and(|l| l.wire(on));
|
||||
repaint |= can;
|
||||
answer.ok(json!(can));
|
||||
}
|
||||
Some(Cmd::Inspect(id, answer)) => match live.as_mut() {
|
||||
Some(l) => answer.ok(l.element(id).map(|e| on_stage(e, l, stage)).unwrap_or(Value::Null)),
|
||||
None => answer.ok(Value::Null),
|
||||
@@ -352,6 +382,12 @@ fn run(rx: Receiver<Cmd>, status: Arc<Mutex<Status>>, slot: Arc<Mutex<Painted>>)
|
||||
None => {}
|
||||
}
|
||||
let Some(l) = live.as_mut() else { continue };
|
||||
// a file opened again while the scene was shown as wireframe: its 3D is made on a thread, so it is asked each
|
||||
// turn until it is there to take it
|
||||
if rewire && l.wire(true) {
|
||||
rewire = false;
|
||||
repaint = true;
|
||||
}
|
||||
let due = if playing { base + (since.elapsed().as_secs_f64() * l.fps) as i64 } else { frame + steps };
|
||||
let mut stepped = 0;
|
||||
while frame < due && stepped < 4 {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//! notify.permission -> bool macOS's prompt, or its answer if already given
|
||||
//! dock.badge {text} the Dock icon's badge, on Windows the taskbar button's overlay ("" clears it)
|
||||
//! app.urls -> string[] raea:// links opened since the last ask, the app brought to the front for each
|
||||
//! app.drops -> {over, dropped} files dragged from the Finder: whether some are over the window, the paths dropped since the last ask
|
||||
//! native.log -> {...} what was done, for tests
|
||||
//!
|
||||
//! Live only on screen (--window) and without RAEA_NO_OPEN=1: otherwise every call is recorded and answered as if done,
|
||||
@@ -39,6 +40,8 @@ struct Log {
|
||||
static LOG: Mutex<Option<Log>> = Mutex::new(None);
|
||||
/// raea:// links that arrived and the page hasn't read yet (filled by the Apple event handler, on the main thread).
|
||||
static URLS: Mutex<Vec<String>> = Mutex::new(Vec::new());
|
||||
/// Files dragged onto the window: whether some are over it now, and the paths dropped the page hasn't read yet (drops).
|
||||
static DROPS: Mutex<(bool, Vec<String>)> = Mutex::new((false, Vec::new()));
|
||||
|
||||
fn log<T>(f: impl FnOnce(&mut Log) -> T) -> T {
|
||||
f(LOG.lock().unwrap().get_or_insert_with(Log::default))
|
||||
@@ -58,12 +61,12 @@ pub struct NativePlugin {
|
||||
impl Plugin for NativePlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
let live = self.live && std::env::var("RAEA_NO_OPEN").as_deref() != Ok("1");
|
||||
app.insert_resource(Live(live)).init_resource::<Queue>().init_resource::<HostCalls>().add_systems(Startup, (calls, start)).add_systems(Update, drain);
|
||||
app.insert_resource(Live(live)).init_resource::<Queue>().init_resource::<HostCalls>().add_systems(Startup, (calls, start)).add_systems(Update, (drops, drain).chain());
|
||||
}
|
||||
}
|
||||
|
||||
fn calls(mut calls: ResMut<HostCalls>) {
|
||||
for name in ["clipboard.write", "clipboard.read", "app.open", "notify", "notify.permission", "dock.badge", "app.urls", "native.log"] {
|
||||
for name in ["clipboard.write", "clipboard.read", "app.open", "notify", "notify.permission", "dock.badge", "app.urls", "app.drops", "native.log"] {
|
||||
calls.on(name, move |w, args, answer| w.resource::<Queue>().0.lock().unwrap().push(Job(name.to_string(), args, answer)));
|
||||
}
|
||||
}
|
||||
@@ -75,6 +78,23 @@ fn start(live: Res<Live>, _main: NonSendMarker) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Bevy's drag-and-drop messages (winit's), kept for app.drops: live or not, a file dropped on the window is the
|
||||
/// person's own act, never something a call does to them.
|
||||
fn drops(mut evs: MessageReader<bevy::window::FileDragAndDrop>) {
|
||||
use bevy::window::FileDragAndDrop as D;
|
||||
for e in evs.read() {
|
||||
let mut d = DROPS.lock().unwrap();
|
||||
match e {
|
||||
D::HoveredFile { .. } => d.0 = true,
|
||||
D::HoveredFileCanceled { .. } => d.0 = false,
|
||||
D::DroppedFile { path_buf, .. } => {
|
||||
d.0 = false;
|
||||
d.1.push(path_buf.to_string_lossy().into_owned());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn drain(world: &mut World) {
|
||||
let jobs = std::mem::take(&mut *world.resource::<Queue>().0.lock().unwrap());
|
||||
if jobs.is_empty() {
|
||||
@@ -150,6 +170,11 @@ fn run(live: bool, name: &str, a: &Value, answer: Answer) {
|
||||
log(|l| l.urls.extend(urls.iter().cloned()));
|
||||
answer.ok(json!(urls))
|
||||
}
|
||||
"app.drops" => {
|
||||
let mut d = DROPS.lock().unwrap();
|
||||
let dropped = std::mem::take(&mut d.1);
|
||||
answer.ok(json!({"over": d.0, "dropped": dropped}))
|
||||
}
|
||||
"native.log" => answer.ok(log(|l| json!({"live": live, "clipboard": l.clipboard, "opened": l.opened, "notified": l.notified, "badge": l.badge, "urls": l.urls}))),
|
||||
_ => answer.err(format!("no native call {name}")),
|
||||
}
|
||||
@@ -379,3 +404,30 @@ mod tests {
|
||||
assert!(e.contains("raea.app"), "{e}");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod drop_tests {
|
||||
use super::{DROPS, drops};
|
||||
use bevy::prelude::*;
|
||||
use bevy::window::FileDragAndDrop as D;
|
||||
|
||||
/// What app.drops answers: files over the window while they're dragged, then the paths once, as they're dropped.
|
||||
#[test]
|
||||
fn a_finder_drag_says_over_then_hands_its_paths_once() {
|
||||
let mut app = App::new();
|
||||
app.add_message::<D>().add_systems(Update, drops);
|
||||
let window = Entity::PLACEHOLDER;
|
||||
app.world_mut().write_message(D::HoveredFile { window, path_buf: "/tmp/a.mov".into() });
|
||||
app.update();
|
||||
assert!(DROPS.lock().unwrap().0, "over while dragged");
|
||||
app.world_mut().write_message(D::HoveredFileCanceled { window });
|
||||
app.update();
|
||||
assert!(!DROPS.lock().unwrap().0, "not over once it leaves");
|
||||
app.world_mut().write_message(D::DroppedFile { window, path_buf: "/tmp/a.mov".into() });
|
||||
app.world_mut().write_message(D::DroppedFile { window, path_buf: "/tmp/b c.png".into() });
|
||||
app.update();
|
||||
let mut d = DROPS.lock().unwrap();
|
||||
assert!(!d.0);
|
||||
assert_eq!(std::mem::take(&mut d.1), vec!["/tmp/a.mov".to_string(), "/tmp/b c.png".to_string()]);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ description = "raea's render engine: an edit's rows drawn by Bevy (3D) or the di
|
||||
[dependencies]
|
||||
# a frame's rows as the passes read them (FrameRows, the edit, the clock, row helpers, bevy_api)
|
||||
raea-sys-frame = { path = "../../systems/frame" }
|
||||
# a part held where a hand has it, and wireframe (the app's scene inspector)
|
||||
raea-sys-hold = { path = "../../systems/hold" }
|
||||
# the passes, each a crate of its own (systems/)
|
||||
raea-sys-splat = { path = "../../systems/splat" }
|
||||
raea-sys-sprite = { path = "../../systems/sprite" }
|
||||
|
||||
@@ -45,7 +45,7 @@ fn meshes(
|
||||
q: Query<(Entity, &Mesh3d, &MeshMaterial3d<StandardMaterial>, Has<bevy::mesh::skinning::SkinnedMesh>, Has<bevy::mesh::morph::MeshMorphWeights>), Pending>,
|
||||
mats: Res<Assets<StandardMaterial>>,
|
||||
mut assets: ResMut<Assets<Mesh>>,
|
||||
mut copies: Local<HashMap<AssetId<Mesh>, Option<Handle<Mesh>>>>,
|
||||
mut copies: Local<HashMap<(AssetId<Mesh>, bool), Option<Handle<Mesh>>>>,
|
||||
mut said: Local<bool>,
|
||||
) {
|
||||
if on.is_empty() {
|
||||
@@ -73,16 +73,18 @@ fn meshes(
|
||||
}
|
||||
// each mesh's traceable form, made once: itself when it's in Solari's layout, else a copy; None when it can't
|
||||
// be traced (not triangles, no normals, or its data only on the GPU)
|
||||
let h = match copies.get(&m.0.id()) {
|
||||
// (a copy by whether its material has a normal map: only that reads the tangents)
|
||||
let mapped = mats.get(&mat.0).is_some_and(|m| m.normal_map_texture.is_some());
|
||||
let h = match copies.get(&(m.0.id(), mapped)) {
|
||||
Some(h) => h.clone(),
|
||||
None => {
|
||||
let Some(t) = assets.get(&m.0).map(traceable) else { continue };
|
||||
let Some(t) = assets.get(&m.0).map(|src| traceable(src, mapped)) else { continue };
|
||||
let h = match t {
|
||||
Some(Traceable::Same) => Some(m.0.clone()),
|
||||
Some(Traceable::Copy(mesh)) => Some(assets.add(mesh)),
|
||||
None => None,
|
||||
};
|
||||
copies.insert(m.0.id(), h.clone());
|
||||
copies.insert((m.0.id(), mapped), h.clone());
|
||||
h
|
||||
}
|
||||
};
|
||||
@@ -104,7 +106,11 @@ enum Traceable {
|
||||
Copy(Mesh),
|
||||
}
|
||||
|
||||
fn traceable(src: &Mesh) -> Option<Traceable> {
|
||||
/// `src` in Solari's layout. A mesh with no tangents of its own gets MikkTSpace's only when `mapped` (its material has
|
||||
/// a normal map: the one thing Solari reads a tangent for, scene/bindings.wesl); else any unit vector across each
|
||||
/// normal does, as the layout needs the attribute. MikkTSpace on every traced mesh was most of a ray-traced render's
|
||||
/// wait for its models (one thread, 0.36 s of a 3.8 s render of a 2.5 s shot).
|
||||
fn traceable(src: &Mesh, mapped: bool) -> Option<Traceable> {
|
||||
if src.primitive_topology() != PrimitiveTopology::TriangleList {
|
||||
return None;
|
||||
}
|
||||
@@ -133,7 +139,12 @@ fn traceable(src: &Mesh) -> Option<Traceable> {
|
||||
out.insert_indices(Indices::U32(idx));
|
||||
match src.attribute(Mesh::ATTRIBUTE_TANGENT) {
|
||||
Some(t) => out.insert_attribute(Mesh::ATTRIBUTE_TANGENT, t.clone()),
|
||||
None => out.generate_tangents().ok()?,
|
||||
None if mapped => out.generate_tangents().ok()?,
|
||||
None => {
|
||||
let VertexAttributeValues::Float32x3(normals) = out.attribute(Mesh::ATTRIBUTE_NORMAL)? else { return None };
|
||||
let across: Vec<[f32; 4]> = normals.iter().map(|n| Vec3::from(*n).any_orthonormal_vector().extend(1.0).to_array()).collect();
|
||||
out.insert_attribute(Mesh::ATTRIBUTE_TANGENT, across);
|
||||
}
|
||||
}
|
||||
Some(Traceable::Copy(out))
|
||||
}
|
||||
@@ -151,6 +162,24 @@ mod tests {
|
||||
m
|
||||
}
|
||||
|
||||
/// A mesh with no tangents and no normal map gets a unit tangent across each normal without MikkTSpace (which
|
||||
/// needs UVs' derivatives and was most of a render's wait for its models); with a normal map, MikkTSpace's.
|
||||
#[test]
|
||||
fn a_mesh_without_a_normal_map_gets_tangents_across_its_normals() {
|
||||
let tangents = |mapped| match traceable(&quad(RenderAssetUsages::default()), mapped) {
|
||||
Some(Traceable::Copy(m)) => match m.attribute(Mesh::ATTRIBUTE_TANGENT) {
|
||||
Some(VertexAttributeValues::Float32x4(t)) => t.clone(),
|
||||
_ => panic!("no tangents"),
|
||||
},
|
||||
_ => panic!("not a copy"),
|
||||
};
|
||||
for t in tangents(false) {
|
||||
let v = Vec3::new(t[0], t[1], t[2]);
|
||||
assert!((v.length() - 1.0).abs() < 1e-5 && v.dot(Vec3::Z).abs() < 1e-5 && t[3] == 1.0, "{t:?}");
|
||||
}
|
||||
assert_eq!(tangents(true).len(), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_additive_or_multiplying_surface_is_not_traced() {
|
||||
// additive dust cards traced as opaque shaded a sunlit wall; opaque, masked and blended surfaces stay traced
|
||||
@@ -163,9 +192,9 @@ mod tests {
|
||||
// raea-sys-grass's blades: RENDER_WORLD only, their data taken when Bevy extracts them (RR0's film panicked on them)
|
||||
let mut grass = quad(RenderAssetUsages::RENDER_WORLD);
|
||||
let _ = grass.take_gpu_data().expect("a fresh mesh's data can be taken");
|
||||
assert!(traceable(&grass).is_none());
|
||||
assert!(traceable(&grass, true).is_none());
|
||||
// a mesh still in the main world is copied into Solari's layout, its u16 indices widened
|
||||
match traceable(&quad(RenderAssetUsages::default())) {
|
||||
match traceable(&quad(RenderAssetUsages::default()), true) {
|
||||
Some(Traceable::Copy(m)) => assert!(matches!(m.indices(), Some(Indices::U32(v)) if v == &vec![0, 1, 2])),
|
||||
_ => panic!("a readable triangle mesh is traceable"),
|
||||
}
|
||||
|
||||
@@ -189,6 +189,7 @@ impl Engine {
|
||||
let backend = raea_io_media::backend(&media_backend())?;
|
||||
app.insert_non_send(Media { backend, decoders: HashMap::new(), dir: dir.to_path_buf() });
|
||||
}
|
||||
raea_sys_hold::install(&mut app, live); // a part held by a hand, and wireframe (docs/scene-feed.feature SF4c, SF3e)
|
||||
mem_mark("engine: plugins built (DefaultPlugins, the render device)");
|
||||
Ok(Opening { app, prog: prog.clone(), inserted: inserted.to_vec(), dir: dir.to_path_buf(), timeline, live })
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
//! VideoToolbox's BGRA as the RGBA a Frame holds.
|
||||
|
||||
/// A row of BGRA as RGBA, its alpha kept or made 255. Four bytes at a time as one word, which the compiler turns into
|
||||
/// vector code: a 4K frame took 5.5 ms a byte at a time, most of what playing one cost (RAEA_MEDIA_STATS, 11-13).
|
||||
pub(crate) fn bgra_to_rgba(src: &[u8], dst: &mut [u8], alpha: bool) {
|
||||
let opaque = if alpha { 0 } else { 0xff00_0000 };
|
||||
for (d, s) in dst.chunks_exact_mut(4).zip(src.chunks_exact(4)) {
|
||||
let v = u32::from_le_bytes([s[0], s[1], s[2], s[3]]);
|
||||
let out = (v & 0xff00_ff00) | ((v & 0xff) << 16) | ((v >> 16) & 0xff) | opaque;
|
||||
d.copy_from_slice(&out.to_le_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::bgra_to_rgba;
|
||||
|
||||
#[test]
|
||||
fn bgra_becomes_rgba_with_its_alpha_kept_or_made_opaque() {
|
||||
let src = [10, 20, 30, 40, 1, 2, 3, 0];
|
||||
let mut out = [0u8; 8];
|
||||
bgra_to_rgba(&src, &mut out, true);
|
||||
assert_eq!(out, [30, 20, 10, 40, 3, 2, 1, 0]);
|
||||
bgra_to_rgba(&src, &mut out, false);
|
||||
assert_eq!(out, [30, 20, 10, 255, 3, 2, 1, 255]);
|
||||
}
|
||||
|
||||
/// A 4K frame's worth, timed (cargo test -p raea-io-apple --release convert -- --nocapture).
|
||||
#[test]
|
||||
fn a_4k_frame_is_converted_in_a_frame_s_small_part() {
|
||||
let src: Vec<u8> = (0..3840 * 2160 * 4).map(|i| (i % 251) as u8).collect();
|
||||
let mut out = vec![0u8; src.len()];
|
||||
let t = std::time::Instant::now();
|
||||
for _ in 0..10 {
|
||||
bgra_to_rgba(&src, &mut out, false);
|
||||
}
|
||||
eprintln!("4K BGRA to RGBA: {:.2} ms a frame", t.elapsed().as_secs_f64() * 100.0);
|
||||
assert_eq!(&out[..4], &[src[2], src[1], src[0], 255]);
|
||||
}
|
||||
}
|
||||
@@ -213,13 +213,7 @@ impl Decoder {
|
||||
let mut rgba = vec![0u8; w * h * 4];
|
||||
for y in 0..h {
|
||||
let row = std::slice::from_raw_parts(base.add(y * bpr), w * 4);
|
||||
let dst = &mut rgba[y * w * 4..(y + 1) * w * 4];
|
||||
for x in 0..w {
|
||||
dst[x * 4] = row[x * 4 + 2];
|
||||
dst[x * 4 + 1] = row[x * 4 + 1];
|
||||
dst[x * 4 + 2] = row[x * 4];
|
||||
dst[x * 4 + 3] = if self.alpha { row[x * 4 + 3] } else { 255 };
|
||||
}
|
||||
crate::convert::bgra_to_rgba(row, &mut rgba[y * w * 4..(y + 1) * w * 4], self.alpha);
|
||||
}
|
||||
rgba
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#![cfg(target_vendor = "apple")]
|
||||
|
||||
mod audio;
|
||||
mod convert;
|
||||
mod decode;
|
||||
mod encode;
|
||||
mod vt;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "raea-io-gen-fit"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
license = "FSL-1.1-ALv2"
|
||||
publish = false
|
||||
description = "A generated model measured and fitted before a scene uses it: raea gen check, and every mesh.generate output of a run fitted by its step's size"
|
||||
|
||||
[dependencies]
|
||||
raea-io-gen-core = { path = "../gen-core" }
|
||||
# the measuring and fitting (raea-core-meshcheck)
|
||||
raea-core-meshcheck = { path = "../../core/meshcheck" }
|
||||
# what gen check finds, as raea's one Finding (docs/direction.feature DR3)
|
||||
raea-core-facts = { path = "../../core/facts" }
|
||||
serde_json = "1"
|
||||
@@ -10,7 +10,7 @@ use raea_core_facts::{Finding, finding};
|
||||
use raea_core_meshcheck::{Glb, Want, check, fix};
|
||||
use serde_json::{Value as J, json};
|
||||
|
||||
use crate::flow::Flow;
|
||||
use raea_io_gen_core::flow::Flow;
|
||||
|
||||
pub const USAGE: &str = "raea gen check MODEL.glb [--h METRES] [--dims W,D,H] [--turn DEG] [--faces N | --seen METRES] [--parts a,b] [--rig] [--solid] [-o FIXED.glb] [--json] (a model measured: size, pivot, facing, triangles, loose pieces, holes, textures, and the Blender script each fault needs; -o writes it fitted)";
|
||||
|
||||
+2
-4
@@ -10,10 +10,8 @@ description = "Generation flows: made.app's models at provider cost, ComfyUI wor
|
||||
raea-io-gen-comfy = { path = "../gen-comfy" }
|
||||
raea-io-gen-core = { path = "../gen-core" }
|
||||
raea-io-home = { path = "../home" }
|
||||
# a generated model measured and fitted after its step (raea gen check; fit.rs)
|
||||
raea-core-meshcheck = { path = "../../core/meshcheck" }
|
||||
# what gen check finds, as raea's one Finding (docs/direction.feature DR3)
|
||||
raea-core-facts = { path = "../../core/facts" }
|
||||
# a generated model measured and fitted after its step (raea gen check)
|
||||
raea-io-gen-fit = { path = "../gen-fit" }
|
||||
serde_json = "1"
|
||||
# image.crop, image.scale, image.stitch, run here (native.rs)
|
||||
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "webp"] }
|
||||
@@ -58,6 +58,7 @@ fn runner<'a>(args: &[String], base: &Path, local: Option<&'a dyn Local>) -> Run
|
||||
r.policy.exact = args.iter().any(|a| a == "--exact");
|
||||
r.policy.comfy_on_replicate = args.iter().any(|a| a == "--comfy-on-replicate") || crate::setting("RAEA_COMFY_ON") .as_deref() == Some("replicate");
|
||||
r.policy.tripo = !args.iter().any(|a| a == "--no-tripo") && crate::tripo::available();
|
||||
r.policy.keys = crate::route::Keys::here();
|
||||
if let Some(l) = local.filter(|_| !args.iter().any(|a| a == "--no-local")) {
|
||||
r.policy.local = l.names();
|
||||
r.local = Some(l);
|
||||
|
||||
+4
-2
@@ -1,10 +1,9 @@
|
||||
//! Generation flows run: route.rs sends each step of a flow to a backend (made.app, fal, Replicate, OpenRouter, a Modal
|
||||
//! endpoint, Fish Audio, a ComfyUI server, or a model the host runs locally) and run.rs makes them, cached by content; cli.rs is
|
||||
//! `raea gen`. The flow format and hosted backends are raea-io-gen-core, ComfyUI import and export raea-io-gen-comfy,
|
||||
//! both re-exported here under their old paths.
|
||||
//! both re-exported here under their old paths, as is fit (raea-io-gen-fit, a generated model measured and fitted).
|
||||
|
||||
pub mod cli;
|
||||
pub mod fit;
|
||||
mod hosted;
|
||||
pub mod native;
|
||||
pub mod route;
|
||||
@@ -13,6 +12,9 @@ pub mod run;
|
||||
mod tests;
|
||||
#[cfg(test)]
|
||||
mod tests_tripo;
|
||||
#[cfg(test)]
|
||||
mod tests_keys;
|
||||
|
||||
pub use raea_io_gen_comfy as comfy;
|
||||
pub use raea_io_gen_fit as fit;
|
||||
pub use raea_io_gen_core::{direct, fal, fish, flow, http, made, modal, openrouter, replicate, setting, tripo, tsflow, types};
|
||||
+53
-1
@@ -3,7 +3,8 @@
|
||||
//! Tripo 3D: through the tripo CLI on the user's own key when this host has both (tripo.rs), else the same Tripo model on fal. text.generate goes to
|
||||
//! OpenRouter (RAEA_GEN_TEXT_MODEL, else Kimi). Otherwise: a `comfy` step on the ComfyUI server; a step with ComfyUI weights on the server too when
|
||||
//! the flow asks for the exact weights (`--exact`), else made's model for that op, which is noted as standing in for
|
||||
//! them; a local model when the host has one for the op (sao for effects); made for the rest.
|
||||
//! them; a local model when the host has one for the op (sao for effects); made for the rest. A picture step on a host
|
||||
//! with no made.app key goes to fal (nano-banana-2), else OpenRouter (Gemini's image model), when it has their key.
|
||||
|
||||
use serde_json::{Map, Value as J, json};
|
||||
|
||||
@@ -86,6 +87,52 @@ pub struct Policy {
|
||||
pub comfy_on_replicate: bool,
|
||||
/// the tripo CLI and a key are on this host (tripo::available), so mesh steps run on Tripo itself
|
||||
pub tripo: bool,
|
||||
/// which picture services this host has a key for
|
||||
pub keys: Keys,
|
||||
}
|
||||
|
||||
/// The picture services this host has a key for (MADE_API_KEY, FAL_KEY, OPENROUTER_API_KEY). With no made.app key, a
|
||||
/// picture step that names no model goes to fal, then OpenRouter (the app's Images and video offers all three; Shane
|
||||
/// 11-14: "maybe add openrouter and fal as other image options"). Default: made's, as before.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Keys {
|
||||
pub made: bool,
|
||||
pub fal: bool,
|
||||
pub openrouter: bool,
|
||||
}
|
||||
|
||||
impl Default for Keys {
|
||||
fn default() -> Self {
|
||||
Keys { made: true, fal: false, openrouter: false }
|
||||
}
|
||||
}
|
||||
|
||||
impl Keys {
|
||||
/// what this host has, from the environment and raea's env file
|
||||
pub fn here() -> Keys {
|
||||
let has = |k: &str| crate::setting(k).is_some_and(|v| !v.trim().is_empty());
|
||||
Keys { made: has("MADE_API_KEY"), fal: has("FAL_KEY"), openrouter: has("OPENROUTER_API_KEY") }
|
||||
}
|
||||
}
|
||||
|
||||
/// fal's and OpenRouter's picture models, for a picture step on a host with no made.app key
|
||||
pub const FAL_IMAGE: &str = "fal-ai/nano-banana-2";
|
||||
pub const FAL_IMAGE_EDIT: &str = "fal-ai/nano-banana-2/edit";
|
||||
pub const OPENROUTER_IMAGE: &str = "google/gemini-3.1-flash-image";
|
||||
|
||||
/// A picture step where made.app has no key here: fal's nano-banana-2 (made's own default for pictures), else
|
||||
/// OpenRouter's Gemini image model; None for any other step, or with neither key.
|
||||
fn without_made(s: &Step, k: &Keys) -> Option<(Backend, Option<String>)> {
|
||||
let edit = match s.op.as_str() {
|
||||
"image.generate" => false,
|
||||
"image.edit" => true,
|
||||
_ => return None,
|
||||
};
|
||||
if k.fal {
|
||||
let e = if edit { FAL_IMAGE_EDIT } else { FAL_IMAGE };
|
||||
return Some((Backend::Fal(e.into()), Some(format!("no made.app key here: fal's {e}"))));
|
||||
}
|
||||
k.openrouter.then(|| (Backend::OpenRouter(OPENROUTER_IMAGE.into()), Some(format!("no made.app or fal key here: OpenRouter's {OPENROUTER_IMAGE}"))))
|
||||
}
|
||||
|
||||
/// Where a step runs, and a note when it stands in for something it was asked for.
|
||||
@@ -132,6 +179,11 @@ pub fn route(s: &Step, p: &Policy) -> Result<(Backend, Option<String>), String>
|
||||
if let Some(l) = local_default(s).filter(|l| p.local.iter().any(|x| x.as_str() == *l)) {
|
||||
return Ok((Backend::Local(l.into()), None));
|
||||
}
|
||||
if !p.keys.made {
|
||||
if let Some(r) = without_made(s, &p.keys) {
|
||||
return Ok(r);
|
||||
}
|
||||
}
|
||||
let m = made_default(s).ok_or(format!("nothing runs {} yet: give it a model (made:<id>, fal:<endpoint>, comfy)", s.op))?;
|
||||
Ok((Backend::Made(m.into()), None))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
//! raea gen's picture steps on a host without a made.app key: fal, then OpenRouter (route.rs Keys).
|
||||
use serde_json::json;
|
||||
|
||||
use crate::flow::Step;
|
||||
use crate::route::{Backend, Keys, Policy, route};
|
||||
|
||||
fn on(made: bool, fal: bool, openrouter: bool) -> Policy {
|
||||
Policy { keys: Keys { made, fal, openrouter }, ..Default::default() }
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pictures_go_to_fal_then_openrouter_without_a_made_key() {
|
||||
let make = Step::new("image.generate", json!({"prompt": "a lighthouse in fog"}));
|
||||
let edit = Step::new("image.edit", json!({"prompt": "make it night", "image": "https://example.com/a.png"}));
|
||||
// made's key here: made, as before (and with no keys known at all, the default)
|
||||
assert!(matches!(route(&make, &on(true, true, true)).unwrap().0, Backend::Made(_)));
|
||||
assert!(matches!(route(&make, &Policy::default()).unwrap().0, Backend::Made(_)));
|
||||
// no made key: fal's nano-banana-2, its edit endpoint for an edit, said in the note
|
||||
let (b, note) = route(&make, &on(false, true, true)).unwrap();
|
||||
assert_eq!(b, Backend::Fal("fal-ai/nano-banana-2".into()));
|
||||
assert!(note.unwrap().contains("no made.app key"));
|
||||
assert_eq!(route(&edit, &on(false, true, false)).unwrap().0, Backend::Fal("fal-ai/nano-banana-2/edit".into()));
|
||||
// no made or fal key: OpenRouter's Gemini image model, for both
|
||||
assert_eq!(route(&make, &on(false, false, true)).unwrap().0, Backend::OpenRouter("google/gemini-3.1-flash-image".into()));
|
||||
assert_eq!(route(&edit, &on(false, false, true)).unwrap().0, Backend::OpenRouter("google/gemini-3.1-flash-image".into()));
|
||||
// none of the three: made, which then asks for its key when it runs
|
||||
assert!(matches!(route(&make, &on(false, false, false)).unwrap().0, Backend::Made(_)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn only_picture_steps_and_unnamed_models_fall_back() {
|
||||
let none = on(false, true, true);
|
||||
// a video step stays on made (fal and OpenRouter take its key only when the step names them)
|
||||
let video = Step::new("video.generate", json!({"prompt": "waves"}));
|
||||
assert!(matches!(route(&video, &none).unwrap().0, Backend::Made(_)));
|
||||
// a step that names its model goes there whatever keys are here
|
||||
let mut named = Step::new("image.generate", json!({"prompt": "x"}));
|
||||
named.model = Some("made:nano_banana_2".into());
|
||||
assert_eq!(route(&named, &none).unwrap().0, Backend::Made("nano_banana_2".into()));
|
||||
}
|
||||
@@ -89,7 +89,10 @@ pub fn export_cache(tsx: &Path, js: &Path, out: &Path, args: &[String]) -> Optio
|
||||
// never a stale export)
|
||||
let text = String::from_utf8_lossy(&bundle);
|
||||
let made: std::collections::HashSet<PathBuf> = std::fs::read_to_string(root.join("outputs.list")).unwrap_or_default().lines().map(PathBuf::from).collect();
|
||||
files.retain(|p| !made.contains(&std::fs::canonicalize(p).unwrap_or_else(|_| p.clone())) || p.file_stem().is_some_and(|n| text.contains(&*n.to_string_lossy())));
|
||||
// (a file is one of them only if its name is one of theirs, or it is a link to one: only those are resolved)
|
||||
let names: std::collections::HashSet<&std::ffi::OsStr> = made.iter().filter_map(|m| m.file_name()).collect();
|
||||
let may_be_made = |p: &Path| p.file_name().is_some_and(|n| names.contains(n)) || p.symlink_metadata().is_ok_and(|m| m.file_type().is_symlink());
|
||||
files.retain(|p| !may_be_made(p) || !made.contains(&std::fs::canonicalize(p).unwrap_or_else(|_| p.clone())) || p.file_stem().is_some_and(|n| text.contains(&*n.to_string_lossy())));
|
||||
// absolute media paths the bundle names (an import from outside the edit's folder becomes its path)
|
||||
for q in text.split('"').skip(1).step_by(2) {
|
||||
if q.starts_with('/') && q.len() < 4096 && Path::new(q).extension().and_then(|x| x.to_str()).is_some_and(|x| MEDIA_EXTS.contains(&x.to_ascii_lowercase().as_str())) {
|
||||
@@ -99,6 +102,9 @@ pub fn export_cache(tsx: &Path, js: &Path, out: &Path, args: &[String]) -> Optio
|
||||
files.push(std::env::current_exe().ok().and_then(|e| std::fs::canonicalize(e).ok())?);
|
||||
files.sort();
|
||||
files.dedup();
|
||||
// the optimized copies there are, listed once: asking each media file for its own read its first and last MiB and
|
||||
// listed this folder again (2,417 files in one real project, before a render's first frame). Only a video has any
|
||||
let copies: Vec<String> = std::fs::read_dir(raea_io_media::mezz::dir()).map(|d| d.flatten().map(|e| e.file_name().to_string_lossy().into_owned()).collect()).unwrap_or_default();
|
||||
for p in &files {
|
||||
eat(p.as_os_str().as_encoded_bytes());
|
||||
match std::fs::metadata(p) {
|
||||
@@ -110,12 +116,14 @@ pub fn export_cache(tsx: &Path, js: &Path, out: &Path, args: &[String]) -> Optio
|
||||
}
|
||||
// which file its decoders read: a video's optimized copy, once complete, changes the pixels without touching
|
||||
// the source (raea_io_media::mezz)
|
||||
if MEDIA_EXTS.contains(&p.extension().and_then(|x| x.to_str()).unwrap_or("").to_ascii_lowercase().as_str()) {
|
||||
if raea_io_media::mezz::has(p) {
|
||||
let video = matches!(p.extension().and_then(|x| x.to_str()).unwrap_or("").to_ascii_lowercase().as_str(), "mp4" | "mov" | "m4v");
|
||||
if video && !copies.is_empty() && let Some(fp) = raea_io_media::mezz::fingerprint(p) {
|
||||
// its whole copy (FP.EXT) and its range copies ([email protected]): the frames inside them come from the copies
|
||||
let named = |mark: char| copies.iter().any(|n| n.strip_prefix(fp.as_str()).is_some_and(|rest| rest.starts_with(mark) && !rest.contains("partial")));
|
||||
if named('.') {
|
||||
eat(b"mezz");
|
||||
}
|
||||
// its range copies too: the frames inside them come from the copies
|
||||
for r in raea_io_media::mezz::ranges(p) {
|
||||
for r in named('@').then(|| raea_io_media::mezz::ranges(p)).unwrap_or_default() {
|
||||
eat(format!("mezz@{}-{}", r.first, r.last).as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,7 @@ pub fn bundle_fresh(tsx: &Path, out_js: &Path, o: &CompOpts, portable: Option<&P
|
||||
let work = std::env::temp_dir().join(format!("raea-cli-b{}", std::process::id()));
|
||||
remove_work(&work);
|
||||
copy_dir(&dir, &work.join("src"), 0)?;
|
||||
drop_tsconfigs(&work.join("src"), 0);
|
||||
let motion_src = raea_io_home::home().join("sdk/raea/src").canonicalize().map_err(|e| format!("raea/motion/src: {e}"))?;
|
||||
copy_dir(&motion_src, &work.join("motion"), 0)?;
|
||||
let sdks = sdks();
|
||||
|
||||
@@ -16,6 +16,25 @@ pub fn copy_dir(from: &Path, to: &Path, depth: usize) -> R<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The copy of an edit's folder without its own tsconfig.json and jsconfig.json files: the work folder's is the one a
|
||||
/// bundle resolves by. A project's own (raea writes one into every new project, for its editor) is the nearest to its
|
||||
/// sources, so the bundler read it in place of the work folder's: its `paths` name no live runtime, a played
|
||||
/// composition's `react` was the engine's React, and `raea play`, the app's stage and every still drawn by playing
|
||||
/// threw "__at is not a function" before the first frame (0.1.2; a render, which needs no such path, went through).
|
||||
pub fn drop_tsconfigs(dir: &Path, depth: usize) {
|
||||
let Ok(entries) = std::fs::read_dir(dir) else { return };
|
||||
for e in entries.flatten() {
|
||||
let p = e.path();
|
||||
if p.is_dir() {
|
||||
if depth < 6 {
|
||||
drop_tsconfigs(&p, depth + 1);
|
||||
}
|
||||
} else if matches!(e.file_name().to_str(), Some("tsconfig.json" | "jsconfig.json")) {
|
||||
let _ = std::fs::remove_file(&p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub const MEDIA_EXTS: [&str; 10] = ["mp4", "mov", "m4v", "mp3", "wav", "m4a", "png", "jpg", "webp", "gif"];
|
||||
|
||||
/// The edit's source with its imports pointed at the bundle's copy of the SDK (its package name, a subpath such as /3d,
|
||||
@@ -107,8 +126,19 @@ pub fn sources(root: &Path) -> R<Vec<PathBuf>> {
|
||||
let mut stack = vec![root.to_path_buf()];
|
||||
while let Some(d) = stack.pop() {
|
||||
for e in std::fs::read_dir(&d).map_err(|e| format!("{}: {e}", d.display()))?.flatten() {
|
||||
// what copy_dir leaves out is no source of the edit's (a project's .git and node_modules were walked whole:
|
||||
// 2 s before a render's first frame in a project of ten thousand files)
|
||||
let name = e.file_name();
|
||||
if name.to_string_lossy().starts_with('.') || name == "node_modules" || name == "target" {
|
||||
continue;
|
||||
}
|
||||
let p = e.path();
|
||||
if p.is_dir() {
|
||||
// the entry's own kind, without another stat; a link is followed
|
||||
let dir = match e.file_type() {
|
||||
Ok(t) if !t.is_symlink() => t.is_dir(),
|
||||
_ => p.is_dir(),
|
||||
};
|
||||
if dir {
|
||||
stack.push(p);
|
||||
} else if matches!(p.extension().and_then(|x| x.to_str()), Some("ts" | "tsx" | "js" | "jsx" | "mjs")) {
|
||||
out.push(p.strip_prefix(root).unwrap().to_path_buf());
|
||||
|
||||
@@ -71,3 +71,35 @@ fn outside_copies_what_the_edit_imports_beyond_its_folder() {
|
||||
assert!(e.contains("lib/c.ts") && e.contains("outside raea's home"), "{e}");
|
||||
std::fs::remove_dir_all(&t).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_project_s_own_tsconfig_is_not_in_the_work_copy() {
|
||||
// raea writes a tsconfig.json into every new project: copied with the sources, it shadowed the work folder's
|
||||
let d = std::env::temp_dir().join(format!("raea-bundle-tsconfig-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&d);
|
||||
std::fs::create_dir_all(d.join("from/components")).unwrap();
|
||||
for f in ["from/tsconfig.json", "from/components/jsconfig.json", "from/a.tsx", "from/components/data.json"] {
|
||||
std::fs::write(d.join(f), "{}").unwrap();
|
||||
}
|
||||
copy_dir(&d.join("from"), &d.join("to"), 0).unwrap();
|
||||
drop_tsconfigs(&d.join("to"), 0);
|
||||
assert!(!d.join("to/tsconfig.json").exists() && !d.join("to/components/jsconfig.json").exists());
|
||||
assert!(d.join("to/a.tsx").exists() && d.join("to/components/data.json").exists());
|
||||
// the project's own files are untouched
|
||||
assert!(d.join("from/tsconfig.json").exists());
|
||||
let _ = std::fs::remove_dir_all(&d);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_edit_s_sources_leave_out_hidden_folders_and_packages() {
|
||||
let d = std::env::temp_dir().join(format!("raea-bundle-sources-{}", std::process::id()));
|
||||
let _ = std::fs::remove_dir_all(&d);
|
||||
for f in ["a.tsx", "parts/b.ts", ".git/hooks/c.js", "node_modules/pkg/d.js", "target/e.ts", "out/f.json"] {
|
||||
std::fs::create_dir_all(d.join(f).parent().unwrap()).unwrap();
|
||||
std::fs::write(d.join(f), "").unwrap();
|
||||
}
|
||||
let mut got = sources(&d).unwrap();
|
||||
got.sort();
|
||||
assert_eq!(got, vec![PathBuf::from("a.tsx"), PathBuf::from("parts/b.ts")]);
|
||||
let _ = std::fs::remove_dir_all(&d);
|
||||
}
|
||||
+143
-10
@@ -5,15 +5,18 @@
|
||||
//! A seek is the prop `__seek` ([time, n], set by the dom layer's `currentTime`); playing is `__play` ([on, time, n,
|
||||
//! loop], set by `play()` and `pause()`), `__muted` the element's muted and `__volume` its volume. Playing, the decoder's frames come on the
|
||||
//! source's clock (its sound's: raea-runtime-js media_play.rs), each a `time` news for the element's currentTime, with
|
||||
//! `timeupdate` four times a second as a browser's, `playing` once it's going, and `ended` at its end. raea-runtime-dom's
|
||||
//! `timeupdate` four times a second as a browser's, `playing` once it's going, and `ended` at its end. A playing
|
||||
//! video's frames come ahead of their time, each with the moment it is due: at each sync (the page's own frame) the
|
||||
//! one due then is shown, so the picture keeps the page's rhythm whatever the decoder's. raea-runtime-dom's
|
||||
//! page host keeps one `Medias` and syncs it after each commit.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use blitz_dom::BaseDocument;
|
||||
use blitz_dom::node::{ImageData, RasterImageData, SpecialElementData};
|
||||
use raea_runtime_js::media_html::stream::{Cmd, Msg, Stream};
|
||||
use raea_runtime_js::media_html::stream::{Cmd, Halvings, Msg, Stream};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use raea_sys_page::ops::Nodes;
|
||||
@@ -35,6 +38,14 @@ pub struct Media {
|
||||
duration: f64,
|
||||
/// the latest frame: width, height, pixels
|
||||
frame: Option<(u32, u32, Arc<Vec<u8>>)>,
|
||||
/// what it is drawn from when it came as its size alone (its halving), until that goes to the painter with it
|
||||
halves: Halvings,
|
||||
/// how many halvings its decoder is asked to send with each frame
|
||||
halvings: u8,
|
||||
/// a playing video's frames not due yet: each its time, its picture and when to show it
|
||||
ahead: VecDeque<(f64, (u32, u32, Vec<u8>), Instant, Halvings)>,
|
||||
/// when this was last synced, and how far apart syncs have been lately (the page's frame, s)
|
||||
synced: (Option<Instant>, f64),
|
||||
/// `__play` as last seen, and whether it asks to play
|
||||
play: Option<Value>,
|
||||
playing: bool,
|
||||
@@ -42,6 +53,13 @@ pub struct Media {
|
||||
volume: Option<f64>,
|
||||
/// when the last `timeupdate` went
|
||||
told: Option<std::time::Instant>,
|
||||
/// RAEA_MEDIA_STATS=1: since when, frames shown, frames a newer one took the place of before the page drew, and
|
||||
/// the time setting the picture took (sum and max, ms)
|
||||
stats: Option<(std::time::Instant, u32, u32, f64, f64)>,
|
||||
/// RAEA_MEDIA_STATS=1: when a frame was last shown, and the longest wait between two this second (ms)
|
||||
shown_gap: (Option<std::time::Instant>, f64),
|
||||
/// RAEA_MEDIA_STATS=1, this second: the page's frames, the longest (ms), and how late frames were shown (sum, max; ms)
|
||||
paced: (u32, f64, f64, f64),
|
||||
}
|
||||
|
||||
impl Media {
|
||||
@@ -71,11 +89,12 @@ pub fn sync(doc: &mut BaseDocument, nodes: &Nodes, medias: &mut Medias, out: &mu
|
||||
Some(m) if m.src == src && m.load == load => m,
|
||||
_ => {
|
||||
let stream = (!src.is_empty()).then(|| raea_runtime_js::media_html::stream::open(&raea_sys_page::net::page_path(&src), video)).flatten();
|
||||
medias.insert(id, Media { src, load, poster: None, seek: None, stream, video, loaded: false, seeking: None, seeked: false, duration: f64::NAN, frame: None, play: None, playing: false, muted: None, volume: None, told: None });
|
||||
medias.insert(id, Media { src, load, poster: None, seek: None, stream, video, loaded: false, seeking: None, seeked: false, duration: f64::NAN, frame: None, halves: Vec::new(), halvings: 0, ahead: VecDeque::new(), synced: (None, 1.0 / 60.0), paced: (0, 0.0, 0.0, 0.0), play: None, playing: false, muted: None, volume: None, told: None, shown_gap: (None, 0.0), stats: (std::env::var("RAEA_MEDIA_STATS").as_deref() == Ok("1")).then(|| (std::time::Instant::now(), 0, 0, 0.0, 0.0)) });
|
||||
medias.get_mut(&id).unwrap()
|
||||
}
|
||||
};
|
||||
let mut redraw = false;
|
||||
let mut came = 0u32;
|
||||
if m.poster != poster {
|
||||
m.poster = poster;
|
||||
redraw = true;
|
||||
@@ -111,6 +130,7 @@ pub fn sync(doc: &mut BaseDocument, nodes: &Nodes, medias: &mut Medias, out: &mu
|
||||
st.ask(Cmd::Play { at: p.get(1).and_then(Value::as_f64).unwrap_or(0.0), looping: p.get(3).and_then(Value::as_bool).unwrap_or(false) });
|
||||
} else {
|
||||
st.ask(Cmd::Pause);
|
||||
m.ahead.clear();
|
||||
}
|
||||
}
|
||||
m.play = play;
|
||||
@@ -125,10 +145,14 @@ pub fn sync(doc: &mut BaseDocument, nodes: &Nodes, medias: &mut Medias, out: &mu
|
||||
bevy::log::warn!("raea-page: media: {err}");
|
||||
out.push(json!({"id": id, "type": "error", "message": err}));
|
||||
}
|
||||
Msg::Frame(t, f) => {
|
||||
Msg::Frame(t, f, halves) => {
|
||||
// the first frame or a seek's: shown now, and what was on its way for before the seek is not
|
||||
m.ahead.clear();
|
||||
let (w, h) = (f.width, f.height);
|
||||
m.frame = Some((w, h, Arc::new(f.rgba)));
|
||||
m.halves = halves;
|
||||
redraw = true;
|
||||
came += 1;
|
||||
if !m.loaded {
|
||||
m.loaded = true;
|
||||
out.push(json!({"id": id, "type": "loadeddata", "w": w, "h": h, "duration": m.duration}));
|
||||
@@ -142,6 +166,12 @@ pub fn sync(doc: &mut BaseDocument, nodes: &Nodes, medias: &mut Medias, out: &mu
|
||||
told(m, id, t, out);
|
||||
}
|
||||
}
|
||||
// a playing video's frame, for later; one that comes after a pause is for nothing
|
||||
Msg::Due(t, f, due, halves) => {
|
||||
if m.playing {
|
||||
m.ahead.push_back((t, (f.width, f.height, f.rgba), due, halves));
|
||||
}
|
||||
}
|
||||
Msg::Time(t) => {
|
||||
if m.landed(t) {
|
||||
out.push(json!({"id": id, "type": "seeked", "time": t}));
|
||||
@@ -152,13 +182,58 @@ pub fn sync(doc: &mut BaseDocument, nodes: &Nodes, medias: &mut Medias, out: &mu
|
||||
out.push(json!({"id": id, "type": "time", "time": t}));
|
||||
}
|
||||
}
|
||||
Msg::Playing(t) => out.push(json!({"id": id, "type": "playing", "time": t})),
|
||||
Msg::Playing(t) => {
|
||||
m.ahead.clear();
|
||||
out.push(json!({"id": id, "type": "playing", "time": t}));
|
||||
}
|
||||
Msg::Ended(t) => {
|
||||
m.playing = false;
|
||||
out.push(json!({"id": id, "type": "ended", "time": t}));
|
||||
}
|
||||
}
|
||||
}
|
||||
// the frame due at this sync: the latest whose moment has come, or comes within half a page frame (shown a
|
||||
// touch early rather than a whole page frame late); the ones before it were never seen
|
||||
let now = Instant::now();
|
||||
if let Some(last) = m.synced.0 {
|
||||
let dt = now.duration_since(last).as_secs_f64();
|
||||
m.synced.1 += 0.1 * (dt.min(0.1) - m.synced.1);
|
||||
if m.stats.is_some() && !m.ahead.is_empty() {
|
||||
(m.paced.0, m.paced.1) = (m.paced.0 + 1, m.paced.1.max(dt * 1e3));
|
||||
}
|
||||
}
|
||||
m.synced.0 = Some(now);
|
||||
let reach = now + Duration::from_secs_f64((0.5 * m.synced.1).min(0.008));
|
||||
let (due, passed) = due_by(&mut m.ahead, reach);
|
||||
came += passed;
|
||||
if let Some((t, (w, h, rgba), at, halves)) = due {
|
||||
m.halves = halves;
|
||||
let late = now.saturating_duration_since(at).as_secs_f64() * 1e3;
|
||||
(m.paced.2, m.paced.3) = (m.paced.2 + late, m.paced.3.max(late));
|
||||
m.frame = Some((w, h, Arc::new(rgba)));
|
||||
(redraw, m.seeked) = (true, true);
|
||||
came += 1;
|
||||
told(m, id, t, out);
|
||||
}
|
||||
// how many halvings its frames should come with: as many as bring one within twice the size it is drawn at
|
||||
// (the painter's rule, blitz-paint mip_level), counted from its box as last laid out
|
||||
if m.video && draw && let (Some((w, h, _)), Some(n), Some(st)) = (m.frame.as_ref(), nodes.by_id.get(&id), m.stream.as_mut()) {
|
||||
let want = doc.get_node(*n).map_or(0, |node| {
|
||||
let (l, scale) = (node.final_layout(), doc.viewport().scale_f64());
|
||||
let drawn = (l.content_box_width() as f64 * scale / *w as f64).min(l.content_box_height() as f64 * scale / *h as f64);
|
||||
let mut n = 0u8;
|
||||
while drawn > 0.0 && drawn * f64::from(1u32 << (n + 1)) <= 1.0 && n < 6 {
|
||||
n += 1;
|
||||
}
|
||||
n
|
||||
});
|
||||
// RAEA_MEDIA_HALVINGS=0: frames drawn as they come, as before (to compare with)
|
||||
let want = if std::env::var("RAEA_MEDIA_HALVINGS").as_deref() == Ok("0") { 0 } else { want };
|
||||
if want != m.halvings {
|
||||
m.halvings = want;
|
||||
st.ask(Cmd::Halvings(want));
|
||||
}
|
||||
}
|
||||
if redraw && m.video && draw {
|
||||
let pic = match (&m.poster, m.seeked) {
|
||||
(Some(p), false) => poster_image(p).map(|(w, h, px)| (w, h, Arc::new(px))),
|
||||
@@ -167,12 +242,38 @@ pub fn sync(doc: &mut BaseDocument, nodes: &Nodes, medias: &mut Medias, out: &mu
|
||||
// the frame's pixels shared, not copied again (a 4K frame is 33 MB)
|
||||
.or_else(|| m.frame.as_ref().map(|(w, h, px)| (*w, *h, px.clone())));
|
||||
if let (Some((w, h, px)), Some(n)) = (pic, nodes.by_id.get(&id)) {
|
||||
set_image(doc, *n, w, h, px);
|
||||
let began = std::time::Instant::now();
|
||||
set_image(doc, *n, w, h, px, std::mem::take(&mut m.halves));
|
||||
if let Some(s) = m.stats.as_mut().filter(|_| came > 0) {
|
||||
let ms = began.elapsed().as_secs_f64() * 1e3;
|
||||
(s.1, s.2, s.3, s.4) = (s.1 + 1, s.2 + came - 1, s.3 + ms, s.4.max(ms));
|
||||
if let Some(l) = m.shown_gap.0 {
|
||||
m.shown_gap.1 = m.shown_gap.1.max(began.duration_since(l).as_secs_f64() * 1e3);
|
||||
}
|
||||
m.shown_gap.0 = Some(began);
|
||||
let took = s.0.elapsed().as_secs_f64();
|
||||
if took >= 1.0 {
|
||||
eprintln!("raea-page: video {took:.2} s: {} frames shown ({w}x{h}), {} passed over before the page drew, picture set avg {:.2} ms max {:.2} ms, longest gap {:.0} ms; the page synced {} times, longest apart {:.0} ms; shown late avg {:.1} ms max {:.1} ms", s.1, s.2, s.3 / s.1.max(1) as f64, s.4, m.shown_gap.1, m.paced.0, m.paced.1, m.paced.2 / s.1.max(1) as f64, m.paced.3);
|
||||
*s = (std::time::Instant::now(), 0, 0, 0.0, 0.0);
|
||||
m.shown_gap.1 = 0.0;
|
||||
m.paced = (0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Of the frames waiting, the one to show by `reach`: the latest whose moment has come, taken out with the ones before
|
||||
/// it, and how many those were (frames nobody saw: the page drew less often than they came).
|
||||
fn due_by<T>(ahead: &mut VecDeque<(f64, T, Instant, Halvings)>, reach: Instant) -> (Option<(f64, T, Instant, Halvings)>, u32) {
|
||||
let (mut due, mut passed) = (None, 0);
|
||||
while ahead.front().is_some_and(|f| f.2 <= reach) {
|
||||
passed += due.replace(ahead.pop_front().unwrap()).is_some() as u32;
|
||||
}
|
||||
(due, passed)
|
||||
}
|
||||
|
||||
/// A playing element's time: each as `time` (its currentTime), and a `timeupdate` four times a second.
|
||||
fn told(m: &mut Media, id: u64, t: f64, out: &mut Vec<Value>) {
|
||||
out.push(json!({"id": id, "type": "time", "time": t}));
|
||||
@@ -197,12 +298,44 @@ fn poster_image(src: &str) -> Option<(u32, u32, Vec<u8>)> {
|
||||
Some((size.x, size.y, img.data?))
|
||||
}
|
||||
|
||||
/// Node `n` drawn as an image: `rgba` as its raster, its layout made again for the picture's size.
|
||||
fn set_image(doc: &mut BaseDocument, n: blitz_dom::NodeId, w: u32, h: u32, rgba: Arc<Vec<u8>>) {
|
||||
/// Node `n` drawn as an image: `rgba` as its raster. Its layout is made again only when the picture's size isn't the
|
||||
/// last one's: a playing video's next frame is the same size, and making its box and its ancestors' layout again for
|
||||
/// each was a part of every page frame it played in.
|
||||
fn set_image(doc: &mut BaseDocument, n: blitz_dom::NodeId, w: u32, h: u32, rgba: Arc<Vec<u8>>, halves: Halvings) {
|
||||
let Some(node) = doc.get_node_mut(n) else { return };
|
||||
let Some(el) = node.element_data_mut() else { return };
|
||||
el.special_data = SpecialElementData::Image(Box::new(ImageData::Raster(RasterImageData { width: w, height: h, data: vello::peniko::Blob::new(rgba) })));
|
||||
let same = matches!(&el.special_data, SpecialElementData::Image(i) if matches!(&**i, ImageData::Raster(r) if (r.width, r.height) == (w, h)));
|
||||
let image = RasterImageData { width: w, height: h, data: vello::peniko::Blob::new(rgba) };
|
||||
if !halves.is_empty() {
|
||||
raea_sys_page::preload_mips(&image, halves);
|
||||
}
|
||||
el.special_data = SpecialElementData::Image(Box::new(ImageData::Raster(image)));
|
||||
if same {
|
||||
return node.insert_damage(raea_sys_page::REPAINT_DAMAGE);
|
||||
}
|
||||
node.clear_layout_cache();
|
||||
node.insert_damage(raea_sys_page::ALL_DAMAGE);
|
||||
node.mark_ancestors_dirty();
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// At a sync the frame shown is the latest one due by then; earlier ones due are passed over, later ones wait.
|
||||
#[test]
|
||||
fn the_frame_due_is_the_latest_whose_moment_has_come() {
|
||||
let t0 = Instant::now();
|
||||
let at = |ms: u64| t0 + Duration::from_millis(ms);
|
||||
let mut ahead: VecDeque<(f64, u8, Instant, Halvings)> = (0..4).map(|i| (i as f64 / 60.0, i as u8, at(17 * i as u64), Vec::new())).collect();
|
||||
// nothing is due before the first
|
||||
assert!(due_by(&mut ahead, t0 - Duration::from_millis(1)).0.is_none());
|
||||
// a page drawing as often as the frames come shows each
|
||||
assert_eq!(due_by(&mut ahead, at(0)).0.map(|f| f.1), Some(0));
|
||||
assert_eq!(due_by(&mut ahead, at(17)).0.map(|f| f.1), Some(1));
|
||||
// a page a frame late shows the latest and counts the one it passed
|
||||
let (due, passed) = due_by(&mut ahead, at(51));
|
||||
assert_eq!((due.map(|f| f.1), passed), (Some(3), 1));
|
||||
assert!(ahead.is_empty());
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,7 @@ pub fn render(args: &[String]) -> R<String> {
|
||||
unsafe { std::env::set_var("RAEA_SOURCE_STAMPS", "1") };
|
||||
}
|
||||
bundle_composition(&tsx, &js, &o, None)?;
|
||||
raea_runtime_react::startup_mark("the composition bundled");
|
||||
let wanted = match (flag(args, "--frame"), flag(args, "--at")) {
|
||||
(Some(f), _) => Some(vec![f.parse().map_err(|_| "--frame takes a frame number")?]),
|
||||
(_, Some(at)) => Some(at.split(',').map(|f| f.trim().parse::<i64>().map_err(|_| "--at takes frame numbers".to_string())).collect::<R<_>>()?),
|
||||
@@ -91,6 +92,7 @@ pub fn render(args: &[String]) -> R<String> {
|
||||
};
|
||||
// a whole video made from these same inputs before is the export: cloned from the cache, not rendered again
|
||||
let cache = if wanted.is_none() && !raea_sys_layers::on() { export_cache(&tsx, &js, &out, args) } else { None };
|
||||
raea_runtime_react::startup_mark("the export cache looked up");
|
||||
let manifest = MANIFEST.lock().unwrap().clone();
|
||||
if let Some(c) = &cache {
|
||||
// with --manifest, the manifest kept beside the export comes back too
|
||||
|
||||
@@ -12,7 +12,11 @@ pub mod stream {
|
||||
/// where a playing source has got to, that it played to its end, or its failure.
|
||||
pub enum Msg {
|
||||
Meta { w: u32, h: u32, duration: f64 },
|
||||
Frame(f64, raea_io_media::Frame),
|
||||
/// a frame to show now (the first, a seek's). Asked for halvings (`Cmd::Halvings`), it comes as its size and
|
||||
/// the halving it is drawn from, its own pixels left behind
|
||||
Frame(f64, raea_io_media::Frame, Halvings),
|
||||
/// a playing video's frame, decoded ahead of its time: the frame at this time, to show at this moment
|
||||
Due(f64, raea_io_media::Frame, std::time::Instant, Halvings),
|
||||
/// a playing source's time (an audio one's, which has no frames; a video's when paused)
|
||||
Time(f64),
|
||||
/// playing from this time: the sound is on its way
|
||||
@@ -22,6 +26,48 @@ pub mod stream {
|
||||
Fail(String),
|
||||
}
|
||||
|
||||
/// Halvings of a frame, largest first: each a 2x2 mean of the one before (width, height, RGBA). A frame drawn at
|
||||
/// under half its size is drawn from one, so a 4K frame in a small player is neither sampled across four of
|
||||
/// its pixels at a time (it shimmers) nor sent whole to the GPU for every frame; and since the one it is drawn
|
||||
/// from is all that is sent, a quarter second of 4K frames waiting is 30 to 120 MB where whole it would be 500.
|
||||
pub type Halvings = Vec<(u32, u32, Vec<u8>)>;
|
||||
|
||||
/// `n` halvings of an RGBA picture (fewer once a side is a pixel).
|
||||
pub fn halvings(w: u32, h: u32, rgba: &[u8], n: u8) -> Halvings {
|
||||
let mut out: Halvings = Vec::new();
|
||||
for _ in 0..n {
|
||||
let (sw, sh, src) = match out.last() {
|
||||
Some(last) => (last.0, last.1, last.2.as_slice()),
|
||||
None => (w, h, rgba),
|
||||
};
|
||||
if sw < 2 || sh < 2 {
|
||||
break;
|
||||
}
|
||||
let (dw, dh) = ((sw / 2) as usize, (sh / 2) as usize);
|
||||
let stride = sw as usize * 4;
|
||||
let mut px = vec![0u8; dw * dh * 4];
|
||||
for (y, row) in px.chunks_exact_mut(dw * 4).enumerate() {
|
||||
let (top, bottom) = (&src[2 * y * stride..][..dw * 8], &src[(2 * y + 1) * stride..][..dw * 8]);
|
||||
for ((d, a), b) in row.chunks_exact_mut(4).zip(top.chunks_exact(8)).zip(bottom.chunks_exact(8)) {
|
||||
for c in 0..4 {
|
||||
d[c] = ((a[c] as u16 + a[c + 4] as u16 + b[c] as u16 + b[c + 4] as u16 + 2) / 4) as u8;
|
||||
}
|
||||
}
|
||||
}
|
||||
out.push((dw as u32, dh as u32, px));
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// A frame as it is sent when `n` halvings are asked for: whole with none; else its size, and the nth halving
|
||||
/// alone (the one it is drawn from).
|
||||
pub fn sent(f: raea_io_media::Frame, n: u8) -> (raea_io_media::Frame, Halvings) {
|
||||
match halvings(f.width, f.height, &f.rgba, n).pop() {
|
||||
Some(last) => (raea_io_media::Frame { rgba: Vec::new(), ..f }, vec![last]),
|
||||
None => (f, Vec::new()),
|
||||
}
|
||||
}
|
||||
|
||||
/// What the element asks of its decoder. Play plays from `at` on the source's clock (its sound's, when it has
|
||||
/// sound and a device): frames as they fall due, each `Frame` news, and `Ended` at its end unless `looping`.
|
||||
pub enum Cmd {
|
||||
@@ -31,6 +77,9 @@ pub mod stream {
|
||||
Muted(bool),
|
||||
/// the element's volume, 0..1: the sound's gain while it isn't muted
|
||||
Volume(f32),
|
||||
/// how many times each frame should be halved from here on (the page counts them from the size the video is
|
||||
/// drawn at; 0 while it is drawn at over half its size)
|
||||
Halvings(u8),
|
||||
}
|
||||
|
||||
pub struct Stream {
|
||||
@@ -133,7 +182,7 @@ pub mod stream {
|
||||
let i = dec.info().clone();
|
||||
let _ = tx.send(Msg::Meta { w: i.width, h: i.height, duration: i.duration });
|
||||
let _ = tx.send(match dec.frame_at(0.0) {
|
||||
Ok(f) => Msg::Frame(0.0, f),
|
||||
Ok(f) => Msg::Frame(0.0, f, Vec::new()),
|
||||
Err(e) => Msg::Fail(e),
|
||||
});
|
||||
Some(crate::media_play::Source::Video(dec))
|
||||
|
||||
+204
-31
@@ -1,13 +1,15 @@
|
||||
//! A `video` or `audio` playing (media_html.rs's stream, on its decoder's thread): seeks answered with the frame at the
|
||||
//! time asked; played, frames as they fall due on the source's clock, which is its sound's (media_sound.rs) when it has
|
||||
//! sound and the Mac a device, else the wall's. Frames are asked for at the clock's time, so a decoder that falls
|
||||
//! behind skips frames rather than letting the picture lag its sound.
|
||||
//! sound and the Mac a device, else the wall's. A playing video's frames are decoded a little ahead of the clock and
|
||||
//! sent with the moment each is due (`Msg::Due`), so how long a frame takes to decode is no part of when it is
|
||||
//! shown, and a loop's first frame is ready before its last has gone. A decoder that falls behind the clock skips
|
||||
//! frames rather than letting the picture lag its sound.
|
||||
|
||||
use std::path::Path;
|
||||
use std::sync::mpsc::{Receiver, RecvTimeoutError, Sender};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use crate::media_html::stream::{Cmd, Msg};
|
||||
use crate::media_html::stream::{Cmd, Msg, sent};
|
||||
use crate::media_sound::Sound;
|
||||
|
||||
/// What was opened: a video's decoder, or an audio source's samples.
|
||||
@@ -33,10 +35,54 @@ pub struct Player<'a> {
|
||||
volume: f32,
|
||||
clock: Option<Clock>,
|
||||
looping: bool,
|
||||
/// the frame (index at fps) last sent while playing, so a frame isn't decoded twice
|
||||
shown: Option<i64>,
|
||||
/// the frame (index at fps) to decode next while playing
|
||||
cursor: i64,
|
||||
/// what the cursor's frames are ahead of the clock by, in laps: `duration` once the cursor has gone round a
|
||||
/// loop the clock hasn't yet, else 0
|
||||
lap: f64,
|
||||
/// frames the clock passed before they were decoded, since the last frame sent (for the stats)
|
||||
skipped: i64,
|
||||
/// when the last Time news went (an audio source's, which has no frames)
|
||||
told: Option<Instant>,
|
||||
/// how many halvings each frame is sent with (`Cmd::Halvings`)
|
||||
halvings: u8,
|
||||
/// where the picture last sent was in time, while paused: sent again when the halvings asked for change
|
||||
still: Option<f64>,
|
||||
/// RAEA_MEDIA_STATS=1: how play is going, said a line a second
|
||||
stats: Option<Stats>,
|
||||
}
|
||||
|
||||
/// A second of play as the decoder's thread saw it (RAEA_MEDIA_STATS=1): the frames it sent, the frames the clock
|
||||
/// passed over (decoding fell behind, or the thread woke late), and how long a frame took to decode.
|
||||
struct Stats {
|
||||
since: Instant,
|
||||
frames: u32,
|
||||
skipped: u32,
|
||||
sum: f64,
|
||||
max: f64,
|
||||
/// the longest wait between two frames decoded, ms
|
||||
gap: f64,
|
||||
last: Option<Instant>,
|
||||
}
|
||||
|
||||
impl Stats {
|
||||
fn new() -> Self {
|
||||
Stats { since: Instant::now(), frames: 0, skipped: 0, sum: 0.0, max: 0.0, gap: 0.0, last: None }
|
||||
}
|
||||
fn frame(&mut self, decode: Duration, skipped: i64, fps: f64) {
|
||||
let now = Instant::now();
|
||||
if let Some(l) = self.last {
|
||||
self.gap = self.gap.max((now - l).as_secs_f64() * 1e3);
|
||||
}
|
||||
self.last = Some(now);
|
||||
let ms = decode.as_secs_f64() * 1e3;
|
||||
(self.frames, self.skipped, self.sum, self.max) = (self.frames + 1, self.skipped + skipped.max(0) as u32, self.sum + ms, self.max.max(ms));
|
||||
let took = self.since.elapsed().as_secs_f64();
|
||||
if took >= 1.0 {
|
||||
eprintln!("raea-media: play {took:.2} s: {} frames sent of {:.0} due, {} skipped, decode avg {:.1} ms max {:.1} ms, longest gap {:.0} ms", self.frames, took * fps, self.skipped, self.sum / self.frames.max(1) as f64, self.max, self.gap);
|
||||
*self = Stats { last: self.last, ..Stats::new() };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Player<'a> {
|
||||
@@ -46,7 +92,7 @@ impl<'a> Player<'a> {
|
||||
Source::Audio(a) => (a.duration(), 0.0),
|
||||
};
|
||||
let fps = if fps.is_finite() && fps > 1.0 { fps } else { 30.0 };
|
||||
Player { path, source, duration, fps, sound: None, muted: false, volume: 1.0, clock: None, looping: false, shown: None, told: None }
|
||||
Player { path, source, duration, fps, sound: None, muted: false, volume: 1.0, clock: None, looping: false, cursor: 0, lap: 0.0, skipped: 0, told: None, halvings: 0, still: Some(0.0), stats: (std::env::var("RAEA_MEDIA_STATS").as_deref() == Ok("1")).then(Stats::new) }
|
||||
}
|
||||
|
||||
/// Answers the element's asks until it's gone (its stream dropped).
|
||||
@@ -54,7 +100,7 @@ impl<'a> Player<'a> {
|
||||
loop {
|
||||
// playing: wake for the next frame; paused: wait for an ask
|
||||
let first = if self.clock.is_some() {
|
||||
match rx.recv_timeout(Duration::from_secs_f64(0.5 / self.fps)) {
|
||||
match rx.recv_timeout(self.until_next()) {
|
||||
Ok(c) => Some(c),
|
||||
Err(RecvTimeoutError::Timeout) => None,
|
||||
Err(RecvTimeoutError::Disconnected) => return self.stop(),
|
||||
@@ -84,6 +130,13 @@ impl<'a> Player<'a> {
|
||||
s.set_volume(v);
|
||||
}
|
||||
}
|
||||
Cmd::Halvings(n) => {
|
||||
// paused, the picture showing is sent again with what it is now drawn from
|
||||
if n != self.halvings && self.clock.is_none() && seek.is_none() {
|
||||
seek = self.still;
|
||||
}
|
||||
self.halvings = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
if pause && self.clock.is_some() {
|
||||
@@ -117,6 +170,47 @@ impl<'a> Player<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// How long until there is something to do: the cursor's frame comes within the lead, or the clock reaches the
|
||||
/// end. (Frames were once sent when they fell due, each after its own decode: 22 to 29 ms apart at 60 fps where
|
||||
/// 16.7 is even, a 4K frame 6.6 ms late, and a loop's first frame behind a seek; RAEA_MEDIA_STATS, 11-13.)
|
||||
fn until_next(&self) -> Duration {
|
||||
let frame = 1.0 / self.fps;
|
||||
let wait = match &self.source {
|
||||
Source::Video(_) => {
|
||||
let now = self.now();
|
||||
let decode = if self.at_end() { f64::INFINITY } else { self.cursor_time() - self.lead() - now };
|
||||
decode.min(self.duration - now).clamp(0.0005, frame)
|
||||
}
|
||||
Source::Audio(_) => 0.5 * frame,
|
||||
};
|
||||
Duration::from_secs_f64(wait)
|
||||
}
|
||||
|
||||
/// The cursor's frame's time on the clock.
|
||||
fn cursor_time(&self) -> f64 {
|
||||
self.cursor as f64 / self.fps + self.lap
|
||||
}
|
||||
|
||||
/// The cursor is past the source's last frame (a looping source's cursor goes round instead).
|
||||
fn at_end(&self) -> bool {
|
||||
!self.looping && self.duration.is_finite() && self.cursor as f64 / self.fps >= self.duration - 0.5 / self.fps
|
||||
}
|
||||
|
||||
/// How far ahead of the clock frames are decoded: a quarter second, which rides out a decode that stalls (a
|
||||
/// reader starting again, a busy machine: 40 to 85 ms seen) and the seek back to a loop's start (70 ms). No more
|
||||
/// than 128 MB of frames wait at once, 200 nearing a loop's end, and never fewer than two frames: a 4K frame
|
||||
/// sent whole is 33 MB (three wait), sent as the halving it is drawn from 8 or 2 (the quarter second).
|
||||
fn lead(&self) -> f64 {
|
||||
let frame = 1.0 / self.fps;
|
||||
let bytes = match &self.source {
|
||||
Source::Video(d) => (d.info().width as f64 * d.info().height as f64 * 4.0 / 4f64.powi(self.halvings as i32)).max(1.0),
|
||||
Source::Audio(_) => 1.0,
|
||||
};
|
||||
let near_wrap = self.looping && self.duration.is_finite() && (self.lap > 0.0 || self.duration - self.cursor as f64 * frame < 0.25);
|
||||
let most = ((if near_wrap { 200e6 } else { 128e6 }) / bytes).floor().max(2.0) * frame;
|
||||
most.min(0.25)
|
||||
}
|
||||
|
||||
/// The clock's time now.
|
||||
fn now(&self) -> f64 {
|
||||
match (&self.clock, &self.sound) {
|
||||
@@ -137,8 +231,13 @@ impl<'a> Player<'a> {
|
||||
let volume = self.volume;
|
||||
self.sound = Some(audio.and_then(|a| Sound::open(a, self.muted).inspect(|s| s.set_volume(volume)).inspect_err(|e| bevy::log::debug!("raea-runtime-js: media plays on the wall's clock: {e}")).ok()));
|
||||
}
|
||||
self.shown = None;
|
||||
(self.cursor, self.lap, self.skipped) = ((t * self.fps).floor() as i64, 0.0, 0);
|
||||
self.told = None;
|
||||
self.restart(t);
|
||||
}
|
||||
|
||||
/// The clock started at `t` (the sound from there, else the wall).
|
||||
fn restart(&mut self, t: f64) {
|
||||
self.clock = Some(match &self.sound {
|
||||
Some(Some(s)) => {
|
||||
s.start(t);
|
||||
@@ -162,30 +261,67 @@ impl<'a> Player<'a> {
|
||||
/// The frame at `t`, sent as the frame at exactly `t`; false when the element's gone.
|
||||
fn frame(&mut self, t: f64, tx: &Sender<Msg>) -> bool {
|
||||
match &mut self.source {
|
||||
Source::Video(dec) => tx.send(dec.frame_at(t).map_or_else(Msg::Fail, |f| Msg::Frame(t, f))).is_ok(),
|
||||
Source::Video(dec) => {
|
||||
self.still = Some(t);
|
||||
let n = self.halvings;
|
||||
tx.send(dec.frame_at(t).map_or_else(Msg::Fail, |f| {
|
||||
let (f, halves) = sent(f, n);
|
||||
Msg::Frame(t, f, halves)
|
||||
}))
|
||||
.is_ok()
|
||||
}
|
||||
Source::Audio(_) => tx.send(Msg::Time(t)).is_ok(),
|
||||
}
|
||||
}
|
||||
|
||||
/// One step of playing: the end (again from the start when looping), or the frame falling due now.
|
||||
/// One step of playing: the end (the clock again from the start when looping), or the cursor's frame decoded
|
||||
/// and sent with the moment it is due, once it is within the lead. One frame a step, so an ask is never kept
|
||||
/// waiting behind more than one decode.
|
||||
fn tick(&mut self, tx: &Sender<Msg>) -> bool {
|
||||
let t = self.now();
|
||||
if self.duration.is_finite() && t >= self.duration - 0.5 / self.fps {
|
||||
if self.looping {
|
||||
self.go(0.0);
|
||||
return self.frame(0.0, tx);
|
||||
let mut t = self.now();
|
||||
let frame = 1.0 / self.fps;
|
||||
if self.duration.is_finite() && self.looping && t >= self.duration {
|
||||
// round again: the frames already sent for this lap were timed on the old clock's end, which is now
|
||||
if self.lap > 0.0 {
|
||||
self.lap = 0.0;
|
||||
} else {
|
||||
self.cursor = 0;
|
||||
}
|
||||
self.restart(t - self.duration);
|
||||
t = self.now();
|
||||
} else if self.duration.is_finite() && !self.looping && t >= self.duration - 0.5 * frame {
|
||||
self.halt();
|
||||
return tx.send(Msg::Ended(self.duration)).is_ok();
|
||||
}
|
||||
match &self.source {
|
||||
Source::Video(_) => {
|
||||
let i = (t * self.fps).floor() as i64;
|
||||
if self.shown == Some(i) {
|
||||
// a looping source's cursor goes round ahead of the clock
|
||||
if self.looping && self.duration.is_finite() && self.lap == 0.0 && self.cursor as f64 * frame >= self.duration - 0.5 * frame {
|
||||
(self.cursor, self.lap) = (0, self.duration);
|
||||
}
|
||||
if self.at_end() || self.cursor_time() - self.lead() > t {
|
||||
return true;
|
||||
}
|
||||
self.shown = Some(i);
|
||||
self.frame(t, tx)
|
||||
// behind the clock by more than a frame: the frames it passed are skipped
|
||||
if self.cursor_time() + frame < t {
|
||||
let i = ((t - self.lap) * self.fps).floor() as i64;
|
||||
self.skipped += i - self.cursor;
|
||||
self.cursor = i;
|
||||
}
|
||||
let (at, due_in) = (self.cursor as f64 * frame, self.cursor_time() - t);
|
||||
let began = Instant::now();
|
||||
let Source::Video(dec) = &mut self.source else { return true };
|
||||
// asked for mid-frame: a source whose frames aren't exactly on fps's grid gives the frame showing then
|
||||
let n = self.halvings;
|
||||
let got = dec.frame_at(at + 0.5 * frame).map(|f| sent(f, n));
|
||||
let took = began.elapsed();
|
||||
let due = began + Duration::from_secs_f64(due_in.max(0.0));
|
||||
self.cursor += 1;
|
||||
if let Some(s) = self.stats.as_mut() {
|
||||
s.frame(took, std::mem::take(&mut self.skipped), self.fps);
|
||||
}
|
||||
self.still = Some(at);
|
||||
tx.send(got.map_or_else(Msg::Fail, |(f, halves)| Msg::Due(at, f, due, halves))).is_ok()
|
||||
}
|
||||
Source::Audio(_) => {
|
||||
if self.told.is_some_and(|w| w.elapsed() < Duration::from_millis(100)) {
|
||||
@@ -226,6 +362,23 @@ mod tests {
|
||||
ok.then_some(p)
|
||||
}
|
||||
|
||||
/// A halving's pixel is the mean of the four it stands for; an odd last row or column is left out; a picture a
|
||||
/// pixel wide has none; and a frame is sent whole when none are asked for.
|
||||
#[test]
|
||||
fn halvings_are_means_of_four() {
|
||||
use crate::media_html::stream::{halvings, sent};
|
||||
let px: Vec<u8> = (0..5 * 3 * 4).map(|i| (i * 3) as u8).collect();
|
||||
let h = halvings(5, 3, &px, 3);
|
||||
assert_eq!(h.iter().map(|(w, h, p)| (*w, *h, p.len())).collect::<Vec<_>>(), vec![(2, 1, 8)]);
|
||||
let mean = |x: usize, c: usize| ((px[x * 4 + c] as u16 + px[(x + 1) * 4 + c] as u16 + px[(5 + x) * 4 + c] as u16 + px[(5 + x + 1) * 4 + c] as u16 + 2) / 4) as u8;
|
||||
assert_eq!(h[0].2, vec![mean(0, 0), mean(0, 1), mean(0, 2), mean(0, 3), mean(2, 0), mean(2, 1), mean(2, 2), mean(2, 3)]);
|
||||
let f = raea_io_media::Frame { pts: 0.0, width: 5, height: 3, rgba: px.clone() };
|
||||
let (whole, none) = sent(f.clone(), 0);
|
||||
assert!(whole.rgba == px && none.is_empty());
|
||||
let (size, one) = sent(f, 1);
|
||||
assert!(size.rgba.is_empty() && (size.width, size.height) == (5, 3) && one == vec![h[0].clone()]);
|
||||
}
|
||||
|
||||
/// Played on the wall's clock (RAEA_AUDIO_MUTE=1: no device), a video's frames come as they fall due and it ends
|
||||
/// at its end; a seek answers with the frame at exactly its time; looping, it goes round; paused, it stops.
|
||||
#[test]
|
||||
@@ -235,7 +388,7 @@ mod tests {
|
||||
let Some(path) = clip() else { return eprintln!("no ffmpeg: skipped") };
|
||||
let mut st = stream::open(path.to_str().unwrap(), true).expect("a stream");
|
||||
assert!(matches!(next(&st, Duration::from_secs(10)), Some(Msg::Meta { w: 160, h: 90, .. })));
|
||||
assert!(matches!(next(&st, Duration::from_secs(5)), Some(Msg::Frame(t, _)) if t == 0.0));
|
||||
assert!(matches!(next(&st, Duration::from_secs(5)), Some(Msg::Frame(t, ..)) if t == 0.0));
|
||||
|
||||
let began = Instant::now();
|
||||
st.ask(Cmd::Play { at: 0.0, looping: false });
|
||||
@@ -243,9 +396,12 @@ mod tests {
|
||||
let (mut frames, mut last, mut ended) = (0, -1.0, None);
|
||||
while let Some(m) = next(&st, Duration::from_secs(3)) {
|
||||
match m {
|
||||
Msg::Frame(t, f) => {
|
||||
Msg::Due(t, f, due, _) => {
|
||||
assert!(t > last, "frames in order: {t} after {last}");
|
||||
assert_eq!((f.width, f.height), (160, 90));
|
||||
// each is due when its time comes on the clock (the wall's, here), sent before then
|
||||
let on_clock = due.duration_since(began).as_secs_f64();
|
||||
assert!((on_clock - t).abs() < 0.06, "the frame at {t} is due at {on_clock}");
|
||||
(frames, last) = (frames + 1, t);
|
||||
}
|
||||
Msg::Ended(t) => {
|
||||
@@ -258,17 +414,27 @@ mod tests {
|
||||
let (end, took) = ended.expect("it ended");
|
||||
assert!((end - 1.0).abs() < 0.05, "ended at its duration: {end}");
|
||||
assert!((0.85..1.4).contains(&took), "a second's clip took {took} s");
|
||||
assert!(frames >= 20, "{frames} frames of 30");
|
||||
assert!(frames >= 25, "{frames} frames of 30");
|
||||
|
||||
st.ask(Cmd::Seek(0.5));
|
||||
assert!(matches!(next(&st, Duration::from_secs(2)), Some(Msg::Frame(t, _)) if t == 0.5));
|
||||
assert!(matches!(next(&st, Duration::from_secs(2)), Some(Msg::Frame(t, ..)) if t == 0.5));
|
||||
|
||||
let looped = Instant::now();
|
||||
st.ask(Cmd::Play { at: 0.5, looping: true });
|
||||
let (mut wrapped, mut last, until) = (false, 0.5, Instant::now() + Duration::from_millis(1200));
|
||||
let (mut wrapped, mut last, mut laps, until) = (false, 0.5, 0.0, Instant::now() + Duration::from_millis(2300));
|
||||
while Instant::now() < until {
|
||||
match next(&st, Duration::from_millis(200)) {
|
||||
Some(Msg::Frame(t, _)) => {
|
||||
wrapped |= t < last;
|
||||
Some(Msg::Due(t, _, due, _)) => {
|
||||
// the first frame of the next lap is sent before the last frame of this one has gone
|
||||
if t < last {
|
||||
wrapped = true;
|
||||
laps += 1.0;
|
||||
assert!(due > Instant::now(), "the loop's first frame came after it was due");
|
||||
}
|
||||
// round the loop a frame is still due when the clock is at its time: half a second of play
|
||||
// to the end, then a second a lap
|
||||
let on_clock = due.duration_since(looped).as_secs_f64();
|
||||
assert!((on_clock - (t - 0.5 + laps)).abs() < 0.06, "lap {laps}: the frame at {t} is due {on_clock} s after play");
|
||||
last = t;
|
||||
}
|
||||
Some(Msg::Ended(_)) => panic!("a looping source doesn't end"),
|
||||
@@ -278,13 +444,20 @@ mod tests {
|
||||
assert!(wrapped, "looping went round");
|
||||
|
||||
st.ask(Cmd::Pause);
|
||||
let mut after = 0;
|
||||
while let Some(m) = next(&st, Duration::from_millis(300)) {
|
||||
if matches!(m, Msg::Frame(..)) {
|
||||
after += 1;
|
||||
// paused, asked for two halvings: the picture showing comes again as its size and its second halving
|
||||
while next(&st, Duration::from_millis(300)).is_some() {}
|
||||
st.ask(Cmd::Halvings(2));
|
||||
match next(&st, Duration::from_secs(2)) {
|
||||
Some(Msg::Frame(_, f, halves)) => {
|
||||
assert_eq!((f.width, f.height), (160, 90));
|
||||
assert!(f.rgba.is_empty(), "the frame's own pixels stay behind");
|
||||
assert_eq!(halves.iter().map(|(w, h, px)| (*w, *h, px.len())).collect::<Vec<_>>(), vec![(40, 22, 40 * 22 * 4)]);
|
||||
}
|
||||
_ => panic!("no frame with its halvings"),
|
||||
}
|
||||
assert!(after <= 1, "{after} frames after pausing");
|
||||
// what was on its way comes; then nothing more
|
||||
while next(&st, Duration::from_millis(300)).is_some() {}
|
||||
assert!(next(&st, Duration::from_millis(300)).is_none(), "frames after pausing");
|
||||
let _ = std::fs::remove_file(path);
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ raea-io-trace = { path = "../../io/trace" }
|
||||
raea-core-program = { path = "../../core/program" }
|
||||
raea-sys-mix = { path = "../../systems/mix" }
|
||||
raea-sys-frame = { path = "../../systems/frame" }
|
||||
raea-sys-hold = { path = "../../systems/hold" }
|
||||
bevy = { version = "=0.20.0", default-features = false, features = ["std", "default_app"] }
|
||||
serde_json = "1"
|
||||
wgpu = "=30.0.1"
|
||||
|
||||
@@ -16,6 +16,7 @@ mod open;
|
||||
mod sound;
|
||||
mod pointer;
|
||||
mod pick3d;
|
||||
pub use pick3d::want_wire;
|
||||
pub use sound::warm_audio;
|
||||
mod draw;
|
||||
|
||||
|
||||
@@ -34,6 +34,10 @@ impl Live {
|
||||
None => json!({"owner": "", "props": {}, "text": "", "kind": "mesh"}),
|
||||
};
|
||||
out["entity"] = json!(hit.entity.to_bits());
|
||||
// where it stands (docs/scene-feed.feature SF4c): what its handles are drawn from
|
||||
if let Some(w) = self.scene.as_mut().map(|e| e.world_mut()) {
|
||||
out["placed"] = placed_json(raea_sys_hold::placed(w, hit.entity));
|
||||
}
|
||||
// how a part with no key is asked for again (locate): its entity, as text (its bits don't fit a page's number)
|
||||
out["entity_key"] = json!(format!("entity:{}", hit.entity.to_bits()));
|
||||
for (k, v) in [("part", json!(true)), ("key", json!(hit.key)), ("name", json!(hit.name)), ("rect", json!([r[0] as f64 * w, r[1] as f64 * h, r[2] as f64 * w, r[3] as f64 * h])), ("point", json!(hit.point.to_array())), ("distance", json!(hit.distance))] {
|
||||
@@ -79,6 +83,40 @@ impl Live {
|
||||
}
|
||||
}
|
||||
|
||||
/// The part a key names, as it stands now: its entity (as "entity:BITS") and where it stands. None when nothing
|
||||
/// drawn has that key. A picked part asked for again after the scene's code changed (a new world, new entities).
|
||||
pub fn part(&mut self, key: &str) -> Option<Value> {
|
||||
let w = self.scene.as_mut()?.world_mut();
|
||||
let e = raea_sys_hold::part_of(w, key)?;
|
||||
Some(json!({"entity_key": format!("entity:{}", e.to_bits()), "placed": placed_json(raea_sys_hold::placed(w, e))}))
|
||||
}
|
||||
|
||||
/// The part a key names held at a place in its parent's space (translation, rotation as a quaternion, scale), or
|
||||
/// let go of (None): drawn there until then, its code untouched. False with no 3D or no such part.
|
||||
pub fn hold(&mut self, key: &str, to: Option<([f32; 3], [f32; 4], [f32; 3])>) -> bool {
|
||||
let Some(w) = self.scene.as_mut().map(|e| e.world_mut()) else { return false };
|
||||
let Some(e) = raea_sys_hold::part_of(w, key) else { return false };
|
||||
let Some(mut held) = w.get_resource_mut::<raea_sys_hold::Held>() else { return false };
|
||||
match to {
|
||||
Some((t, r, s)) => {
|
||||
held.parts.insert(e, Transform { translation: Vec3::from(t), rotation: Quat::from_array(r).normalize(), scale: Vec3::from(s) });
|
||||
}
|
||||
None => {
|
||||
held.parts.remove(&e);
|
||||
}
|
||||
}
|
||||
self.dirty = true;
|
||||
true
|
||||
}
|
||||
|
||||
/// Every mesh drawn as its edges over its shading, or as it is. False with no 3D or no wireframe pass.
|
||||
pub fn wire(&mut self, on: bool) -> bool {
|
||||
let Some(w) = self.scene.as_mut().map(|e| e.world_mut()) else { return false };
|
||||
let ok = raea_sys_hold::set_wire(w, on);
|
||||
self.dirty |= ok;
|
||||
ok
|
||||
}
|
||||
|
||||
/// The scene drawn from an orbit (yaw and pitch in radians, distance in metres, about `target`) until None puts
|
||||
/// the composition's camera back. False with no 3D.
|
||||
pub fn set_view(&mut self, orbit: Option<(f32, f32, f32, [f32; 3])>) -> bool {
|
||||
@@ -131,3 +169,19 @@ impl Live {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Where a part stands, for the page: its place in its parent's space and in the world (translation, rotation as a
|
||||
/// quaternion [x, y, z, w], scale), and its parent's matrix in the world (16 numbers, column by column; null at the top).
|
||||
fn placed_json(p: raea_sys_hold::Placed) -> Value {
|
||||
let trs = |t: Transform| json!({"translation": t.translation.to_array(), "rotation": t.rotation.to_array(), "scale": t.scale.to_array()});
|
||||
json!({
|
||||
"local": trs(p.local),
|
||||
"world": trs(p.world.compute_transform()),
|
||||
"parent": p.parent.map(|g| Mat4::from(g.affine()).to_cols_array().to_vec()),
|
||||
})
|
||||
}
|
||||
|
||||
/// Scenes opened from here on can be drawn as wireframe (`Live::wire`): the app's stage asks once, before any opens.
|
||||
pub fn want_wire() {
|
||||
raea_sys_hold::want_wire();
|
||||
}
|
||||
@@ -340,9 +340,13 @@ pub fn await_models(_app: &mut App) -> Result<(), String> {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub fn await_models(app: &mut App) -> Result<(), String> {
|
||||
let mut t0 = bevy::platform::time::Instant::now();
|
||||
let t_all = t0;
|
||||
let mut most = 0usize;
|
||||
// the cameras off while models load, so the draws are binned once, whole (#48): raea-sys-post's views.rs
|
||||
let mut off: Option<Vec<Entity>> = None;
|
||||
// RAEA_MODELS_TRACE=1: each wait that ran an update says how many and for which models (a render's frame time)
|
||||
let trace = std::env::var("RAEA_MODELS_TRACE").as_deref() == Ok("1");
|
||||
let mut pumped = 0usize;
|
||||
loop {
|
||||
let world = app.world_mut();
|
||||
if let Some(e) = world.resource_mut::<Error>().0.take() {
|
||||
@@ -367,8 +371,17 @@ pub fn await_models(app: &mut App) -> Result<(), String> {
|
||||
}
|
||||
if waiting == 0 {
|
||||
if let Some(cams) = off { raea_sys_post::views::on(app, cams); }
|
||||
if trace && pumped > 0 {
|
||||
eprintln!("raea models: waited {pumped} update(s), {:.1} ms", t_all.elapsed().as_secs_f64() * 1e3);
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
if trace && pumped == 0 {
|
||||
let mut q = app.world_mut().query::<&Model3d>();
|
||||
let who: Vec<String> = q.iter(app.world()).filter(|m| !(matches!(m.state, ModelState::Ready { .. }) && m.settled())).map(|m| format!("{} ({}; surfaces {}, toon {}, shaders {})", m.id, match m.state { ModelState::Loading => "loading", ModelState::Spawned(_) => "spawned", ModelState::Ready { .. } => "ready" }, m.surfaces.len(), m.toon.len(), m.shaders.len())).take(4).collect();
|
||||
eprintln!("raea models: waiting on {waiting}: {}", who.join("; "));
|
||||
}
|
||||
pumped += 1;
|
||||
if done > most {
|
||||
most = done;
|
||||
t0 = bevy::platform::time::Instant::now();
|
||||
|
||||
@@ -198,7 +198,7 @@ impl<R: OpIds> Plugin for BridgePlugin<R> {
|
||||
.add_message::<PageConflict>()
|
||||
.configure_sets(PreUpdate, PageSystems::Step.after(PageSystems::Events).after(bevy::picking::PickingSystems::Last))
|
||||
.configure_sets(PostUpdate, (PageSystems::Commands, PageSystems::Restyle, PageSystems::Layout, PageSystems::Twins, PageSystems::Paint).chain())
|
||||
.add_systems(PostUpdate, (apply_commands.in_set(PageSystems::Commands), twins::<R>.in_set(PageSystems::Twins)));
|
||||
.add_systems(PostUpdate, (apply_commands.in_set(PageSystems::Commands), twins::<R, true>.in_set(PageSystems::Twins)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,8 +221,9 @@ fn elements(doc: &BaseDocument, ops: Option<&HashMap<u64, NodeId>>, out: &mut Ve
|
||||
}
|
||||
|
||||
/// Twins spawned for new elements and despawned with theirs (and with their page), and each one's box written when it
|
||||
/// changed (H1). A twin's components are the page's (H9): one a system wrote is put back, named.
|
||||
fn twins<R: OpIds>(
|
||||
/// changed (H1). A twin's components are the page's (H9): one a system wrote is put back, named. Without `BOXES` (an
|
||||
/// event's sync, under RAEA_TWIN_SYNC_LIGHT) a kept twin keeps the box it has: only a new one takes its box now.
|
||||
fn twins<R: OpIds, const BOXES: bool>(
|
||||
mut commands: Commands,
|
||||
docs: NonSend<Docs>,
|
||||
roots: Option<NonSend<R>>,
|
||||
@@ -237,6 +238,11 @@ fn twins<R: OpIds>(
|
||||
error!("raea-page: a system wrote {property} on {twin}, which is the page's; the page's value stays (docs/blitz-bevy.feature B3 H9)");
|
||||
conflicts.write(PageConflict { twin, property: property.into(), owner: Owner::Page });
|
||||
};
|
||||
// RAEA_TWIN_SYNC_LIGHT=1 (a trial, off by default): an event's sync spawns and despawns twins and sets their
|
||||
// hierarchy, but leaves a kept twin's box as it is. Layout hasn't run since the frame's own pass took every box, and
|
||||
// that pass takes them again after this frame's layout; taking each element's rect on every pointer move was most of
|
||||
// a 400-clip timeline drag's twin work (docs/timeline.feature TL13a)
|
||||
let keep_boxes = !BOXES && std::env::var_os("RAEA_TWIN_SYNC_LIGHT").is_some_and(|v| v == "1");
|
||||
let index = &mut *index;
|
||||
// pages gone: their twins with them
|
||||
index.pages.retain(|page, t| {
|
||||
@@ -260,11 +266,12 @@ fn twins<R: OpIds>(
|
||||
by_key.clear();
|
||||
t.by_node.clear();
|
||||
for (key, node) in now.drain(..) {
|
||||
let at = doc.get_client_bounding_rect(node).map(|b| ElementBox(Rect::new(b.x as f32, b.y as f32, (b.x + b.width) as f32, (b.y + b.height) as f32))).unwrap_or_default();
|
||||
let rect = || doc.get_client_bounding_rect(node).map(|b| ElementBox(Rect::new(b.x as f32, b.y as f32, (b.x + b.width) as f32, (b.y + b.height) as f32))).unwrap_or_default();
|
||||
let op = if let Key::Op(id) = key { Some(id) } else { plain.0.get(page).and_then(|m| m.get(&node)).copied() };
|
||||
let el_now = PageElement { page: *page, node, op };
|
||||
let e = match t.by_key.remove(&key) {
|
||||
let (e, at) = match t.by_key.remove(&key) {
|
||||
Some(e) => {
|
||||
let mut kept = None;
|
||||
if let Ok((mut el, mut b)) = twins.get_mut(e) {
|
||||
if let Some((was_el, was_b)) = t.written.get(&e) {
|
||||
if *el != *was_el {
|
||||
@@ -275,11 +282,17 @@ fn twins<R: OpIds>(
|
||||
}
|
||||
}
|
||||
el.set_if_neq(el_now);
|
||||
// an event's sync leaves the box to the frame's own pass, which takes it after layout
|
||||
let at = if keep_boxes { *b } else { rect() };
|
||||
b.set_if_neq(at);
|
||||
kept = Some(at);
|
||||
}
|
||||
e
|
||||
(e, kept.unwrap_or_else(rect))
|
||||
}
|
||||
None => {
|
||||
let at = rect();
|
||||
(commands.spawn((el_now, at)).id(), at)
|
||||
}
|
||||
None => commands.spawn((el_now, at)).id(),
|
||||
};
|
||||
t.written.insert(e, (el_now, at));
|
||||
by_key.insert(key, e);
|
||||
@@ -445,7 +458,7 @@ impl<H: EventHandler> EventHandler for Forward<'_, H> {
|
||||
/// for the event's path and for whatever runs in the frame after it (its box comes at [`PageSystems::Twins`]).
|
||||
/// The twins brought to the pages now, outside their set: before an event's delivery, after a host step's commits.
|
||||
pub fn sync_twins<R: OpIds>(world: &mut World) {
|
||||
if let Err(e) = world.run_system_cached(twins::<R>) {
|
||||
if let Err(e) = world.run_system_cached(twins::<R, false>) {
|
||||
warn!("raea-page: twins: {e}");
|
||||
}
|
||||
}
|
||||
|
||||
+11
-6
@@ -87,6 +87,9 @@ export interface LocalTime {
|
||||
width: number;
|
||||
/** in px, what the Sequence gives its children */
|
||||
height: number;
|
||||
/** frames the subtree runs for from its frame 0, which useVideoConfig reports as durationInFrames: a Sequence's own
|
||||
* length cut where its parent's ends, a Loop's one pass, the composition's at the root */
|
||||
duration: number;
|
||||
}
|
||||
|
||||
export const ClockContext = createContext<ClockState | null>(null);
|
||||
@@ -198,8 +201,9 @@ export function useLocalTime(caller: string): LocalTime {
|
||||
useClockTick(local ? null : clock);
|
||||
if (local) return local;
|
||||
let t = rootTimes.get(clock);
|
||||
if (!t || t.frame !== clock.frame || t.width !== clock.config.width || t.height !== clock.config.height) {
|
||||
t = { frame: clock.frame, origin: 0, width: clock.config.width, height: clock.config.height };
|
||||
const c = clock.config;
|
||||
if (!t || t.frame !== clock.frame || t.width !== c.width || t.height !== c.height || t.duration !== c.durationInFrames) {
|
||||
t = { frame: clock.frame, origin: 0, width: c.width, height: c.height, duration: c.durationInFrames };
|
||||
rootTimes.set(clock, t);
|
||||
}
|
||||
return t;
|
||||
@@ -210,12 +214,13 @@ export function useCurrentFrame(): number {
|
||||
return useLocalTime("useCurrentFrame").frame;
|
||||
}
|
||||
|
||||
/** The settings of the composition being rendered (a Sequence's width and height win inside it). */
|
||||
/** The settings of the composition being rendered (inside a Sequence, its width, height and length win). */
|
||||
export function useVideoConfig(): VideoConfig {
|
||||
const clock = useClockState("useVideoConfig");
|
||||
const local = useContext(LocalTimeContext);
|
||||
if (!local || (local.width === clock.config.width && local.height === clock.config.height)) return clock.config;
|
||||
return { ...clock.config, width: local.width, height: local.height };
|
||||
const c = clock.config;
|
||||
if (!local || (local.width === c.width && local.height === c.height && local.duration === c.durationInFrames)) return c;
|
||||
return { ...c, width: local.width, height: local.height, durationInFrames: local.duration };
|
||||
}
|
||||
|
||||
export interface ClockProps {
|
||||
@@ -303,7 +308,7 @@ export function Clock(props: ClockProps) {
|
||||
if (!LITE) return <ClockContext.Provider value={state}>{props.children}</ClockContext.Provider>;
|
||||
return (
|
||||
<ClockContext.Provider value={state}>
|
||||
<LocalTimeContext.Provider value={{ frame, origin: 0, width, height }}>{props.children}</LocalTimeContext.Provider>
|
||||
<LocalTimeContext.Provider value={{ frame, origin: 0, width, height, duration: durationInFrames }}>{props.children}</LocalTimeContext.Provider>
|
||||
</ClockContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,4 +15,5 @@
|
||||
import { fish, lyria, sao } from "@raea/asset/assets";
|
||||
export { getContext, context, setContext, start, loaded, now, immediate, version, mtof, ftom, dbToGain, gainToDb, intervalToFrequencyRatio, Frequency, Midi, Time, TransportTime, Ticks, Param, Signal, ToneAudioNode, getDestination, Destination, Master, Instrument, Synth, MonoSynth, FMSynth, AMSynth, DuoSynth, MembraneSynth, NoiseSynth, MetalSynth, PluckSynth, PolySynth, Sampler, Player, GrainPlayer, Players, Oscillator, OmniOscillator, FatOscillator, PulseOscillator, Noise, Effect, Reverb, Freeverb, JCReverb, FeedbackDelay, PingPongDelay, Filter, AutoFilter, Compressor, Limiter, EQ3, Distortion, Chorus, BitCrusher, Tremolo, Vibrato, Phaser, AutoPanner, Gain, Volume, Panner, Channel, PanVol, Solo, Meter, FFT, Waveform, Analyser, LFO, Convolver, PitchShift, Offline, bus, buses, tokensynth, getTransport, Transport, Draw, Loop, Part, Sequence, Pattern, ToneOut, Sfx, vary, snapshot, reset } from "./tone/all";
|
||||
|
||||
export { fire } from "./tone/fire";
|
||||
export { sao, lyria, fish };
|
||||
@@ -176,7 +176,8 @@ export class Meter extends ToneAudioNode {
|
||||
constructor(_o?: unknown) {
|
||||
super("Gain", { gain: 1 });
|
||||
}
|
||||
getValue() {
|
||||
// a level, or an FFT's or a Waveform's bins (as Tone's getValue is number | number[])
|
||||
getValue(): number | Float32Array {
|
||||
return -Infinity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// raea/tone in a page: a sound fired now (docs/hardware.feature HW0d), as <Sfx> is a game's one-shot on a frame.
|
||||
import { type Ev, ctx } from "./all";
|
||||
|
||||
type Engine = { call: <T>(name: string, args?: unknown) => Promise<T> };
|
||||
|
||||
/** the graph the page's mixer has, as last sent */
|
||||
let sent = "";
|
||||
let fires = 0;
|
||||
let said = false;
|
||||
|
||||
/**
|
||||
* raea: a page's one-shot, heard now. `play(time)` runs the way an <Sfx>'s does, its triggers become events, and the
|
||||
* page's mixer in raea's window plays them at once (the host call sound.fire, on raea's mixer core). Make the
|
||||
* instruments and effects once, at the top level of a module, as a composition does; `play` only triggers them.
|
||||
* const click = new Tone.NoiseSynth({ envelope: { attack: 0.001, decay: 0.03, sustain: 0 } }).connect(Tone.buses.ui);
|
||||
* button.onpointerdown = () => Tone.fire((t) => click.triggerAttackRelease("32n", t));
|
||||
* Returns false, with no sound, where no raea engine is under the page (a browser).
|
||||
*/
|
||||
export function fire(play: (time: number) => void): boolean {
|
||||
const engine = (globalThis as { __raea_engine?: Engine }).__raea_engine;
|
||||
const evs: Ev[] = [];
|
||||
const prev = [ctx.sink, ctx.sinkKey, ctx.seq, ctx.now] as const;
|
||||
ctx.sink = evs;
|
||||
// each fire's own keys: the mixer hears a key once
|
||||
ctx.sinkKey = `fire${++fires}`;
|
||||
ctx.seq = 0;
|
||||
ctx.now = 0;
|
||||
try {
|
||||
play(0);
|
||||
} finally {
|
||||
[ctx.sink, ctx.sinkKey, ctx.seq, ctx.now] = prev;
|
||||
}
|
||||
if (!engine) {
|
||||
if (!said) console.info("raea/tone fire: no raea engine under this page, so its sounds are silent");
|
||||
said = true;
|
||||
return false;
|
||||
}
|
||||
if (evs.length === 0) return true;
|
||||
const graph = ctx.graphJson();
|
||||
const args = graph === sent ? { evs } : { graph, evs };
|
||||
sent = graph;
|
||||
// a call that failed sends the graph again with the next
|
||||
engine.call("sound.fire", args).catch(() => void (sent = ""));
|
||||
return true;
|
||||
}
|
||||
@@ -44,7 +44,7 @@
|
||||
- Keep an interior under about 50 m across. A bounce ray that goes 50 m without hitting anything counts as sky, so a
|
||||
bigger hall gets sky light in its bounce.
|
||||
- Put every light in the tree from the first frame, and change brightness with the sky, the glows and the exposure
|
||||
rather than the sun's `illuminance`. As of raea 0.1.1:
|
||||
rather than the sun's `illuminance`. As of raea 0.1.2:
|
||||
- a `DirectionalLight` that appears after the first frame lights nothing directly;
|
||||
- the traced sun keeps its first frame's strength (its direction does follow);
|
||||
- one `--at` render that jumps more than about 4.5 s between two frames loses the traced sun for every frame
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
burn none, and leave the words file beside the export for the platform's own captions.
|
||||
- Sound to -14 LUFS integrated with true peak at or below -1 dBTP: one `<Mix lufs={-14} ceiling={-1.5} />` per
|
||||
composition does it (`motion/sound`). A spec that names another number wins.
|
||||
- Render the export at `--quality master`, named in lowercase letters, digits and hyphens, with its shape and length:
|
||||
- Render the export at `--quality master` (motion graphics and type) or `--quality high` (a film), and versions made
|
||||
for notes with no `--quality` flag; name it in lowercase letters, digits and hyphens, with its shape and length:
|
||||
`spring-launch-9x16-15s.mp4`. Each version is a new file beside the last, never written over it.
|
||||
- In the raea app, post each deliverable with `feed_post` and `export: true`, tagged with the same keys across the
|
||||
project (`platform:tiktok`, `aspect:9x16`, `cut:15s`, `market:uk`): they become the project's Table, which is how
|
||||
|
||||
@@ -26,6 +26,25 @@
|
||||
audio's own rate, so they can be shorter than a frame.
|
||||
- Use `muted` for picture-only clips, `playbackRate` for speed changes (the sound follows) and `loop` with `endAt` to
|
||||
repeat a short source from `startFrom` each time it reaches `endAt` (without `endAt`, nothing loops).
|
||||
- For a speed ramp, give `speedCurve` instead of `playbackRate`: `[place, speed]` points over the source from
|
||||
`startFrom` (place 0) to `endAt` (place 1, so it needs `endAt`), each speed from 0.1 to 10, changing in a straight
|
||||
line between points: `speedCurve={[[0, 1], [0.5, 4], [1, 1]]}` speeds up to 4x at the middle and back. The sound
|
||||
follows it. The clip then takes `speedLength(speedPoints("clip", curve), endAt - startFrom)` frames, so give its
|
||||
`<Sequence>` that `durationInFrames` (rounded).
|
||||
- For a look over a stretch of time, put an `<Effect kind="mono" />` in a `<Sequence>` of its own, written after
|
||||
the parts it covers: it filters everything drawn before it for that sequence's frames, and draws nothing itself.
|
||||
Kinds: `blur`, `mono` (black and white), `sepia`, `vivid`, `faded`, `contrast`, `bright`, `dark`, `invert`, `hue`.
|
||||
`amount` (0 to 1) says how much; `in` and `out` are the frames it takes to come on and go off. The feed's timeline
|
||||
shows such a sequence as an effect clip, so the person can move, trim or retune it there.
|
||||
An effect of your own is its `parts`, CSS filter functions from amount 0 to amount 1:
|
||||
`<Effect kind="dream" parts={[["blur", 0, 6, "px"], ["saturate", 1, 1.6]]} />` (blur, brightness, contrast,
|
||||
grayscale, hue-rotate, invert, saturate, sepia).
|
||||
- To recut a composition as data rather than by hand, use `raea/editor`, the model behind the feed's timeline.
|
||||
`fromRender({ frames, fps, cuts })` makes its scenes clips of a main track, `applyAll(t, ops)` makes the edits
|
||||
(`split`, `move`, `trim`, `remove`) and hands back each one's inverse, so a change can be undone, and
|
||||
`segmentsOf(t)` is the cut as `<Composition edit={{ segments }}>` takes it. The main track's magnet closes every
|
||||
gap, as the feed's does. Segments say only which source frames play in which order: a speed or a freeze on a clip
|
||||
is not in them. docs/manual/examples/edits.tsx builds a timeline, edits it and undoes it.
|
||||
- Use `<Img src>` for stills. The frame waits until the image has loaded. An image whose file isn't there fails the
|
||||
render with "missing image: PATH"; a plain App prints that line and draws nothing.
|
||||
|
||||
|
||||
@@ -46,8 +46,26 @@ A video's bitrate follows its size and frame rate (about 20 Mbit/s at 1080p30, 8
|
||||
flat pictures), and `--kbps N` sets it. `--quality draft|high|master` (or 0..1: 0.6, 0.85, 0.95) asks for constant
|
||||
quality instead, each frame getting the bits it needs: `master` keeps thin type and hard vector edges clean at 4K
|
||||
(about 31 Mbit/s on flat motion graphics). Blotching in dark areas is the encoder, not the composition: export dark
|
||||
material as PNG frames (`RAEA_READBACK=rgba raea render piece.tsx -o frames/`) and encode them with more bits for the
|
||||
darks.
|
||||
material as PNG frames (`RAEA_READBACK=rgba raea render piece.tsx -o piece.frames/`) and encode them with more bits for
|
||||
the darks. A `NAME.frames/` folder is never committed, and raea's storage dry run lists it a day after
|
||||
the render unless something names it.
|
||||
|
||||
Which to ask for. A version made for notes (a cut to review, a shot that will be joined, a preview) takes no
|
||||
`--quality` flag: the default is already close to the picture `master` gives, in a fraction of the file. Measured on
|
||||
1080p24 film footage: the default 16 Mbit/s, `high` 30, `master` 87; against the `master` encode the default scores
|
||||
VMAF 99.5 (its worst frame 95.8) and `high` 99.7. So `master` on every review version is five times the disk for
|
||||
nothing a person sees, and a film reviewed ten times is ten gigabytes. Keep `master` for the one file that is
|
||||
delivered when it is motion graphics or type (thin edges at 4K are where it shows); deliver a film at `high`. A notes
|
||||
version takes no `--quality draft` either: constant quality has no ceiling, so on grain or noise `draft` can come
|
||||
out larger than the default.
|
||||
|
||||
When a version is replaced, keep it, and never `rm` a render yourself: a person may want the earlier cut back, and an
|
||||
item, a note or a composition may still name it. Name versions `-vN` (`cut-v3.mp4`, not `cut3.mp4`) so raea can
|
||||
tell a version from a shot number, and put "final" in the name of a delivered file. When space is short, call
|
||||
`storage_plan`: it lists only versions with a newer one beside them, unused feed renders, frames and broken copies,
|
||||
never a file anything names, and it says why each is listed. Show the person that list, and only on their yes call
|
||||
`storage_trash` with it: the list waits in Settings › Storage for the person to move, and what they move goes to the
|
||||
Trash, where they can put it back.
|
||||
|
||||
## A person's hand edits
|
||||
|
||||
|
||||
@@ -13,9 +13,11 @@ import { Held, useWake } from "./hold";
|
||||
import { stepTo, type Config } from "./session";
|
||||
import { convert } from "./scene";
|
||||
import { standInImages } from "./texture";
|
||||
import { standInPMREM } from "./pmrem";
|
||||
import { elementsOf } from "../parts";
|
||||
|
||||
standInImages();
|
||||
standInPMREM();
|
||||
|
||||
export interface R3FProps extends Config {
|
||||
children?: ReactNode;
|
||||
|
||||
@@ -5,6 +5,7 @@ import * as THREE from "three";
|
||||
import { toRaea, stopsOf } from "../units";
|
||||
import type { Part, Props } from "./material";
|
||||
import { srcOf } from "./texture";
|
||||
import { LEFT_OUT } from "./pmrem";
|
||||
|
||||
const hex = (c: THREE.Color) => "#" + c.getHexString();
|
||||
const at = (o: THREE.Object3D) => o.getWorldPosition(new THREE.Vector3()).toArray() as [number, number, number];
|
||||
@@ -164,7 +165,10 @@ export function skyOf(scene: THREE.Scene, gl?: THREE.WebGLRenderer, webgpu = fal
|
||||
}
|
||||
const env = srcOf(scene.environment);
|
||||
const sky = bg instanceof THREE.Texture ? srcOf(bg) : undefined;
|
||||
if (scene.environment && !(env && PANORAMA.test(env))) warnOnce("scene.environment", "isn't a panorama file raea can load (.hdr, .exr, .png, .jpg): left out");
|
||||
// three's PMREMGenerator making one from a scene or a cube map (pmrem.ts): said as that, not as a missing file
|
||||
const by = scene.environment?.userData?.[LEFT_OUT];
|
||||
if (scene.environment && typeof by === "string" && !env) warnOnce("scene.environment", `made by three's ${by}, which renders on the GPU and raea doesn't make yet: the scene is drawn without it (use a panorama: <Environment preset> or PMREMGenerator.fromEquirectangular of an .hdr)`);
|
||||
else if (scene.environment && !(env && PANORAMA.test(env))) warnOnce("scene.environment", "isn't a panorama file raea can load (.hdr, .exr, .png, .jpg): left out");
|
||||
if (bg instanceof THREE.Texture && !(sky && PANORAMA.test(sky))) warnOnce("scene.background", "texture isn't a panorama file raea can load: left out");
|
||||
const rotation = scene.environmentRotation?.y ?? 0;
|
||||
if (env && PANORAMA.test(env)) {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
// three's PMREMGenerator filters an environment on the GPU: it renders a scene (RoomEnvironment, three's own recipe for
|
||||
// soft studio light) or a panorama into a cube map with the renderer, which in raea is a stand-in that never draws
|
||||
// (session.ts). raea filters an environment itself, from a panorama (lights.ts skyOf, raea's <Environment>), so the
|
||||
// generator hands back what raea can read: fromEquirectangular of a panorama raea loads is that panorama, lighting the
|
||||
// scene as scene.environment; fromScene and fromCubemap are left out, the scene drawn without them and a warning saying
|
||||
// so (skyOf). fromScene threw inside the stand-in renderer and took the whole <R3F> scene with it (#131).
|
||||
import * as THREE from "three";
|
||||
import { srcOf } from "./texture";
|
||||
|
||||
/** what a stand-in environment was made by, when raea can't light by it: skyOf names it in its warning */
|
||||
export const LEFT_OUT = "raeaLeftOut";
|
||||
|
||||
function standIn(src: string | undefined, by: string): THREE.WebGLRenderTarget {
|
||||
const t = new THREE.WebGLRenderTarget(1, 1);
|
||||
t.texture.mapping = THREE.CubeUVReflectionMapping;
|
||||
if (src) t.texture.userData.src = src;
|
||||
else t.texture.userData[LEFT_OUT] = by;
|
||||
return t;
|
||||
}
|
||||
|
||||
let done = false;
|
||||
|
||||
/** PMREMGenerator's makers as stand-ins, once */
|
||||
export function standInPMREM() {
|
||||
if (done) return;
|
||||
done = true;
|
||||
const pm = THREE.PMREMGenerator.prototype as unknown as Record<string, unknown>;
|
||||
pm.fromScene = () => standIn(undefined, "PMREMGenerator.fromScene");
|
||||
pm.fromSceneAsync = async () => standIn(undefined, "PMREMGenerator.fromScene");
|
||||
pm.fromEquirectangular = (texture: THREE.Texture) => standIn(srcOf(texture), "PMREMGenerator.fromEquirectangular");
|
||||
pm.fromEquirectangularAsync = async (texture: THREE.Texture) => standIn(srcOf(texture), "PMREMGenerator.fromEquirectangular");
|
||||
pm.fromCubemap = () => standIn(undefined, "PMREMGenerator.fromCubemap");
|
||||
pm.fromCubemapAsync = async () => standIn(undefined, "PMREMGenerator.fromCubemap");
|
||||
pm.compileCubemapShader = () => {};
|
||||
pm.compileEquirectangularShader = () => {};
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
// a frame's scene is the same whichever frame came before it: a render equals its play (raea's first rule).
|
||||
import * as THREE from "three";
|
||||
import { advance, createRoot, extend, flushSync, type ReconcilerRoot, type RenderProps, type RootState } from "@react-three/fiber";
|
||||
import type { ReactNode } from "react";
|
||||
import { Component, createElement, type ReactNode } from "react";
|
||||
import { renderInto } from "./targets";
|
||||
|
||||
extend(THREE as unknown as Parameters<typeof extend>[0]);
|
||||
@@ -92,6 +92,21 @@ const seedOf = (key: string) => [...key].reduce((h, c) => Math.imul(h ^ c.charCo
|
||||
|
||||
const sessions = new Map<string, Session>();
|
||||
|
||||
/** The scene under an error boundary of raea's: what it throws (rendering, in an effect, in a ref) is handed to `on`,
|
||||
* and it draws nothing after. A promise thrown (a load suspending) isn't an error and passes by it, as before. */
|
||||
class Caught extends Component<{ on: (error: unknown) => void; children?: ReactNode }, { failed: boolean }> {
|
||||
state = { failed: false };
|
||||
static getDerivedStateFromError() {
|
||||
return { failed: true };
|
||||
}
|
||||
componentDidCatch(error: unknown) {
|
||||
this.props.on(error);
|
||||
}
|
||||
render() {
|
||||
return this.state.failed ? null : this.props.children;
|
||||
}
|
||||
}
|
||||
|
||||
export type Config = Omit<RenderProps<HTMLCanvasElement>, "gl" | "frameloop" | "size" | "events" | "dpr">;
|
||||
|
||||
function start(key: string, width: number, height: number, config: Config, json: string): Session {
|
||||
@@ -115,8 +130,16 @@ export function stepTo(key: string, frame: number, fps: number, width: number, h
|
||||
const live = s;
|
||||
const render = (i: number) => {
|
||||
let store: ReturnType<typeof live.root.render> | undefined;
|
||||
seeded(live, () => flushSync(() => { store = live.root.render(scene(i)); }));
|
||||
let failed: { error: unknown } | undefined;
|
||||
seeded(live, () => flushSync(() => { store = live.root.render(createElement(Caught, { on: (error: unknown) => void (failed ??= { error }) }, scene(i))); }));
|
||||
if (store) live.state = store.getState();
|
||||
// thrown out of the <R3F> that's drawing it, so the composition throws as it would outside R3F: the render is
|
||||
// refused, naming the error. R3F's own root only reports it (reportError, else console.error: a stack without its
|
||||
// message) and draws nothing, and the render ended with 0 errors (#131). The root starts again next time
|
||||
if (failed) {
|
||||
end(key);
|
||||
throw failed.error;
|
||||
}
|
||||
};
|
||||
// the same frame drawn again (a live replay): its children may have changed, its clock hasn't. When parts of it
|
||||
// mounted only now (a model, a font: what suspended while the frames were stepped, loaded since), their useFrame
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
// What an R3F scene throws is the composition's error, and three's PMREMGenerator doesn't take the scene with it
|
||||
// (#131: any error inside <R3F> was swallowed, the scene drew nothing and the render ended with 0 errors).
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { useThree } from "@react-three/fiber";
|
||||
import { useEffect, useMemo, type ReactNode } from "react";
|
||||
import * as THREE from "three";
|
||||
import { RoomEnvironment } from "three/examples/jsm/environments/RoomEnvironment.js";
|
||||
import { convert } from "../src/input/scene";
|
||||
import { end, stepTo } from "../src/input/session";
|
||||
import { standInPMREM } from "../src/input/pmrem";
|
||||
import type { Part } from "../src/parts";
|
||||
|
||||
standInPMREM();
|
||||
|
||||
const flat = (parts: Part[]): Part[] => parts.flatMap((p) => [p, ...flat(p.children ?? [])]);
|
||||
let n = 0;
|
||||
function partsOf(scene: (i: number) => ReactNode, key = `e${n++}`) {
|
||||
const s = stepTo(key, 0, 30, 400, 400, {}, scene);
|
||||
const st = s.state as unknown as { scene: THREE.Scene; camera: THREE.Camera; gl: THREE.WebGLRenderer };
|
||||
return flat(convert(st.scene, st.camera, st.gl, 400).parts);
|
||||
}
|
||||
const Box = () => (
|
||||
<mesh>
|
||||
<boxGeometry />
|
||||
<meshBasicMaterial color="red" />
|
||||
</mesh>
|
||||
);
|
||||
|
||||
describe("an error inside the scene", () => {
|
||||
test("thrown while rendering, it's thrown out of the frame with its message, and the next frame starts again", () => {
|
||||
const Boom = (): null => {
|
||||
throw new Error("mesh threw");
|
||||
};
|
||||
expect(() => partsOf(() => (<><Box /><Boom /></>), "boom")).toThrow("mesh threw");
|
||||
// the same key without the throw draws: the failed root was ended, not kept
|
||||
expect(partsOf(() => <Box />, "boom").some((p) => p.type === "Mesh")).toBe(true);
|
||||
end("boom");
|
||||
});
|
||||
|
||||
test("thrown in an effect, it's thrown out too", () => {
|
||||
const Late = () => {
|
||||
useEffect(() => {
|
||||
throw new Error("effect threw");
|
||||
}, []);
|
||||
return null;
|
||||
};
|
||||
expect(() => partsOf(() => (<><Box /><Late /></>))).toThrow("effect threw");
|
||||
});
|
||||
});
|
||||
|
||||
describe("three's PMREMGenerator", () => {
|
||||
test("fromScene (RoomEnvironment) leaves the environment out with a warning and the scene draws", () => {
|
||||
const warned: string[] = [];
|
||||
const warn = console.warn;
|
||||
console.warn = (m: string) => void warned.push(String(m));
|
||||
try {
|
||||
const Studio = () => {
|
||||
const { gl, scene } = useThree();
|
||||
useMemo(() => {
|
||||
const pm = new THREE.PMREMGenerator(gl);
|
||||
scene.environment = pm.fromScene(new RoomEnvironment(), 0.04).texture;
|
||||
}, [gl, scene]);
|
||||
return null;
|
||||
};
|
||||
const parts = partsOf(() => (<><Studio /><Box /></>));
|
||||
expect(parts.some((p) => p.type === "Mesh")).toBe(true);
|
||||
expect(parts.some((p) => p.type === "Environment")).toBe(false);
|
||||
} finally {
|
||||
console.warn = warn;
|
||||
}
|
||||
expect(warned.some((w) => w.includes("PMREMGenerator.fromScene"))).toBe(true);
|
||||
});
|
||||
|
||||
test("fromEquirectangular of a panorama lights the scene by that panorama", () => {
|
||||
const Sky = () => {
|
||||
const { gl, scene } = useThree();
|
||||
useMemo(() => {
|
||||
const hdr = new THREE.Texture();
|
||||
hdr.userData.src = "media/studio.hdr";
|
||||
scene.environment = new THREE.PMREMGenerator(gl).fromEquirectangular(hdr).texture;
|
||||
}, [gl, scene]);
|
||||
return null;
|
||||
};
|
||||
const env = partsOf(() => (<><Sky /><Box /></>)).find((p) => p.type === "Environment");
|
||||
expect(env?.props.src).toBe("media/studio.hdr");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,103 @@
|
||||
// <Nudge adjust>: a part's brightness, contrast, saturation, exposure, sharpen, highlights, shadows, temperature, tint,
|
||||
// fade, vignette and grain (docs/timeline.feature TL7g; sdk/video adjust.ts).
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { adjustError, adjustId, adjustSteps, toneAt, vignetteStyle } from "@raea/video/adjust";
|
||||
import { Nudge } from "@raea/video/nudge";
|
||||
import { renderFrame } from "../src/test";
|
||||
|
||||
const opts = { fps: 30, width: 1920, height: 1080, durationInFrames: 300 };
|
||||
const at = (el: JSX.Element, frame = 0) => renderFrame(el, { ...opts, frame });
|
||||
|
||||
describe("the tone curve", () => {
|
||||
test("as shot it is the picture as it was", () => {
|
||||
for (const v of [0, 0.25, 0.5, 0.75, 1]) expect(toneAt({}, v)).toBeCloseTo(v, 6);
|
||||
expect(adjustSteps({})).toEqual([]);
|
||||
});
|
||||
|
||||
test("exposure is a stop either way, brightness lifts the mids and holds the ends", () => {
|
||||
expect(toneAt({ exposure: 1 }, 0.25)).toBeCloseTo(0.5, 6);
|
||||
expect(toneAt({ exposure: -1 }, 0.5)).toBeCloseTo(0.25, 6);
|
||||
expect(toneAt({ brightness: 1 }, 0.25)).toBeCloseTo(0.5, 6);
|
||||
expect([toneAt({ brightness: 1 }, 0), toneAt({ brightness: 1 }, 1)]).toEqual([0, 1]);
|
||||
});
|
||||
|
||||
test("contrast turns about the middle grey; highlights and shadows each move their own end", () => {
|
||||
expect(toneAt({ contrast: 1 }, 0.5)).toBeCloseTo(0.5, 6);
|
||||
expect(toneAt({ contrast: 1 }, 0.75)).toBeCloseTo(1, 6);
|
||||
expect(toneAt({ contrast: -1 }, 1)).toBeLessThan(0.7);
|
||||
// highlights moves the bright more than the dark, shadows the dark more than the bright
|
||||
expect(toneAt({ highlights: 1 }, 0.75) - 0.75).toBeGreaterThan(toneAt({ highlights: 1 }, 0.25) - 0.25);
|
||||
expect(toneAt({ shadows: 1 }, 0.25) - 0.25).toBeGreaterThan(toneAt({ shadows: 1 }, 0.75) - 0.75);
|
||||
expect(toneAt({ highlights: -1 }, 0.8)).toBeLessThan(0.8);
|
||||
});
|
||||
|
||||
test("fade lifts the blacks and lowers the whites", () => {
|
||||
expect(toneAt({ fade: 1 }, 0)).toBeCloseTo(0.22, 6);
|
||||
expect(toneAt({ fade: 1 }, 1)).toBeCloseTo(0.9, 6);
|
||||
});
|
||||
});
|
||||
|
||||
describe("the filter's steps", () => {
|
||||
test("only what is changed: a tone table, a saturation, a warmth, a sharpen, a grain", () => {
|
||||
expect(adjustSteps({ contrast: 0.3 }).map((s) => s.tag)).toEqual(["feComponentTransfer"]);
|
||||
expect(adjustSteps({ saturation: -1 })).toEqual([{ tag: "feColorMatrix", attrs: { type: "saturate", values: "0" } }]);
|
||||
expect(adjustSteps({ temperature: 1 })[0].attrs.values).toBe("1.12 0 0 0 0 0 1 0 0 0 0 0 0.88 0 0 0 0 0 1 0");
|
||||
expect(adjustSteps({ sharpen: 1 })[0].attrs.kernelMatrix).toBe("0 -0.4 0 -0.4 2.6 -0.4 0 -0.4 0");
|
||||
// the tone table: 17 levels each for red, green and blue, alpha left as it is
|
||||
const table = adjustSteps({ exposure: 1 })[0];
|
||||
expect(table.children?.map((c) => c.tag)).toEqual(["feFuncR", "feFuncG", "feFuncB"]);
|
||||
expect(table.children?.[0].attrs.tableValues.split(" ")).toHaveLength(17);
|
||||
});
|
||||
|
||||
test("grain is a noise added about its middle, kept to where the part is, its seed the frame", () => {
|
||||
const steps = adjustSteps({ contrast: 0.2, grain: 0.5 }, 42);
|
||||
expect(steps.map((s) => s.tag)).toEqual(["feComponentTransfer", "feTurbulence", "feColorMatrix", "feComposite", "feComposite"]);
|
||||
expect(steps[0].attrs.result).toBe("toned");
|
||||
expect(steps[1].attrs.seed).toBe("42");
|
||||
expect(steps[3].attrs).toMatchObject({ in: "toned", in2: "grey", operator: "arithmetic", k3: "0.15", k4: "-0.075" });
|
||||
expect(steps[4].attrs).toEqual({ in: "grained", in2: "SourceGraphic", operator: "in" });
|
||||
expect(adjustId({ grain: 0.5 }, 7)).not.toBe(adjustId({ grain: 0.5 }, 8));
|
||||
expect(adjustId({ contrast: 0.5 }, 7)).toBe(adjustId({ contrast: 0.5 }, 8));
|
||||
});
|
||||
|
||||
test("a vignette is a darkening over the frame, none at 0", () => {
|
||||
expect(vignetteStyle(0)).toBeUndefined();
|
||||
expect(vignetteStyle(1)?.background).toBe("radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.85) 100%)");
|
||||
});
|
||||
|
||||
test("what is wrong is said", () => {
|
||||
expect(adjustError({ glow: 1 } as never)).toMatch(/"glow" isn't one/);
|
||||
expect(adjustError({ sharpen: -0.5 })).toMatch(/sharpen is from 0 to 1/);
|
||||
expect(adjustError({ contrast: 2 })).toMatch(/contrast is from -1 to 1/);
|
||||
expect(adjustError({ contrast: -1, vignette: 1 })).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("<Nudge adjust>", () => {
|
||||
test("the part wears the adjustment's filter, after its key, with the filter beside it", () => {
|
||||
const html = at(<Nudge adjust={{ contrast: 0.4, saturation: 0.2 }} chroma={{ color: "#00ff00" }}><div>hi</div></Nudge>);
|
||||
const id = adjustId({ contrast: 0.4, saturation: 0.2 });
|
||||
expect(html).toContain(`filter:url(#raea-key-00ff00-50-20) url(#${id})`);
|
||||
expect(html).toContain(`<filter id="${id}"`);
|
||||
expect(html).toContain('type="table"');
|
||||
expect(html).toContain('type="saturate" values="1.2"');
|
||||
});
|
||||
|
||||
test("a vignette is a layer over the part's frame", () => {
|
||||
const html = at(<Nudge adjust={{ vignette: 0.5 }}><div>hi</div></Nudge>);
|
||||
expect(html).toContain("radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.425) 100%)");
|
||||
// a vignette alone needs no filter
|
||||
expect(html).not.toContain("<filter");
|
||||
});
|
||||
|
||||
test("keyed: an adjustment's number over time, from as shot, without a still adjust", () => {
|
||||
const el = (frame: number) => at(<Nudge keys={{ "adjust.saturation": [[0, 0], [10, -1]] }}><div>hi</div></Nudge>, frame);
|
||||
expect(el(0)).not.toContain("<filter");
|
||||
expect(el(5)).toContain('type="saturate" values="0.5"');
|
||||
expect(el(10)).toContain('type="saturate" values="0"');
|
||||
});
|
||||
|
||||
test("an adjustment out of range fails", () => {
|
||||
expect(() => at(<Nudge adjust={{ grain: 2 }}><div>hi</div></Nudge>)).toThrow(/grain is from 0 to 1/);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,172 @@
|
||||
// A part's mask, blend and chroma key (docs/timeline.feature TL7f): CapCut's Mask, Blend and Chroma key, drawn by
|
||||
// <Nudge> from sdk/video cutout.ts.
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { BLEND_KINDS, chromaError, chromaId, chromaMatrix, maskError, maskPlain, maskStyle, maskSvg } from "@raea/video/cutout";
|
||||
import { Video } from "@raea/video/media";
|
||||
import { Nudge } from "@raea/video/nudge";
|
||||
import { renderFrame } from "../src/test";
|
||||
|
||||
const opts = { fps: 30, width: 1920, height: 1080, durationInFrames: 30, frame: 0 };
|
||||
const attr = (svg: string, name: string) => [...svg.matchAll(new RegExp(` ${name}="([^"]*)"`, "g"))].map((m) => m[1]);
|
||||
|
||||
describe("a mask keeps a shape of the part (TL7f)", () => {
|
||||
test("a circle chosen is round on any frame: half the shorter side across, in the middle", () => {
|
||||
expect(maskPlain("circle", 1920, 1080)).toMatchObject({ x: 0.5, y: 0.5, w: 0.28125, h: 0.5, feather: 0, invert: false });
|
||||
const svg = maskSvg({ kind: "circle" }, 1920, 1080);
|
||||
expect(attr(svg, "cx")).toEqual(["960"]);
|
||||
expect(attr(svg, "rx")).toEqual(["270"]);
|
||||
expect(attr(svg, "ry")).toEqual(["270"]);
|
||||
expect(svg).not.toContain("<filter");
|
||||
});
|
||||
|
||||
test("each shape: a line keeps what is above it, a mirror a band, a rectangle its corners rounded, a heart and a star in their box", () => {
|
||||
const line = maskSvg({ kind: "line", y: 0.25 }, 1000, 500).split("<rect")[1];
|
||||
// a rect reaching far up, its bottom edge on the line at 125 px
|
||||
expect(Number(attr(line, "y")[0]) + Number(attr(line, "height")[0])).toBe(125);
|
||||
const mirror = maskSvg({ kind: "mirror", h: 0.2 }, 1000, 500).split("<rect")[1];
|
||||
expect(attr(mirror, "height")).toEqual(["100"]);
|
||||
expect(attr(maskSvg({ kind: "rect", w: 0.4, h: 0.4, round: 1 }, 1000, 500), "rx")).toEqual(["100"]);
|
||||
expect(maskSvg({ kind: "heart" }, 1000, 500)).toContain("<path");
|
||||
expect(maskSvg({ kind: "star" }, 1000, 500)).toContain("<polygon");
|
||||
});
|
||||
|
||||
test("turned about its centre, feathered by a blur no larger than the frame and its reach, inverted by excluding it from a solid layer", () => {
|
||||
expect(maskSvg({ kind: "rect", x: 0.25, y: 0.5, rotate: 30 }, 1000, 500)).toContain('transform="rotate(30 250 250)"');
|
||||
const soft = maskSvg({ kind: "circle", feather: 1 }, 1000, 500);
|
||||
expect(attr(soft, "stdDeviation")).toEqual(["25"]);
|
||||
expect(soft).toContain('x="-75" y="-75" width="1150" height="650"');
|
||||
const inverted = maskStyle({ kind: "circle", invert: true }, 1000, 500);
|
||||
expect(inverted.maskImage.startsWith("linear-gradient(#000, #000), url(")).toBe(true);
|
||||
expect(inverted).toMatchObject({ maskComposite: "exclude", WebkitMaskComposite: "xor" });
|
||||
expect(maskStyle({ kind: "circle" }, 1000, 500)).not.toHaveProperty("maskComposite");
|
||||
});
|
||||
|
||||
test("as a mask image the size of the part, its own url()s escaped so they aren't read as the page's", () => {
|
||||
const s = maskStyle({ kind: "circle", feather: 0.5 }, 1920, 1080);
|
||||
expect(s.maskImage.startsWith('url("data:image/svg+xml,')).toBe(true);
|
||||
expect(s.maskImage.slice(5)).not.toMatch(/url\(/);
|
||||
expect(s).toMatchObject({ maskSize: "100% 100%", maskRepeat: "no-repeat" });
|
||||
});
|
||||
|
||||
test("a kind it hasn't got, or a value out of range, is refused", () => {
|
||||
expect(maskError({ kind: "moon" as never })).toMatch(/kind is one of line, mirror, circle, rect, heart, star/);
|
||||
expect(maskError({ kind: "circle", feather: 2 })).toMatch(/feather is from 0 to 1/);
|
||||
expect(maskError({ kind: "circle", w: -1 })).toMatch(/0 or more/);
|
||||
expect(maskError({ kind: "circle", x: 0.2 })).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("a chroma key takes a colour out (TL7f)", () => {
|
||||
// what the matrix gives a colour's alpha, as the filter clamps it
|
||||
const alpha = (values: string, [r, g, b]: number[]) => {
|
||||
const a = values.split(" ").map(Number).slice(15);
|
||||
return Math.min(1, Math.max(0, a[0] * r + a[1] * g + a[2] * b + a[4]));
|
||||
};
|
||||
|
||||
test("a green screen goes, red and white and grey stay, a dark green is half seen", () => {
|
||||
const m = chromaMatrix({ color: "#00ff00" });
|
||||
expect(alpha(m, [0, 1, 0])).toBe(0);
|
||||
expect(alpha(m, [0.1, 0.9, 0.15])).toBe(0);
|
||||
expect(alpha(m, [1, 0, 0])).toBe(1);
|
||||
expect(alpha(m, [1, 1, 1])).toBe(1);
|
||||
expect(alpha(m, [0.4, 0.4, 0.4])).toBe(1);
|
||||
const dark = alpha(m, [0, 0.5, 0]);
|
||||
expect(dark).toBeGreaterThan(0);
|
||||
expect(dark).toBeLessThan(1);
|
||||
// the colour rows are as they were
|
||||
expect(m.split(" ").slice(0, 15).join(" ")).toBe("1 0 0 0 0 0 1 0 0 0 0 0 1 0 0");
|
||||
});
|
||||
|
||||
test("more strength takes more of the hue; more shadow lets the screen's shadows through half seen", () => {
|
||||
const pale = [0.5, 0.8, 0.5];
|
||||
expect(alpha(chromaMatrix({ color: "#0f0", strength: 0.2 }), pale)).toBe(1);
|
||||
expect(alpha(chromaMatrix({ color: "#0f0", strength: 1 }), pale)).toBe(0);
|
||||
// a shadow on the screen: a darker, duller green
|
||||
const shade = [0.05, 0.5, 0.05];
|
||||
expect(alpha(chromaMatrix({ color: "#0f0", shadow: 0 }), shade)).toBe(1);
|
||||
const half = alpha(chromaMatrix({ color: "#0f0", shadow: 1 }), shade);
|
||||
expect(half).toBeGreaterThan(0.1);
|
||||
expect(half).toBeLessThan(0.5);
|
||||
});
|
||||
|
||||
test("a blue screen keys blue, not green", () => {
|
||||
const m = chromaMatrix({ color: "#1040e0" });
|
||||
expect(alpha(m, [0.06, 0.25, 0.88])).toBe(0);
|
||||
expect(alpha(m, [0, 1, 0])).toBe(1);
|
||||
});
|
||||
|
||||
test("a grey has no hue to key by, and a colour must be one", () => {
|
||||
expect(chromaError({ color: "#808080" })).toMatch(/is grey/);
|
||||
expect(chromaError({ color: "green" })).toMatch(/#rrggbb or #rgb/);
|
||||
expect(chromaError({ color: "#0f0", strength: 3 })).toMatch(/strength is from 0 to 1/);
|
||||
expect(chromaId({ color: "#0f0" })).toBe("raea-key-00ff00-50-20");
|
||||
});
|
||||
});
|
||||
|
||||
describe("<Nudge> draws them on the part it places", () => {
|
||||
test("an element gets the blend, and the key as its filter before its own, drawn beside it", () => {
|
||||
const html = renderFrame(<Nudge blend="screen" chroma={{ color: "#00ff00" }}><div style={{ filter: "blur(2px)" }}>hi</div></Nudge>, opts);
|
||||
expect(html).toContain("mix-blend-mode:screen");
|
||||
expect(html).toContain("filter:url(#raea-key-00ff00-50-20) blur(2px)");
|
||||
expect(html).toContain('<filter id="raea-key-00ff00-50-20" color-interpolation-filters="sRGB"');
|
||||
expect(html).toContain("<feColorMatrix");
|
||||
expect(html).toContain('operator="in"');
|
||||
});
|
||||
|
||||
test("a masked element is placed in a full-frame layer, so the mask is laid over the frame and moves with it", () => {
|
||||
const html = renderFrame(<Nudge x={40} mask={{ kind: "circle" }}><div style={{ width: 100 }}>hi</div></Nudge>, opts);
|
||||
expect(html).toMatch(/<div style="[^"]*transform:translate\(40px, 0px\)[^"]*mask-image:url\("data:image\/svg\+xml,[^"]*"><div style="width:100px">hi<\/div><\/div>/);
|
||||
});
|
||||
|
||||
test("a component is placed in a full-frame layer that carries them; normal is no blend", () => {
|
||||
const Part = () => <p>part</p>;
|
||||
const html = renderFrame(<Nudge mask={{ kind: "line", rotate: 10 }} blend="normal"><Part /></Nudge>, opts);
|
||||
expect(html).toContain("mask-image:url(");
|
||||
expect(html).not.toContain("mix-blend-mode");
|
||||
});
|
||||
|
||||
test("a blend it hasn't got, a grey key and a bad mask are refused", () => {
|
||||
expect(BLEND_KINDS).toContain("plus-lighter");
|
||||
expect(() => renderFrame(<Nudge blend={"glow" as never}><div /></Nudge>, opts)).toThrow(/blend is one of normal, darken, screen/);
|
||||
expect(() => renderFrame(<Nudge chroma={{ color: "#777777" }}><div /></Nudge>, opts)).toThrow(/is grey/);
|
||||
expect(() => renderFrame(<Nudge mask={{ kind: "circle", round: 4 }}><div /></Nudge>, opts)).toThrow(/round is from 0 to 1/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("a <Video> wears its cutout's mattes (TL7l in a composition)", () => {
|
||||
const seq = (html: string) => /mask-image:url\(([^)]*)\)/.exec(html)?.[1];
|
||||
const at = (frame: number, more: object = {}) =>
|
||||
renderFrame(<Video src="/media/clips/take.mp4" startFrom={30} matte={{ src: "/media/matte/take-person", fps: 30, count: 90 }} {...more} />, { ...opts, durationInFrames: 120, frame });
|
||||
|
||||
test("the matte its source frame was made from, as its mask over the picture as it is placed", () => {
|
||||
// from its frame 30 on: the composition's frame 10 shows the file's frame 40
|
||||
expect(seq(at(10))).toBe("/media/matte/take-person/m00041.png");
|
||||
expect(at(10)).toContain("mask-size:cover");
|
||||
expect(at(10)).toContain("mask-position:50% 50%");
|
||||
expect(seq(at(0, { playbackRate: 2 }))).toBe("/media/matte/take-person/m00031.png");
|
||||
expect(seq(at(5, { playbackRate: 2 }))).toBe("/media/matte/take-person/m00041.png");
|
||||
// contained, or stretched to the box, the matte is too
|
||||
expect(at(10, { style: { objectFit: "contain" } })).toContain("mask-size:contain");
|
||||
expect(at(10, { style: { objectFit: "fill" } })).toContain("mask-size:100% 100%");
|
||||
});
|
||||
|
||||
test("one matte each few frames is held until the next; past the last, the last", () => {
|
||||
const sparse = { matte: { src: "/media/matte/take-person/", fps: 30, every: 4, count: 23 } };
|
||||
expect(seq(at(10, sparse))).toBe("/media/matte/take-person/m00011.png");
|
||||
expect(seq(at(13, sparse))).toBe("/media/matte/take-person/m00011.png");
|
||||
expect(seq(at(14, sparse))).toBe("/media/matte/take-person/m00012.png");
|
||||
expect(seq(at(110, sparse))).toBe("/media/matte/take-person/m00023.png");
|
||||
});
|
||||
|
||||
test("a file at another rate than the composition's: the matte of the file's own frame", () => {
|
||||
// a 24 fps file in a 30 fps composition: the composition's frame 30 from the start is the file's 1 s, its frame 24
|
||||
expect(seq(renderFrame(<Video src="/media/clips/take.mp4" matte={{ src: "/media/matte/t", fps: 24, count: 72 }} />, { ...opts, durationInFrames: 120, frame: 30 }))).toBe("/media/matte/t/m00025.png");
|
||||
});
|
||||
|
||||
test("none without a matte; what it can't wear is said", () => {
|
||||
expect(seq(renderFrame(<Video src="/media/clips/take.mp4" />, opts))).toBeUndefined();
|
||||
expect(() => at(0, { framing: "face" })).toThrow(/can't go with framing/);
|
||||
expect(() => at(0, { matte: { src: "/media/matte/t", fps: 0, count: 3 } })).toThrow(/fps/);
|
||||
expect(() => at(0, { matte: { src: "/media/matte/t", fps: 30, count: 0 } })).toThrow(/count/);
|
||||
});
|
||||
});
|
||||
Loaded 100 of 215 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user