Compare commits

...
161 Commits
Author SHA1 Message Date
shinyobjectz a18b7c757c whats-new 0.1.9: Google's AI connects again (raea-feed #102, Antigravity)
The 0.1.9 app carries raea-feed #102 (merged 0747749059): Google stopped serving Gemini CLI to personal accounts on
06-18, so the app's Google pick starts Antigravity instead. A paying user's bug report found it. docs/ is outside what
a promotion compares, so v0.1.9 can still be promoted from rc2.
2026-11-22 13:59:28 -08:00
shinyobjectz a2f91a82c3 Windows: vendor/bevy_pbr's shaders keep LF, so raea's forks of them pass their hash check
0.1.9-rc1's Windows pack panicked at its first render: "Bevy's bevy_pbr/volumetric_fog/volumetric_fog.wesl changed
(hash 0x1849e019c9fbec64, raea's fork was taken from 0xd6b92688464146be)". swap_embedded_shader hashes the embedded
bytes, vendor/bevy_pbr is now in the tree, and a Windows checkout turns its LF into CRLF; shadows.wesl and
environment_filter.wesl, forked the same way, would have stopped next. Mac and Linux passed. Only bevy_pbr's shaders
are pinned: all are stored LF, while hanabi's are stored CRLF and are hashed by nothing.
2026-11-22 13:14:10 -08:00
shinyobjectz be71820281 L2: the app's build links ~/raea's apps/site, as a release's does
Conformance gave no results on cdd44b172d: its app build (vite, blitz/vite.config.ts) stopped at host/library/local.ts's
import of apps/site/api/src/library/fuse.ts, which the private repo holds and a public commit doesn't. l2.sh links it
from ~/raea beside the app's node_modules, as the release builds the app in a maintainer's checkout.
2026-11-22 12:48:38 -08:00
shinyobjectz 1c63d49e8b Plugin bindings: SolariLighting's first_bounce_probability and the Tint material, as L2's registry read has them
L2 on cdd44b172d found sdk/plugins/src drifted from the plugin build's TypeRegistry: the realism stack added
SolariLighting::first_bounce_probability and MeshMaterial3d<ExtendedMaterial<StandardMaterial, Tint>>, which only that
build can read (L1 doesn't make it). Generated by tools/bevy-plugins.sh gen with L2's raea-bevy-sdk; its check then
says the bench matches its lock.
2026-11-22 12:45:29 -08:00
shinyobjectz e3b55f2990 skills pin: raea-skills #114, so 0.1.9's strict skills gate passes
The release's gate (tools/release.sh: SKILLS_STRICT=1, its own raea) failed at 584be72747 where L1's lane check only
warns: the pinned cli.md was made before raea ask reached raea's help, and raea/random-colors (#176) was taught
nowhere. craft/motion.md now teaches random, interpolateColors and OffthreadVideo where it says how to seed what holds
still; tools/skills.sh skips the module itself, whose names come from raea; the pin takes raea-skills 6c7cbf0, with
cli.md and the guide's copy generated from raea's main and raea-feed's. In a clean archive with these: skills: ok.
2026-11-22 12:13:09 -08:00
shinyobjectz 584be72747 whats-new 0.1.9: the long film's own numbers, as the launch thread gives them
Past 24 GB before (memguard stopped it at 28 to 33 GB), a 4.8 GB peak now (4202a87850), beside the 13,000-frame
control's 8%.
2026-11-22 12:02:55 -08:00
shinyobjectz 8bc4afdd4a whats-new 0.1.9: 3D renders check themselves, parts follow the frame, long films whole, light, nothing to build, raea ask
RL4's notes for 0.1.9, from the 145 commits since v0.1.8 and raea-feed's merges since 11-19 (#86, #92, #98-#101), each
claim checked against its commit or the release build's usage. Known carries 0.1.8's items that still stand, drops
DirectX 12's slower compile for DXC's unmeasured one (#215), and adds the whole-film frame-pure fault Stay showed.
2026-11-22 11:58:06 -08:00
shinyobjectz 2dbedfe1d2 L2 on a public commit: the feed app at raea-feed's main, as L1 reads it
A commit of the public repo records no apps/app (neither its files nor a submodule pointer: the app is raea-feed's,
outside the export), so l2.sh checked out an empty commit in its app clone and stopped before building. It now fetches
raea-feed's main into the checkout's own clone, the commit L1's skills step reads when the tree names none.
2026-11-22 11:51:27 -08:00
shinyobjectz cdd44b172d SG9, SG13: Stay on the 0.1.9 stack, its three errors cleared and its whole render's light caught
Stay's composition (in its project, not this repo) now ends the montage's glasshouse move where it comes nearest the
plant, and its two words over the picture say data-allow-overlap: rendered whole it has no camera-reverse or
type-over-part error, and its 35 chunks (tools/film.sh's route) render with none. Rendered whole it has 12 frame-pure
errors, each a later shot drawn far darker than the same frame alone: SG9 doing its job on the fault Stay's code works
round, written down as what's left.
2026-11-22 11:45:26 -08:00
shinyobjectz 4797b5ca61 SG4a: the bounce spills to a scratch file as the frames come
The render's sound streamer reserved both channels for the whole render and filled them a frame at a time, so a
render's resident memory grew 12.8 KB a frame even with nothing to hear (Malloc Large's resident pages climbing while
its size held: about 143 MB over the 13,200-frame control after its first minute). Each frame's samples now go to an
unlinked scratch file (raea_io_home::scratch_file) and are read back once after the last frame, and only when something
sounded: a silent render lets its bounce go unread. A full disk while writing it is said as one. raea-sys-mix's
offline tests pass unchanged (the bounce reads back the same samples).
2026-11-22 11:15:00 -08:00
shinyobjectz 3c8fc66bc0 SG4a: the end checks run as the frames come
raea-sys-stage's Staging and raea-sys-contact's Clipping take each frame's parts as it's drawn and keep only
what their verdicts read: each frame's camera, each block of words' and each named part's place on screen, each
frame's cover and subject, the words over parts, and the solids of the parts on screen (a part's let go once
it's been gone 120 frames, an overlap's kept until it's said; only the last frame's pair tests are reused).
raea-runtime-endchecks hands each frame in; a still's frames go in one at a time, their parts made and let go.
Nothing keeps a render's parts now: raea-io-kept is gone. raea-core-scene's ids_of names a frame's parts as
spans_of follows them. Contact's unused slice check and told are gone, its deepest hit shared with the lint.

The film: the same 439 errors, 705 warns and 47 notes in the same order; end checks 0.6 s (22.7 s); a 4.06 GB
resident peak (4.76). The control's end checks add nothing (1.32 GB after its last frame; they rose to 1.52 GB).
Its frames still grow 25% after the first minute (docs/stage-guards.feature).

LX7's plan row follows the clipping check's per-frame code into clip.rs. raea-cli's tests name raea scene's
usage where it moved (raea-app-scene), and an unused alias goes.
2026-11-22 09:41:52 -08:00
shinyobjectz c2e10d5181 skills pin: raea-skills #113, the 3D guides' copies and the SDK reference for nobuild 2026-11-22 09:41:52 -08:00
shinyobjectz eb5ce854ca Manual reference: <Environment portals> and FogVolume's soft and taper (tools/manual-ref.sh gen)
The SDK pages, generated on origin/main with this stack: the sky portals and the fog volume's soft edges and taper
from the Solari look work below nobuild.
2026-11-22 09:41:52 -08:00
shinyobjectz cd03baf109 nobuild: its copied code folded into what it copies (dupes: 293 exact, 57 near)
- raea-sys-rt: one GPU timer for a traced pass (timer.rs), used by raea GI and the far sun; one reader for a pass's
  reach (RAEA_SUN_FAR, RAEA_TRACED_AO); one compute-pipeline queue (cache::pipeline) for GI and its cache.
- raea-io-trace: overrides(), the variables still set over a component's props, said once a run; <VolumetricFog> and
  <SolariLighting> both read through it.
- raea-render-raytrace takes raea-sys-post's Halton places (a facility crate) instead of its own copy; the settings'
  split, taa and one_pass are read where metalfx uses them.
- engine-shaders keeps its declared shaders in a map; fog reads RAEA_FOG_EPI's places in one match; smaller rewrites
  in plugins, look, stats, lod, compose and post.
- tools/dupes.max: exact=293, near=57.
2026-11-22 09:41:52 -08:00
shinyobjectz f8c16d2656 nobuild: the crates' sizes, layers, taxonomy and licences L1 checks
raea-sys-frame was past its 2,000 lines: the engine's own shaders move to their own crate, raea-sys-engine-shaders
(<ShaderConstants>' type is raea_sys_engine_shaders::consts::ShaderConstants), and the path tracer moves into
raea-sys-rt beside the traced passes that use it (<Pathtracer>'s type is raea_sys_rt::pathtracer::PathtracerSettings).
raea-render was past its limit too: the AOV prepasses and readback move into raea-sys-compose::aov, raea-render
keeps the plugin and its want/capture. raea-render-raytrace, raea-sys-fog, raea-runtime-export and raea-render name
the new paths; tools/layers.toml places raea-sys-gi and raea-sys-engine-shaders; tools/taxonomy.list has
ShaderConstants.

tools/licenses.sh measures raea-cli without the plugin catalog's edge (the catalog is its own feature), so NOTICE's
catalog and LICENSES/ drop 18 crates only the catalog's optional plugins reached; NOTICE's opening sentence still
covers every crate in Cargo.lock.
2026-11-22 09:15:58 -08:00
shinyobjectz c6c165ca4c Solari: the binding array's dummy buffer is one traced vertex, 64 bytes
7c12c971c4 widened Solari's traced vertex to 64 bytes for its colour, but the dummy buffer bound into a binding array's
freed slots stayed 48, the vertex before. Once a part's mesh slab was freed, its slot held the dummy, and the GPU
refused the frame (buffer bound with size 48 where the shader expects 64): Stay stopped at frame 1699 every time, in
a whole render only, never in stills. The BLAS's stride and the dummy now read one constant, VERTEX_BYTES, and Stay
renders to its end.
2026-11-22 09:15:58 -08:00
shinyobjectz 97e3fc3892 vendor: bevy_pbr in the manifest, and Solari's thin-surface change in restir.wesl marked
nobuild vendored bevy_pbr (G-buffer transmission and pre-exposed emission, the jittered prepass's dither, RaeaFarSun
for LT21, RaeaGiScreen for LT3) and patched it in Cargo.toml, but vendor/vendor.toml didn't list it, and restir.wesl's
visibility rays from the sample's side carried no raea: mark, so tools/vendor check failed. Both stated, with each
patch's reason and the way back to upstream.
2026-11-22 09:15:58 -08:00
shinyobjectz 2487f40dd1 NB2a: raea check's blotching debug read as a stat channel in main's scorer
Folded in when nobuild met main: main moved the blotching closure into scorer(), so this commit's RAEA_CHECK_DEBUG
read through raea_io_trace::stat moves there with it.
2026-11-22 09:15:58 -08:00
shinyobjectz e9909de88f NB2a: debug views as channels with values; messages that told an author to run cargo
io/trace's stat_value gives a channel a value (pass=depth, lod_debug=time, fog_skip=a,b; a channel chosen bare is
"1"), its variable still the override. Nine debug views (clay, fog_debug, fog_show_fallback, lod_debug, pass,
pass_rays, pass_reach, song_debug, volume_debug), inspect and fog_skip go through it, so a composition chooses them
with stats.on. tools/nobuild.sh stats: pass=depth chosen from TypeScript draws RAEA_PASS=depth's frame (max 0 levels
apart, 240 from the picture), and its static check covers the 35 stat and view variables decided done.

raea song, framing="face" and matchmove say to update raea when raea-perceive is missing (releases ship it) rather than
to build it. export-game says this raea ships without raea-game and how to ask for it; the note on the smaller player
prints only to a checkout's build.
2026-11-22 09:15:58 -08:00
shinyobjectz ee42e31469 NB2a: stat channels and pass timings chosen and read from TypeScript
io/trace's stats.rs: a stat channel is a RAEA_ variable's name without RAEA_ (bake_trace, trace, bevy_passes), on
when the composition chose it (native("stats.on", { channels }) at its top level), when RAEA_STATS lists it, or when
its variable is set, the override. The 51 reads of 24 trace and stat variables go through raea_io_trace::stat. Each
of Bevy's render passes (RenderDiagnosticsPlugin, on by bevy_passes) and PassTimer's go into the run's totals, with
the counters engine/draws and engine/updates; native("stats.read", {}) returns them, and a run that chose a channel
prints the table and keeps stats.json in its trace folder (docs/manual/reference/cli/traces.md).

tools/nobuild.sh stats checks it: every channel decided done reads through stat(); the scene choosing bevy_passes and
trace traces, reads 9 passes and 11 draws back on its last frame, prints the table and keeps stats.json; with nothing
chosen nothing prints; RAEA_TRACE=1 and RAEA_STATS give the same trace lines. 12 frames take 12 updates.

raea-render's lines stay as they were (NB4a's plugin choice folded to one line). native-calls.ts gains the two calls,
and bevy.app.*, which raea registers now that the macOS build links the plugin catalog.
2026-11-22 09:15:58 -08:00
shinyobjectz d30c4a687a NB4a: the macOS raea carries the plugin catalog
raea-cli's macOS dependency table turns on raea-bevy-plugins/catalog and raea-runtime-react's bevy-plugins, so the
default build has every catalog plugin compiled in and adds each only when a project chooses it. tools/nobuild.sh
catalog on it: avian's ball falls and hanabi's fountain rises in a render and in play, package.json chose both, and
blur, a 2D card, fog, steady and the path tracer draw the same pixels as raea without the catalog (max 0 levels).
Windows and Linux stay as they were until their builders build it and pass the check. The check's pixel counter read
ImageMagick's colour fields one place off.
2026-11-22 09:15:58 -08:00
shinyobjectz f2bf93cbee NB4a: an Engine adds only the catalog plugins its project chooses; raea-cli's catalog feature compiles them all in
package.json raea.plugins (a list of names, or declarations keyed by name) chooses them, a scene's components and
resources under a plugin's crate add that plugin, and each chosen plugin brings the ones it needs. raea's own
registrations and a build without the catalog are unchanged. The run's trace records what was chosen and why
(plugins_chosen), and a name the build lacks is said once. sync writes engine/bevy-plugins' catalog feature: every
declared plugin but those declared "catalog": false (bevy, Bevy's optional features). tools/nobuild.sh catalog renders
and plays a project choosing avian and hanabi, and compares scenes that choose none against a raea without the catalog.
2026-11-22 09:15:58 -08:00
shinyobjectz 1dee25c609 Steady's rates, motion blur's kind, the path tracer's samples and air, and Solari's dynamic are props, each checked against its variable
Eight more environment variables become props, each variable now only an override on every camera:
- <AntiAliasing steady={{ still, moving, px }}>: steady's rates (systems/post Steady's fields), over RAEA_STEADY_*.
  RAEA_STEADY stays the every-camera form of mode="steady".
- <MotionBlur kind="shutter"|"bevy">, over RAEA_MOTION_BLUR.
- <Pathtracer samples media>, over RAEA_LIGHT_SPP and RAEA_PT_MEDIA=0. They live in raea_sys_frame::pathtracer
  (PathtracerSettings), so the fog's volumes can read media. A render draws each frame as many times as the most any
  camera asks for.
- <SolariLighting dynamic>, over RAEA_SOLARI_DYNAMIC. This was read once when the plugin was built. It is now a
  SolariSettings field, and the skin-twin and hidden-part systems run while any traced camera asks for it.

tools/nobuild.sh props gains a column for the composition the variables go on (RAEA_STEADY needs a scene without
steady), and a "traced" light path for a scene that asks for Solari or the path tracer itself. Settings with no trace
record of their own are checked by pixels alone. Three fixtures join fog.tsx: steady.tsx, blur.tsx and traced.tsx
(Pathtracer and Solari, with a slab there on the first frame only). All 15 rows pass:
- steady, its rates and the blur's kind are pixel-identical to their variables;
- the path tracer is deterministic, so samples and media compare exactly too: 21 and 27 levels from the default's;
- dynamic is as near its variable as two runs are (0.013 against 0.014), and the hidden slab's shadow is gone (5.8
  levels).

docs/nobuild.feature NB1a.
2026-11-22 09:15:58 -08:00
shinyobjectz cb40dca08b The volumetric fog's RAEA_FOG_* knobs are <VolumetricFog> props, and tools/nobuild.sh props checks each against its variable
Fourteen variables tuned the froxel fog, each read inside the render world. They are props now, the variable only an
override that wins on every camera and is said once:
- shadow (what dims light through a volume);
- heroExact, epipolar (the shafts' samples) and tricubic;
- under <SolariLighting>, solari: false, or its candidates, history frames, sky rays, what lights it, filter and guide.
mode, hero, tile, slices and samples were props already; RAEA_FOG_MODE, RAEA_FOG_HERO and RAEA_FOG_GRID now override
them the same way.

raea-sys-fog's froxel/tuning.rs reads the camera row's new vfog_* columns into FroxelFog.tune, which the render world
reads per view. Its parts:
- the shadow rule from the first fog camera;
- the hero passes' pipelines keyed by tricubic;
- Solari's fog light on or off for each view.
The settings each camera draws with go into the run's trace as fog_settings.

tools/nobuild.sh props renders each row of tools/nobuild/props.tsv twice and compares them: the composition that sets
the prop, and the scene's base with the variable. A raster frame must match exactly. A Solari frame must be as near
as two base runs, with the prop moving it well past that. The settings records must match. tools/nobuild/fog.tsx has
nine compositions, and all nine pass:
- the seven raster ones are pixel-identical (max 0) and each unlike the default;
- Solari's settings agree within 0.007 levels (noise 0.007) and move the frame 1.5;
- Solari's off agrees within 0.010 and moves the frame 9.6.

The inventory scan reads new files as well as tracked ones (git grep --untracked, .gitignore still honoured).

docs/nobuild.feature NB1a.
2026-11-22 09:15:58 -08:00
shinyobjectz 177f74e376 Every shader constant in the inventory is set from TypeScript: arrays and vectors too, toon and lens embedded, Solari's inline numbers named
<ShaderConstants> takes a list for an array or a vector (array<f32, 6>, vec3<f32>, vec3). The list has as many values
as the constant holds, and each keeps the element type. An array of vectors, or a length that doesn't match, is
reported and left alone.

toon.wesl, toon_outline.wesl and lens.wesl move from load_internal_asset! to the embedded registry, so a project's
engine-shaders/ and <ShaderConstants> reach them too. The toon and lens scene is pixel-identical before and after
(max difference 0, three frames).

The four numbers written inline in raea's patches to Solari and in emit_taa are now named constants, with typed props:
- SPECULAR_MOTION_ROUGHNESS (0.0625) and REFLECTION_DEPTH_SHARE (0.5), as mirror.motionRoughness and mirror.depthShare;
- GLOSSY_NEE_FLOOR (0.25), as glossyLightFloor;
- emit_taa's STILL_LOW, STILL_HIGH, MOVING_GAIN and MOVING_FLOOR, as emissiveClamp.
The jitter cycle's 8 is SolariSettings.jitter_frames (<SolariLighting jitterFrames>). The trace's solari_settings
reads 8 by default and 16 from jitterFrames={16}.

tools/nobuild.sh consts is the per-row check. It writes one scene that sets every inventoried shader constant through
<ShaderConstants>, renders it with every pass on, and records each row as settable, refused or absent in
docs/nobuild/consts.tsv. Result: 87 of 88 are settable. The one refused is raea_sys_gi's SPOTS, an array of vec2 that
stays as it is.

docs/nobuild.feature NB1a.
2026-11-22 09:15:58 -08:00
shinyobjectz b3c2394cb7 A constant in any engine shader is set from TypeScript: <ShaderConstants>, and <SolariLighting constants> for Solari's
<ShaderConstants shader="bevy_solari/realtime/restir.wesl" values={{ SPATIAL_REUSE_RADIUS_PIXELS: 24 }} /> (raea/pbr)
puts a reflected raea_sys_frame::engine_shaders::consts::ShaderConstants on a bare entity. When an Engine opens, the
first frame's component rows are read and each named `const NAME ... = EXPR;` is rewritten before anything compiles,
in whichever text the Engine draws with (the binary's, a project's engine-shaders/ copy, or RAEA_ENGINE_SHADERS'
copy). An embedded shader is rewritten in the registry and swapped in Assets<Shader> as its first load lands. A shader
a crate hands to wgpu (emit_taa, the MetalFX guides) gets the constant through engine_shaders::text. The const keeps
its type: a float literal, or an expression of floats such as PI, takes a float; a u32 or an i32 takes a whole number;
a bool takes a boolean. A name the shader doesn't declare, an array, a vector, or a shader the Engine doesn't have is
reported and left alone. The constants are compiled in once, so a value that a later frame brings or changes isn't
drawn, and raea says so once. The trace's engine_shaders and engine_shader_text events give each changed shader's text
by its FNV hash. Two runs drew with the same shaders when the hashes agree, whatever the pixel noise.

<SolariLighting constants> types thirteen of Solari's and the denoiser's: spatialReuse, mirrorRoughness, cacheEnd,
cacheLifetime, cacheSearch, the three reconnect rules, mirror's four (RT17's replacement rules) and emissiveHistory
(emit_taa's HISTORY_CAP).

Checked:
- PI = 4.5 in bevy_render/maths.wesl, from <ShaderConstants> and as the same edit in engine-shaders/, compiles to the
  same text (0xc654f1dc03f921b3), and the pixels are identical on all four frames (max difference 0). 57% of the
  pixels moved from the plain run.
- On the desk under Solari, constants={{ mirrorRoughness: 0.3, emissiveHistory: 2 }} and the same two edits in
  engine-shaders/ compile the same bindings.wesl (0xf8394379c716471c) and emit_taa (0x66661df32dc6be6b). Both mirror
  the monitor stand's base; the plain run doesn't.
- A missing name, an array (look.wesl's DARK) and a missing shader are each reported, and those shaders are left
  unchanged.
- The SDK manual pages are regenerated, and the 3D guides say how to use the constants.

docs/nobuild.feature NB1a.
2026-11-22 09:15:58 -08:00
shinyobjectz 737468b8cd The engine's own shaders open to a project: a file in engine-shaders/ replaces one from its first frame, with no build
A project's engine-shaders/ folder mirrors the paths Bevy embeds shaders at, <crate>/<path under its src>
(engine-shaders/bevy_pbr/render/pbr.wesl, engine-shaders/raea_render_raytrace/emit_taa.wgsl). When an Engine opens,
after every plugin has embedded its shaders, each file there replaces the binary's in Bevy's EmbeddedAssetRegistry,
and raea names them and warns that each is tied to this raea's version. A shader whose plugin loaded it during build
(load_shader_library!) is swapped in Assets<Shader> in PreUpdate, right after the asset server hands over its first
load, so the pipelines' first compile has the file's text. An AssetServer::reload would land some frames later and
recompile every pipeline that used it partway through a render. An empty file is filled with the shader this raea
draws with, so an author has the original to start from without the sources. A file that matches no engine shader is
reported as stray.

RAEA_ENGINE_SHADERS=DIR points at a raea checkout. Every .wgsl and .wesl in its git tree is read at its embedded path
(the crate named by the nearest Cargo.toml), so a session that edits an engine shader renders the edit without a
build. raea prints how many of them differ from the binary's. raea's runtime forks of Bevy's shaders
(swap_embedded_shader: shadows, volumetric fog, dof, post, the environment filter) are made from Bevy's original at
load, so tree mode leaves them as made. raea-render-raytrace's own wgpu shaders (the MetalFX guides and emit_taa)
are read the same way through engine_shaders::text, and are declared with their built-in text so they can be filled.

Checked on a lit scene and on the desk room under Solari:
- the unchanged pbr.wesl as an override is pixel-identical on all four frames;
- an inverted pbr.wesl inverts 57% of the pixels from frame 0 on;
- the same edit through RAEA_ENGINE_SHADERS gives the same pixels (max difference 0);
- emit_taa with its restore removed takes the screen's green from 67-69 to 29.8 (project) and 29.9 (tree);
- the real checkout in tree mode reads 110 shaders, none unlike the binary's, and lands 0.2 levels from a plain run,
  within run-to-run spread (two plain runs differ by 6.2);
- empty files are filled byte for byte with vendor/bevy_pbr's pbr.wesl and raytrace's two shaders.

docs/nobuild.feature NB5b; the 3D limits guide says how an author uses it.
2026-11-22 09:15:58 -08:00
shinyobjectz 82f1fb4052 <SolariLighting>'s denoiser, guides, emission and jitter are props: an A/B is two compositions, not a build
Ten choices the traced light made from environment variables read once (RAEA_SOLARI_DENOISE, _PSR, _PSR_DEPTH,
_EMISSIVE, _UPSCALE, _AA, _JITTER, RAEA_METALFX_PREEXPOSURE, RAEA_EMIT_TAA_SHARP), so trying one on a scene meant a
build or a copied binary, are now fields of raea_render_raytrace::SolariSettings, a reflected component on the camera
read per view each frame: <SolariLighting denoise guides reflectionDepth emissive upscale preexposure aa jitter
emissiveSharpness>, each prop's TSDoc saying what it changes and its default. Solari's own fields are props too
(primarySamples, secondarySamples, confidenceCap, firstBounce, and the world cache's frames, lightSamples, reach,
updates, cellSize, lodScale). Each variable still overrides its field on every camera, a developer's A/B across scenes,
and raea says so once on stderr. Every view's settings as they applied go into the run's trace (solari_settings),
the first frame and on a change.

Checked on window.tsx's orb (the window scene's live settings as <SolariLighting> props, each knob set one way by
the prop and the other by its variable): the settings each view drew with are the same for all eleven (with scale's
RAEA_SOLARI_SCALE), each differs from the defaults', and the scene's raw <BevyComponent> fields and <SolariLighting>'s
give the same. Pixels can't be compared exactly (two runs of different compositions differ by 0.45 levels on
average, of one composition by 0.11); where a knob moves the picture well past that, the prop's and the variable's
agree (denoise off 6.4 levels apart against 33 from the default; preexposure 4, 0.7 against 2.5).
2026-11-22 09:15:58 -08:00
shinyobjectz 99c3f52524 tools/nobuild.sh: why raea is built, and every cause of a build in the code with its TypeScript form
builds sorts every cargo or lane build in antsy's history by its stated purpose (the last 14 days: 2870 builds, 57.2 h,
44 sessions; 161 trying a value, a toggle, a debug view or a timing, 204 a TS-facing feature that needed engine glue).
scan lists RAEA_* environment reads, shader constants, the binaries' optional features, declared Bevy plugins, places
that tell an author to run cargo, and causes written down by hand, each joined with its decision (class, TypeScript
form, check, status) into docs/nobuild/inventory.tsv: 432 causes, 224 that stay (machine settings, raea's own
plumbing, a shader's own math) and 214 open.
2026-11-22 09:15:58 -08:00
shinyobjectz a691968e57 A glossy reflection no longer trails what it shows: the denoiser takes its reflection's depth
MetalFX's denoiser was given the glass's own depth on a glossy screen, so when the orb it reflected moved on there was no
disocclusion for it to see, and it smeared the orb's history along its path. Solari's guides now put a glossy pixel that
moves as its reflection does (perceptual roughness up to 0.25) and mostly reflects (a specular share of 0.5 or more) as
far off as what it reflects, as a mirror's already was, and keep it on the frames it draws its diffuse lobe, as its
motion is kept; MetalFX takes that guide depth (R32Float) in place of the prepass's. A glossy pixel whose reflection
leaves the scene gets the depth of the far point its motion is of: left unwritten (0, the sky's), MetalFX darkened
window.tsx's shelves, far from those pixels, by 8%.

window.tsx (736x981, Solari live preset, every frame drawn once), the worst tile against the same moment settled:
the monitor's tile with an orb crossing, frame 50, +0.71 -> +0.08 stops; every other event, the pans, the flicker,
blur.tsx's trail (0 px) and the forest's canopy (1.11 of the path tracer's) as before; photo 1's desk-still the same
(lit tiles within 0.08 stops, the CRT's 0.0). RAEA_SOLARI_PSR_DEPTH=0 gives the denoiser the prepass's depth.
2026-11-22 09:15:58 -08:00
shinyobjectz 8bd79bd034 Split emission: what a pixel showed is let go once it has gone
RT11 gathered Solari's split emission over frames with no clamp, and a still pixel skipped the depth test, so sky
glimpsed through twigs in some jittered frames kept its light. That also kept whatever a still pixel showed once it had
gone: a 30000-nit orb crossing the desk left a white tube along its path, and one taken or switched off stayed white for
seconds (docs/raytracing.feature RT32).

Each history now keeps the depths it was gathered over (the history depth is Rgba32Float) and, for the nearest of
them, the evidence: how often it is about, how many frames it hasn't been, and whether it was moving when last seen,
all carried with the history as it's reprojected. A still pixel's history is:
- dropped where none of those depths is about it now (a pickup taken, a light that starts off from rest)
- held to the emission about it (3 x 3 samples) and its evidence started again where its nearest surface has gone:
  away longer than a surface about nearly every frame can be, away the jitter's whole cycle (8 / s^2 frames, from
  upscale.rs), or moving when last seen (an orb's rim as it passed)
- held to the emission about it where every surface it saw is about (a lamp switched off goes dark at once)
Where the view moves, a history is kept if its depth is among those about it and its nearest surface hasn't gone; it's
held only above four times the brightest emission within the history read's reach (5 x 5), and one that fails keeps
one frame's weight. A twig is found again by some jitter position within a cycle, so the canopy keeps its light.
RAEA_EMIT_TAA_DEBUG=4 paints which rule held each pixel.

Measured (lightbench window.tsx, 736x981, the Solari live preset, every frame rendered, each drawn once; the worst of
256 tiles against the same moment held still and settled, whose own noise is 0.07-0.10 stops), before -> after:
- an orb crossing the desk, still camera, frames 30/50/70: +3.61/+3.47/+3.38 -> +0.37/+0.71/+0.21 stops (what's left
  is the monitor's glossy reflection and the desk's lighting lagging the orb)
- one that starts from rest, frames 50/70: +2.42/+3.68 -> +0.31/+0.34 (its rim fades within the jitter's cycle)
- taken, and switched off, still camera: +2.29 and +2.56 -> 0.19 and 0.18 at most
- the same while the camera pans: +2.03 and +2.29 -> 0.19 and 0.17 at most
- blur.tsx's ball over an empty background: 14682 px of trail at frame 11 -> 0
- photo 2 drifting: 0 px jumping 80 levels from frame to frame, before and after
- the forest's canopy against the path tracer: 1.09 -> 1.11 (the whole frame 1.09 both)
2026-11-22 09:15:58 -08:00
shinyobjectz 3796d708db Renders draw each frame once: the Engine's reads skip the frame drawn last
Before each frame f, a render with 3D drew frame f - 1 again, so the Engine's reads (S2d) answer from f - 1's World. In
order, f - 1 is the frame drawn last and its World is f - 1's already; engine_before's comment said that frame was left
as it was, but Engine::draw skips a redraw only when a Bevy plugin is active. So every frame of a render drew twice,
and every temporal pass (Solari's, MetalFX's, the split emission's) took a second update in which nothing moved, which
live play never draws. With MotionBlur's pre-step on top, a blurred render drew each frame four times.

Engine::drawn says which frame drew last, and engine_before draws f - 1 only when it isn't.

Measured (lightbench window.tsx under Solari, 150 frames): the emission pass ran 307 times, now 158 (150 and the
load's 8 warm-ups); live play runs it once a presented frame. A moving orb's rim, seen still on each second draw,
had stayed as rings at every place it had been. The bevy-ts cases: 89 pass and 4 open before and after (the
world-read cases among the passes), in 1m55s instead of 2m23s. Motion blur unchanged: the shutter's three scores
(0.002, 0.067/0.034, 0.044/0.044), a camera's jump 0.00 levels off the sharp frame, a dash blurred from frame 1.
2026-11-22 09:15:58 -08:00
shinyobjectz 2929ce6a04 Camera cuts: a camera that jumps drops its history, and motion blur skips the jump
A cut to another camera was marked (Shots, RR2), but one camera moved far
in one frame, as a game's respawn or teleport moves it, was not. Solari's
and MetalFX's history carried the last view into the new one for half a
second, steady's filter blended it in, and motion blur streaked every pixel
along the jump.

raea-sys-post cut.rs sets CameraCut on each 3D camera every frame. A jump is
a turn of more than half the field of view in one frame, a lens changed by
half or more, or a step ten times the camera's recent pace and longer than
ten near planes. A camera's first move after it appears or cuts opens a
shot and is no step cut, unless it was seen resting first (unmoved across
two consecutive film frames). So a shot that opens on a fast move keeps its
blur, and so does a frame drawn alone with --at: the engine loads that
frame's pose at frame 0, then steps from the frame before. On a cut,
Solari's reset is set (MetalFX's denoiser, its scaler and emit_taa follow
it), steady starts its history again, and the shutter draws nothing.

Measured (lightbench window.tsx at 736x981 under Solari, the live preset;
each frame after the cut against the new view settled; worst 1/8 tile):
- one camera jumping to a view it never saw: first three frames 0.50, 0.43,
  0.38 stops -> 0.17, 0.13, 0.12 (a reset by hand: 0.14, 0.13, 0.12)
- a 90-degree flick in 15 frames: unchanged (no cut), 0.11 stops at its end
- blur.tsx, a 3 m jump with blur on: the jump frame 70.8 levels off the
  sharp frame -> 0.0. A pan of 1.5 m a frame from frame 0 is still blurred
  from frame 1, and its --at frame matches the full render's
- the three shutter scores unchanged (0.002, 0.067/0.034, 0.044/0.044)

Steady's reset follows the same flag; no steady scene was cut here.
2026-11-22 09:15:58 -08:00
shinyobjectz 929c03d5e4 Motion blur: each pixel gathered along the longest motion near it, as a box shutter spreads light
Bevy's MotionBlur gathers each pixel along its own motion, so a still pixel
beside a moving one takes none of its light. A ball crossing a still frame
smeared inward only: 64 px where the shutter's streak is 86, with 8% of its
light lost. In a tracking shot, the bars behind the ball streaked inside their
outlines only, keeping 0.68 of their light.

raea's Shutter replaces it under raea/3d's MotionBlur (RAEA_MOTION_BLUR=bevy
keeps Bevy's, to compare). It finds the longest motion in each 20 px tile
(across the tile's rows, then down them), then in each 3x3 neighbourhood of
tiles, and gathers each pixel along that motion. A tap nearer the camera than
the pixel counts by its own motion; one as far or farther counts by the
pixel's. Each tap is worth 1/|v| per pixel of path, as a box shutter spreads a
moving pixel's light. The share of the open shutter that no tap reaches is the
pixel itself. This is McGuire et al. 2012's tiles and depth split, with its
cone weights replaced by the box shutter's. It takes 1.5 taps per pixel of
path, at most two per sample each way, and reads single- and multisampled
prepasses; under MSAA a pixel's own depth and motion are its nearest
sample's, so an edge pixel part-covered by a moving surface moves with it
(its first sample alone left a ring at the moving ball's outline).

A still surface's streak that slides out from behind a nearer still one
isn't in the frame, so it stops short at the nearer one's edge (the 0.034).

Tested against the shutter's own truth (32 sub-frames a frame, the open half
averaged; LightBench's blur scenes):
- a ball crossing a still frame: profile error 0.077 -> 0.002, light 0.924 -> 0.999
- a tracking shot: the bars' streak 0.369 -> 0.067, the bars beside the ball
  0.699 -> 0.034, the ball still sharp
- a pan with parallax: the bars' streak 0.188 -> 0.044, the bars beside the
  ball 0.866 -> 0.044
- under Solari (single-sampled): 0.026 -> 0.002

Cost at 1920x1080 with MSAA, measured by repeating its passes 40 and 80 times a
frame: 0.2-0.35 ms played live (a few pixels of motion a frame), and 0.6-1.1 ms
at 32 taps on long streaks. One pass reading 400 texels per tile had cost
1.1 ms on its own.
2026-11-22 09:15:58 -08:00
shinyobjectz 4d5deeedac Closed solids: a ray that finds a solid's inside ends there
RT28 shaded every back face as its front. A ray that starts inside a closed
solid (within RAY_T_MIN of a contact, where a floor ray's origin lands inside
a 5 cm ball) then bounced round its inside until Russian roulette, which a
white surface never ends: the contact test with a 5 cm white ball hung, and
the 1 m one took 59 s.

Now only a two-sided hit is shaded from behind: a double-sided material, or
one passing light through. GpuMaterial's padding word carries
StandardMaterial's double_sided. Any other back face ends the path in the path
tracer and the initial path, and is a sample of nothing in the world cache, as
before RT28.

The 5 cm white ball takes 17 s, the 1 m one 4 s. The thin-sheet test is
unchanged, and so is Solari against the tracer on the five scenes (Solari's
light 0.998 of before on the window and the hall, 0.991 on the desk).
2026-11-22 09:15:58 -08:00
shinyobjectz 9efe6f8919 Thin surfaces: rays shade a back face as its front, and light passes by diffuse transmission
A ray that hit a surface from behind found it black, in the path tracer and in Solari alike: the BRDF has nothing below
the normal, so the path ended there. Raster turns a double-sided material's normal toward the eye, so Solari's first
hit (from the G-buffer) was lit where the tracer's was black: a needle spray seen from below, a curtain from the
window's side, every beam the hall's kit built inside out. Solari's world cache queried such a hit's cell by its
unturned normal and got the other side's light, a leak (photo 1's desk: 6% over the tracer). A hit's normals now turn
toward the ray (bindings.wesl face_hit) everywhere a ray is resolved; emission stays one-sided, as light sampling has it.

And StandardMaterial's diffuse_transmission now reaches both: the diffuse lobe gives that share of its light to the far
side (Lambertian there, as Bevy's raster splits it), sampled by the same draw rescaled, so a material without it draws
exactly the numbers it did. A ray through to the far side starts off that side (offset_ray_origin), for bounces,
light-sample visibility and ReSTIR's reuse. Bevy's G-buffer carries it in its flags' five spare bits (to 1/31);
Solari's material table carries it exactly, in what was the UV transform's padding.

A sheet that passes 0.3 (lightbench sheet.tsx), sun behind / sun in front: tracer 0.430, Solari 0.410 (0.429; Solari's
G-buffer holds 9/31). Seen from its back: 1.000 of its front in both (the tracer drew it black).
Photo 2's curtain as one sheet passing the window's light instead of a glow standing in for it: 0.90 of the photo
traced, 0.86 under Solari (the glow: 1.29). Solari against the tracer: photo 1 1.062 -> 0.986; photo 3 canopy 1.13 ->
1.10, whole 1.11 -> 1.09 (the tracer lit the sprays' undersides); photo 5 "under the sky" 1.24 -> 0.99 with the kit's
beams turned right side out; photo 4 unchanged; photo 2 0.972 -> 0.951 (the leak had hidden a broad 5% deficit).
2026-11-22 09:15:58 -08:00
shinyobjectz 79d304f87d G-buffer emission pre-exposed, so a bright lamp isn't drawn at 0.80 of its light
Bevy's G-buffer holds a surface's emission as rgb9e5, which tops out at 65408. Photo 5's lamps are 75000 nits of
3000 K white, so their red and green clipped there: drawn at 0.80 of the path tracer's brightness (5.62 against 7.06
in the hall's linear frame) and less red than they are. Solari reads its lights from its own material table, so
their light was right; only what the camera sees of them was clipped.

The emission is now stored times the view's exposure (as Bevy already stores a lightmap's light in the same channel,
and as Solari's light tiles store radiance), so its top is where the display's is; every reader divides it back out
(Bevy's deferred lighting, Solari's G-buffer reads), and MetalFX's guide pass reads it pre-exposed as it wanted it.
It needs the vendored bevy_pbr, so solari-look now stacks on realism.

The hall against the tracer, at MetalFX's display-equivalent pre-exposure: the ring's lamps 0.79 -> 0.99 of their
light, the warm wall 0.80 -> 1.00, the whole frame 0.976 -> 0.984. Photo 3's forest is unchanged (whole-frame linear
mean 1.0006); photo 2's desk differs from the build before by no more than two runs of that build differ.
2026-11-22 09:15:58 -08:00
shinyobjectz d0eb2424a6 Fog: light is dimmed by what the fog absorbs on its way to each point of it
The froxel passes scatter light once, and lit each point as if nothing stood between it and the light, but for
Bevy's constant: exp(-extinction x the box's half-diagonal) on every point of a volume (the hall's steam: 0.10
throughout, its sunlit face and its far side alike). Against the path tracer (it walks the fog, so it has every order
of scattering) grey fog under a uniform sky came out 0.595 of the clear sky where the truth is 0.398.

Each volume now carries the extinction that dims light on its way to a point (GpuVolume.shadow), and the light pass
(the sun, point and spot lights), the hero pass's integrand and Solari's (its lamps, the sky's rays) take the optical
depth along the way through every volume: closed for a plain box (exp(-falloff x height) integrates exactly), 4
Gauss-Legendre nodes where faces are soft or the box tapers. Bevy's constant goes.

RAEA_FOG_SHADOW picks how much of the medium dims: absorb (the default), delta (absorption + scattering x (1 - g)),
full, off, or bevy (as before). Scored against the tracer:
- fogsky, white then grey at the centre (truth 1.000, 0.398): absorb 1.000, 0.411; delta 0.877, 0.362; full 0.746,
  0.317; off and bevy 1.000, 0.595. Dimming by the whole extinction loses the light the fog scatters on toward the
  point, which a single-scatter grid has no other way to bring back
- the hall's air light (with air minus without) against the 16k-sample truth: whole 0.939 (bevy) -> 0.975, steam's
  lit face 0.889 -> 0.925; delta 0.66, full 0.53
- live at 736 x 1312, scale 0.67: 66 fps best, 65 median, as before (the quadrature on the haze, before it was
  closed, cost 4 fps)
2026-11-22 09:15:58 -08:00
shinyobjectz b45cbe4085 Sky portals: Solari samples the sky through a room's openings as a light
A room lit by the sky through a small opening (photo 5's hall, under a 5 x 10 m skylight) got that light only from
rays bounced at random that happened to leave through it: too rarely for the denoiser to keep, so against the path
tracer the hall's wet floor held 0.72 of its light (the sky gives 75% of it there) and the wall by the window 0.58.

<Environment portals> names the openings (each four corners round it); the camera carries them as SkyPortals, the
environment uniform packs up to 8, and each is a light source of a new kind (3). A sample is a point on the opening
(w 2), lit by the environment map along the way through it, from either side, its visibility traced on to the sky.
The light tiles mark it in the normal's lowest bit. A ray that escapes through a portal is weighted against light
sampling by the power heuristic (the initial path, the path tracer); the world cache leaves that light to sampling
as it leaves an emissive's, and the fog pass leaves it to its sky term.

Checked on the hall, no air: the path tracer with the portal against without, 4096 spp, every region 0.99-1.02 and
the whole frame 1.000, its noise down (near floor 0.067 -> 0.018). Solari against the tracer, without -> with: floor
0.83 -> 1.05 (near 0.72 -> 1.03), wall by the window 0.58 -> 1.04, ceiling 0.81 -> 1.07; raw Solari at full scale
1.01-1.03 on both, so what's left (mid floor 1.12, scaffolds 0.99 -> 1.26) is the denoised, upscaled path's. Live at
736 x 1312, scale 0.67: 70 -> 66 fps at best. The fog invariants are unchanged.
2026-11-22 09:15:58 -08:00
shinyobjectz 5a4060df5e Path tracer: it walks the fog volumes, so the hall's haze and steam have a ground truth
The reference path tracer drew no participating media, so Solari's froxel fog was held only to single-scatter
math. It now walks the scene's FogVolumes as raea_sys_fog reads them (pathtracer/media.wesl): a segment's next
collision by delta tracking against the summed extinction of the volumes it crosses, light sampled there by the
Henyey-Greenstein phase with MIS against the phase's own rays, the path going on along a phase-drawn direction; every
light sample's transmittance by ratio tracking. Both unbiased. raea_sys_fog hands it its volume buffer each frame
(PathtracerMedia); RAEA_PT_MEDIA=0 leaves the volumes out.

The froxel passes' Volume, the phase and its sampling move into froxel_volume.wesl, which the tracer imports too.

Checked (lightbench fogsky.tsx, foglamp.tsx, 1024 spp): white fog under a uniform sky leaves it at 1.000 everywhere,
every order of scattering included; a lamp's glow in thin fog 1.01-1.07 of the single-scatter integral beyond 8 px,
growing outward as the higher orders spread it. Grey fog (albedo 0.5) traces to 0.37-0.40 of the clear sky where
Solari's froxel pass gives 0.595: the pass lets the light reach each cell undimmed by the fog on its way.
2026-11-22 09:15:58 -08:00
shinyobjectz 4a5612ae10 Fog: Solari's sky in the froxel grid follows a guide, and each cell's points are stratified
Seen through a small opening (photo 5's skylight, 5 x 10 m, 38 m up), the sky lit each froxel cell through few of the rays drawn from the medium's phase, and once the sky was at its physical share of the sun the haze flickered: 4.61% of pixels moved 8 levels or more frame to frame in the still, 6.83% in the swaying take (3.71% with the pass off).

Each cell now keeps a guide: a fading sum of the directions that reached the sky from it, weighted by the light each brought over its pdf, its own from the last frame and half a neighbour's. Half its rays come from a cone round their mean, as wide as their spread, half from the phase, each weighted by the mixed pdf, so the estimate stays unbiased whatever the guide holds. Weighting by contribution matters: counting the cone's own rays narrowed the cone frame by frame. The cell's point is drawn from an R3 sequence offset per cell, so its history covers the cell sooner; the sky's rays stay random, since a sequence tied to the frames the guide learned from biased it (white fog 2-3% too bright).

Measured on photo 5: flicker 4.61% -> 2.29% still, 6.83% -> 4.26% swaying; the sky term's raw noise in the frame's middle 309% -> 128% a cell. White fog under a uniform sky still leaves it unchanged (1.000), grey fog 0.595 against 0.601, and the hall's regions match the unguided pass within a frame's noise. Two ping-pong rgba32float textures of the atlas's size. RAEA_FOG_SOLARI_GUIDE=0 draws from the phase alone (1 the cell's own guide, 2 a neighbour's).
2026-11-22 09:15:58 -08:00
shinyobjectz b8e2a3d6d2 FogVolume: soft edges and a taper, for steam and smoke that don't read as boxes
The froxel grid filled a fog volume's box evenly (or thinning going up), so photo 5's column of steam showed as a lit rectangle. Two props shape the density inside the box: soft (0 to 1) ramps it in from every face over that share of the half-size with a smoothstep, and taper (0 to 1) narrows the box toward its floor, a plume widening as it climbs. froxel_volume.wesl's volume_weight is the one place the light pass, the hero pass and Solari's pass read a volume's density; FogThinning becomes FogShape {falloff, soft, taper}. Only the froxel grid draws them, as with falloff.

Checked on photo 5: the plume's density 2 with soft 0.8 and taper 0.7 changes the steam's region by 28% against the box; falloff 1 cuts the haze at the ceiling 4 times; volumes without the props render as before (the haze's regions unchanged to 0.01).
2026-11-22 09:15:58 -08:00
shinyobjectz 4506c0ca2b Solari: the world cache counts sky light only where a ray reaches the sky
A world-cache update ray cut at world_cache_max_gi_ray_distance (50 m) counted every miss as the sky, so in a room larger than the cut the cache filled with sky light. In photo 5's hall (41 x 88 x 38 m, its sky at its physical share of the sun) the dark regions came out 2-80 times the path tracer's: the ceiling 2.05, under the skylight 16.5, the drum 82.

A miss now counts the sky only if one any-hit query past the cut reaches it too; one blocked past it adds nothing. The default cut is 1000 m. Against the path tracer (1024 spp, HDR from two exposures 5 stops apart, fog off): ceiling 0.88, under the skylight 1.90, drum 5.4, the whole frame 0.99. The hall's frame rate at 736x1312, scale 0.67, M5 Pro: 75 fps against 76.
2026-11-22 09:15:58 -08:00
shinyobjectz 9ae63e33c2 Fog: Solari's emissive lights and sky light the froxel grid
Under Solari the grid's light pass saw only Bevy's lights, so a lamp Solari lights a room with and the sky through
an opening lit no air. A compute pass after the light pass resamples Solari's light list at each cell (8 candidates,
one shadow ray) and traces a sky ray drawn from the medium's phase, keeps a reprojected history of the light
arriving, blurs it over the cell's 3x3x3 neighbours and scatters it by the medium at the cell; the integrate pass
adds it to the atlas's light. Directional lights stay the light pass's.

Checked: white fog under a uniform sky leaves it unchanged (1.000), grey fog matches the single-scatter answer within
1%, and an emissive sphere's glow matches it within 2-9% beyond two cells. Costs 2.6 ms at 736x1312, render scale
0.67, on an M5 Pro. RAEA_FOG_SOLARI=0 leaves it out; RAEA_FOG_SOLARI_{CANDIDATES,SKY,FRAMES,PARTS,FILTER} tune it.
2026-11-22 09:15:58 -08:00
shinyobjectz cb0d9c5482 MetalFX: pre-exposure 16, so the denoiser's compression stops eating Solari's rare bright samples
MetalFX's denoiser works on bright light compressed, and Solari's one path a pixel is made of rare bright samples (the
sky in a glossy reflection, a lamp found by one path in many), so they counted for less than their share. Against the
path tracer at 1 (the default before): the desk kept 0.74 of its light, the forest's haze 0.72 and far trunks 0.87, the
hall 0.935; Russian roulette's doubled samples lost more (the hall's windows: q 0.5 kept 0.60 of q 1's light, 0.97 with
the frame 3.4 stops darker). setPreExposure(16) divides the colour by 16 before and multiplies the output by it after:
the desk 0.86, the haze 1.03, the trunks 1.01, the hall 0.971 with q 0.5 keeping 0.98 of q 1's; flicker 0.85 -> 0.88% of
pixels. Higher keeps more and lets fireflies through (64: the desk 0.91, the hall's dark corners 1.2; 256: the desk's
wall 1.59). RAEA_METALFX_PREEXPOSURE sets it.
2026-11-22 09:15:58 -08:00
shinyobjectz aaa6f50339 Solari: a light marked volumetric keeps its shadow maps, which cut the fog's shafts
RT10 turned every light's shadow maps off while Solari traces its shadows, but raea's froxel fog reads those maps to
cut its shafts. With them gone a volumetric sun lit the fog everywhere or nowhere: in a hall lit through a skylight
the steam's in-scatter fell from 0.58 to 0.02. A light with VolumetricLight now keeps its maps (and gets them back if
RT10 turned them off before it was marked).
2026-11-22 09:15:58 -08:00
shinyobjectz 87f8ac9a85 Solari's guides for MetalFX: a mirror is denoised as what it shows
MetalFX's guides came from the G-buffer, so a mirror's pixel was guided as the glass: one albedo, one normal. The
denoiser took everything the mirror showed for noise and smeared it (photo 4's arched mirror: its rock a smudge, no
ripples, no dune, no clouds). Solari already works out primary surface replacement guides (a mirror's pixel takes the
albedo, normal, roughness, depth and motion of what it reflects), but only for DLSS-RR under the dlss feature.

- bevy_solari: with SolariGuideBuffers in the render world, every Solari view gets SolariGuideTextures and the
  pipelines that write them (realtime/guides.rs); without it, nothing is compiled or drawn that wasn't before
- a mirror that shows the sky is guided as sky (infinitely far, nothing to denoise), marked by its diffuse albedo's
  alpha; left as the glass's, the clouds in the mirror were smoothed away
- MetalFX's guide pass reads Solari's guides (metalfx_guides.wgsl, moved out of metalfx.rs) and its specular motion:
  Apple's GPUs have no read-write Rg16Float, so Solari can't write it into the prepass's motion
- RAEA_SOLARI_PSR=0 guides from the G-buffer as before

Photo 4, settled: the mirror as sharp as undenoised. Moving (the camera sways 1.5 degrees), the mirror against the
undenoised frame at the same camera: 0.0030 (G-buffer guides 0.0080). The forest and the desk unchanged: whole-frame
linear means within 0.1% and 0.5%, fine noise the same.
2026-11-22 09:15:58 -08:00
shinyobjectz d1faf4f06f Solari: a surface's normal turned from the eye is bent back to face it in the real-time path, primary and bounce
The BRDF returns 0 where N.V < 0.0001, so a smooth surface's silhouette (a dune's crest under a low camera, one seen
in a mirror) drew a black line. The path tracer already bent such normals with facing_normal; the real-time path's
G-buffer resolve and its bounce hits now do the same. Photo 4's crest lines are gone in the live render.
2026-11-22 09:15:58 -08:00
shinyobjectz 4cec0645fb Solari: SolariLighting::first_bounce_probability, Russian roulette on the first bounce by workgroup
In dense foliage the first bounce is most of the frame's tracing: in photo 3's spruce stand, one light candidate and
one bounce, Solari's initial path takes 10.5 ms of 15 at 1080x1920 drawn at half size, and 0.46 with no bounce. With
first_bounce_probability q below 1, an 8 x 8 workgroup traces its pixels' first bounce with probability q and the
bounce's light counts 1 / q (in the throughput every bounce-0 candidate is weighted by), so the estimate keeps its mean;
a skipped pixel keeps its primary light sample and takes its bounce from ReSTIR's reuse. The coin is the workgroup's
because a SIMD group waits for its slowest ray: pixels skipped at random saved little (q 0.5: 10.25 -> 8.97 ms).

Measured on the forest (M5 Pro, 1080x1920, half size, lean): the initial path 10.47 -> 7.23 ms at q 0.5 and 5.78 at
0.25; 46 -> 55 and 63 fps; 66 at 0.5 with the far trees bare. The look against q 1 after MetalFX, in linear light:
whole 0.986 and 0.963; far trunks 0.94 and 0.86, the haze 0.94 and 0.86, the sofa 0.965 and 0.95; flicker (pixels
moving 8 levels a frame) 0.38% against 0.37%; no seams on the workgroups' grid. So the frame loses some light where its
bounce found the sky through gaps, more as q falls; the reuse's weights are where to look. Defaults to 1, where no coin
is drawn and the frame is as before (0.03% of pixels 8 levels apart, as between runs).
2026-11-22 09:15:58 -08:00
shinyobjectz cdc7ad98a4 Solari: a ray skips the see-through query in a scene with no see-through material
trace_ray finds the nearest opaque instance, then walks the TLAS a second time for instances whose material a ray may
pass through. In a scene with none, that second walk finds nothing and still costs: in photo 3's spruce stand (2,062
tree instances whose bounds overlap along every ray) it was a third of the trace. The environment light's uniform now
carries any_alpha (some material in the scene is see-through), and trace_ray and trace_ray_previous_frame return the
opaque hit without the second query when it's 0.

The forest at 1080x1920, drawn at half size, on an M5 Pro: Solari's GPU time 21.9 -> 15.3 ms (its initial path 16.2 ->
10.7, the world cache 2.4 -> 2.0); 26 -> 38 fps with the default settings, 32 -> 46 with one light candidate and one
bounce. The frame is the same (every region's mean to four digits; 0.04% of pixels more than 8 levels apart, as between
two runs). Photo 1's desk, a few dozen instances, runs as before (23 fps at 1920x1080, full size). A scene with a
see-through material traces as it did. RAEA_SOLARI_ALPHA_PASS=always runs the second query regardless, to time it.
2026-11-22 09:15:58 -08:00
shinyobjectz a058f87048 Solari: what a surface emits goes round MetalFX's denoiser and is gathered over frames with no clamp
MetalFX's denoiser clamps its history to what it sees about each pixel this frame, which keeps Solari's rare bright
paths from flaring, and also drops a highlight that shows in only some of the jittered frames: sky seen through a
spruce stand's twigs, each gap smaller than a pixel, came out at 0.52 of the path tracer's light (0.47 as seen
through the tone curve) while raw Solari had all of it. Emission has no noise to suppress, so it needs no clamp. The
guide pass takes it out of the colour (as RAEA_SOLARI_EMISSIVE=split did) and emit_taa.wgsl gathers it at the
output's size: each frame's jittered samples weighted by their distance to a pixel's centre (exp(-6 d^2), output
pixels), added to the pixel's history reprojected by the nearest surface's motion and read through a Catmull-Rom
filter. Where the pixel moved and the history's depth isn't among those about it, the history counts as one frame's;
a camera cut drops it; it holds 16 frames' weight at most.

Measured against the path tracer, drawn at half size: the canopy 0.99 of its light in linear light, 1.03 as seen;
the whole frame 0.98 and 0.94 (MetalFX alone 0.74, 0.81). A sunlit room 0.870 and a lamp-lit one 0.786 (0.870 and
0.78-0.82 before). Its window's edges: 2 pixels a frame jumping 80 levels (MetalFX alone 0; each frame's emission
put back alone, 1088). A fast pan and push trails no more than MetalFX does (0.10% of pixels 24 levels off the
history-free frames, MetalFX 0.06%). A screen's fine detail 0.44 of the tracer's (MetalFX 0.52). About 1 ms at
1080x1920 on an M5 Pro.

On the way: a test of depth where nothing moved dropped whichever was rarer about a pixel (the sky) and lost a
quarter of the canopy's light; dropping a failed history outright left a moving window's edge crawling (300 pixels).
RAEA_SOLARI_EMISSIVE=mask gives the emission to the denoiser as before; RAEA_EMIT_TAA_SHARP sets the kernel;
RAEA_EMIT_TAA_DEBUG=1 paints the weights, 2 and 3 never and always keep the history.
2026-11-22 09:15:58 -08:00
shinyobjectz 304604231e Solari: a path's last bounce takes the lights' light at its hit even where the world cache can't be used
A path ends into the world cache only where its ray cleared a cache cell and the cell was found; elsewhere it went on.
On the last bounce there was nothing to go on to, so a short ray (under a sofa, at a trunk's foot, between moss
pillows) ended the path with nothing, not even the lights' light where it landed. Now the last bounce samples the
lights there and adds the cache only when it can. Against the path tracer on a forest under an overcast sky, with one
bounce: the sofa 0.80 -> 0.89, the trunks 0.85 -> 0.89 and 0.80 -> 0.84, the whole frame 0.78 -> 0.80, so one bounce
now holds what three do (0.90, 0.89, 0.86, 0.81) and its initial path costs 15 ms where three cost 20-22 (1080x1920
drawn at half size). A sunlit room 0.856-0.860 -> 0.870; a lamp-lit room within its spread between runs.
2026-11-22 09:15:58 -08:00
shinyobjectz d58fade59c Solari and the path tracer trace vertex colours
Solari's traced vertex was position, normal, uv and tangent, and raea's traced copy of a mesh left any vertex colours
out, so a vertex-coloured mesh drew in its colours in raster but grey traced: a procedural forest's bark and moss came
out white-grey under the path tracer while the sofa, coloured by its material, was right. The colour now rides in the
traced vertex (64 bytes: Bevy lays it out after the tangent) and multiplies the base colour at every hit, as Bevy's
StandardMaterial does in raster; a mesh without one is traced white. A desk lamp's room and a sunlit room measure as
before against the path tracer (0.78, 0.86), and the lamp room's path-traced reference is unchanged pixel for pixel.
The unit test is written but not run here: testing this crate alone rebuilds Bevy with other features, more than the
disk had free.
2026-11-22 09:15:58 -08:00
shinyobjectz 9edcbf507c Solari world cache: a cell's plane measured from its centre, not the world's origin
From the origin, a curved surface a metre or more away changed planes every half degree of its normal at 5 cm cells,
and was cut into strips of cells too thin to be found again. Measured on a desk lamp's shade (ReSTIR, 5 cm cells),
its light against the path tracer's, two runs each: denoised 0.784-0.788 before, 0.780-0.783 after (within the
spread between runs); raw 0.878 before, 0.891 after. A sunlit room is unchanged (0.86).
2026-11-22 09:15:58 -08:00
shinyobjectz fc7edcdc49 Solari world cache: the lights' light sampled where a path ends, cells keyed by their surface's plane and size, a miss no longer a zero
A cell held the lights' light taken at one point for the whole cell. Next to a small bright light that point
misses most of it: a lamp's bulb a few cm from its shade's lining. On LightBench's bounce test (a matte panel
4 cm over an emissive sphere), the panel's bounce reached 0.48 of the path tracer's. A cell now holds only the
light that has bounced, plus the sky's. The lights' own light is sampled at the very point where a path ends,
with the full BRDF and as many candidates as the cache took (world_cache_direct_light_sample_count), and where
the cache's own GI ray lands. The bounce test now reads 0.97 at 4 cm and 1.01 at 20 cm.

A cell's key now has the plane its surface lies in, in quarter cells along the normal. Without it, surfaces
facing the same way across a cavity the size of a cell (a shade's lining and its dark cladding) shared cells.
The key also has the cell's size, so cells of two LOD levels can't collide.

A query that makes a cell, or finds one with no update yet, returned zero light. It now says it found none.
A path then continues instead of ending, and an update whose ray found none is skipped by a cell that already
has light. A cell with none still takes it, so a room with no sky fills.

A desk lamp in a room at night, its light against the path tracer's, unclipped:
- raw, cache at defaults: 0.72 -> 0.74 (0.85 with cells traced from the surface point, which cost a sunlit
  room 3%, so not taken)
- through the denoiser: 0.47 -> 0.58
- ReSTIR with 5 cm cells: 0.66 -> 0.78
A sunlit room is unchanged (0.86); with only 2 candidates where paths end, it fell to 0.79.
2026-11-22 09:15:58 -08:00
shinyobjectz 30edd5d1a6 MetalFX leaves what a surface emits undenoised, by its denoise strength mask
A screen's picture came out smeared, its texture taken for noise; taken out of
the colour and put back after, an emissive edge stayed stepped and crawled with
the jitter. The emission's share of each pixel's colour now goes to MetalFX's
denoise strength mask, and the emission (compressed) to its albedo. Photo 2's
live scene at 0.67: pixels jumping 40 levels a frame 2386 -> 8, the error
against the path tracer unchanged. RAEA_SOLARI_EMISSIVE=split keeps the old way.
2026-11-22 09:15:58 -08:00
shinyobjectz 52ee3e0438 MetalFX denoises a view drawn small and brings it up in the same pass
Denoising the main pass's corner first and scaling after gained nothing from
the jitter: the denoiser settled each frame on the small grid, and at 0.67
the frame kept 0.73 of the full size's fine detail. A view drawn small is now
denoised after the forward meshes, where Bevy's DLSS runs, by MetalFX's
denoised scaler from the corner out to the whole view, as it is made to; it
keeps 0.90 at 0.67 and 0.82 at 0.5, and costs the same or less.

A pixel with nothing in the G-buffer (a forward mesh, the sky) gives the
denoiser its own colour as its albedo, so it has nothing there to smooth.
The emissive comes back at the output's size, read between the jittered
G-buffer's pixels. RAEA_SOLARI_UPSCALE=two keeps the first way, to compare.

Photo 2 live at 1248x1664 (1080p's pixels), M5 Pro, a loaded GPU, best of
three: 32 fps full size, 50 at 0.67, 70 at 0.5 (median 62); the error against
the path tracer moves 15.7 -> 15.8 at 0.67 (docs/raytracing.feature RT9).
2026-11-22 09:15:58 -08:00
shinyobjectz 1c7b3afeb8 Solari drawn below the view's size and brought up by MetalFX; no unread shadow maps
<SolariLighting scale={s}> (RenderScale; RAEA_SOLARI_SCALE for every Solari
camera) draws the main pass at s of the view a side, in the corner of its
textures (Bevy's MainPassResolutionOverride, as its DLSS uses): the
G-buffer, Solari's tracing, the denoiser and the forward meshes. MetalFX's
temporal scaler then brings it up to the whole view in EarlyPostProcess,
before the post-processing. The denoiser works on the corner, at the main
pass's size, and copies back only it.

The projection is jittered by a Halton (2, 3) cycle, told to the denoiser,
which gives back a frame without it, so the scaler is told none
(RAEA_SOLARI_JITTER routes it otherwise, to compare). A full-size Solari view
is jittered too while the denoiser runs, which anti-aliases its edges: photo
2's frame 95 came 15.9 -> 15.6 off the path tracer (RAEA_SOLARI_AA=0 holds it
still).

Lights draw no shadow maps while every active 3D camera traces its light and
nothing skinned or morphed is raster-lit by them; Solari never reads them.

Photo 2 live, M5 Pro, a loaded GPU (best of four): 736x981 at 52 fps full
size, 67 at 0.67, 92 at 0.5; at 1248x1664 (1080p's pixels) 34, 44 and 55.
Tracing at 0.67 costs a third of full size; the error against the path
tracer is unchanged (15.4 against 15.8). (docs/raytracing.feature RT9, RT10)
2026-11-22 09:15:58 -08:00
shinyobjectz b1fafa9bf9 Solari: each stage timed on the GPU (RAEA_SOLARI_TIMES=1)
Solari's lighting ran as one compute pass, so nothing said where a real-time
frame's tracing went. It now runs a pass a stage (light tiles, world cache,
initial path, spatial and shade), each with begin and end timestamps and a
trailing timed pass after them, as Metal reads a pass's end write as 0 without
one. Every 120 frames stderr has each stage's mean in ms.

On photo 2's live scene the initial path is the cost: 2.6 ms at 368x490,
6-9 ms at 736x981 and 12.3 ms at 1104x1472, so tracing scales with the pixels
and rendering below the output size pays (docs/raytracing.feature RT8).
2026-11-22 09:15:58 -08:00
shinyobjectz fe1383442f Solari: what lets light through is traced, and what glows stays out of the denoiser
A material with diffuse_transmission on Bevy's Auto render method draws forward (the G-buffer has no room for
transmission), so under <SolariLighting> it skipped the trace and drew raster-lit over it with its emissive raw: a
lampshade and a sheer curtain came out white (1.85x and 1.49x a photo's), leaves flat. Under Solari such a material
is pinned to the deferred path; Solari 0.20 traces no transmission, so it is lit like any other surface (1.12x and
1.27x, as the path tracer has them).

MetalFX's denoiser took a glowing picture for noise on its near-black albedo and smeared a monitor's clock and
picture. The guide pass now takes each pixel's emissive (the G-buffer's rgb9e5 times the camera's exposure, as Solari
adds it) out of the colour, and a pass after the denoiser's command buffer puts it back: the screen is as sharp as
under <Pathtracer />, without its noise. docs/raytracing.feature RT7.
2026-11-22 09:15:58 -08:00
shinyobjectz 59bfe93107 LT8: screen probes, a probe every 16 pixels tracing the ray scene, pooled on its own surface, filled in by depth and normal (the first step)
raea-sys-gi: a probe on the surface each 16-pixel tile shows traces 16 cosine rays a frame through the TLAS with
gi.wesl's own functions (gi.wesl is now a shader library; WorldCache carries its group), keeps a running mean over up
to 24 frames found where it stood last frame, and is pooled with its neighbours on its own plane. Each pixel takes the
four probes around it by depth and normal and reads the cache at its own surface only where none is on it. A GI
pipeline that fails to build says so (gi-pipeline) instead of quietly measuring raster. The screen passes are timed
on the GPU beside the cache (RAEA_GI_STATS screen_ms; the light check's gi gpu column adds them). LT2's probe grid is
traced only when shown: its rays claimed cache cells no pixel reads.

LT14: raster runs none of this (RAEA_GI=1 only), so LT1's raster numbers stand (FLOOR3 1.392/-0.816/3.392/0.111).
The gi path, filtered, before (dcc8e57d42) against after:
  FLOOR3  mean 2.381/0.617, bias -2.118/-0.547, worst 6.012/5.170, flicker 0.415/0.131, live 16.1/14.4 ms
  glade   mean 1.319/1.292, bias 1.074/1.041, worst 2.941/2.939, flicker 0.782/0.773
  Berlin's walk live 38.9 ms gi against 39.1 raster, raea GI 1.32 ms of GPU (cache 0.31, screen 1.01)
  kitchen live 52.1 ms gi, 1.91 of it GI
FLOOR3's worst tile is its ceiling, lit only by the floor, whose cells rarely find a lens (D7, LT6).
2026-11-22 09:15:58 -08:00
shinyobjectz 089e62ee4c LT3: Berlin with the cache read at each pixel, measured: blotchy from the readout, not the update rate
On Berlin's walk (filtered, frames 96 and 191, no reference) the shaded fronts come out darker and blotchy; live 54.9
ms raster against 64.5 gi, the cache and probes 1.6 ms of GPU at 226k cells. Updating every live cell each frame
(RAEA_GI_UPDATES=300000: 2.0 ms, 407k cells) barely changes the blotches, so a pixel reading its own cell stays the
measuring step and LT8's screen probes draw the light. Docs only: no code, LT1's numbers unchanged.
2026-11-22 09:15:58 -08:00
shinyobjectz 2ab92392d4 LT4: a ray hit sees its instance's record, its averaged albedo and its emission (the first tier)
systems/rt keeps each TLAS instance's record at its custom index (records.rs, the Records buffer, written when a
record changes): its StandardMaterial's base colour times its texture's mean (8-bit RGBA textures with CPU data),
less what is metal, and its emission as the radiance it sends, as the reference's tracer takes it. The probes' and
the world cache's hits (gi.wesl first_hit now returns the instance) read it in place of LT2's flat 0.5 stand-in; an
instance with no StandardMaterial (a hook) keeps the stand-in until the cache learns surfaces from the screen.

LT14: raster runs none of this (the ray scene is gathered only for traced passes), so LT1's raster numbers stand as
d3ecbbd042 measured them. On the gi path, with the temporal filter, before against after:
  FLOOR3  mean 4.819/2.381, bias -4.796/-2.118, worst 7.029/6.012, flicker 0.101/0.415, live 16.3/16.1 ms
  glade   mean 1.474/1.319, bias 1.241/1.074, worst 2.948/2.941, flicker 0.780/0.782
FLOOR3's lenses (4500 nits) now light its cells, but one cosine ray an update rarely finds a lens 2 to 3% of the sky,
so it stays dark and blotchy until emitters are sampled by their power (D7, LT6). Emission taken over the exposure,
as raster draws an unexposed emitter, made FLOOR3 3.2 stops bright.
2026-11-22 09:15:58 -08:00
shinyobjectz 2ca930d81e LT3: the world cache's light reaches the screen, each pixel reading it at its own surface (raea-sys-gi, RAEA_GI=1)
A measuring step, as LT2's irradiance volume was meant to be. raea-sys-gi's screen pass, between the prepass and the
main pass, reads the world cache at each pixel's own surface (from the depth and normal prepasses), takes out the
sun's share (each cell now keeps a mean of how often it sees the sun: cache.wesl sunlit, 4 MiB), and writes it a
texel a pixel. The main pass draws it in place of the irradiance volume, the environment map's diffuse and the
ambient light (vendored bevy_pbr: RaeaGiScreen, mesh view binding 41, read by textureLoad, so a hooked material at
Metal's 16 samplers still builds; zeros where a view has none). The cache's lookup loads before it writes, as a cell
is read by hundreds of pixels. GI cameras get their depth and normal prepasses with MSAA off.

LT14, LT1 raster before against after (binding 41 bound to zeros): FLOOR3 mean 1.379/1.379, bias -0.801/-0.801,
worst 3.370/3.371, flicker 0.101/0.101; glade 1.758/1.758, 1.542/1.542, 3.000/3.000, 0.817/0.817. Live: FLOOR3
12.6/13.7 ms, gambit-walk 49.0/42.6, kitchen 54.9/56.5 timed back to back (61.7 beside another build).
With the temporal filter, raster against gi: glade mean 1.750/1.474, bias 1.532/1.241, worst 2.953/2.948, flicker
0.788/0.780, against a reference that is near black and has no fog (LT5). FLOOR3 goes 4.8 stops dark: it is lit only
by its panels' emission, which no cell knows yet (LT4's first tier); live 14.5/16.3 ms, the cache 0.92 ms of GPU.
2026-11-22 09:15:58 -08:00
shinyobjectz 4946bf9c00 LT12: raea's own temporal filter, the levels' dither moving under it, and the light check pre-rolled
<AntiAliasing mode="steady"> (or RAEA_STEADY on every 3D camera) draws each frame from one of 16 Halton places
inside its pixels and blends it with the frames before (raea-sys-post steady.rs, steady.wesl): the past fetched by
the depth and motion prepasses at the nearest neighbour's motion, clipped to the 3x3 YCoCg spread, blended in linear
light at 1/n down to 1/32 still and 1/8 moving. MSAA goes off under it. Under a jittered view the levels' cross-fade
dither moves to another of its 16 places each frame, in the main pass and the prepass alike (vendored bevy_pbr), so
the filter averages it to its share: on Berlin's 1440p fly the dot bands are gone at full size, and the walk's
heroes leave no trail. The far city's roof slopes alias more without MSAA (prefiltered far levels, LT21).

raea light check now draws 16 frames before each still or shot that doesn't follow the one before, unmeasured, so
whatever keeps a past has its own; and it never steadies the path-traced reference, whose jitter read as the paths'
flicker (FLOOR3 0.478 stops of the reference's own).

LT14, LT1 raster without against with the filter (both pre-rolled):
  FLOOR3  mean 1.379/1.392, bias -0.801/-0.816, worst 3.370/3.392, flicker 0.101/0.111, live 12.6/14.5 ms
  glade   mean 1.758/1.750, bias 1.542/1.532, worst 3.000/2.953, flicker 0.817/0.788
  gambit-walk live 49.0/44.1 ms; kitchen live 53.8/55.6 ms
Live 2560x1440 work p50, median of 3, MSAA 4x against steady: walk 53.0/55.0, fly 47.3/42.5 ms.
Off by default, so LT1's numbers without it are unchanged.
2026-11-22 09:15:58 -08:00
shinyobjectz a0dad6afbc LT21: past the last cascade the sun's shadow comes from a map traced against the ray scene
Past its last shadow cascade (300 m in gambit's CityShot) Bevy draws everything lit, and the fade added before only
softened the line, so on the fly the street went white past it. The sun's shadow there now comes from a map of the
sun's view traced against the ray scene (raea-sys-rt far.rs, far.wesl): 2 km square, 4096 texels a side, each one
ray down along the sun to its first shadow caster, holding how high along the sun it hit. raea-sys-lod's swap of
shadows.wesl fades the last cascade into it and reads it past the cascades (four texels, bilinear, a texel's normal
offset and a slope bias). Not a ray a pixel: the game's camera has no depth prepass, and one would draw all of
Berlin again. Bevy's mesh view group has no hook for another binding, so bevy_pbr is vendored for two (39, 40:
RaeaFarSun, a stand-in and a uniform of zeros where there's none; docs/bevy-upgrade.md).

A texel is kept at its column modulo the map's size, so the map follows the eye eight texels at a time and traces
only the strip new to it; after the TLAS changes it traces 256 rows a frame again, in turn; the whole map only on
the first frame or when the sun turns. On the 1440p fly (GPU timestamps, p50): a strip 0.38 ms (36,500 rays), 256
rows 0.28 ms; the whole map once, 16 to 31 ms. A first version re-traced the whole map every 128 m: a 16 ms hitch,
and its edge fade stepped. Off unless RAEA_SUN_FAR is set (metres each way, 1024 for 1).

Live at 2560x1440 (median of 3, work p50, without against with): walk 51.1 against 50.4 ms, fly 54.5 against
45.6, inside the runs' 5 to 10 ms spread. On the fly the street and the far blocks keep their shadows to the
horizon; popped tiles are as before but for 0.4% more, far chimney shadows shimmering at 600 m to 1 km.

LT14, LT1 on raster, before (the branch before this) / off / on (RAEA_SUN_FAR=1):
  floor3-room  mean 1.379 / 1.379 / 1.379, bias -0.801 all, worst 3.370 / 3.366 / 3.372, flicker 0.101 all,
               live 14.4 / 13.8 / 13.6 ms, work p50 13.8 / 14.1 / 13.9
  glade        mean 1.758, bias 1.542, worst 3.000, flicker 0.817, all three alike
  gambit-walk  live 51.8 / 48.8 / 44.4 ms, work p50 50.0 / 44.9 / 42.4 (no reference yet, LT5)
  kitchen      live 61.0 / 54.3 / 55.6 ms, work p50 59.4 / 53.0 / 55.2 (no reference yet)
Another session's jobs ran beside them; the live numbers are within that noise.
2026-11-22 09:15:58 -08:00
shinyobjectz 425d7439b9 LT3: the TLAS is kept from frame to frame, built again only when an instance comes, goes, moves or changes its mask
The ray scene's TLAS was made and built anew every frame. It's now kept: a frame whose instances match the last
(the same meshes, transforms and masks, and no new BLAS batch) costs a comparison, and a TLAS is made anew only when
it runs out of room, with half as much again to spare. Each instance's custom index is its place in the list, for
LT4's record table. raea GI's stats now count the builds and the instances last held.

On Berlin's walk at 1080p with GI on (0.5 m cells, 131072 rays, 6 s live; another session's build and render were
running, so both binaries ran back to back): cpu_ms_tlas 0.257 a call against 0.997, 9 builds in 118 frames. GI's
own numbers match (cache cells p50 207,309 against 207,663; probes p50 0.258 against 0.267 ms, p90 1.18 in both);
work p50 48.2 against 46.8 ms, within the load's noise. One GPU frame peaked at 18.9 ms against 2.0 before, a
single spike: open.

No light, shadow or shading changes (LT14 doesn't apply).
2026-11-22 09:15:58 -08:00
shinyobjectz ca161bcb73 LT21: a part's Detail can name the box it is measured to, so a thing's levels switch at one distance
A Detail with edge measured each level to its own meshes' bounds. A city tile's levels overhang the tile by up to
100 m, and each level reaches differently. The code holding the levels measured to the tile's map box, so the two
disagreed by up to 62 m. On the 540p detail fly a tile's LOD2 faded out by its bounds with LOD1 not yet held
(raea had it 90% faded in), the sky showed through it, and LOD1 then appeared at once in frame 35.

Detail's bounds (TSX detail.box, six numbers in the part's own space) is the box the part is measured to and sized
by in place of its meshes'. A thing's levels given one box switch at one distance, and code holding levels by
distance can measure exactly as raea does. RAEA_LOD_DEBUG's report now names each range's part and gives the frame,
each mesh's bounds and inherited visibility, and a hidden mesh's ancestors. Any value but 1 or time keeps only the
parts whose name holds it. That is how the hidden LOD1 was found.

With every tile measured to one box (gambit's City), the fly's frame 35 goes from 29 popped 8x8 tiles to 2, frame
226 from 12 to none, and the shot from 199 to 160. The rest were there before. It changes what is drawn at a
distance, not light or shading, and no LT1 scene draws a Detail, so LT1's numbers are unchanged. lod tests: 8 pass.
2026-11-22 09:15:58 -08:00
shinyobjectz da31c4b3c6 LT3: the world cache, built and timed on Berlin before anything rests on it
A hash grid of cells on the surfaces rays hit (cache.wesl, from vendor/bevy_solari's world cache made raea's):
2^20 cells of 84 bytes. A cell's size grows with distance from the eye, it is split by its side, its read place is
jittered, and a read claims an empty cell and keeps a live one alive. Each frame, before the probes, two compute
passes run. The upkeep (compact.wesl) ages every cell and lists the live ones with a two-level prefix sum. The
update (gi.wesl learn and blend) has 40000 cells learn the sun through a shadow ray and one bounce into last frame's
cache, then blend, keeping fewer frames while a cell's light is changing. The list's length becomes the update's
indirect dispatch, copied out between the passes. The probes' hits read the cache, or LT2's stand-in where a cell
is new. Until hits know their surface (LT4) a cell sees albedo 0.5 and is keyed by the side a ray meets.

RAEA_GI_STATS gives the cache's GPU ms and the probes' apart (each pass's own timestamps) and the live cells. On
Berlin's walk at 1080p with 131072 probe rays a frame: smallest cell 0.15 m, cache 0.931 ms p50, cells peak
1,032,116 (the table full); 0.5 m, 0.512 ms, 479,631; 1 m, 0.456 ms, 189,480. The probes cost 0.259 ms at 0.5 m
(LT2's alone 0.253). 0.5 m is the default. The cache lights nothing on screen yet (Metal's sampler limit, as LT2),
so no frame changes and LT14 has nothing to measure. Its light is still unchecked.
2026-11-22 09:15:58 -08:00
shinyobjectz e35a7769c0 LT21: the sun's shadows fade out at their distance instead of ending in a line; the extract-order line out again
Bevy draws everything past the last shadow cascade fully lit, so a city's shadows stopped in a straight line across
the street (on the 540p fly over Berlin, at 300 m). raea-sys-lod swaps Bevy's shadows.wesl (its hash checked) for
one whose last cascade fades to lit over the cascades' overlap, the last 30% of the distance, and reloads it: an
embedded shader is read on the IO threads as soon as PbrPlugin registers it, so a swap made later draws Bevy's.
The fly's frames change on about 2% of their pixels, all lighter.

Reaching 900 m, where the day's fog begins, costs too much as it is (live at 2560x1440, median of 3, work p50):
walk 45.9 ms at 300 m against 53.3, fly 42.5 against 54.3. Far shadows wait on far cascades cast by coarse levels
and redrawn every few frames.

The ordering of mesh extraction after visibility ranges comes out: Bevy 0.20 already orders them (bevy_pbr
mesh.rs:200), and it changed no pixel. The frame 35 and 226 snaps are still open.

LT14, LT1 on raster before (main 19:53) and after:
  floor3-room  mean 1.379 / 1.379 stops, bias -0.801 / -0.801, worst 3.370 / 3.370, flicker 0.101 / 0.101,
               live 15.5 / 14.8 ms (work p50 15.47 / 15.14)
  glade        mean 1.758 / 1.758, bias 1.542 / 1.542, worst 3.000 / 3.000, flicker 0.817 / 0.817
  gambit-walk  live 47.2 / 44.1 ms (work p50 44.76 / 42.48); no reference yet
  kitchen      live 61.0 / 59.9 ms (work p50 58.80 / 58.58); no reference yet
The live differences are run to run; the fade costs nothing measurable.
2026-11-22 09:15:58 -08:00
shinyobjectz 0dfab1dbfd LT3: the plan: the world cache first, measured on Berlin before anything rests on it
The cache's files under systems/rt (cache.rs, cache.wesl, cache_update.wesl, compact.wesl), and what gi.wesl and
gi.rs gain. Until hits know their surface (LT4) a cell sees LT2's stand-in (albedo 0.5) and is keyed by the side a
ray meets. LT2's probe rays seed it, and the screen's 8x8-tile paths come after. It runs behind RAEA_GI=1, timed per
pass.
2026-11-22 09:15:58 -08:00
shinyobjectz 39369393f7 Windows: DX12's shader compiler ships with raea (#215)
Without dxcompiler.dll beside raea.exe, wgpu's DX12 backend compiles raea's shaders with the old FXC: 6 to 13 s
of hitches at start and as new 3D appears, on every PC DX12 is chosen for (Intel, AMD, Arc). On the test PC the
chat page took 17.7 s with FXC and 12.0 s with DXC (Vulkan 11.4 to 13.2 s). The Windows zip and installer now
carry Microsoft's DirectX Shader Compiler 1.8.2502 (dxcompiler.dll and dxil.dll, redistributable under
Microsoft's terms), fetched by tools/release/win-bundle.sh at a pinned sha256 and placed beside raea.exe with
its three licences. tools/release/win-bundle.files lists them, release-check.sh allows the two DLLs, and
NOTICE names them.

The skill's "1. Install (once)" names tools/release.sh: checked, still holds (the zip's bin\ gains two DLLs;
installing is unchanged).
2026-11-22 09:15:03 -08:00
shinyobjectz 4202a87850 SG4a: a live render's parts kept on disk, the MP4 writer's samples on disk, the master's true peak and loudness a block at a time, shapes in 16 MB generations
The film with every check on: 2.43 GB at frame 13,000 (3.7), 2.73 GB after its sound and video, a 4.8 GB peak (6.0),
the same 439 errors, 705 warns and 47 notes. The control (one scene, 13,200 frames): 1.27 GB at frame 13,000 against
1.07 in its first minute (+19%, was +44%), a 1.5 GB peak (2.85). raea-io-kept is new: each frame's parts go to a temp
file, each props map, string and material once by its content, a part's own place left out (a camera's kept).
2026-11-22 07:29:58 -08:00
shinyobjectz 2fd0c7f14a SG4a: the clipping check holds each shape's solid over its part's frames; frame purity's stills skip the checks it never reads
The clipping check made all 1,323 of the film's shape solids before its first frame and held them to its end
(2.9 GB of cells, 4 GB of footprint). A shape's solid is made at its part's first frame now, shared while parts
hold it and let go after the last of them, unless an overlap of it is still to be said (solid.rs Held). The
footprint after the check fell from 6.4 GB to 3.2 GB in the same 19 s.

Frame purity's stills, rendered by a second raea while the first still holds its memory, ran their own clipping
and staging checks (1.6 GB on the film's 44 stills); purity reads only their pictures and parts on screen.

The film with every check on: a 6.0 GB peak (8.5 before), the same 439 errors, 705 warns and 47 notes.
2026-11-22 05:06:26 -08:00
shinyobjectz 1c5993d5a4 SG4a: the status: the encoders' samples and the mesh share were most of the growth
The film with every check on now holds 2.4 GB at frame 1,000 (3.4 before) and 3.7 GB at
13,000 (5.75), with an 8.6 GB peak (9.5). What still grows is listed with its share: the
kept scenes and the checks' per-frame data, partly free allocator pages, the bounced
sound and the manifest's JSON values.
2026-11-22 03:47:53 -08:00
shinyobjectz 8cc12db395 SG4a: the mesh share lets go of what no part holds
A part whose size changes each frame is a new shape each frame, and Shared kept a
strong handle to every one: the film held 234,945 meshes a minute in (450 MB of heap,
and their GPU buffers), nearly all for shapes no part had any more. The share now
sweeps what only it holds whenever it has doubled since the last sweep. It moves to its
own crate, raea-sys-share (runtime/scene3d re-exports it), since scene3d is at its
2,000 lines.
2026-11-22 03:47:53 -08:00
shinyobjectz bc42f11ff2 SG4a: a long render's encoded video and its sound are kept on disk, not in memory
VideoToolbox, openh264 and rav1e each kept every encoded sample in memory until the
end, and the mux copied them all again: a 7-minute film's 1 GB. raea-io-codec's
Samples writes each to an unlinked temp file as it comes out (delete-on-close on
Windows) and remux::annexb_mux_from reads them back one at a time for the mux. The
offline bounce fills each channel as the frames come, sized once from the frame count,
instead of an interleaved copy of the whole sound split in two at the end.
2026-11-22 03:35:01 -08:00
shinyobjectz 0c9fc255f2 SG14: frame-empty is an error; a room's walls and models fill the frame, the page's background doesn't
A standing slab (a wall) fills the frame but is never the shot's subject; a model's file box adds coverage
(never judges: raea poses joints off the rest box), and a room model round the camera leaves the frame
unjudged. A CSS background over half the frame is the page's ground: since stage-guards-9 the film's
cream fills hid all five of its empty stretches. Frame passes and instanced copies leave a frame unjudged,
fire is of unknown size. Stay's 8 false empties are gone, the film's real ones fail, 29 clean scenes and
every other check unchanged.
2026-11-22 01:53:02 -08:00
shinyobjectz 7a1520bc3b SG13: raea fingerprint things' lurch runs on every render
Its camera-speed check (P2) read the picture's motion and compared each half second's mean speed with the one
before, inside a move away from its eases, and ran only by hand. A speed that ramps up over a few frames passes the
stage's one-frame kink, so only that check caught it. motion.rs ramps runs the same on the camera itself, on every
render, as a camera-lurch warning at 2x, none near a kink already said. On the 29 clean scenes it says 3, all real
(a camera locked to a raccoon breaking from a walk to a run, 2.4x); on the mobile-ads film, 6 beside its 41 errors.
2026-11-21 23:46:49 -08:00
shinyobjectz 9d237cf06a SG4a: the shape cache lets go, in memory and on disk
raea-core-shape's cache of each shape expression's triangles held every one for the process, in memory and on disk.
A part whose size changes each frame is a new expression each frame, so a long render grew by a mesh a part a frame,
and the disk cache gained 2.46 million files (9.7 GB, 2.2 million of them boxes) in 12 hours of renders, filling the
disk to 1 GB free. Memory is held to 1 GB of triangles, let go past it and made or read again as asked; only a shape
that took 2 ms or more to make is kept on disk, the boolean cuts the disk cache was for.
2026-11-21 23:32:43 -08:00
shinyobjectz abead7eae4 SG1: a ShaderExtension's uniforms follow the frame
A mesh's shader spec was read once, from its first frame, so a ShaderExtension uniform driven by the frame drew
frame 0's value all video long: a card tinted by frame / 89 stayed blue to frame 89, and SG9's frame purity failed
it (30136 pixels differ from the frame rendered alone). Its uniforms now go as own:uniforms rows, as a <Material>'s
do (own_uniforms' ext, for a 3D mesh's material), and own_live.rs packs them into the shaded material's slots when
they change (ShaderExt slots_for, from the names and the struct fields it was built with). The card goes blue,
purple, red, and SG9 passes.
2026-11-21 23:32:43 -08:00
shinyobjectz c2044c2899 raea-sys-stage builds on main: RAEA_TIMES read from the environment
8f92302403 timed the stage checks with raea_io_trace::stat, which only the unlanded nobuild branch adds, so main has
not compiled raea-sys-stage (nor raea) since: L1 compiled the shared workspace, where nobuild was applied. It reads
RAEA_TIMES as the clipping check on main does.
2026-11-21 22:56:02 -08:00
shinyobjectz e8eafcdedb SG4a: a long render's end checks let each scene, and then the solids, go
The end checks made every frame's parts while every frame's scene was still held, and raea-sys-contact's solids (one
per model file or shape expression, kept for the process) stayed after them, through frame purity's stills. Now the
checks take each frame's scene as its parts are made (told_taking, for the frames nothing reads the 3D of after), and
forget the files' triangles and the solids once they've run. RAEA_MEM_MARKS=1 prints the footprint every
RAEA_MEM_MARKS_EVERY frames of a live render and after each end step.

On the 13,175-frame film: 3.9 GB with each frame's parts made (about 1 GB less), 3.3 GB after the end checks (7.4
before), and a peak of 9.3 GB (10.5 to 10.9 before), with the same 435 errors, 699 warns and 47 notes. The clipping
check keeps each pair's stretches as they come, not every frame's hit (its findings the same, in order), and SG11's
type-over-part findings are said in the order they start, not a HashMap's.
2026-11-21 22:42:48 -08:00
shinyobjectz 20e3eba1e7 SG11: the 3D guide's rule 9 says page type stays off the parts
Words in the page over a tenth of a part for a quarter second fail the render (type-over-part), and words meant to sit
on the scene go in an element with data-allow-overlap. The skill's 3D router says the same (raea-skills #112, pin
2eaab93).
2026-11-21 21:53:44 -08:00
shinyobjectz 1cf7dbf59a SG11, SG14: Stay rendered whole with its page known
SG11 finds two type-over-part errors on Stay, both meant (a word drawn over the plant, the end title across the
screen), which take data-allow-overlap. SG14's empty stretches past frame 1699 are a dark sphere and a canyon's walls,
backdrop by the slab rule, so frame-empty stays a warning. The note that a mesh bound 48 bytes at frame 1699 was wrong:
it was Solari's dummy buffer, fixed on nobuild.
2026-11-21 21:50:52 -08:00
shinyobjectz 7be6b93b3f raea render's manual: the exposure check's clause back in its sentence
stage-guards-9's note on data-allow-overlap went in mid-sentence, leaving "and its pictures' exposure" after it.
2026-11-21 21:39:01 -08:00
shinyobjectz 590ec633f8 SG11, SG14: the manifest lists the page's pictures and the words that may sit on a part
The render manifest's frames gain `pictures`: each shown img, inline svg, and element painting a background image or
a colour at least half opaque, past a quarter percent of the frame (engine/page manifest.rs). SG14's coverage counts
them with the page's words and videos. Measured on Stay with its page known, two of its four empty stretches before
frame 1699 clear; the other two show a pool room whose walls, floor and water are backdrop by the slab rule, so
frame-empty stays a warning.

Words in an element that says data-allow-overlap are marked allowOverlap in the manifest, and SG11's type-over-part
leaves them be: a headline across a card is an error, the same words under data-allow-overlap pass. The finding's
fix and raea render's manual say so. in_caption and the new walk share one ancestor test.
2026-11-21 21:37:18 -08:00
shinyobjectz 35ce4cfdb3 SG11: page words over a 3D part are an error; SG4a: a long film renders whole with its end checks
SG11 (systems/stage/src/page.rs): words in the page, from the manifest's text (its ink's box, opacity 0.1 or
more), over more than 10% of a 3D part's box on screen for a quarter second or more, or on a still alone, are a
type-over-part error: one for each run of the words, naming the parts under them with their shares. A backdrop
(framing's slab rule, now shared) and a part with allowOverlap are left out, and so are words the manifest marks
allowOverlap. The stage checks take each frame's page (check_with, told); SG14's coverage counts the page's words,
videos and pictures, so a headline over an empty 3D isn't an empty frame (still a warning: the page doesn't write
its pictures into the manifest yet). raea-sys-stage's manifest.rs reads each frame's page from the manifest and
writes the parts and remounts into it (moved from raea-runtime-export, at its 2,000 lines).

A still's end checks now run once its page is laid out, on the scene each still keeps, by either route. The rows
route ran them on a thread before the page existed, and the live route (a game's stills) ran none.

SG4a: the 13,175-frame film renders whole with every end check on, peaking at 9.4 to 13.6 GB; before, it was
killed past 24 GB after its last frame. The sound step at a live render's end built the 3D's rows again from every
kept scene (28 GB): it leaves the 3D out now (program_of). A still past frame 3,600 makes its 3D live, as a game's
does, unless a compute in it carries state: raea check --quick on the film went from 10.4 GB and 39 s to 0.8 GB
and 9 s, with the same pixels and findings as the rows route at three frames, and SG9's 64 stills of the film fit
(by rows they passed 30 GB and were killed). The remounts are counted as the frames go.

Left: memory still grows with the frames (each frame's scene is kept for the end checks).
2026-11-21 21:11:05 -08:00
shinyobjectz 15af3be4b1 SG9: a video render with 3D in it holds a sample of its frames to the same frames rendered on their own
At a render's end (apps/direction pure.rs), one more raea renders the sample with --at:
every 300th frame, the last, and the frame after each remount (more than 20 parts
mounting or unmounting, which the manifest now lists). Each still is held to the video's
frame: a channel off by more than 96 levels through a 3x3 erosion, on more than 1e-4 of
the frame (tools/frame-pure-3d.sh's bar). It uses the largest channel, not luma: the
positive control's orange box over grey floor was 68 levels apart in luma and 116 in
blue. A frame that differs is rendered alone with --frame N. If it still differs, a
frame-pure error names the frame, the patch's box, the parts under it (a still's
manifest now lists each frame's parts on screen, from raea-sys-stage's on_screen) and
the two pictures, kept in OUT.frame-pure/. If it matches alone, frame-pure-jump warns:
raea's fault, not the composition's. RAEA_FRAME_PURE=0 skips it; render.md says so, and
now names the stage checks too.
2026-11-21 21:11:05 -08:00
shinyobjectz 7bc06bb777 SG4a: the clipping check holds each part over the frames it's in, not a slot for every frame
A 13,175-frame film (mobile-ads film2) was killed at 27-33 GB the moment its last frame
was drawn: the clipping check made tracks_of's dense tracks, a slot a frame for every
part id across the whole render, and filled() copied them again. A long film's parts
each live in one scene, so nearly all of those slots were empty. core/scene's spans_of
keeps each part from its first frame to its last (tracks_of is built on it, so the ids
stay one rule), and raea-sys-contact reads spans and a part's own world, with no filled
copy. raea scene stage over the same film peaked at 3.1 GB, so the stage checks were
never the cause.
2026-11-21 21:03:29 -08:00
shinyobjectz 67d85113fd SG8, SG16: Label, page type that names a 3D part, placed through the shot's camera; the 3D guide names the check behind each rule
Words that name or point at a part were written into the world as RichText, where they turned with the floor and
shrank with distance. Label (raea/camera) is page type instead: it projects its point through the props the shot's
Camera3d gets (a cameraPath's camera(frame), perspective or orthographic) and draws flat words there, capitals 32 px at
1080 by default and refused under 22, its box inside title-safe and growing away from the nearer edge, with a line and
a dot to the point, and nothing while the point is behind the camera or out of frame. On a moving camera its dots stay
on the boxes' tops in every frame.

The 3D guide's rules 4, 5, 9, 10 and 11 name what holds each: SG2's names, line-of-parts and part-snap, the type checks
and read={false}, camera-lurch and camera-reverse, raea scene stage, frame-empty and subject-cut, raea show --despite;
Line3d, cameraPath and Label are the recipes. The craft floor refuses labels written into the 3D.
2026-11-21 19:13:17 -08:00
shinyobjectz 3a98e0a52d raea run prints its console, its answer and a throw's message (#168)
raea run's program said nothing: its console went to the log, and raea run's headless App has no log, so every
console line was dropped. The default export's return value was dropped too. A throw printed its stack alone, which on
JavaScriptCore is only the frames, so the message was missing.

- runtime/calls: CONSOLE. While it's on (and ECHO), a script's console goes to the terminal as node's does: log and
  info to stdout, warn and error to stderr (raea-runtime-react's __raea_log). print takes err for a line meant for
  stderr.
- raea-runtime-export: run_bundle_to_terminal turns it on for raea run, raea test and raea blender run. raea check's
  asks and a spec's read keep run_bundle, whose stdout is their answer.
- raea-runtime-bundle: bundle_script's entry (script_entry.ts) prints what the default export returns, a string as it
  is and anything else as indented JSON. A throw prints as error: Name: message, then the stack, on stderr, exit 1.

Checked with the issue's cases on this build: console lines before and after an await, both streams, a returned object
and a returned string, a throw (exit 1, message and stack on stderr), a script with no default export. raea test's
output is unchanged (random-colors.test.ts, 9 pass). The manual's raea run page says all of it, with an example.
2026-11-21 19:11:44 -08:00
shinyobjectz 2aa85c456a SG2: footage, splats, sequences, fog, fires and grass are rows by identity, and spawned again when what they are changes
A live frame (every mp4's 3D) gave these kinds the id of their place in the frame, so a plate mounted as another
unmounted took the other's row and kept its clip, as a RichText once kept another's words. They are rows by identity
now, as meshes and text blocks are (live.rs BY_IDENTITY), and the columns each takes whole from its first frame (a
plate's clip, a splat's or a sequence's file, a fog's density texture, a fire's simulation, a field's grids) spawn it
again when they change, in a live frame and in a still's tracks alike (core/scene kept.rs WHOLE).
a_new_plate_never_takes_an_old_ones_row holds both.
2026-11-21 19:09:56 -08:00
shinyobjectz 8f92302403 SG10, SG12, SG13, SG14, SG15: raea render holds its 3D to type that reads, parts that don't snap, a camera that settles and a composed frame, and raea show won't post a render that still holds an error
raea-sys-stage (systems/stage) reads every frame's parts through its camera at the end of every render, beside the
clipping check: RichText too small or turned too far to read, a reveal that never starts or never finishes, words not
held long enough to read (SG10); a part's size on screen jumping in one frame, and a line built as a growing chain of
parts (SG12); a camera whose speed kinks or that goes in and back out within 1.5 s (SG13); frames with almost nothing
on screen, and the shot's subject cut by the edge (SG14). RichText read={false} leaves scenery out. raea scene stage
runs the same checks without drawing; raea scene moved from raea-runtime-export into raea-app-scene so the export crate
keeps room under its 2,000 lines.

Calibrated on the mobile-ads film (13,174 frames) and 33 clean scenes: the snap check as first written said 1,446
errors on the film and 1,252 on four clean scenes, and the lurch check 48 on Stay from f32 acos noise; what was left
out is each a measured false error (pop-ins, shared names, layout edits, parts over 6 m, speeds under what can be
seen, the gap between two long moves). The film now holds 375 errors (lurches at its spline's keys, labels at 60-75
degrees, code at 3-7 px); no type or snap error on the clean scenes.

raea show refuses a file whose newest render in its project's record holds an error it wasn't let through with,
naming each (engine/cli/src/held.ts); --despite CHECK "why" passes one and the why goes on the item. A still stepped
alone (raea check --quick, render --at) is judged for what a still shows, never for reveals or reading time.
2026-11-21 19:09:56 -08:00
shinyobjectz d2242ed6e6 skills: pin raea-skills ccbc507 (reference/sdk.md: random, interpolateColors and OffthreadVideo) 2026-11-21 17:39:14 -08:00
shinyobjectz 666acf6050 MV1-MV3: random, interpolateColors and OffthreadVideo from raea (#176)
A project moving to raea from another React video tool used three names raea didn't export (public #176). Each now
does what the issue describes, in sdk/raea/src/random-colors.ts, exported from raea:
- random(seed): a number in [0, 1) from a string or number seed, the same on every frame, run and machine (FNV-1a
  and murmur3's finaliser); null is Math.random.
- interpolateColors(input, inputRange, outputRange): interpolate per channel over @raea/ui's CSS colour parser,
  clamped at the ends, as rgba(r, g, b, a).
- <OffthreadVideo>: <Video> under that name.

sdk/raea/conformance/random-colors.test.ts: 9 tests (the issue's values, pinned random values, range and spread,
alpha, three keyframes, a colour that doesn't parse). The SDK reference lists them on raea's page; random-colors.ts
is skipped as an import path of its own, as canvas2d.ts is. docs/move-in.feature: MV1-MV3 done, MV4 (--props,
getInputProps, calculateMetadata) and MV5 (--scale, #175) open.
2026-11-21 17:39:14 -08:00
shinyobjectz 94dae14946 LightBench LB7: a world radiance cache, the nearer child first, and the bounce at half resolution
--cache on: a bounce ray reads the hashed cell it hits (sized by distance from the camera, one of six normal
directions; cache.wgsl) instead of tracing on, and feeds it a fresh sample: that point's direct light plus one ray to
the next surface's cell, so light goes one bounce further each frame and a pixel gets every bounce for two rays; a
resolve pass after the pixels folds each cell's samples into its light and frees untouched cells (NVIDIA's SHaRC,
Bevy Solari's world cache). The nearest-hit walk visits the nearer child first and skips kept boxes past its hit.
--bounce-res half: one pixel of each 2 x 2 block, a different one each frame, traces the bounce (half.wgsl) and every
pixel takes it from the four nearest blocks weighted by distance, normal and plane. The grid's two lists are one
buffer, so the pass binds 8 storage buffers.

Measured on the M5 Pro at 1280x720, the room at exposure 3, 16 lights, against an 8-bounce reference (its 1024- and
2048-frame frames agree to 0.91): the cache 21.5 / 7.5 / 3.5 / 1.8 at 1 / 16 / 64 / 256 frames, bias to -0.12 (5 cm
cells 1.84, 20 cm 2.91), where two traced bounces stop at 6.5 with -4.3 bias; at half resolution 15.3 / 6.4 / 2.9 /
1.6. The lighting pass takes 20.9 ms with the cache at full resolution and 8.5 ms at half (frame 11.8 ms, 85 fps);
nearer-child-first saved 7%. Timings on this shared machine move by up to 40% between runs.
2026-11-21 17:31:28 -08:00
shinyobjectz ec01569901 LightBench LB6: a sun with an angular size, sky light from bounce rays that leave, and --scene room
The sun is one shadow ray a lit point to a point on its disc (a cone sample), the same in every mode, so --sun-size
softens its shadows; a bounce ray that leaves the scene brings PI times the sky's radiance. --scene room puts the
knot and wall in a closed 8 x 3.6 x 11 m room with a window in its left wall, sun, sky and two bounces on unless
given. The BVH walks and the samplers move to trace.wgsl, joined to light.wgsl at compile time (frames unchanged,
RMSE 0.00 against the last commit's).

Measured on the M5 Pro at 1280x720, the room at exposure 3, 16 lights: the 512- and 1024-frame references agree to
RMSE 1.27; the weighted path 29.8 / 9.2 / 5.2 / 2.9 at 1 / 16 / 64 / 256 frames, its bias going to 0. At most
K + 1 + 3N rays a pixel (5 / 8 / 11 for N = 0 / 1 / 2) and 5.4 / 15.2 / 25.1 ms of lighting pass: in a closed room
every bounce ray hits, so two bounces at full rate miss 60 fps. The patch's edge (10-90%) is 5 / 11 / 20 px for a
sun of 0.53 / 4 / 12 degrees.
2026-11-21 17:30:27 -08:00
shinyobjectz 56ff2a7031 LightBench LB5: diffuse bounces through the BVH, each hit lit by the pixel's own light sampling; an f32 history
--bounce N follows N cosine-chosen rays from each pixel to the nearest triangle (a closest-hit walk of the same BVH,
with a CPU twin checked against every triangle) and lights each hit as a pixel is lit: one light sample in the
sampled modes, every light with --mode all. Triangles carry their albedo in their vec4s' w. --view bounce shows the
bounced light alone. The light history is now rgba32float: past a few hundred frames its 1/n steps vanished in f16
and the mean stopped moving.

Measured on the M5 Pro at 1280x720, the knot scene: the 512- and 1024-frame references agree to RMSE 0.33 (0-255),
and the weighted bounce falls as 1/sqrt(frames) to it, 15.3 / 6.5 / 3.7 / 2.0 / 1.1 at 1 / 4 / 16 / 64 / 256 frames,
its bias going to 0; two bounces 1.1 at 256. A sampled pixel traces at most K + 2N rays at 16 or 256 lights
(4 / 6 / 8 for N = 0 / 1 / 2); the lighting pass takes 3.1 / 6.2 / 9.8 ms at 16 lights and 8.4 / 13.3 / 16.9 ms at
256, where the every-light reference with one bounce traces up to 513 rays and takes 207 ms.
2026-11-21 17:30:27 -08:00
shinyobjectz 88ff2b6967 LightBench LB3c: a light grid, so a pixel weighs only the lights whose range reaches its cell
grid.rs builds world cells over everything the lights reach (2 m, at most 96 along an axis) each frame, each listing
the lights whose range sphere touches it; the sampled modes choose among the pixel's cell's lights, the every-light
reference still loops over all of them. --grid on|off; the field's lights (--scene field) are scattered over it, 6 m
reach each. Checked: a unit test (every light reaching any of 20000 points is in its cell, 300 lights); in the field
at 256 lights, weighted frames with the grid on and off are byte-identical raw and after 64 frames (RMSE to the
reference 15.63 raw, 1.95 accumulated), lights outside a cell weighing nothing; GPU lighting pass with the grid off and
on: 8.2 / 7.1 ms at 256 lights, 17.5 / 8.7 at 1024, 50.7 / 13.6 at 4096, rays 3.94 to 3.96 a lit pixel throughout.
2026-11-21 17:30:27 -08:00
shinyobjectz e708783013 LightBench LB4: rays a lit pixel counted on the GPU and the lighting pass timed by its own timestamps
Each workgroup sums its pixels' shadow rays and the most any traced, one atomic a workgroup into a stats buffer that a
timing run (--bench) reads back. The pass writes timestamps at its own start and end (the M5 Pro's Metal has neither
inside-pass nor inside-encoder timestamps, so Bevy's RenderDiagnosticsPlugin records CPU time only for it). Checked
at 1280x720: every light 11.3 rays a lit pixel (most 16) at 16 lights, 180.9 (most 256) at 256, its pass 5.1 and
77.7 ms; weighted K=4 3.44 and 3.45 rays (most 4) at 16 and 256 lights, its pass 2.9 and 8.3 ms: more lights don't
add rays, only the weighing of every light, which a light grid removes next.
2026-11-21 17:30:27 -08:00
shinyobjectz 90182e445b LightBench LB4: sweep.sh reruns the light-count, detail and field-of-view sweeps at 1280x720 and prints a line a run
First run (M5 Pro): every light 7.6 / 22.5 / 83.0 ms at 16 / 64 / 256 lights; K=4 uniform 6.1 / 6.7 / 6.2, weighted
5.2 / 6.3 / 11.0; the field draws 14.4% of its triangles adaptive (30.8% at 20 deg, 10 of 24 culled at 8 deg), but its
frame time is the same either way (11.1 against 11.4 ms): at 393k triangles the lighting pass, not the raster, is the cost.
2026-11-21 17:30:27 -08:00
shinyobjectz edbcb15e81 LightBench LB2 (CPU path): discrete LODs and a Nanite-style cluster hierarchy chosen by projected error, culling, --scene field
lod.rs: projected_px = focal_px * error * scale / depth to the bounds' near side (a camera inside asks for full detail).
Discrete LODs are the mesh halved by meshopt (absolute error, monotonic). The hierarchy groups 128-triangle clusters
by meshopt's partition (about four a group), simplifies each group to half with its border locked, and re-splits it;
each cluster keeps its own and its parent group's error and bounds, both only growing upward, so drawing a cluster
when its own error is within tau and its parent's isn't takes a parent or its children, never both. field.rs: rows of
knots sharing one hierarchy, culled against the view, each rebuilt from its chosen clusters when they change;
--detail full|adaptive, --tau, --fov, --view lod (colour by level). Checked: unit tests (farther coarser, 15 deg finer
than 45 at 20 m, inside the bounds full; on the closed knot every drawn edge is shared by exactly two triangles at 8
distance/threshold pairs; 16384 triangles draw 12032 / 9152 / 4416 / 1136 / 256 at 1 / 4 / 12 / 30 / 90 m, all at
0 px); the field (24 knots, 393216 triangles): adaptive 14.4% at 45 deg, 30.8% at 20 deg, at 8 deg 10 culled.
2026-11-21 17:30:27 -08:00
shinyobjectz 0a77ecb65e LightBench LB3b: temporal accumulation, reprojected, kept only on the same surface, reset on a camera cut; --raw
The light (before albedo) accumulates in a history each pixel reads from where its point was last frame, kept when
the stored distance (2%) and normal (0.9) agree, at most --history frames (32). A jump of over a metre or 20 degrees
in a frame is a cut and starts it again; --camera still|orbit|cut and --view history show it. Checked at 64 lights,
weighted K=4, 1280x720: RMSE to the every-light reference 8.3 / 5.8 / 3.4 / 2.5 / 1.9 after 1 / 4 / 16 / 32 / 64
frames (14.5/sqrt(frames), the 32-frame history settling like ~63), --raw 14.5 throughout; while orbiting the history
stays full but where the knot and wall uncover the ground; on a cut the ground's history drops to one frame and rebuilds.
2026-11-21 17:30:27 -08:00
shinyobjectz 90f138fba0 sdk: Cuboid's doc says Bevy's front face shows a picture upside down and its back face the right way up (found rebuilding a photo: every printed label read upside down) 2026-11-21 17:30:27 -08:00
shinyobjectz bdd30b7c65 LightBench LB1 and LB3a: a Rust + Bevy test renderer (bench/lightbench, docs/lightbench.feature)
Bevy's deferred prepass is the G-buffer (depth, world normals, albedo); a compute pass lights it into the HDR main
texture from point lights, every light (the reference) or K chosen uniformly or by their unshadowed light, each with
one shadow ray through LightBench's own binned-SAH triangle BVH, which holds every triangle (off-screen casters too).
Checked: the BVH matches brute force in unit tests and on the GPU (byte-identical frames at 4122 triangles); the
pillar outside the view casts into it (--no-pillar removes the band); 1280x720, 262k triangles, frame time with the
GPU waited for: every light 7.8 / 22.4 / 81.5 ms at 16 / 64 / 256 lights, uniform K=4 6.2 to 7.7 ms flat, weighted
K=4 5.3 to 10.9 ms; at 64 lights the RMSE against the reference falls ~1/sqrt(2) a doubling of K (uniform 56.8 to
14.1, weighted 30.8 to 7.1 from K=1 to 16), weighted K=4 as good as uniform K=16.
2026-11-21 17:28:45 -08:00
shinyobjectz 71ee5ab583 raea gen: made quotes a length-priced edit with its real video; fal puts a start frame in image_url
made: a model billed per second of its input (seedance_2_5_edit, catalog inputSecondsPricing) was quoted with a
stand-in URL, and made answered "couldn't read the source video: unsupported media container". The run now uploads
that input once and quotes and sends with the same media id; the plan says the price per second instead of the error.

fal: body() took the first non-list field containing "image_url", which in Seedance 2.5's schema is end_image_url,
so the start frame went in as the last frame and fal refused the job (422). The plain image_url / image_urls field
is picked first, and an end_image input goes to the end-frame field. Test: a_start_frame_goes_to_image_url_not_the_end_frame.

Found making the raea cloud hero film (11-18).
2026-11-21 17:27:49 -08:00
shinyobjectz 3469759329 TM0, TM1, TM2, TM3, TM4, TM8: telemetry goal written (docs/telemetry.feature) and six of its tasks done
Shane 11-20: repair and improve telemetry, split by platform and release period, and get it from CLI installs too, so
that only a build from source sends nothing. TM0-TM8 written; TM0, TM1, TM3 (server), TM8 live on raea-api 788657a4
and raea-admin (private 3a45e44, D1 0050 and 0051); TM1-TM4 in the app from raea-feed #99 (2f702df). TM5-TM7 (the
CLI, source builds silent, who may turn it off) stay open.
2026-11-21 17:24:21 -08:00
shinyobjectz 18b37c421c raea-bot is now raea cloud (Shane, 11-18): its name in setup.sh, cloud.feature CL6b and the box server's comment 2026-11-21 17:21:26 -08:00
shinyobjectz f70360f1ee Boxes set up one way, and the Linux test machine in raea's own Sprites org (11-18)
- sdk/cloud/deploy/sprites/setup.sh: everything a box needs, run on the Sprite as
  bash -s -- NAME RAEA_VERSION AGENTS [REF] < setup.sh: packages, Node, raea's Linux release (sha256-checked),
  sdk/cloud's server (a tarball box.sh sends, or the public repo at REF), the ACP agents, the box's token, the farm's
  env, the skills, and the raea-cloud service. box.sh up runs it by hand (RAEA_CLOUD_REF for a commit instead of the
  local tree), and raea cloud's agents run the same script through the Sprites API, so the two can't differ (CR11).
  Tested on two throwaway Sprites, one each way: both ready in about 50 s with the same /v1/health.
- sdk/cloud/deploy/sprites/org.sh: the org guard box.sh had, shared: the org only from
  ~/.config/raea-cloud/sprites.env, refused when private/cloud/sprites-denied.txt lists it.
- tools/linux-box.sh: makes and completes the Linux test Sprite raea-linux (RAEA_LINUX_BOX picks another) in that
  org: build packages, the toolchain, the public repo, and an ubuntu 24.04 root /srv/noble for builds at glibc 2.39.
  tools/linux-check.sh uses it by default; its first check passed at 5194d34ef (raea-cli in 726 s, raea-render
  without default features in 134 s).
- tools/denied.sh: fails on any name from the private Sprites deny list found outside it, in the whole working tree;
  with no private checkout (public CI) there's nothing to check. L1 runs it.
2026-11-21 17:21:26 -08:00
shinyobjectz fcbfba57b9 Filter layers sized by what they draw, and an atlas as large as the GPU's textures (#125)
A 2160x3840 page with seven or more full-frame filtered elements was refused: each filtered element was an image the
size of its box in Vello's image atlas, and the atlas stopped at 8192 px a side, which holds six frame-sized images.
A motion blur of six <Freeze> samples plus one more filter was enough.

- blitz-paint: a filter's layer is the boxes the element and its descendants draw (drawn_bounds), and a box that
  draws nothing (box_paints: no background, border, shadow, outline, text of its own, inline content or replaced
  content) is left out, as Chrome sizes a filter's input. A full-frame wrapper around a 200 px square is a layer the
  square's size grown by the blur's reach. An element that draws nothing at all keeps its border box.
- vello_encoding: the atlas grows to the device's max_texture_dimension_2d (set_max_atlas_size, 16384 on Apple
  silicon: 28 frame-sized images at 2160x3840), set by raea-page before it makes its renderer. A full 16384 atlas is
  1 GiB, made only when a page needs it. The refusal names the real size.

bench/filter-atlas/check.sh: the issue's repro with twelve wrappers (each square's middle white, the page between
#333) and ten frame-sized filtered layers whose boxes draw (the page's middle 184; nine would be 176). Both are
refused on 0.1.8 (6 and 4 images left out) and pass here. bench/filter-overflow/check.sh still passes. Twelve filter
shapes (wrappers with absolute and in-flow children, text, a span, an image, a drop shadow, a border, nested
filters, a rotated child, a clipping wrapper, an SVG, a box shadow) draw the same pixels as 0.1.8 (PSNR 120).
2026-11-21 17:16:34 -08:00
shinyobjectz 8b1cef58d5 font-missing: render_said lives with the page's not_applied, so the export crate stays under its 2,000 lines
#174's render_said put raea-runtime-export at 2,009 lines. It reads raea-sys-page's not_applied and nothing of the
export's, so it moves there (raea-sys-page gains raea-core-facts) and the export re-exports it: the CLI's call is
unchanged.
2026-11-21 17:12:38 -08:00
shinyobjectz da20262976 A font-family whose first family isn't there is a render warning, naming the font drawn instead (#174)
A fontFamily that wasn't installed or loaded drew in the next family that was (the browser's serif, Times, when
none was), and the render said nothing: a web font that failed to load turned a whole video into Times.

- blitz-dom: each text style's family list is asked about as stylo_to_parley makes it, and its first named family is
  checked against the fonts once the inline layout is built (the builder holds the font context until then). A miss
  is kept once as: font "X" not found: drawn in Y, where Y is the first later family that resolves, or the generic's
  face. A family found later (a web font still loading at the first layout) takes its line back. Lists that start
  with the platform's system-face names (-apple-system, BlinkMacSystemFont, ui-*) aren't checked, nor bevy_text's.
- raea-runtime-export: render_said says each as a font-missing warning, with a fix, once the frames are out; it is
  counted with the render's findings and kept in its manifest, and is followed by the #34 note as before.

Checked on this build: the issue's repro warns for NoSuchFamily123 (drawn in Times) and not for Helvetica. A Tailwind
stack, a system-font stack, Georgia and monospace say nothing. A missing brand font before Helvetica warns once though
two elements use it. An @font-face web font from staticFile says nothing, as a still at frame 0 and as a video.
2026-11-21 17:12:38 -08:00
shinyobjectz 6dc089b82c skills: 44adf23, the SDK reference and meshes guide with Line3d and Tube (raea-skills #108) 2026-11-21 17:11:09 -08:00
shinyobjectz 34bf8eb021 SG6: Line3d and Tube, a line through points as one part drawn on solid at every frame
A curve drawn as a chain of parts (a box a segment) mounted a part a frame as it grew, each a frame late or at
another's place, so the stage film's curves came in chunks with their joins showing. raea/mesh's Line3d (flat, a
width, round joins and ends, facing its points' plane) and Tube (round, rings carried along so they never twist,
capped) are one BufferMesh each through every point, cut at p of their length, so animating p draws the line on.
The meshes guide's curve recipe uses them and names a chain of parts as a common mistake; the manual's raea/mesh
page and Tube's taxonomy line; sdk/raea/conformance/line3d.test.tsx.
2026-11-21 17:07:56 -08:00
shinyobjectz 6e1d7ceee0 SG5: one clock for every 3D part that takes a frame of its Sequence
sdk/render/src/3d/clock.ts holds the check RichText had: a frame prop at or past its Sequence's last frame is refused
at the part's first frame, naming the prop and the fix. RichText, a mesh's and a material's animate (its first key:
an animation the Sequence's end cuts short is fine, one that never starts isn't), a lens effect's and MotionBlur's
animate, and BevyComponent's from use it. Video's startFrom (a frame of its source clip) and a volume source's
seconds are left out on purpose. sdk/raea/conformance/one-clock.test.tsx; the spec's SG4 and SG5 status.
2026-11-21 17:02:16 -08:00
shinyobjectz 4bdc4749e4 SG4: a part whose entity had already gone is an error naming it and the frame
The frame store's despawn used World::despawn, which only logs "Could not despawn entity" when the entity is gone
(despawned with another row it hung from) and carries on while the part is drawn wrong. It now uses try_despawn,
drops the row from the store either way, and returns an error naming the row's kind and id; remove_rows_from and
Engine::remove_rows pass it on, and a render fails on it with the frame ("frame N: Could not despawn entity: the text
part 'quote' had already gone ..."). The store test covers it.
2026-11-21 17:02:16 -08:00
shinyobjectz d83975535f skills: d8ed3cd, the SDK reference with cameraPath (raea-skills #107) 2026-11-21 16:39:33 -08:00
shinyobjectz f7147d52c0 SG7: the manual's raea/camera page lists cameraPath and its types 2026-11-21 16:39:33 -08:00
shinyobjectz 9d311f5fde SG7: cameraPath, a camera path that can't lurch
raea/camera's cameraPath(keys): keys timed in frames, each channel (position, look point, fov) a cubic paced by time
with one velocity a key, so the camera's speed carries across every key; it eases only at the ends and at a hold, and
no channel passes a key and comes back. camera(frame) gives Camera3d's props (fov in radians, as Bevy's is), and
check() names a key whose timing still makes the camera brake hard, with the fix.

On the stage film's 155 keys (the film's own camera diagnosis) framing reversals go from 24 to 5 and speed changes of
2x within 3 frames from 51 to 29; what's left is in the keys (turns, poses given twice, a quick move against a slow
one), and check() names exactly the 18 of the last kind. The 3D guide's camera rule uses it.
2026-11-21 16:39:33 -08:00
shinyobjectz ba2dc6ade7 SG3: a glyph that grows the 3D text atlas is drawn whole
bevy_rich_text3d 0.8 read the atlas image's size before allocating a glyph, and the allocation that doubled the
atlas's height left that glyph drawn into the old bounds: the letter came out cut (a Space Mono H in the stage film,
hidden there by warming the atlas with throwaway text). raea now patches it (vendor/bevy_rich_text3d, tess.rs reads the
size after allocating; vendor.toml says why and the way back to upstream).

engine/render/tests/diag/glyph-atlas-probe.tsx draws the glyph set into a cold atlas and a warm one, and
tools/frame-pure-3d.sh compares the two. SSIM over a whole frame scored the cut letter 0.9996, so the check also counts
pixels off by over 96 levels after an erosion that drops lone ones: 179 on a build without the fix, 0 with it.
2026-11-21 16:32:52 -08:00
shinyobjectz c3dd6b7d52 SG0: the stage repros are a standing check: a 3D sequence's frames must match the same frames rendered alone
tools/frame-pure-3d.sh renders each repro in engine/render/tests/diag as one sequence (lossless PNGs, frame after
frame in one process, as an mp4's live 3D is made) and four of its frames alone, and fails below SSIM 0.999 naming the
repro and frame. Green on main after SG1 and SG2 (0.9998 and up on every sampled frame); a sequence's frame 28
against frame 29 alone scores 0.986, so a part held since its first frame can't pass. kept-props2 leaves out its
picture row, which showed two brands' logos. L1 runs it when the code that makes or draws 3D rows changes.
2026-11-21 16:05:34 -08:00
shinyobjectz f4b524f896 SG16: the 3D guide's rules say what the stage guards hold
The mobile-ads essay's faults came from rules the guide didn't state or stated wrong:
- rule 5 said a shape is fixed for a part's life; since SG1 a changed shape or words is built again on the frames it
  changes, so the rule is now grow by scale, and change words only when they change;
- one clock (SG5): a scene is a Sequence and its parts read useCurrentFrame, never a frame passed down as a prop;
- type that reads: labels in the page over the 3D, world type at least 22 px caps, within 35 degrees of the camera,
  held for its reading time (SG9-SG12's numbers);
- a camera that settles: keys timed by frames and paced by time, no push-pull or pan reversal inside 1.5 s (SG13).
2026-11-21 15:57:02 -08:00
shinyobjectz 0d01e4ef43 SG5: RichText refuses an at or exitAt past its Sequence's last frame
`at` and `exitAt` count in useCurrentFrame's frames. A scene that passed its own frame down as a prop gave a frame
from another clock, which in a shorter Sequence fell past the end, so the move never started (a quote set at its
scene's frame 1013 never appeared in a 150-frame part). The error names the prop, the Sequence's last frame and the
fix.
2026-11-21 15:57:02 -08:00
shinyobjectz 83d8f8e305 SG1: a 3D part whose shape or words change is spawned again; SG2: a text block keeps its own row
An mp4 draws its 3D live, frame by frame (raea-runtime-scene live.rs), and the engine reads a part's shape, its
words and its surface's maps only when the part's row is spawned. So a Sphere whose radius grew, a RichText whose
words changed and a Ribbon's newest box all held their first frame's: curves drew as dashes, counters stayed at
"0.0 MB" and typed lines stopped half-typed. A text block also kept the id its frame gave it (text0, the frame's
first block), so a block mounted as another unmounted took over that one's row and drew the old words in its own
glyphs' colours.

- core/scene kept.rs: which columns a row keeps from its spawn, per kind (kept_col, respawns); a part's kept inputs
  as one number (spawn_sig); tracks cut where those change (split_kept); KeptInputs for the fast path. The live
  column tables moved here from live.rs, which is at its size limit.
- live.rs diff: a row whose kept columns changed is dropped with the rows under it (glyphs, components; those first,
  SG4) and spawned again under the same id. Text blocks are rows by identity, as meshes are. A glyph's colour is sent
  as col_r/g/b.
- fast.rs: the fast path takes the full path when a part's kept inputs changed.
- A still's rows (and RAEA_3D=program's) cut a part's track where its kept inputs change.
- runtime/live/tests/stage_guards.rs: 5 tests (a shape spawned again, new words laid out again, a new text never
  takes an old one's row, a glyph's colour, a still's own shape and words). live_emissive and live_sheet pass.
- docs/stage-guards.feature: the diagnosis and the guards SG0-SG16.
2026-11-21 15:57:02 -08:00
shinyobjectz 9e03e5fe4b manual: the SDK pages main's ask and camera changes left stale
brief.md and fingerprint.md gain fingerprint.ts's ask (AK8: flags asked again of the decision model as it scores), and
camera.md loses the HTML image props its component no longer takes, as tools/manual-ref/sdk.ts writes them from main.
2026-11-21 15:55:32 -08:00
shinyobjectz 5a73a7d5b4 skills pin: raea-skills #106, raea ask in the skills and the references main changed
feed.md (the ask tool), files.md (~/.raea/ask, RAEA_HOST_FILE, install.json) and sdk.md (raea/ask) were stale on main,
so every lane's L1 failed its skills step; fingerprint.md and collaborate.md now say when to ask.
2026-11-21 15:51:25 -08:00
shinyobjectz 2c0d626432 manual: show's labels, media sheet's labels file and export xml's two projects, as main's help says
f858b78c3b (CO2b, CO2c) gave raea show --label/--detail/--labels and raea media sheet its OUT.labels.json, and the
layers app's export xml now writes NAME.premiere.xml and NAME.resolve.xml, without their reference pages, so L1's
manual reference step has failed on main since 11-18. Regenerated with tools/manual-ref/cli.ts, and the three flags
described.
2026-11-21 15:48:24 -08:00
shinyobjectz 031d1357ca vendor: hanabi's contract tests carry the raea: mark for #196's label change
#196 renamed two shader labels in vendor/bevy_hanabi/src/render/shader_contract_tests.rs (no colon, which DXC reads as
a file name) without a raea: mark, so tools/vendor check has failed on main since 11-19 and every landing's L1 with it.
2026-11-21 15:43:31 -08:00
shane a6f59c198f Merge pull request #213 from shinyobjectz/fp-silent
fingerprint: a render with no sound track has no sound to judge
2026-11-20 17:15:22 -08:00
shane 6073b116b7 Merge pull request #214 from shinyobjectz/ask-double
AK8: the fingerprint's flags asked again of clef
2026-11-20 17:15:18 -08:00
shane 6298d127e5 Merge pull request #210 from shinyobjectz/one-plan
PL8: one way to keep work, and any tracker beside it
2026-11-20 17:15:13 -08:00
shane 5a57a5e128 Merge pull request #212 from shinyobjectz/ask-calibrate
AK6-AK7: raea ask learns from the person: verdicts, notes and approvals, calibrate and try
2026-11-20 16:39:12 -08:00
shane 328aba8849 Merge pull request #211 from shinyobjectz/ask
AK0-AK4: raea ask, questions about a piece's picture and sound, paid from the person's plan
2026-11-20 16:38:58 -08:00
shane af925441a8 skills: the pin at raea-skills #105, with controllers gone and plan.org the one list
It also carries raea-skills #104, whose raea side (#205) is already in main.
2026-11-20 16:38:45 -08:00
shane d203d64944 Merge pull request #209 from shinyobjectz/no-controllers
PJ9: controllers are gone; a standing rule is a taste line
2026-11-20 16:38:29 -08:00
shinyobjectz af2b35f439 AK8: the fingerprint's flags asked again of clef
raea fingerprint score FILE --ask flags (or ask: "flags" in fingerprint.ts)
puts each flagged moment to clef as a yes/no question in its axis's own
words, looking or listening as the axis does, on that moment's window
alone, so it costs by the flags and never by the piece; --ask unsure also
asks the windows an axis puts in its plausible band without flagging them.
It goes through raea ask's runner (routes, cache, record, the person's
calibration), and the axis's words are the question's label words, so the
person's notes calibrate it (AK6, AK7).

Each flag gets a line under the score ("dark: clef doesn't see it (0.00)",
and a clef array with --json), and each answer replaces clef's last
eye:clef evidence row for that moment, which trains the head and never
counts as the person's. A moment it couldn't ask says why, and the score
goes on.

The double check is its own crate, raea-app-double, since raea-app-ask
holds 1841 of its 2000 lines. The manual page covers score --ask beside
readings' and postmortem's --ask N; docs/ask.feature marks AK8 done.
2026-11-20 16:26:21 -08:00
shinyobjectz 1858bf9bef fingerprint: a file with no sound track has no sound to judge
Columns::sound embeds at least one clip, so a render with no audio stream
got one empty clip's CLAP vector, and Modality::Sound.in_file said it had
sound. Its sound axes then judged silence, and score could hold it back as a
gating dropout or clip over the whole file. Sound and sound events are now
in a file only when it has levels to read; the embedding is unchanged, so
evidence rows and damage windows keep their features.
2026-11-20 16:24:00 -08:00
shinyobjectz 0daaeb5b38 AK6-AK7: raea ask learns from the person: verdicts, notes and approvals label it, calibrate and try
A label belongs to a question and the clips a call sent, so new words asked of the same clips share its labels.
raea ask verdict ANSWER WORD is the person's answer in the question's own terms; a note of theirs on the posted
render, inside the window and holding one of the question's label words, is a yes, and a post they approved without
one is a no. Each call now keeps its file's identity, so the note is matched to the render it was left on, never to a
later render at the same path. An agent's own look (--eye agent) is kept and never counted.

raea ask calibrate holds each labelled version to the person's labels through the fingerprint's own AUC, quantile
and gates (16 of each kind, 3 projects, 0.8); a version that passes flags where 10% of their clean work would, and
goes out with the question from then on, in place of raea's shipped calibration. One under 0.6 after 32 labels lists
what it missed. raea ask try sends new words with the kept clips through the same runner and prints both AUCs.

The record now writes each row in one write, since several runs append to the same files.
2026-11-20 15:50:31 -08:00
shinyobjectz 6a4ff18a0b ask: six snippets reshaped that the dupes check read as copies
L1's dupes step counted 300 exact groups against 294 allowed, and each of the six new groups was ask code beside an
existing twin. Recorded answers are read in one step, the cache folder names its PathBuf, the media prune reads each
entry's metadata in one chain, a temp clip is removed with .ok(), the client encodes base64 with the engine itself,
and a question id is checked over its bytes.
2026-11-20 15:25:33 -08:00
shinyobjectz 24b8bf33e4 AK4: raea ask --brief none, for a caller that writes the whole state itself
The app's critique and game check now ask through raea ask (raea-feed) with their own state: --brief none (or
"brief": "none" in a batch) keeps raea ask from adding the nearest brief's facts to it, and with no brief and the
caller's state, the caller says what the piece is. docs/ask.feature AK4 says what's built and in review: the pool
route's sounds, criteria, pool left and ask scope on raea-api, and the app's /host/ask, ask tool and critique.
2026-11-20 15:17:23 -08:00
shinyobjectz 68433ab526 AK3: raea ask: questions about a piece's picture and sound, prepared, asked in parallel and kept
raea-app-ask. prepare.rs reads what raea knows of the piece before it spends: what the file holds, the nearest brief.ts
(through raea spec) and a words file. A question that doesn't apply is dropped or swapped with why (a silent piece
asks sound-silent in place of sound); not knowing whether anyone speaks, both variants go in one call with the voice
question, and the answer sets the other aside. runner.rs plans a batch into calls (by file, window, files beside it
and what the questions look at, 64 a call), cuts each clip once, calls in parallel (--jobs), streams the answers, and
when the pool is spent partway keeps what came and reports the rest as waiting. record.rs keeps every call and
answer under ~/.raea/ask with the clips it cut, by hash, at most 2 GB. verbs.rs is raea ask: own words (--choose,
--grade, --rate, --flag), the standard sets (--set, --std, ask list), windows (--from, --to, --at), --with, --batch
(a JSON list or lines, - for stdin), --dry, --json and --gate for pipelines.

sdk/raea's raea/ask gives scripts ask and askMany over raea ask --batch --json. The clef client's failures are
typed so a spent pool waits rather than fails; decide.changed needs files beside it. The manual's CLI and SDK pages
are written with it; AK1, AK1b, AK2 and AK3 are done in docs/ask.feature.
2026-11-20 15:07:41 -08:00
shinyobjectz 70cb98d3e8 AK1b: raea-io-clef: one clef client, routed to the person's plan first; raea judge moved onto it
One call: the state, the questions by id, and stills (JPEG), videos (MP4) and sounds (MP3) cut with raea's FFmpeg to
clef's limits (480 px H.264 at a small bitrate, mono 16 kHz MP3, JPEG at most 1,600 px; ffprobe says first what a file
holds). It goes the first way that answers: the raea app's host (/host/ask, which adds its sign-in), an agent key
(RAEA_AGENT_KEY with RAEA_API, for pipelines and servers), the person's own Cloudflare account; with none it says how
to get one. No plan or no ask scope hands on to the next way; a spent pool stops unless the person has their own keys.
Unchanged questions on unchanged media come from a cache by request hash; RAEA_CLEF_REPLAY gives recorded answers to
tests.

raea judge asks through it (Question::from_wire reads its rubric's clef-native questions), so apps/judge's own
clef.rs is gone and the judge pays from the plan when the app is signed in. docs/settings.md lists the new settings.
2026-11-20 14:44:32 -08:00
shinyobjectz 6c7bf70a4e AK1: raea-core-ask: the question, how its answer reads, the standard sets and clef's limits
A question is clef's own shape (yes, choose, grade, rate), what it needs to be asked (`when`, and the question asked in
its place with `swap`, so sound to sound-silent is data), what it looks at and listens to, its window, label words and
calibration. Every answer reads as a problem score from 0 to 1 whatever its type, so one calibration fits all; a
question flags past its calibrated threshold, or past even odds as advice. A wording is versioned by a stable hash.

The standard sets: the rubric, read from its guide (one copy); av, picture with sound; defects, the fingerprint's
seven axes with no labels, in its own words; platform, the check packs' 17 model questions with their calibration (3
pass the 0.8 gate); decide, picks and before/after. The limits are raea-api's where stricter, so a call that passes
them passes on every route. sdk/raea/src/ask.gen.ts is generated from the types and checked by a test.
2026-11-20 14:38:44 -08:00
shinyobjectz dc956173f1 AK1: ask's spec: questions about a piece's picture and sound, paid from the person's plan
docs/ask.feature sets the model and plans AK1-AK9: one question format and one clef client for every caller (the CLI,
pipelines and scripts, raea check, the fingerprint's double check, the app's agents, critique and game checks, raea
judge); ask understands a question before it spends; the person's pool first, then an agent key, then their own
Cloudflare keys; one parallel runner that cuts each clip once; standard sets (rubric, picture with sound, the
fingerprint's unlabelled axes, the check packs' questions, decisions); and answers kept and labelled so each question
earns its threshold, better words can be measured, and a calibrated question can later be learned locally.
2026-11-20 14:32:28 -08:00
shinyobjectz d90b05017e PL8a: a brief has no tasks, and an object's plan is its parts
core/brief's Brief drops stages and its Stage, Mark and Task types: a
project's tasks are its plan.org. An older brief with stages still
reads; raea doctor says its tasks belong in plan.org and moves nothing.

core/brief's object plan, the solids contract, is parts() in
NAME.parts.ts (raea spec --as parts), so plan means only a project's
plan.org. No project used plan(); the bevy guides that teach it, the
manual and the reference pages follow.
2026-11-20 14:00:55 -08:00
shinyobjectz 5f55c55d57 PL8: one way to keep work, and any tracker beside it
docs/plan.feature PL8: plan.org is the one list, a message isn't a task,
closing follows the work, the keywords are the file's, and a task is kept
in step with another tracker by :LINK: and #+LINK_STATES:, agreed with
raea cloud.

@raea/task: trackersOf, trackerStates, keywordFor and statusFor read a
task's :LINK: entries (SYSTEM:ID, one per system) and the head's status
maps; checkPlan names a bad entry, a URL, a system twice on one task, one
tracker item on two tasks and an unknown mapped keyword, each with its
fix, and requires nothing else. newPlan takes the keyword sequence its
caller keeps. A raea cloud plan.org passes with nothing flagged.
2026-11-20 14:00:55 -08:00
shinyobjectz 86fe5d3673 size and no-void skip skills/, as they do in the live tree
raea-skills is its own repo. In the live checkout git never lists a
submodule's files, so neither check read them; L1's export extracts the
pinned skills as plain files, and since the pin took in the vendored
video-decompiler skill every lane's L1 failed on its font licences and its
907-line scene.tsx.
2026-11-20 13:01:40 -08:00
shinyobjectz 822b73fc7d PJ9: controllers are gone; a standing rule is a taste line
A taste line's check now takes any of raea's checks by name or a project's
own .ts check by path, with values and a level, beside the six forms. raea
check reads the project's own taste.ts beside the person's and the
workspace's, and raea context prints it.

Removed: the controller schema, raea controller, raea spec --as controller,
[controller] overrides in .raea/project, the registry's controller kind and
its lints, controllers/ in new projects and shared/, and controller() in
raea/brief. raea controller and raea doctor say where a controller's parts
go; doctor moves or deletes nothing. The direction proof's five rules are
lines in its taste.ts and it passes as before.
2026-11-20 13:00:19 -08:00
shane db53845b01 Merge pull request #207 from wackyza/styles-plan
Videoform: the plan and its tasks (VF1-VF13)
2026-11-20 12:38:35 -05:00
shane 3ffe34bb7d Merge pull request #205 from wackyza/check-fewer-rounds
raea check: fewer rounds, shorter checks, and raea's own mix and master
2026-11-20 12:38:08 -05:00
Zachary GuglinandClaude Opus 5.5 0706baee4e Videoform: the plan and its tasks (VF1-VF13)
A videoform is the kind of video a person makes again and again, read once from five to ten of their finished videos
(from the drive, or streamed from a URL with nothing downloaded) into embeddings and measures, then followed and checked
on every cut without going back to the references. It's a kind of fingerprint, and flows into what raea has: its
ranges into its profile (FP6e), its rules into a controller's rule fields (DR4, DR8), its structure into a script
template, its references into brief.ts's shape. What ships runs on raea's own models; the domain vocabulary is written
by the person's own AI. docs/videoform.md is the plan (what's built on, what a videoform keeps, the resolver, when it
doesn't hold together, judging, the build order); docs/videoform.feature its rask tasks, with their plans.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 19:09:46 -08:00
shane 1b7450fb4b Merge pull request #206 from shinyobjectz/win-sizes-export-game
Windows: sizes without du, export-game says it makes Mac games; TokenSynth's line in 0.1.8's notes
2026-11-19 21:34:26 -05:00
shinyobjectz 84acab1f50 whats-new 0.1.8: TokenSynth ran end to end on Windows
rc12 on a Windows runner with nothing on the PATH but raea and Windows: raea setup-audio tokensynth in 113 s, then C2 and C3 of "warm analog bass" in about 75 s each on the CPU, both in tune (64.8 Hz and 130.5 Hz), and again from the asset store at once. The Known line now says only that it runs on the CPU there.
2026-11-19 17:52:04 -08:00
shinyobjectz 25280d1eba Windows: sizes without du, and export-game says it makes Mac games
raea setup-audio (and raea motion's model folders) said "(?)" for every size on Windows: raea_io_home::disk_use ran du, which Windows has no copy of. Without du it now adds up the files' sizes (through links when asked, 64 folders deep at most) and writes them in du -h's units. a_folder_is_sized_without_du; run on a Windows 11 PC with no du, and on macOS.

raea export-game on Windows or Linux said "no player at ...\\raea-game (build it: cargo build --profile game ...)": its targets are a Mac's (signed with codesign) and those releases carry no player, so the advice led nowhere. Off a Mac it now says it makes Mac games and that Windows and Linux games aren't there yet.
2026-11-19 17:52:03 -08:00
Zachary GuglinandClaude Opus 5.5 6350c5deb0 raea-runtime-export keeps under its crate limit with LX6 and LT1's plan: the exposure filter's comment trimmed
rask's size gate counts a crate's planned tasks: the 2D fill filter left raea-runtime-export at 2001 lines with them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 17:00:57 -08:00
Zachary GuglinandClaude Opus 5.5 b6dad1b8aa raea check reads the picture once for flashing, freezes, flash frames and blotching: the same findings in half the time
Four of raea check's rules each decoded the whole export, one after another: 3.7 s apiece on the 11-14 walkaround,
38 s of FFmpeg on a 56 s master export. Run at the same time they took 15.8 s, the same as in turn: decoding is the
machine's whole CPU, so only decoding less saves anything. One FFmpeg now decodes it once and splits the frames into
the four filter chains the rules were tuned on, each to its own output with its own options as when it ran alone
(raea-app-check-read once.rs): the flashing screen's frames to stdout with their showinfo times on stderr,
freezedetect's lines on stderr, the 32x18 grey and blotching's 2 s crops to named pipes. Each rule is split into its
read and its judgement, and the judgements run on what the one read gave, in the order they ran before.

tests/parity.rs holds the one read to the four alone on a clip FFmpeg makes: the same flashing frames and times, the
same brightness, the same crops and the same freeze. On both Telluride projects' exports the check's findings and passes
are identical to before (its JSON byte for byte), and it takes 7-8 s where it took 13-20, and 20-29 s where blotching's
comparison render also runs (37-59 before). Without named pipes (Windows with FFmpeg) the rules read alone as before,
and without FFmpeg raea's own readers do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 16:41:53 -08:00
Zachary GuglinandClaude Opus 5.5 4c3a3ba799 raea mixes and masters every render's sound: dialogue at one level, a leveller before the limiter, room tone at the joins
The person's rule, 11-19: raea does its own mix on everything, then masters it. Until now a render was
mastered only with a <Mix>, and then by a gain and a limiter alone; levels were the agent's to set. The 11-14 walkaround's
lines ran from -13.8 to -26.9 LUFS, so the agent measured each with ffmpeg and set its gainDb, the limiter still took
up to 8 dB off phone speech's peaks, and the joins between lines fell to dead silence (a dropout, the check said). It
then built and mastered the voice outside raea.

- The mix (raea-sys-mix-level, level.rs): each line of dialogue, a clip on the voice bus or footage's sound on no bus,
  is measured over the span of its take it plays (BS.1770, gated) and brought to -23 LUFS, by at most 12 dB. Room tone
  and silent takes (under -45) keep their level; so do music, effects and every other bus, which sit under dialogue as
  their buses set them. gainDb is an offset on top. Live play and the render level the same span the same way (the
  clip's span comes from the SDK's data-clip-from and data-clip-to).
- The master: a leveller in the limiter (from 9 dB under the ceiling, 3:1 on the mix's RMS, 10 ms in, 150 ms out)
  rounds the loud passages so the limiter catches only what's left, in live play, the render and seedling's limiter
  alike; the gain is made up for what it took. Without a <Mix>, every render masters to -14 LUFS at -1 dBTP.
- The joins (joins.rs): a gap the mix drops into dead silence and comes straight back from gets the room's own tone, the
  quietest stretch of sound near it, looped and faded, found at the level the master plays it. A pause that fades is
  the edit's and stays. The render fills them; live play hears the gap.

The walkaround's v1 sound, each line straight from its take: before, its lines spread 6.7 LU and it had a dropout (and
the mono fold's false clipping); now 2.1 LU, no dropout, -14.5 LUFS, -1.6 dBTP, with nothing set by hand. The Kia cut,
whose voice was mastered outside raea, comes out at -14.1 LUFS, -1.2 dBTP. MASTER_VERSION 4. The guides stop telling
agents to level lines or add a <Mix> to be mastered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 16:41:53 -08:00
Zachary GuglinandClaude Opus 5.5 6d076868f0 raea check measures clipping on each channel: the mono fold read a clean master as clipped
The clipping rule read the sound folded to mono, which ffmpeg's -ac 1 (and raea's fold, after it) make at
(L + R) * 0.707: a centred voice comes out 3 dB hotter than either side. The 11-14 walkaround's v1 and v2 masters peak at
-1.5 and -1.6 dBTP, no channel near full scale, yet their folds passed 1.0 and the check found 9 to 36 flat-topped runs
over full scale. The agent spent two renders on it and then mastered the voice outside raea; raea check on those same
files, each channel at its own level, finds no clipping. Clipping is a channel's: each is now read as it is (read::channels,
FFmpeg's -ac 2 or raea's own decoders), and a second is the most runs any channel had. A clipped channel is still found,
one that the fold would have hidden among the other too. The dropout and dead-stop rules keep reading the fold.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 16:41:53 -08:00
Zachary GuglinandClaude Opus 5.5 119f458018 raea render holds a video's text to the check's rules as it ends, and keeps a 2D frame's fill out of the lighting advice
A round sooner: what the render's manifest already knows is said by the render, not left for the check after it (the
11-14 walkaround's price figures in the UI zone waited a render and a check). Text off the frame is an error, as the
check has it. Text in a UI zone is a warn by the default zones, since the platform's are the check's to decide; reading
time waits for the check, which has the transcript. Video renders only: a stills render samples too few frames to time
a text. raea check's issue-to-finding conversion is now Issue::finding, which both use.

Exposure's lighting advice ("a fill, an ambient or the sky's light reaches them nowhere") is a 3D scene's. A frame with
no 3D in the render and no footage on it is the page's own fill, dark or bright by design (the walkaround's brand-dark
logo card warned on every stills render), so it's measured and kept in the manifest, not said. A frame with footage
keeps its warning: a clip that drew black still shows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 16:41:53 -08:00
Zachary GuglinandClaude Opus 5.5 1899d29dff raea check says who can fix what it finds, so a round goes only to what another render can change
Two Telluride walkaround projects (11-14, 11-16) took nine renders; five chased findings no render could move. The
checks measured right every time; what they didn't say was whose each finding was. Nothing a rule measures, and no
line it draws, changes here: what changes is how a finding is told.

- The picture's own or the encode's (raea-app-check-cause). A rule an encode can cause is measured again on the
  composition drawn at the same frames without encoding (raea render --at, out of the record). Blotching is the first:
  the walkaround's phone footage scored blotchy in 9 of 28 samples before any encoding, so every export failed and no
  setting cleared it. Now the picture's own is a note, and what the encode added is the error with a fix raea has:
  --quality high added to 14 of 28 samples (x264 crf 12 moved the score at most 0.005; master added none), so the
  check says render with --quality master, and the master export then passes with the note.
- Carried. A finding an earlier export of the same composition had at the same moment ends "[also in …]": what changed
  between them didn't move it. Its rank stays as measured.
- A source isn't a delivery: a take under assets/ or media/ checked on its own reports its loudness as a note.

The text rules (clipped, UI zones, reading time, face, cues, brand kit) move to raea-app-check-text, so raea render can
hold its own text to them, and raea-app-check stays under its size limit. Probe gives the video's frame rate.
The rendering guide tells agents to fix every error in one pass, not to repeat a change that didn't move a carried
finding, and that a note is for the person.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 16:41:53 -08:00
730 changed files with 87506 additions and 6056 deletions

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
# vendor/bevy_pbr's shaders keep LF on every checkout. raea replaces some of them with its own forks only after checking
# Bevy's is still the one the fork was taken from, by its bytes' hash (raea_sys_frame::bevy_api::swap_embedded_shader),
# and a Windows checkout turns LF into CRLF: 0.1.9-rc1's Windows build panicked on volumetric_fog.wesl at its first render
vendor/bevy_pbr/**/*.wesl text eol=lf
vendor/bevy_pbr/**/*.wgsl text eol=lf
+3 -3
View File
@@ -1,11 +1,11 @@
# gitleaks: the default rules, minus raea's asset ledgers, whose "key" field is a content hash of the made file
# (prompt, seed and model), not a credential; and Bevy's batching code, whose `prev_key = item.sort_key.0` is a
# render-phase sort key.
# render-phase sort key and whose `Opaque3dBinKey` and `Wireframe3dBinKey` (vendor/bevy_pbr) are bin keys' type names.
[extend]
useDefault = true
[allowlist]
description = "asset ledgers and Bevy sort keys"
description = "asset ledgers and Bevy sort and bin keys"
paths = ['''(^|/)assets/made\.jsonl$''']
regexTarget = "line"
regexes = ['''prev_key = item\.sort_key''']
regexes = ['''prev_key = item\.sort_key''', '''(bin_key|BinKey) = [A-Za-z0-9]+BinKey\b''']
Generated
+212 -10
View File
@@ -3065,8 +3065,6 @@ dependencies = [
[[package]]
name = "bevy_pbr"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb760932d1e683e7c00011f5c99e4e1cc893646a3a7b7224da6daf9bfa94853d"
dependencies = [
"arrayvec",
"bevy_app",
@@ -3438,8 +3436,6 @@ dependencies = [
[[package]]
name = "bevy_rich_text3d"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b3cfe8f7187fb6f8e4889b8e7dcf39ff36bf7a84fcbd4f7b69f7d3b8a7bfe4"
dependencies = [
"bevy",
"cosmic-text",
@@ -13636,6 +13632,22 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "019b4b213425016d7d84a153c4c73afb0946fbb4840e4eece7ba8848b9d6da22"
[[package]]
name = "raea-app-ask"
version = "0.1.0"
dependencies = [
"dunce",
"raea-core-ask",
"raea-io-assets",
"raea-io-clef",
"raea-io-home",
"raea-io-trace",
"raea-sys-fingerprint",
"serde",
"serde_json",
"sha2 0.10.9",
]
[[package]]
name = "raea-app-capcut"
version = "0.1.0"
@@ -13654,10 +13666,11 @@ dependencies = [
name = "raea-app-check"
version = "0.1.0"
dependencies = [
"dunce",
"raea-app-check-cause",
"raea-app-check-flash",
"raea-app-check-inbox",
"raea-app-check-read",
"raea-app-check-text",
"raea-core-brief",
"raea-core-facts",
"raea-io-ffmpeg",
@@ -13667,6 +13680,15 @@ dependencies = [
"serde_json",
]
[[package]]
name = "raea-app-check-cause"
version = "0.1.0"
dependencies = [
"image",
"raea-core-facts",
"serde_json",
]
[[package]]
name = "raea-app-check-flash"
version = "0.1.0"
@@ -13683,13 +13705,24 @@ dependencies = [
name = "raea-app-check-read"
version = "0.1.0"
dependencies = [
"libc",
"raea-app-media",
"raea-io-ffmpeg",
"raea-io-home",
"raea-io-media",
"raea-sys-measure",
"serde_json",
]
[[package]]
name = "raea-app-check-text"
version = "0.1.0"
dependencies = [
"dunce",
"raea-core-facts",
"serde_json",
]
[[package]]
name = "raea-app-ci"
version = "0.1.0"
@@ -13704,12 +13737,15 @@ name = "raea-app-direction"
version = "0.1.0"
dependencies = [
"dunce",
"image",
"raea-app-check",
"raea-app-check-text",
"raea-app-notes",
"raea-app-registry",
"raea-core-brief",
"raea-core-facts",
"raea-io-home",
"raea-io-media",
"raea-io-trace",
"raea-runtime-bundle",
"raea-runtime-react",
@@ -13717,6 +13753,21 @@ dependencies = [
"serde_json",
]
[[package]]
name = "raea-app-double"
version = "0.1.0"
dependencies = [
"raea-app-ask",
"raea-core-ask",
"raea-io-assets",
"raea-io-clef",
"raea-sys-columns",
"raea-sys-fingerprint",
"raea-sys-fingerprint-use",
"serde",
"serde_json",
]
[[package]]
name = "raea-app-engines"
version = "0.1.0"
@@ -13740,6 +13791,7 @@ dependencies = [
"dunce",
"fastrand",
"raea-app-check",
"raea-app-double",
"raea-io-home",
"raea-sys-columns",
"raea-sys-fingerprint",
@@ -13786,14 +13838,13 @@ dependencies = [
name = "raea-app-judge"
version = "0.1.0"
dependencies = [
"base64 0.22.1",
"dunce",
"image",
"raea-core-ask",
"raea-core-facts",
"raea-io-clef",
"raea-io-home",
"raea-runtime-bundle",
"serde_json",
"ureq 2.12.1",
]
[[package]]
@@ -13875,11 +13926,26 @@ dependencies = [
"serde_json",
]
[[package]]
name = "raea-app-scene"
version = "0.1.0"
dependencies = [
"dunce",
"raea-core-facts",
"raea-runtime-bundle",
"raea-runtime-export",
"raea-sys-contact",
"raea-sys-light-meter",
"raea-sys-stage",
"serde_json",
]
[[package]]
name = "raea-app-solid"
version = "0.1.0"
dependencies = [
"dunce",
"raea-app-ask",
"raea-app-judge",
"raea-core-facts",
"raea-core-meshcheck",
@@ -13933,7 +13999,6 @@ dependencies = [
"dunce",
"raea-app-check",
"raea-app-registry",
"raea-core-brief",
"raea-core-facts",
"raea-io-assets",
"raea-io-home",
@@ -14154,6 +14219,7 @@ version = "0.1.0"
dependencies = [
"bevy",
"dunce",
"raea-app-ask",
"raea-app-capcut",
"raea-app-check",
"raea-app-ci",
@@ -14166,6 +14232,7 @@ dependencies = [
"raea-app-media",
"raea-app-notes",
"raea-app-play",
"raea-app-scene",
"raea-app-solid",
"raea-app-sound",
"raea-app-targets",
@@ -14212,6 +14279,15 @@ dependencies = [
"serde_json",
]
[[package]]
name = "raea-core-ask"
version = "0.1.0"
dependencies = [
"serde",
"serde_json",
"ts-rs",
]
[[package]]
name = "raea-core-brief"
version = "0.1.0"
@@ -14442,6 +14518,20 @@ dependencies = [
"serde_json",
]
[[package]]
name = "raea-io-clef"
version = "0.1.0"
dependencies = [
"base64 0.22.1",
"raea-core-ask",
"raea-io-assets",
"raea-io-ffmpeg",
"raea-io-home",
"serde_json",
"sha2 0.10.9",
"ureq 2.12.1",
]
[[package]]
name = "raea-io-codec"
version = "0.1.0"
@@ -14632,6 +14722,16 @@ dependencies = [
"serde_json",
]
[[package]]
name = "raea-lightbench"
version = "0.1.0"
dependencies = [
"bevy",
"bytemuck",
"meshopt",
"wgpu",
]
[[package]]
name = "raea-modules"
version = "0.1.0"
@@ -14713,6 +14813,7 @@ dependencies = [
"raea-io-media",
"raea-io-net-calls",
"raea-io-os",
"raea-io-trace",
"raea-page",
"raea-page-sound",
"raea-page-stage",
@@ -14749,6 +14850,7 @@ dependencies = [
"blitz-dom",
"raea-gpu-device",
"raea-io-home",
"raea-io-trace",
"raea-runtime-bake",
"raea-runtime-dom",
"raea-runtime-js",
@@ -14810,11 +14912,13 @@ dependencies = [
"raea-runtime-view",
"raea-sys-compose",
"raea-sys-compute",
"raea-sys-engine-shaders",
"raea-sys-environment",
"raea-sys-fog",
"raea-sys-fog-half",
"raea-sys-frame",
"raea-sys-framepass",
"raea-sys-gi",
"raea-sys-grass",
"raea-sys-grid",
"raea-sys-hold",
@@ -14851,7 +14955,11 @@ dependencies = [
"objc2 0.6.5",
"objc2-metal 0.3.2",
"objc2-metal-fx",
"raea-io-home",
"raea-io-trace",
"raea-sys-engine-shaders",
"raea-sys-post",
"raea-sys-rt",
"serde_json",
"wgpu",
]
@@ -14868,6 +14976,7 @@ name = "raea-rune-bevy"
version = "0.1.0"
dependencies = [
"bevy",
"raea-io-trace",
"rune",
"wgpu",
]
@@ -14995,6 +15104,7 @@ version = "0.1.0"
dependencies = [
"bevy",
"raea-io-home",
"raea-io-trace",
"raea-modules",
"raea-runtime-bundle",
"raea-runtime-react",
@@ -15011,6 +15121,7 @@ dependencies = [
"raea-core-scene",
"raea-io-home",
"raea-io-media",
"raea-io-trace",
"raea-native",
"raea-runtime-bundle-lib",
"raea-runtime-cssurls",
@@ -15044,6 +15155,7 @@ dependencies = [
"raea-core-shape",
"raea-io-media",
"raea-io-net",
"raea-io-trace",
"raea-native",
"raea-runtime-plugins",
"raea-runtime-wear",
@@ -15084,6 +15196,7 @@ dependencies = [
"keyboard-types",
"raea-core-wire",
"raea-io-net",
"raea-io-trace",
"raea-runtime-dom-media",
"raea-runtime-js",
"raea-runtime-twins",
@@ -15101,6 +15214,7 @@ dependencies = [
"bevy",
"blitz-dom",
"raea-io-net",
"raea-io-trace",
"raea-runtime-js",
"raea-sys-image",
"raea-sys-page",
@@ -15141,6 +15255,17 @@ dependencies = [
"wgpu",
]
[[package]]
name = "raea-runtime-endchecks"
version = "0.1.0"
dependencies = [
"raea-core-facts",
"raea-core-scene",
"raea-sys-contact",
"raea-sys-stage",
"serde_json",
]
[[package]]
name = "raea-runtime-export"
version = "0.1.0"
@@ -15157,10 +15282,12 @@ dependencies = [
"raea-io-assets",
"raea-io-media",
"raea-io-net",
"raea-io-trace",
"raea-page",
"raea-render",
"raea-runtime-bake",
"raea-runtime-encode",
"raea-runtime-endchecks",
"raea-runtime-page",
"raea-runtime-pagestore",
"raea-runtime-react",
@@ -15174,6 +15301,8 @@ dependencies = [
"raea-sys-light-meter",
"raea-sys-mix",
"raea-sys-page",
"raea-sys-rt",
"raea-sys-stage",
"serde_json",
"wgpu",
]
@@ -15187,6 +15316,7 @@ dependencies = [
"raea-core-k",
"raea-core-program",
"raea-gpu-device",
"raea-io-trace",
"raea-runtime-view",
"raea-sys-frame",
"raea-sys-k",
@@ -15224,6 +15354,7 @@ dependencies = [
"raea-io-net",
"raea-io-net-calls",
"raea-io-os",
"raea-io-trace",
"raea-runtime-bundle",
"raea-runtime-jsengine",
"serde",
@@ -15238,6 +15369,7 @@ dependencies = [
"miniz_oxide 0.8.9",
"objc2 0.6.5",
"raea-io-home",
"raea-io-trace",
"rquickjs",
]
@@ -15325,6 +15457,7 @@ dependencies = [
"raea-bevy-world",
"raea-core-program",
"raea-core-shape",
"raea-io-trace",
"raea-sys-frame",
"raea-sys-material",
"raea-sys-shader",
@@ -15401,6 +15534,7 @@ version = "0.1.0"
dependencies = [
"bevy",
"raea-core-program",
"raea-io-trace",
"raea-runtime-plugins",
"raea-sys-compute",
"raea-sys-copies",
@@ -15413,6 +15547,7 @@ dependencies = [
"raea-sys-post",
"raea-sys-sampler",
"raea-sys-shader",
"raea-sys-share",
"serde_json",
]
@@ -15423,6 +15558,7 @@ dependencies = [
"muxide",
"raea-io-codec",
"raea-io-media",
"raea-io-trace",
"re_mp4",
]
@@ -15454,6 +15590,7 @@ version = "0.1.0"
dependencies = [
"bevy",
"raea-io-assets",
"raea-io-trace",
"raea-runtime-calls",
"raea-runtime-react",
"raea-seedling",
@@ -15507,6 +15644,7 @@ dependencies = [
"raea-gpu-device",
"raea-io-home",
"raea-io-media",
"raea-io-trace",
"raea-page",
"raea-sys-frame",
"raea-sys-k",
@@ -15561,6 +15699,7 @@ dependencies = [
"bevy_seedling",
"firewheel",
"raea-io-media",
"raea-io-trace",
"raea-sys-mix",
"raea-sys-tone",
"serde_json",
@@ -15651,11 +15790,14 @@ name = "raea-sys-compose"
version = "0.1.0"
dependencies = [
"bevy",
"bytemuck",
"indexmap",
"raea-core-program",
"raea-io-trace",
"raea-sys-frame",
"raea-sys-rt",
"serde_json",
"wgpu",
]
[[package]]
@@ -15679,6 +15821,7 @@ dependencies = [
"raea-core-meshcheck",
"raea-core-scene",
"raea-core-shape",
"raea-io-trace",
"serde_json",
]
@@ -15701,6 +15844,17 @@ dependencies = [
"rayon",
]
[[package]]
name = "raea-sys-engine-shaders"
version = "0.1.0"
dependencies = [
"bevy",
"raea-core-program",
"raea-io-trace",
"raea-sys-frame",
"serde_json",
]
[[package]]
name = "raea-sys-environment"
version = "0.1.0"
@@ -15777,8 +15931,11 @@ dependencies = [
"bevy",
"bytemuck",
"raea-core-program",
"raea-io-trace",
"raea-sys-frame",
"raea-sys-rt",
"raea-sys-volume",
"serde_json",
]
[[package]]
@@ -15863,6 +16020,16 @@ dependencies = [
"serde_json",
]
[[package]]
name = "raea-sys-gi"
version = "0.1.0"
dependencies = [
"bevy",
"raea-sys-compose",
"raea-sys-rt",
"wgpu",
]
[[package]]
name = "raea-sys-glb"
version = "0.1.0"
@@ -16008,6 +16175,8 @@ name = "raea-sys-lod"
version = "0.1.0"
dependencies = [
"bevy",
"raea-io-trace",
"raea-sys-frame",
]
[[package]]
@@ -16042,6 +16211,7 @@ dependencies = [
"raea-core-program",
"raea-core-shape",
"raea-io-net",
"raea-io-trace",
"raea-sys-frame",
"raea-sys-mesh",
"raea-sys-sampler",
@@ -16080,11 +16250,21 @@ dependencies = [
"audioadapter-buffers",
"cpal 0.15.3",
"firewheel",
"raea-io-home",
"raea-io-media",
"raea-io-trace",
"raea-sys-mix-level",
"raea-sys-tone",
"serde_json",
]
[[package]]
name = "raea-sys-mix-level"
version = "0.1.0"
dependencies = [
"raea-io-media",
]
[[package]]
name = "raea-sys-ml"
version = "0.1.0"
@@ -16117,8 +16297,10 @@ dependencies = [
"blitz-traits",
"color",
"parley",
"raea-core-facts",
"raea-core-wire",
"raea-gpu-device",
"raea-io-trace",
"raea-sys-filters",
"raea-sys-fonts",
"raea-sys-image",
@@ -16277,6 +16459,13 @@ dependencies = [
"serde_json",
]
[[package]]
name = "raea-sys-share"
version = "0.1.0"
dependencies = [
"bevy",
]
[[package]]
name = "raea-sys-shots"
version = "0.1.0"
@@ -16294,6 +16483,7 @@ dependencies = [
"ort",
"raea-io-home",
"raea-io-media",
"raea-io-trace",
"raea-sys-vision",
"serde_json",
]
@@ -16333,6 +16523,17 @@ dependencies = [
"serde_json",
]
[[package]]
name = "raea-sys-stage"
version = "0.1.0"
dependencies = [
"bevy",
"raea-core-facts",
"raea-core-scene",
"raea-core-shape",
"serde_json",
]
[[package]]
name = "raea-sys-text3d"
version = "0.1.0"
@@ -16417,6 +16618,7 @@ version = "0.1.0"
dependencies = [
"bevy",
"raea-core-program",
"raea-io-trace",
"raea-sys-frame",
"serde_json",
]
+18
View File
@@ -4,6 +4,7 @@
resolver = "2"
members = [
"core/animate",
"core/ask",
"core/brief",
"core/facts",
"core/ease",
@@ -61,6 +62,7 @@ members = [
"io/codec",
"io/media",
"io/assets",
"io/clef",
"io/gen",
"io/gen-comfy",
"io/gen-core",
@@ -80,6 +82,7 @@ members = [
"systems/k",
"systems/tone",
"systems/mix",
"systems/mix/level",
"systems/ml",
"systems/mlx",
"systems/kimodo",
@@ -113,6 +116,7 @@ members = [
"systems/page-net",
"systems/page-ops",
"systems/frame",
"systems/engine-shaders",
"systems/shots",
"systems/hold",
"systems/body",
@@ -120,11 +124,14 @@ members = [
"systems/layers",
"systems/splat",
"systems/sprite",
"systems/stage",
"systems/rt",
"systems/gi",
"systems/text3d",
"runtime/gpuframe",
"runtime/scene3d",
"systems/copies",
"systems/share",
"systems/screen",
"systems/matchmove",
"systems/grid",
@@ -166,6 +173,7 @@ members = [
"runtime/cssurls",
"bench/bridge",
"bench/bevy-parity",
"bench/lightbench",
"bench/bridge/swatch",
"bench/rerender/ios",
"core/alloc",
@@ -178,6 +186,7 @@ members = [
"runtime/wear",
"runtime/canvas",
"runtime/export",
"runtime/endchecks",
"runtime/live",
"runtime/page",
"runtime/appscreen",
@@ -186,10 +195,14 @@ members = [
"runtime/scene",
"runtime/scene2d",
"runtime/shared",
"apps/ask",
"apps/double",
"apps/check",
"apps/check/cause",
"apps/check/flash",
"apps/check/inbox",
"apps/check/read",
"apps/check/text",
"apps/direction",
"apps/notes",
"apps/fingerprint",
@@ -203,6 +216,7 @@ members = [
"apps/interchange",
"apps/judge",
"apps/solid",
"apps/scene",
"apps/media",
"apps/targets",
"apps/game",
@@ -321,6 +335,8 @@ muxide = { path = "vendor/muxide" }
usvg = { path = "vendor/usvg" }
# bevy_seedling 0.8.0 without its cpal 0.18 paths, ported to Bevy 0.20 (changes marked "raea:")
bevy_seedling = { path = "vendor/bevy_seedling" }
# bevy_rich_text3d 0.8.0 whose glyph that grows the atlas is drawn whole (changes marked "raea:", docs/stage-guards.feature SG3)
bevy_rich_text3d = { path = "vendor/bevy_rich_text3d" }
# bevy_text 0.20.0 on parley 0.12, so one parley builds (changes marked "raea:", docs/bevy-upgrade.md)
bevy_text = { path = "vendor/bevy_text" }
# bevy_ui 0.20.0 on Taffy 0.15, Blitz's, so one Taffy builds (changes marked "raea:", docs/bevy-upgrade.md)
@@ -329,6 +345,8 @@ bevy_ui = { path = "vendor/bevy_ui" }
# uv_transform, and a panorama's sun sampled as a light rather than found by reflection rays alone (changes marked
# "raea:", docs/raytracing.feature RT6). Back to upstream once Solari has these.
bevy_solari = { path = "vendor/bevy_solari" }
# the sun's far shadow map (raea-sys-rt far.rs) bound in Bevy's mesh view group (docs/bevy-upgrade.md, docs/realism.feature LT21)
bevy_pbr = { path = "vendor/bevy_pbr" }
# bevy_ui_widgets 0.20.0 on parley 0.12, Blitz's (docs/blitz-bevy.feature B0a)
bevy_ui_widgets = { path = "vendor/bevy_ui_widgets" }
# blitz-paint 0.3.0-beta.4 with angled gradients in tiles laid out around the tile, many-tile gradient layers drawn
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -1,25 +0,0 @@
Copyright (c) 2020 Dario Nieuwenhuis
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-316
View File
@@ -1,316 +0,0 @@
AWS Libcrypto (AWS-LC)
AWS-LC is a fork of BoringSSL, which is itself a fork of OpenSSL.
Content from these and other sources retains their original licensing,
as described below. New files from AWS-LC are made available under the Apache-2.0 license OR the ISC
license. These licenses are reproduced at the bottom of this file.
```
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0 OR ISC
```
================================================================================
BoringSSL
================================================================================
BoringSSL is a Google-maintained fork of OpenSSL. Historically, code
authored by Google for BoringSSL was licensed under the ISC License.
BoringSSL has since relicensed upstream to Apache License 2.0. Existing
AWS-LC code originating from BoringSSL retains its ISC license, while
newer code taken from BoringSSL is licensed under Apache License 2.0.
```
Copyright (c) 2014-2024 Google Inc.
SPDX-License-Identifier: ISC
```
Additional individual contributions to BoringSSL-derived code are
covered under the ISC license:
- Brian Smith (Copyright 2016)
- Robert Nagy (Copyright 2022)
- Arm Ltd (Copyright 2020)
```
Copyright (c) 2025-2026 Google Inc.
SPDX-License-Identifier: Apache-2.0
```
================================================================================
OpenSSL
================================================================================
Code derived from the OpenSSL project is licensed under the
Apache License, Version 2.0.
```
Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved.
SPDX-License-Identifier: Apache-2.0
```
Some OpenSSL-derived files also carry the original SSLeay copyright:
```
Copyright (c) 1995-1998 Eric Young ([email protected]). All rights reserved.
SPDX-License-Identifier: Apache-2.0
```
Portions of OpenSSL-derived code include contributions from:
- Sun Microsystems, Inc. (Copyright 2002)
- Nokia (Copyright 2005)
- Intel Corporation (Copyright 2012-2021)
These contributions are covered under the Apache-2.0 license.
================================================================================
mlkem-native
================================================================================
Code from the mlkem-native project is licensed under Apache License 2.0 or MIT or ISC.
```
Copyright (c) The mlkem-native project authors.
SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
```
================================================================================
mldsa-native
================================================================================
Code from the mldsa-native project is licensed under Apache License 2.0 or MIT or ISC
```
Copyright (c) The mldsa-native project authors.
SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
```
================================================================================
Third-Party Libraries (compiled into libcrypto/libssl)
================================================================================
Fiat Cryptography
-----------------
Synthesizing Correct-by-Construction Code for Cryptographic Primitives.
See third_party/fiat/LICENSE.
```
Copyright (c) 2015-2020 the fiat-crypto authors.
SPDX-License-Identifier: MIT
```
s2n-bignum
----------
Integer arithmetic routines for cryptography.
See third_party/s2n-bignum/s2n-bignum-imported/LICENSE.
```
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0
```
Note: ML-KEM/SHA3 code within s2n-bignum is licensed as
Apache-2.0 OR ISC OR MIT (with attribution), sourced from the
mlkem-native project.
Jitter Entropy RNG
-------------------
CPU Jitter Random Number Generator Library.
See third_party/jitterentropy/jitterentropy-library/LICENSE.
The Jitter Entropy library is dual-licensed under a BSD-style license
and the GNU General Public License Version 2. Amazon expressly elects
to distribute the package under the 3-Clause BSD License and NOT under
GNU General Public License Version 2.
```
Copyright (C) 2017 - 2025, Stephan Mueller <[email protected]>.
SPDX-License-Identifier: BSD-3-Clause
```
Keccak / AES Reference Implementations
---------------------------------------
Public domain (CC0) contributions.
https://creativecommons.org/public-domain/cc0
Code from sources and by authors listed in comments on top of the respective files.
================================================================================
Third-Party Libraries (NOT compiled into libcrypto/libssl)
================================================================================
The following are used for testing and build tooling only. Distributing
code linked against AWS-LC (libcrypto/libssl) does NOT trigger these
license obligations.
Google Test
-----------
See third_party/googletest/LICENSE.
```
Copyright 2008 Google Inc.
SPDX-License-Identifier: BSD-3-Clause
```
Go Standard Library
-------------------
Code in ssl/test/runner/ is derived from the Go standard library.
```
Copyright (c) The Go Authors. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
```
Wycheproof Test Vectors
------------------------
Project Wycheproof is a community managed repository of test vectors that can be used by cryptography library
developers to test against known attacks, specification inconsistencies, and other various implementation bugs.
See third_party/wycheproof_testvectors/LICENSE.
```
SPDX-License-Identifier: Apache-2.0
```
================================================================================
Full License Texts
================================================================================
Apache License 2.0
------------------
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
ISC License
-----------
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
MIT License
-----------
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
BSD 3-Clause License
--------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MIT No Attribution (MIT-0)
--------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-201
View File
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-25
View File
@@ -1,25 +0,0 @@
Copyright (c) 2020-2025 The RustCrypto Project Developers
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-176
View File
@@ -1,176 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
-25
View File
@@ -1,25 +0,0 @@
Copyright (c) 2023 Thomas Pendock
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-202
View File
@@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-201
View File
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-25
View File
@@ -1,25 +0,0 @@
Copyright (c) 2018 Jorge Aparicio
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-201
View File
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-25
View File
@@ -1,25 +0,0 @@
Copyright (c) 2017 Jorge Aparicio
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-21
View File
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2017 Dzmitry Malyshau
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -1,25 +0,0 @@
Copyright (c) 2019 Anthony James Munns
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-12
View File
@@ -1,12 +0,0 @@
Copyrights in the Rand project are retained by their contributors. No
copyright assignment is required to contribute to the Rand project.
For full authorship information, see the version control history.
Except as otherwise noted (below and/or in individual files), Rand is
licensed under the Apache License, Version 2.0 <LICENSE-APACHE> or
<http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
<LICENSE-MIT> or <http://opensource.org/licenses/MIT>, at your option.
The Rand project includes code from the Rust project
published under these same licenses.
-201
View File
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
https://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-26
View File
@@ -1,26 +0,0 @@
Copyright 2018 Developers of the Rand project
Copyright (c) 2014 The Rust Project Developers
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
@@ -1,10 +0,0 @@
Rustls is distributed under the following three licenses:
- Apache License version 2.0.
- MIT license.
- ISC license.
These are included as LICENSE-APACHE, LICENSE-MIT and LICENSE-ISC
respectively. You may use this software under the terms of any
of these licenses, at your option.
@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -1,15 +0,0 @@
ISC License (ISC)
Copyright (c) 2016, Joseph Birr-Pixton <[email protected]>
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
@@ -1,25 +0,0 @@
Copyright (c) 2016 Joseph Birr-Pixton <[email protected]>
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
@@ -1,20 +0,0 @@
rustls-platform-verifier-android 0.2.0 ships no licence file of its own. Its Cargo.toml declares MIT OR Apache-2.0, by its authors.
---- Apache-2.0: the text is LICENSES/texts/Apache-2.0.txt ----
---- MIT ----
Copyright (c) its authors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-6
View File
@@ -1,6 +0,0 @@
Copyright 2021 Travis Veazey
Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
http://opensource.org/licenses/MIT>, at your option. This file may not be
copied, modified, or distributed except according to those terms.
-202
View File
@@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-25
View File
@@ -1,25 +0,0 @@
Copyright (c) 2016 The Amethyst Project Developers
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
-21
View File
@@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2014 Mathijs van de Nes
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-20
View File
@@ -1,20 +0,0 @@
© 2016 Bertram Truong
© 2021 Kornel Lesiński
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+3 -19
View File
@@ -27,7 +27,9 @@ paths for Windows in runtime/bundle). Its bin\ also carries, each with its licen
and libvpx 1.17.0's decoders (BSD-3-Clause with the WebM project's patent grant: libvpx-LICENSE.txt,
libvpx-PATENTS.txt) by tools/release/ffmpeg-win.sh, its H.264 encoder Windows' own (Media Foundation), its source
published as the release tools-ffmpeg-9.0.2-lgpl;
uv (uv.exe; Astral, MIT OR Apache-2.0).
uv (uv.exe; Astral, MIT OR Apache-2.0);
Microsoft's DirectX Shader Compiler v1.8.2502 (dxcompiler.dll, dxil.dll), DX12's shader compiler, redistributed under
its licence terms (dxc-LICENSE-MS.txt; its LLVM parts under dxc-LICENSE-LLVM.txt and dxc-LICENSE-MIT.txt).
The Windows app adds Git for Windows with Git LFS (dugite-native; GPLv2 and its parts' licences, in git\), which raea
runs as a separate program; its complete corresponding source is published as the release tools-git-<tag>-sources.
raea.exe, on a PC with no Git, fetches the same build once into its tools cache (io/assets git()).
@@ -66,7 +68,6 @@ LICENSES/<crate>-<version>/.
async-recursion 1.2.0: MIT OR Apache-2.0
async-signal 0.2.14: Apache-2.0 OR MIT
atomic-arena 0.1.2: MIT OR Apache-2.0
atomic-polyfill 1.0.3: MIT OR Apache-2.0
atspi-common 0.13.0: Apache-2.0 OR MIT
atspi-proxies 0.13.0: Apache-2.0 OR MIT
atspi 0.29.0: Apache-2.0 OR MIT
@@ -74,8 +75,6 @@ LICENSES/<crate>-<version>/.
avian_derive 0.2.3: MIT OR Apache-2.0
avian2d 0.8.0: MIT OR Apache-2.0
avian3d 0.8.0: MIT OR Apache-2.0
aws-lc-rs 1.18.2: ISC AND (Apache-2.0 OR ISC)
aws-lc-sys 0.46.0: ISC AND (Apache-2.0 OR ISC) AND Apache-2.0 AND MIT AND BSD-3-Clause AND (Apache-2.0 OR ISC OR MIT) AND (Apache-2.0 OR ISC OR MIT-0)
az 1.3.0: MIT/Apache-2.0
basis-universal-sys 0.3.1: MIT OR Apache-2.0
basis-universal 0.3.1: MIT OR Apache-2.0
@@ -172,7 +171,6 @@ LICENSES/<crate>-<version>/.
deluxe-core 0.5.0: MIT
deluxe-macros 0.5.0: MIT
deluxe 0.5.0: MIT
der_derive 0.8.0: Apache-2.0 OR MIT
der-parser 10.0.0: MIT OR Apache-2.0
deranged 0.5.9: MIT OR Apache-2.0
derive-getters 0.5.0: MIT
@@ -192,15 +190,12 @@ LICENSES/<crate>-<version>/.
enumflags2 0.7.12: MIT OR Apache-2.0
epaint_default_fonts 0.36.2: (MIT OR Apache-2.0) AND OFL-1.1 AND Ubuntu-font-1.0
epaint 0.36.2: MIT OR Apache-2.0
fastbloom 0.17.0: MIT OR Apache-2.0
fastnoise-lite 1.1.1: MIT
fid-rs 0.2.0: MIT OR Apache-2.0
file-id 0.2.3: MIT OR Apache-2.0
fixed 1.31.0: MIT/Apache-2.0
flagset 0.4.7: Apache-2.0
float_next_after 2.0.0: MIT
float-ord 0.3.2: MIT / Apache-2.0
fs_extra 1.3.0: MIT
fsevent-sys 4.1.0: MIT
futures-timer 3.0.4: MIT/Apache-2.0
fuzzy-matcher 0.3.7: MIT
@@ -213,8 +208,6 @@ LICENSES/<crate>-<version>/.
glam 0.19.0: MIT OR Apache-2.0
gloo-timers 0.3.0: MIT OR Apache-2.0
governor 0.10.4: MIT
hash32 0.2.1: MIT OR Apache-2.0
heapless 0.7.17: MIT OR Apache-2.0
heck 0.4.1: MIT OR Apache-2.0
httlib-huffman 0.3.4: MIT
i_float 1.16.0: MIT
@@ -276,7 +269,6 @@ LICENSES/<crate>-<version>/.
metis 0.2.2: MIT OR Apache-2.0
metrics-util 0.20.4: MIT
metrics 0.24.6: MIT
mint 0.5.9: MIT
mock_instant 0.6.1: 0BSD
moonshine-save 0.8.0: MIT
moonshine-util 0.6.0: MIT
@@ -316,7 +308,6 @@ LICENSES/<crate>-<version>/.
pollster 1.0.1: Apache-2.0/MIT
poly1305 0.8.0: Apache-2.0 OR MIT
polyanya 0.18.0: MIT OR Apache-2.0
postcard-derive 0.2.2: MIT OR Apache-2.0
powerfmt 0.2.1: MIT OR Apache-2.0
proc-macro-crate 1.3.1: MIT OR Apache-2.0
proc-macro-error-attr 1.0.4: MIT OR Apache-2.0
@@ -328,7 +319,6 @@ LICENSES/<crate>-<version>/.
quick-xml 0.31.0: MIT
quick-xml 0.38.4: MIT
radix_trie 0.2.1: MIT
rand_chacha 0.3.1: MIT OR Apache-2.0
rand_xorshift 0.3.0: MIT OR Apache-2.0
rand_xoshiro 0.7.0: MIT OR Apache-2.0
rapidhash 4.5.1: MIT OR Apache-2.0
@@ -347,13 +337,9 @@ LICENSES/<crate>-<version>/.
rune-staging 0.0.1: MIT
rune 0.0.1: MIT
rusticata-macros 4.1.0: MIT/Apache-2.0
rustls-native-certs 0.8.5: Apache-2.0 OR ISC OR MIT
rustls-pemfile 2.2.0: Apache-2.0 OR ISC OR MIT
rustls-platform-verifier-android 0.2.0: MIT OR Apache-2.0
rustls-platform-verifier 0.7.1: MIT OR Apache-2.0
seahash 4.1.0: MIT
selectors 0.38.0: MPL-2.0
serde_arrays 0.2.0: MIT OR Apache-2.0
serde_flexitos 0.2.2: Apache-2.0
serde_regex 1.2.0: MIT OR Apache-2.0
serde_repr 0.1.21: MIT OR Apache-2.0
@@ -363,7 +349,6 @@ LICENSES/<crate>-<version>/.
sif-itree 0.4.1: MIT OR Apache-2.0
sketches-ddsketch 0.3.1: Apache-2.0
smart-default 0.7.1: MIT
spin 0.9.9: MIT
spinning_top 0.3.0: MIT/Apache-2.0
spki 0.8.1: Apache-2.0 OR MIT
steamworks-sys 0.13.0: MIT / Apache-2.0
@@ -394,7 +379,6 @@ LICENSES/<crate>-<version>/.
unicode-general-category 1.1.0: Apache-2.0
universal-hash 0.5.1: MIT OR Apache-2.0
unsafe-libyaml 0.2.11: MIT
urlencoding 2.1.3: MIT
usvg 0.45.1: Apache-2.0 OR MIT
vleue_navigator 0.17.0: MIT OR Apache-2.0
voracious_radix_sort 1.2.0: MIT
+24
View File
@@ -0,0 +1,24 @@
[package]
name = "raea-app-ask"
version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
publish = false
description = "raea ask: questions about a piece's picture and sound, prepared from what raea knows of it, asked of clef in parallel from the person's plan, and every answer kept"
[dependencies]
# the question format and the standard sets; the one clef client, routed to the person's plan first (docs/ask.feature)
raea-core-ask = { path = "../../core/ask" }
raea-io-clef = { path = "../../io/clef" }
raea-io-home = { path = "../../io/home" }
# the fingerprint's AUC, quantile and gates, so a question is calibrated as an axis is (AK7)
raea-sys-fingerprint = { path = "../../systems/fingerprint" }
# today's date for a calibration
raea-io-trace = { path = "../../io/trace" }
dunce = "1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sha2 = "0.10"
[dev-dependencies]
raea-io-assets = { path = "../../io/assets" }
+214
View File
@@ -0,0 +1,214 @@
//! Calibration (docs/ask.feature AK7): a question's answers held to the person's labels (labels.rs), per version of its
//! words. Clef isn't trained on the labels, so its AUC on them is held out already; the one thing fitted is the
//! threshold, the problem score that flags 10% of the clean labels. The gates are the fingerprint's (16 labels of each
//! kind, from 3 projects, an AUC of 0.8). A question that passes is calibrated at its threshold: its answers are
//! findings, and the person's calibration replaces raea's shipped one. One under 0.6 after 32 labels doesn't separate,
//! and says which labels it missed, so its words can be fixed. `raea ask try` asks new words of the labelled clips and
//! sets both AUCs side by side.
use std::collections::{BTreeMap, BTreeSet, HashMap};
use std::path::PathBuf;
use std::sync::Arc;
use raea_core_ask::{Calibration, Question};
use raea_io_clef::Media;
use raea_sys_fingerprint::head::{auc, quantile};
use raea_sys_fingerprint::train::{GATE_AUC, GATE_LABELS, GATE_PROJECTS};
use serde::Serialize;
use serde_json::Value;
use crate::labels::{self, Label};
use crate::prepare::Piece;
use crate::record;
use crate::runner::{self, Event, Group, Kept, Opts, Summary};
pub const FILE: &str = "calibration.json";
/// An AUC under this after twice the gate's labels: the words don't separate the problem.
const SEPARATES: f64 = 0.6;
/// The person's calibrations that passed the gates, by question version.
pub fn local() -> BTreeMap<String, Calibration> {
std::fs::read_to_string(record::dir().join(FILE)).ok().and_then(|t| serde_json::from_str(&t).ok()).unwrap_or_default()
}
/// A question with the person's calibration in place of raea's, when it has one.
pub fn apply(q: &mut Question, local: &BTreeMap<String, Calibration>) {
if let Some(c) = local.get(&q.version()) {
q.calibration = Some(c.clone());
}
}
/// A label the answers missed: a problem it scored low, or clean work it scored high.
#[derive(Debug, Clone, Serialize)]
pub struct Miss {
pub file: String,
pub span: String,
pub problem: f64,
pub bad: bool,
pub note: Option<String>,
}
/// One version's standing.
#[derive(Debug, Clone, Serialize)]
pub struct Standing {
pub id: String,
pub version: String,
pub ask: String,
pub problems: usize,
pub clean: usize,
pub projects: usize,
pub auc: Option<f64>,
pub threshold: Option<f64>,
/// calibrated, advice or "doesn't separate"
pub state: String,
pub why: String,
pub misses: Vec<Miss>,
/// other eyes' labels on its clips, kept and not counted
pub others: usize,
}
/// Each labelled clip's latest problem score for one version, beside its label.
fn scored<'a>(version: &str, standing: &HashMap<(String, String), &'a Label>, calls: &HashMap<String, Value>) -> Vec<(f64, &'a Label)> {
let mut latest: HashMap<String, (f64, &Label)> = HashMap::new();
for a in record::rows("answers.jsonl").iter().filter(|a| a["version"] == version) {
let (Some(p), Some(call)) = (a["problem"].as_f64(), calls.get(a["call"].as_str().unwrap_or_default())) else { continue };
let key = (a["question"].as_str().unwrap_or_default().to_string(), labels::media_key(call));
if let Some(l) = standing.get(&key) {
latest.insert(key.1, (p, l));
}
}
latest.into_values().collect()
}
/// One version held to its labels.
pub fn standing_of(q: &Question, all: &[Label], calls: &HashMap<String, Value>) -> Standing {
let standing = labels::standing(all);
let s = scored(&q.version(), &standing, calls);
let score = |bad: bool| s.iter().filter(|(_, l)| l.bad == bad).map(|(p, _)| *p as f32).collect::<Vec<f32>>();
let (pos, neg) = (score(true), score(false));
let projects = s.iter().map(|(_, l)| l.project.as_str()).collect::<BTreeSet<_>>().len();
let a = Some(auc(&pos, &neg)).filter(|a| a.is_finite());
let threshold = Some(quantile(&neg, 0.9) as f64).filter(|t| t.is_finite());
let mut why = Vec::new();
if pos.len() < GATE_LABELS || neg.len() < GATE_LABELS {
why.push(format!("{} problem and {} clean labels (needs {GATE_LABELS} of each)", pos.len(), neg.len()));
}
if projects < GATE_PROJECTS {
why.push(format!("labels from {projects} projects (needs {GATE_PROJECTS})"));
}
match a {
Some(v) if v < GATE_AUC => why.push(format!("AUC {v:.2} (needs {GATE_AUC})")),
None => why.push("no AUC yet: it needs labels of both kinds".into()),
_ => {}
}
let stuck = s.len() >= 2 * GATE_LABELS && a.is_some_and(|v| v < SEPARATES);
let mut misses: Vec<Miss> = Vec::new();
if stuck {
let mut by: Vec<&(f64, &Label)> = s.iter().collect();
by.sort_by(|x, y| x.0.total_cmp(&y.0));
let low = by.iter().filter(|(_, l)| l.bad).take(5);
let high = by.iter().rev().filter(|(_, l)| !l.bad).take(5);
misses = low.chain(high).map(|(p, l)| Miss { file: l.file.clone(), span: labels::span(l.from, l.to), problem: *p, bad: l.bad, note: l.note.clone() }).collect();
}
let others = all.iter().filter(|l| !l.counted() && l.question == q.id).count();
let state = match (why.is_empty(), stuck) {
(true, _) => "calibrated",
(false, true) => "doesn't separate",
(false, false) => "advice",
};
let why = if why.is_empty() { format!("earned: {} labels from {projects} projects, flags past {:.2}", s.len(), threshold.unwrap_or(0.0)) } else { why.join("; ") };
Standing { id: q.id.clone(), version: q.version(), ask: q.ask.clone(), problems: pos.len(), clean: neg.len(), projects, auc: a, threshold, state: state.into(), why, misses, others }
}
/// Every labelled question's versions as the record kept them (or only `id`'s), newest wording last.
fn versions(only: Option<&str>, all: &[Label]) -> Vec<Question> {
let labelled: BTreeSet<&str> = all.iter().map(|l| l.question.as_str()).collect();
let mut seen = BTreeSet::new();
let mut out = Vec::new();
for a in record::rows("answers.jsonl") {
let id = a["question"].as_str().unwrap_or_default();
if only.is_some_and(|o| o != id) || !labelled.contains(id) || !seen.insert(a["version"].as_str().unwrap_or_default().to_string()) {
continue;
}
out.push(labels::question_of(&a));
}
out
}
/// `raea ask calibrate [ID]`: the feed's labels read again, then every labelled version held to them. The ones that
/// pass are kept as the person's calibration; one that no longer passes loses it.
pub fn calibrate(only: Option<&str>) -> Result<(Vec<Standing>, (usize, usize)), String> {
let feed = labels::from_feed()?;
let (all, calls) = (labels::all(), labels::calls());
let out: Vec<Standing> = versions(only, &all).iter().map(|q| standing_of(q, &all, &calls)).collect();
let mut keep = local();
for s in &out {
keep.remove(&s.version);
if s.state == "calibrated" {
let n = (s.problems + s.clean) as u32;
let c = Calibration { auc: s.auc.unwrap_or(0.0), n, positives: s.problems as u32, threshold: s.threshold, date: today(), by: "you".into() };
keep.insert(s.version.clone(), c);
}
}
record::write_whole(FILE, &serde_json::to_string_pretty(&keep).map_err(|e| e.to_string())?)?;
Ok((out, feed))
}
/// YYYY-MM-DD, UTC.
fn today() -> String {
raea_io_trace::utc(std::time::SystemTime::now()).0.chars().take(10).collect()
}
/// The groups `raea ask try` sends: the new question on each labelled clip set, with the state it was asked with.
pub fn try_groups(like: &str, words: &str) -> Result<(Question, Question, Vec<Group>), String> {
let all = labels::all();
let standing = labels::standing(&all);
let rows = record::rows("answers.jsonl");
let old = rows.iter().rev().find(|a| a["question"] == like).map(labels::question_of).ok_or_else(|| format!("ask try: no answers to {like} in the record"))?;
let new = Question { ask: words.to_string(), calibration: None, ..old.clone() };
let calls = labels::calls();
let mut groups: Vec<Group> = Vec::new();
let mut sent = BTreeSet::new();
for call in calls.values().filter(|c| standing.contains_key(&(like.to_string(), labels::media_key(c)))) {
let names: Vec<&str> = call["media"].as_array().into_iter().flatten().filter_map(Value::as_str).collect();
let Some(kept) = media(&names) else { continue };
if !sent.insert(labels::media_key(call)) {
continue;
}
let piece = Arc::new(Piece { file: PathBuf::from(call["file"].as_str().unwrap_or_default()), project: call["project"].as_str().map(PathBuf::from), ..Default::default() });
let (from, to) = (call["from"].as_f64().unwrap_or(0.0), call["to"].as_f64());
let seconds = to.map_or(60.0, |t| t - from);
let kept = Kept { video_seconds: if kept.videos.is_empty() { 0.0 } else { seconds }, sound_seconds: if kept.sounds.is_empty() { 0.0 } else { seconds }, media: kept, state: call["state"].as_str().unwrap_or_default().into() };
groups.push(Group { piece, from, to, sees: new.sees, hears: new.hears, with: vec![], questions: vec![new.clone()], kept: Some(Arc::new(kept)) });
}
if groups.is_empty() {
return Err(format!("ask try: none of {like}'s labelled clips are still kept (raea ask calibrate lists its labels)"));
}
Ok((old, new, groups))
}
/// A call's clips from the kept media, in the kinds they were sent as; None when one has been pruned.
fn media(names: &[&str]) -> Option<Media> {
let mut m = Media::default();
for n in names {
let bytes = record::media(n)?;
match n.rsplit('.').next() {
Some("mp4") => m.videos.push(bytes),
Some("mp3") => m.sounds.push(bytes),
_ => m.stills.push(bytes),
}
}
Some(m)
}
/// `raea ask try "WORDS" --like ID`: the new words asked of the old question's labelled clips, and both versions held to
/// the same labels.
pub fn try_words(like: &str, words: &str, o: &Opts, out: &mut dyn FnMut(Event)) -> Result<(Summary, Option<(Standing, Standing)>), String> {
let (old, new, groups) = try_groups(like, words)?;
let sum = runner::run_groups(groups, Vec::new(), o, out);
if o.dry {
return Ok((sum, None));
}
let (all, calls) = (labels::all(), labels::calls());
Ok((sum, Some((standing_of(&old, &all, &calls), standing_of(&new, &all, &calls)))))
}
+236
View File
@@ -0,0 +1,236 @@
//! Labels (docs/ask.feature AK6): whether a question's problem was really there in what one call sent, so the question
//! can be calibrated on the person's own eye (calibrate.rs). A label belongs to a question and to the clips a call sent
//! (by their hashes), never to one answer: the same question reworded, asked again of the same clips, has the same
//! labels, which is what lets `raea ask try` measure new words.
//!
//! Where labels come from:
//! - `raea ask verdict ANSWER WORD`: the person answers the question themselves, in its own terms (yes or no, an option,
//! a level). Theirs counts first.
//! - The feed: a note of the person's on the render (its copy in the project's feed, known by `record::ident`), pinned
//! inside the window or not pinned at all, holding one of the question's label words, is a yes; an approved post (done)
//! with no such note is a no. Read again by every `raea ask calibrate`.
//! - Another eye (`verdict --eye agent`: an agent's own look) is kept as `eye:NAME` and never counted, as the
//! fingerprint keeps another eye's readings (FP6d).
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use raea_core_ask::{Kind, Question};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use crate::record;
pub const FILE: &str = "labels.jsonl";
/// A note pinned at t covers 1.5 s before it to 0.5 s after (the fingerprint's span).
const BEFORE: f64 = 1.5;
const AFTER: f64 = 0.5;
/// Whether a question's problem is there in one call's clips, and who said so.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct Label {
pub question: String,
/// the clips the call sent, by hash
pub media: String,
pub bad: bool,
/// "verdict" (the person's), "note" or "approval" (read from the feed), or "eye:NAME" (kept, never counted)
pub source: String,
pub project: String,
pub file: String,
pub from: f64,
pub to: Option<f64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub note: Option<String>,
pub at: String,
}
impl Label {
/// The person's own: a verdict, a note or an approval.
pub fn counted(&self) -> bool {
self.rank() > 0
}
fn rank(&self) -> u8 {
match self.source.as_str() {
"verdict" => 3,
"note" => 2,
"approval" => 1,
_ => 0,
}
}
}
/// The clips a call sent, as one key.
pub fn media_key(call: &Value) -> String {
let mut m: Vec<&str> = call["media"].as_array().into_iter().flatten().filter_map(Value::as_str).collect();
m.sort_unstable();
m.join("+")
}
/// The feed a call's render was posted to: its project's, else the nearest one above its file.
fn feed_of(call: &Value) -> Option<PathBuf> {
let file = Path::new(call["file"].as_str().unwrap_or_default());
call["project"].as_str().map(Path::new).into_iter().chain(file.ancestors()).map(|d| d.join(".raea/feed")).find(|d| d.is_dir())
}
/// A call's project: the folder holding its brief, else the folder holding the feed it was posted to, else its file's.
pub fn project_of(call: &Value) -> String {
if let Some(p) = call["project"].as_str() {
return p.to_string();
}
let home = feed_of(call).and_then(|f| f.parent()?.parent().map(Path::to_path_buf));
let file = Path::new(call["file"].as_str().unwrap_or_default());
home.as_deref().or(file.parent()).map(|p| p.display().to_string()).unwrap_or_default()
}
pub fn all() -> Vec<Label> {
record::rows(FILE).into_iter().filter_map(|v| serde_json::from_value(v).ok()).collect()
}
fn write(labels: &[Label]) -> Result<(), String> {
record::write_whole(FILE, &labels.iter().filter_map(|l| serde_json::to_string(l).ok()).map(|l| l + "\n").collect::<String>())
}
/// The label that stands for each question and clips: the person's verdict, else a note, else an approval.
pub fn standing(labels: &[Label]) -> HashMap<(String, String), &Label> {
let mut out: HashMap<(String, String), &Label> = HashMap::new();
for l in labels.iter().filter(|l| l.counted()) {
let key = (l.question.clone(), l.media.clone());
if out.get(&key).is_none_or(|was| l.rank() >= was.rank()) {
out.insert(key, l);
}
}
out
}
/// A question as its answer kept it (the whole question, else its words).
pub fn question_of(answer: &Value) -> Question {
serde_json::from_value(answer["q"].clone()).unwrap_or_else(|_| Question::plain(answer["question"].as_str().unwrap_or("q"), answer["ask"].as_str().unwrap_or_default()))
}
/// Whether the answer the person gives means the problem is there: yes's flagged answer (yes, or no for a question
/// flagged on no), a flagged option, or a grade or rate in its lower half.
pub fn means_problem(q: &Question, said: &str) -> Result<bool, String> {
let said = said.trim().to_lowercase();
let levels = q.levels();
if q.kind == Kind::Yes {
return match said.as_str() {
"yes" | "no" => Ok((said == "yes") != q.flags.first().is_some_and(|f| f == "no")),
_ => Err(format!("{}: answer yes or no", q.id)),
};
}
if q.kind == Kind::Choose && q.flags.is_empty() {
return Err(format!("{} picks without a wrong answer, so it isn't calibrated", q.id));
}
let Some(i) = levels.iter().position(|l| l.to_lowercase() == said) else { return Err(format!("{}: answer one of {}", q.id, levels.join(", "))) };
Ok(match q.kind {
Kind::Choose => q.flags.iter().any(|f| f.to_lowercase() == said),
_ => (i as f64) < (levels.len().max(2) - 1) as f64 / 2.0,
})
}
/// Every call in the record, by id.
pub fn calls() -> HashMap<String, Value> {
record::rows("calls.jsonl").into_iter().filter_map(|c| Some((c["id"].as_str()?.to_string(), c))).collect()
}
fn label(q: &str, call: &Value, bad: bool, source: &str, note: Option<String>) -> Label {
Label {
question: q.to_string(),
media: media_key(call),
bad,
source: source.into(),
project: project_of(call),
file: call["file"].as_str().unwrap_or_default().into(),
from: call["from"].as_f64().unwrap_or(0.0),
to: call["to"].as_f64(),
note,
at: record::now(),
}
}
/// `raea ask verdict ANSWER WORD [--eye NAME]`: the person's answer to the question on that answer's clips (or another
/// eye's, kept and never counted). A verdict given again replaces the last from the same source.
pub fn verdict(answer: &str, said: &str, eye: Option<&str>) -> Result<String, String> {
let row = record::rows("answers.jsonl").into_iter().find(|a| a["id"] == answer).ok_or_else(|| format!("ask verdict: no answer {answer} in {}", record::dir().display()))?;
let call = calls().remove(row["call"].as_str().unwrap_or_default()).ok_or_else(|| format!("ask verdict: answer {answer}'s call isn't in the record"))?;
let q = question_of(&row);
let bad = means_problem(&q, said)?;
let source = eye.map_or_else(|| "verdict".to_string(), |e| format!("eye:{e}"));
let new = label(&q.id, &call, bad, &source, None);
let mut labels = all();
labels.retain(|l| !(l.question == new.question && l.media == new.media && l.source == new.source));
let line = format!("{}: {} on {} ({}){}", q.id, if bad { "the problem is there" } else { "no problem" }, new.file, span(new.from, new.to), if eye.is_some() { format!(", kept as {source} and not counted") } else { String::new() });
labels.push(new);
write(&labels)?;
Ok(line)
}
pub fn span(from: f64, to: Option<f64>) -> String {
match to {
Some(t) => format!("{from:.1}-{t:.1} s"),
None if from > 0.0 => format!("from {from:.1} s"),
None => "the whole file".into(),
}
}
/// One post of a feed: whether it's approved, its person's notes (pinned second or none, words), and its files.
struct Post {
done: bool,
notes: Vec<(Option<f64>, String)>,
files: Vec<PathBuf>,
}
fn posts(feed: &Path) -> Vec<Post> {
let project = feed.parent().and_then(Path::parent).unwrap_or(feed);
let lib = raea_io_home::user_home().unwrap_or_default().join(".raea/feed/media");
let mut out = Vec::new();
for e in std::fs::read_dir(feed).into_iter().flatten().flatten() {
let Some(p) = std::fs::read_to_string(e.path()).ok().and_then(|t| serde_json::from_str::<Value>(&t).ok()) else { continue };
let notes = p["notes"].as_array().into_iter().flatten().filter(|n| n["author"]["kind"] == "person").filter_map(|n| Some((n["pin"]["t"].as_f64(), n["text"].as_str()?.to_lowercase()))).collect();
let files = p["media"].as_array().into_iter().flatten().filter_map(|m| m["path"].as_str()).filter_map(|m| [lib.join(m), project.join(m)].into_iter().find(|f| f.is_file())).collect();
out.push(Post { done: p["status"] == "done", notes, files });
}
out
}
/// Labels read again from the person's notes and approvals, for every recorded answer whose question has label words.
/// The feed's labels replace the last ones read; verdicts and other eyes' stay. Says how many of each it found.
pub fn from_feed() -> Result<(usize, usize), String> {
let calls = calls();
let mut feeds: HashMap<PathBuf, Vec<Post>> = HashMap::new();
let mut idents: HashMap<PathBuf, Option<String>> = HashMap::new();
let mut found: HashMap<(String, String), Label> = HashMap::new();
for row in record::rows("answers.jsonl") {
let q = question_of(&row);
let Some(call) = calls.get(row["call"].as_str().unwrap_or_default()) else { continue };
let (Some(ident), false) = (call["ident"].as_str(), q.label_words.is_empty()) else { continue };
let Some(dir) = feed_of(call) else { continue };
let len = record::ident_len(ident);
let same = |f: &PathBuf, idents: &mut HashMap<PathBuf, Option<String>>| {
std::fs::metadata(f).is_ok_and(|m| Some(m.len()) == len) && idents.entry(f.clone()).or_insert_with(|| record::ident(f)).as_deref() == Some(ident)
};
let (from, to) = (call["from"].as_f64().unwrap_or(0.0), call["to"].as_f64().unwrap_or(f64::INFINITY));
let words: Vec<String> = q.label_words.iter().map(|w| w.to_lowercase()).collect();
for post in feeds.entry(dir.clone()).or_insert_with(|| posts(&dir)).iter().filter(|p| p.files.iter().any(|f| same(f, &mut idents))) {
let inside = |t: &Option<f64>| t.is_none_or(|t| t - BEFORE < to && t + AFTER > from);
let seen = post.notes.iter().find(|(t, text)| inside(t) && words.iter().any(|w| text.contains(w.as_str())));
let l = match (seen, post.done) {
(Some((_, text)), _) => label(&q.id, call, true, "note", Some(text.clone())),
(None, true) => label(&q.id, call, false, "approval", None),
(None, false) => continue,
};
let key = (l.question.clone(), l.media.clone());
if found.get(&key).is_none_or(|was| l.rank() > was.rank()) {
found.insert(key, l);
}
}
}
let mut labels = all();
labels.retain(|l| !matches!(l.source.as_str(), "note" | "approval"));
let yes = found.values().filter(|l| l.bad).count();
let no = found.len() - yes;
labels.extend(found.into_values());
write(&labels)?;
Ok((yes, no))
}
+132
View File
@@ -0,0 +1,132 @@
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};
use raea_core_ask::{Kind, Question, Reading};
use raea_io_clef::{Answered, Call, Fail};
use serde_json::json;
use crate::labels::{self, means_problem};
use crate::prepare::Piece;
use crate::runner::{self, Entry, Opts};
use crate::{calibrate, record};
/// The labels and calibration files are rewritten whole: one test at a time.
static LOCK: Mutex<()> = Mutex::new(());
fn reading(p: f64) -> Reading {
Reading { value: p, problem: Some(p), choice: None, says: format!("{p:.2}") }
}
fn question(id: &str, words: &[&str]) -> Question {
let mut q = Question::plain(id, &format!("Is there a problem the {id} test names?"));
q.label_words = words.iter().map(|w| w.to_string()).collect();
q
}
/// A call and its answer kept, as the runner keeps them; the answer's id.
fn asked(file: &Path, project: &str, clip: &str, q: &Question, p: f64) -> String {
let call = record::call(&file.display().to_string(), Some(project), 0.0, Some(5.0), "a test", &[clip.to_string()], "a test", 0.0, false);
record::answer(&call, &file.display().to_string(), q, &reading(p), p >= 0.5)
}
fn write(p: &Path, bytes: &[u8]) {
std::fs::create_dir_all(p.parent().unwrap()).unwrap();
std::fs::write(p, bytes).unwrap();
}
#[test]
fn a_persons_note_on_the_posted_render_labels_it_and_an_approval_labels_it_clean() {
crate::tests::setup();
let _one = LOCK.lock().unwrap();
let proj = std::env::temp_dir().join(format!("raea-ask-notes-{}", std::process::id()));
let (a, b, other) = (proj.join("out/a.mp4"), proj.join("out/b.mp4"), proj.join("old/a.mp4"));
write(&a, b"render one");
write(&b, b"render two");
write(&other, b"another render, the same name");
let post = |media: &str, status: &str, notes: serde_json::Value| json!({"media": [{"kind": "video", "path": media}], "status": status, "notes": notes});
let person = |text: &str, t: Option<f64>| json!({"author": {"kind": "person", "name": "me"}, "text": text, "pin": t.map(|t| json!({"t": t}))});
write(&proj.join(".raea/feed/1.json"), post("out/a.mp4", "seen", json!([person("The caption runs OVER HER FACE here", Some(2.0))])).to_string().as_bytes());
let agent = json!({"author": {"kind": "agent"}, "text": "over her face"});
write(&proj.join(".raea/feed/2.json"), post("out/b.mp4", "done", json!([agent, person("lovely", None)])).to_string().as_bytes());
let q = question("notes.face", &["over her face"]);
let project = proj.display().to_string();
asked(&a, &project, "na.mp4", &q, 0.7);
asked(&b, &project, "nb.mp4", &q, 0.2);
asked(&other, &project, "nc.mp4", &q, 0.6);
assert_eq!(labels::from_feed().unwrap(), (1, 1));
let mine: Vec<_> = labels::all().into_iter().filter(|l| l.question == "notes.face").collect();
let on = |clip: &str| mine.iter().find(|l| l.media == clip).unwrap_or_else(|| panic!("{clip}: {mine:?}"));
assert!(on("na.mp4").bad && on("na.mp4").source == "note" && on("na.mp4").note.as_deref().is_some_and(|n| n.contains("over her face")));
assert!(!on("nb.mp4").bad && on("nb.mp4").source == "approval", "an agent's note isn't the person's");
assert!(!mine.iter().any(|l| l.media == "nc.mp4"), "another render with the same name isn't the one posted");
}
#[test]
fn a_verdict_reads_in_the_questions_terms_and_another_eyes_isnt_counted() {
crate::tests::setup();
let _one = LOCK.lock().unwrap();
let mut q = question("verdict.logo", &[]);
assert!(means_problem(&q, "Yes").unwrap() && !means_problem(&q, "no").unwrap());
q.flags = vec!["no".into()];
assert!(means_problem(&q, "no").unwrap(), "a question flagged on no: no is the problem");
let mut g = q.clone();
g.kind = Kind::Grade;
assert!(means_problem(&g, "weak").unwrap() && !means_problem(&g, "acceptable").unwrap());
g.kind = Kind::Choose;
g.options = vec!["first".into(), "second".into()];
g.flags = vec![];
assert!(means_problem(&g, "first").is_err(), "a pick has no wrong answer");
let file = std::env::temp_dir().join("raea-ask-verdict.mp4");
let id = asked(&file, "p", "v1.mp4", &q, 0.3);
labels::verdict(&id, "no", Some("agent")).unwrap();
let said = labels::verdict(&id, "no", None).unwrap();
assert!(said.contains("the problem is there"), "{said}");
let all = labels::all();
let standing = labels::standing(&all);
let l = standing.get(&("verdict.logo".to_string(), "v1.mp4".to_string())).unwrap();
assert!(l.bad && l.source == "verdict");
assert!(all.iter().any(|l| l.source == "eye:agent" && !l.counted()));
}
/// clef as a fake: yes to anything sent a clip whose bytes start "bad".
fn sees_bad(call: &Call) -> Result<Answered, Fail> {
let p = if call.media.videos.iter().any(|v| v.starts_with(b"bad")) { 0.9 } else { 0.1 };
let answers = call.questions.iter().map(|q| (q.id.clone(), json!({"noul": p}))).collect();
Ok(Answered { answers, cost: 0.001, cached: false, route: "a test".into(), pool_left: None })
}
#[test]
fn labels_from_three_projects_calibrate_a_question_and_new_words_are_measured_on_the_same_clips() {
crate::tests::setup();
let _one = LOCK.lock().unwrap();
let (good, flat) = (question("cal.good", &[]), question("cal.flat", &[]));
let file = PathBuf::from("/nowhere/cal.mp4");
for i in 0..36 {
let bad = i % 2 == 0;
let clip = record::keep_media(format!("{}{i}", if bad { "bad" } else { "ok" }).as_bytes(), "mp4");
let project = format!("p{}", i % 3);
let call = record::call(&file.display().to_string(), Some(&project), 0.0, Some(3.0), "a test", &[clip], "a test", 0.0, false);
let (p, word) = if bad { (0.6 + i as f64 / 1000.0, "yes") } else { (0.3 + i as f64 / 1000.0, "no") };
for (q, p) in [(&good, p), (&flat, 0.5)] {
let id = record::answer(&call, &file.display().to_string(), q, &reading(p), false);
labels::verdict(&id, word, None).unwrap();
}
}
let (all, _) = calibrate::calibrate(None).unwrap();
let of = |id: &str| all.iter().find(|s| s.id == id).unwrap_or_else(|| panic!("{id}: {all:?}"));
let g = of("cal.good");
assert_eq!((g.state.as_str(), g.problems, g.clean, g.projects, g.auc), ("calibrated", 18, 18, 3, Some(1.0)), "{g:?}");
let f = of("cal.flat");
assert_eq!(f.state, "doesn't separate", "{f:?}");
assert!(!f.misses.is_empty() && f.auc == Some(0.5));
// the person's calibration goes out with the question from now on
let piece = Arc::new(Piece { file: file.clone(), ..Default::default() });
let (groups, _) = runner::plan(&[Entry { piece, window: None, questions: vec![good.clone()], dropped: vec![], with: vec![] }]);
let sent = &groups[0].questions[0];
assert!(sent.calibrated() && sent.calibration.as_ref().is_some_and(|c| c.by == "you"), "{sent:?}");
// new words for the flat question, asked of its labelled clips
let (sum, both) = calibrate::try_words("cal.flat", "Does anything look broken?", &Opts { jobs: 4, dry: false, ask: sees_bad }, &mut |_| {}).unwrap();
let (old, new) = both.unwrap();
assert_eq!(sum.calls, 36);
assert_eq!((old.auc, new.auc, new.problems + new.clean), (Some(0.5), Some(1.0), 36), "{new:?}");
}
+19
View File
@@ -0,0 +1,19 @@
//! `raea ask` (docs/ask.feature AK2-AK3): questions about a piece's picture and sound. `prepare` reads what raea knows
//! of the piece and keeps the questions that apply; `runner` plans the calls, cuts each clip once and asks in parallel;
//! `record` keeps every call and answer; `labels` reads the person's verdicts, notes and approvals into labels, and
//! `calibrate` holds each question to them (AK6-AK7); `verbs` is the command. `raea check`, the app's critique and the
//! fingerprint's double-check go through the same runner.
pub mod calibrate;
pub mod labels;
pub mod prepare;
pub mod record;
pub mod runner;
pub mod verbs;
pub use verbs::{USAGE, cli};
#[cfg(test)]
mod tests;
#[cfg(test)]
mod labels_tests;
+164
View File
@@ -0,0 +1,164 @@
//! Ask understands a question before it spends (docs/ask.feature AK2): what the file holds (ffprobe), what the project's
//! brief says it's for, whether anyone speaks in it, and from those which questions can be asked, which are swapped for
//! their variant (sound for sound-silent) and which are dropped, each with why. The state paragraph tells clef what the
//! piece is, as the app's critique writes it. When it isn't known whether anyone speaks, both variants are kept, the
//! voice question goes in the same call (runner.rs), free, and the variant that doesn't apply is set aside.
use std::path::{Path, PathBuf};
use raea_core_ask::{Facts, Question, library};
use raea_io_clef::media::{self, Probe};
use serde_json::{Value, json};
/// The question asked beside the rest when no one knows yet whether anyone speaks in the piece.
pub const VOICE: &str = "voice-heard";
/// What raea knows of the piece.
#[derive(Debug, Clone, Default)]
pub struct Piece {
pub file: PathBuf,
pub probe: Probe,
/// the brief's fields, as `raea spec brief.ts --as brief` reads them ({} without a brief)
pub brief: Value,
/// the project's folder (the one holding the brief), when there is one
pub project: Option<PathBuf>,
/// the words heard, when a words file was given
pub words: Option<String>,
/// someone speaks: from --voice, or from the words file (none heard is no)
pub voice: Option<bool>,
/// what the caller adds to the state (what raea measured, the platform)
pub extra: Option<String>,
}
/// The brief nearest the file: brief.ts in its folder or any folder above it.
pub fn brief_near(file: &Path) -> Option<PathBuf> {
let abs = dunce::canonicalize(file).ok()?;
abs.ancestors().skip(1).map(|d| d.join("brief.ts")).find(|b| b.is_file())
}
/// A brief's fields, through `raea spec FILE --as brief` (this raea), or {} when it can't be read.
fn brief_of(path: &Path) -> Value {
let Ok(exe) = std::env::current_exe() else { return json!({}) };
let Ok(out) = std::process::Command::new(exe).args(["spec"]).arg(path).args(["--as", "brief"]).output() else { return json!({}) };
let text = String::from_utf8_lossy(&out.stdout);
let v: Value = text.find('{').and_then(|i| serde_json::from_str(&text[i..]).ok()).unwrap_or_else(|| json!({}));
v.get("brief").cloned().unwrap_or(v)
}
/// The words heard, from a words file (a JSON list of words, each a string or {word} or {text}): their text, and
/// whether anyone speaks (an empty list is no one).
pub fn words_of(path: &Path) -> Result<(String, bool), String> {
let v: Value = serde_json::from_str(&std::fs::read_to_string(path).map_err(|e| format!("{}: {e}", path.display()))?).map_err(|e| format!("{}: {e}", path.display()))?;
let list = v.as_array().or(v["words"].as_array()).ok_or_else(|| format!("{}: a list of words", path.display()))?;
let words: Vec<&str> = list.iter().filter_map(|w| w.as_str().or(w["word"].as_str()).or(w["text"].as_str())).collect();
Ok((words.join(" "), !words.is_empty()))
}
impl Piece {
/// The piece as raea finds it: the file probed, its brief (given or the nearest), its words.
pub fn read(file: &Path, brief: Option<&Path>, words: Option<&Path>, voice: Option<bool>, extra: Option<String>) -> Result<Piece, String> {
let probe = media::probe(file)?;
// "none": no brief, even with one near (a caller that writes the whole state itself, as the app's critique does)
let brief_file = match brief {
Some(p) if p.as_os_str() == "none" => None,
Some(p) => Some(p.to_path_buf()),
None => brief_near(file),
};
let (words, heard) = match words {
Some(w) => words_of(w).map(|(t, h)| (Some(t).filter(|t| !t.is_empty()), Some(h)))?,
None => (None, None),
};
Ok(Piece {
file: file.to_path_buf(),
probe,
brief: brief_file.as_deref().map(brief_of).unwrap_or_else(|| json!({})),
project: brief_file.and_then(|b| b.parent().map(Path::to_path_buf)),
words,
voice: voice.or(heard).or((!probe.sound).then_some(false)),
extra,
})
}
pub fn modes(&self) -> Vec<String> {
let m = &self.brief["mode"];
let list: Vec<&str> = m.as_array().map(|a| a.iter().filter_map(Value::as_str).collect()).unwrap_or_else(|| m.as_str().into_iter().collect());
list.iter().flat_map(|s| s.split(',')).map(|s| s.replace("(assumed)", "").trim().to_string()).filter(|s| !s.is_empty()).collect()
}
pub fn facts(&self) -> Facts {
let modes = self.modes();
Facts { game: modes.iter().any(|m| m == "play"), modes, voice: self.voice, sound: self.probe.sound, video: self.probe.video }
}
/// What clef reads before the media: what the piece is and what's known of it.
pub fn state(&self) -> String {
let b = &self.brief;
let modes = self.modes();
let what = if modes.is_empty() { "video".to_string() } else { modes.join(" and ") };
// with no brief and the caller's own state, the caller says what the piece is
let briefless = b.as_object().is_none_or(|o| o.is_empty());
let mut s = match (b["title"].as_str(), briefless && self.extra.is_some()) {
(_, true) => vec![],
(Some(t), _) => vec![format!("A {what} piece: \"{t}\".")],
(None, _) => vec![format!("A {what} piece.")],
};
for (k, say) in [("audience", "It's for"), ("believe", "It should leave them believing"), ("logline", "Its storyboard"), ("voice", "Its voice")] {
if let Some(v) = b[k].as_str().filter(|v| !v.trim().is_empty()) {
s.push(format!("{say}: {}.", v.trim().trim_end_matches('.')));
}
}
if self.voice == Some(false) {
s.push("No one speaks in it: its sound is the music and the effects, with no voice.".into());
}
if let Some(w) = &self.words {
let cut: String = w.chars().take(1200).collect();
s.push(format!("The words heard: \"{cut}{}\"", if cut.len() < w.len() { "..." } else { "" }));
}
if self.probe.seconds > 0.0 {
s.push(format!("It runs {:.0} s.", self.probe.seconds));
}
if let Some(x) = &self.extra {
s.push(x.trim().to_string());
}
s.join(" ")
}
}
/// Is anyone heard speaking: asked beside the questions that depend on it, at no cost (clef costs by media, not by
/// questions), when no one knows yet.
pub fn voice_question() -> Question {
let mut v = Question::plain(VOICE, "Is anyone heard speaking in it (a voice saying words, not singing)?");
v.sees = raea_core_ask::Sees::Nothing;
v
}
/// The questions kept for this piece, and those dropped with why. A question that doesn't apply is swapped for its
/// variant when that one does; not knowing whether anyone speaks, both are kept.
pub fn keep(questions: Vec<Question>, f: &Facts, rubric_md: Option<&str>) -> (Vec<Question>, Vec<(String, String)>) {
let mut asked: Vec<Question> = Vec::new();
let mut dropped = Vec::new();
let add = |q: Question, asked: &mut Vec<Question>| {
if !asked.iter().any(|a| a.id == q.id) {
asked.push(q);
}
};
for q in questions {
let Some(why) = q.not_for(f) else {
// not knowing whether anyone speaks, its variant goes in too: one call answers either way
let twin = (f.voice.is_none() && q.when.voice.is_some()).then(|| q.swap.as_deref().and_then(|s| library::find(s, rubric_md))).flatten();
add(q, &mut asked);
if let Some(t) = twin {
add(t, &mut asked);
}
continue;
};
match q.swap.as_deref().and_then(|s| library::find(s, rubric_md)).filter(|s| s.not_for(f).is_none()) {
Some(s) => {
dropped.push((q.id.clone(), format!("{why}: asked {} instead", s.id)));
add(s, &mut asked);
}
None => dropped.push((q.id.clone(), why)),
}
}
(asked, dropped)
}
+152
View File
@@ -0,0 +1,152 @@
//! Every answer kept (docs/ask.feature AK3), so a question can be labelled, calibrated and reworded later (AK6, AK7):
//! each call in calls.jsonl (the file, the window, the state, the clips it sent by hash, the route and the cost) and each
//! answer in answers.jsonl (the call, the question and its version, the reading). The clips themselves are kept by hash
//! in media/, at most 2 GB, the oldest out first, so new words can be asked of the same media. A call keeps what its
//! file was (`ident`), so a note on the render's copy in the feed labels it (labels.rs), and an answer keeps its whole
//! question, so a verdict reads in its terms and `raea ask try` can reword it.
use std::io::Write as _;
use std::io::{Read as _, Seek as _, SeekFrom};
use std::path::{Path, PathBuf};
use raea_core_ask::{Question, Reading};
use serde_json::{Value, json};
use sha2::{Digest, Sha256};
/// How much cut media is kept.
pub const MEDIA_CAP: u64 = 2 << 30;
pub fn dir() -> PathBuf {
raea_io_clef::cache::dir()
}
/// A new id: a prefix and twelve hex digits, from the time, the process and a counter.
pub fn new_id(prefix: &str) -> String {
static N: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
let t = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_nanos()).unwrap_or(0);
let seed = format!("{t}-{}-{}", std::process::id(), N.fetch_add(1, std::sync::atomic::Ordering::Relaxed));
let h = seed.bytes().fold(0xcbf2_9ce4_8422_2325u64, |h, b| (h ^ b as u64).wrapping_mul(0x0100_0000_01b3));
format!("{prefix}-{:012x}", h & 0xffff_ffff_ffff)
}
pub fn now() -> String {
let s = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0);
s.to_string()
}
fn append(file: &str, row: &Value) {
let d = dir();
if std::fs::create_dir_all(&d).is_err() {
return;
}
// one write a row: several runs (a script's, two at once) append to the same file, and a row written in pieces
// could be split by another's
if let Ok(mut f) = std::fs::OpenOptions::new().create(true).append(true).open(d.join(file)) {
let _ = f.write_all(format!("{row}\n").as_bytes());
}
}
fn hex(digest: &[u8]) -> String {
digest.iter().take(16).map(|b| format!("{b:02x}")).collect()
}
/// What a file is, cheaply: its size and a hash of its first and last MB. A render is known again by its copy in the
/// feed, and a later render to the same path isn't taken for it.
pub fn ident(path: &Path) -> Option<String> {
const MB: u64 = 1 << 20;
let mut f = std::fs::File::open(path).ok()?;
let len = f.metadata().ok()?.len();
let mut h = Sha256::new();
let mut part = vec![0u8; len.min(MB) as usize];
f.read_exact(&mut part).ok()?;
h.update(&part);
if len > 2 * MB {
f.seek(SeekFrom::Start(len - MB)).ok()?;
f.read_exact(&mut part).ok()?;
h.update(&part);
}
Some(format!("{len}-{}", hex(&h.finalize())))
}
/// The size an ident names, to pass over files that can't be it without reading them.
pub fn ident_len(ident: &str) -> Option<u64> {
ident.split_once('-')?.0.parse().ok()
}
/// One of the record's files written whole, through a temporary file, so a reader never sees half of it.
pub fn write_whole(file: &str, text: &str) -> Result<(), String> {
let d = dir();
let tmp = d.join(format!("{file}.{}.tmp", std::process::id()));
let put = || -> std::io::Result<()> {
std::fs::create_dir_all(&d)?;
std::fs::write(&tmp, text)?;
std::fs::rename(&tmp, d.join(file))
};
put().map_err(|e| format!("{}: {e}", d.display()))
}
/// A clip kept by its hash, as `HASH.EXT` (already kept is left alone).
pub fn keep_media(bytes: &[u8], ext: &str) -> String {
let name = format!("{}.{ext}", hex(&Sha256::digest(bytes)));
let d = dir().join("media");
let p = d.join(&name);
if !p.is_file() && std::fs::create_dir_all(&d).is_ok() {
let _ = std::fs::write(&p, bytes);
prune(MEDIA_CAP);
}
name
}
/// A kept clip's bytes, by its name.
pub fn media(name: &str) -> Option<Vec<u8>> {
std::fs::read(dir().join("media").join(name)).ok()
}
/// The kept media held to `cap` bytes, the least recently written going first.
pub fn prune(cap: u64) {
let Ok(rd) = std::fs::read_dir(dir().join("media")) else { return };
let mut files: Vec<(std::time::SystemTime, u64, PathBuf)> = rd
.flatten()
.filter_map(|e| e.metadata().ok().and_then(|m| Some((m.modified().ok()?, m.len(), e.path()))))
.collect();
let mut total: u64 = files.iter().map(|f| f.1).sum();
files.sort();
for (_, len, p) in files {
if total <= cap {
break;
}
if std::fs::remove_file(&p).is_ok() {
total -= len;
}
}
}
/// One call kept; its id.
#[allow(clippy::too_many_arguments)]
pub fn call(file: &str, project: Option<&str>, from: f64, to: Option<f64>, state: &str, media: &[String], route: &str, cost: f64, cached: bool) -> String {
let id = new_id("c");
let row = json!({
"id": id, "at": now(), "file": file, "ident": ident(Path::new(file)), "project": project, "from": from, "to": to, "state": state,
"media": media, "route": route, "cost": cost, "cached": cached,
});
append("calls.jsonl", &row);
id
}
/// One answer kept; its id.
pub fn answer(call: &str, file: &str, q: &Question, r: &Reading, flagged: bool) -> String {
let id = new_id("a");
let whole = serde_json::to_value(Question { calibration: None, ..q.clone() }).unwrap_or_default();
let row = json!({
"id": id, "at": now(), "call": call, "file": file, "question": q.id, "version": q.version(), "ask": q.ask,
"value": r.value, "problem": r.problem, "choice": r.choice, "says": r.says, "flagged": flagged, "calibrated": q.calibrated(),
"q": whole,
});
append("answers.jsonl", &row);
id
}
/// Every row of one of the record's files.
pub fn rows(file: &str) -> Vec<Value> {
std::fs::read_to_string(dir().join(file)).unwrap_or_default().lines().filter_map(|l| serde_json::from_str(l).ok()).collect()
}
+365
View File
@@ -0,0 +1,365 @@
//! One runner for every caller (docs/ask.feature AK3): a batch planned into calls (grouped by file, window, the files
//! beside it and what of the picture its questions look at, at most 64 questions a call, the voice question added to a
//! call whose questions depend on whether anyone speaks when that isn't known), each clip cut once, the calls
//! made in parallel, the answers streamed back as they come and kept. A pool that's spent partway keeps what came and
//! reports the rest as waiting for it. `dry` cuts the media and says what would be sent, and spends nothing. A group can
//! carry clips kept from an earlier call instead of a file to cut (`raea ask try`), and every question goes out with the
//! person's own calibration when it has earned one (calibrate.rs).
use std::collections::{BTreeSet, HashMap};
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::sync::{Arc, Mutex, mpsc};
use raea_core_ask::{Kind, Picks, Question, Sees, Window, limits};
use raea_io_clef::{Answered, Call, Fail, Media, media};
use serde::Serialize;
use serde_json::{Value, json};
use crate::prepare::{self, Piece, VOICE};
use crate::{calibrate, record};
/// What to ask of one file: its questions (prepared), those dropped with why, a window over all of them (else each
/// question's own), and files set beside it (to pick between, or before and after).
pub struct Entry {
pub piece: Arc<Piece>,
pub window: Option<Window>,
pub questions: Vec<Question>,
pub dropped: Vec<(String, String)>,
pub with: Vec<PathBuf>,
}
/// One call's worth.
pub struct Group {
pub piece: Arc<Piece>,
pub from: f64,
pub to: Option<f64>,
pub sees: Sees,
pub hears: bool,
pub with: Vec<PathBuf>,
pub questions: Vec<Question>,
/// clips kept from an earlier call, sent again in place of cutting the file
pub kept: Option<Arc<Kept>>,
}
/// An earlier call's clips and state, and their seconds of video and sound (for the estimate).
pub struct Kept {
pub media: Media,
pub state: String,
pub video_seconds: f64,
pub sound_seconds: f64,
}
/// One answer, or why a question wasn't asked or still waits: the line `raea ask --json` prints for each.
#[derive(Debug, Clone, Default, Serialize)]
pub struct Answer {
/// its id in the record (`raea ask verdict` takes it)
pub answer: Option<String>,
pub file: String,
pub id: String,
pub version: String,
pub from: f64,
pub to: Option<f64>,
pub says: Option<String>,
pub value: Option<f64>,
pub problem: Option<f64>,
pub choice: Option<String>,
pub flagged: bool,
pub calibrated: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub not_asked: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub waits: Option<String>,
pub route: Option<String>,
pub cached: bool,
}
/// What the run came to.
#[derive(Debug, Clone, Default, Serialize)]
pub struct Summary {
pub asked: usize,
pub answered: usize,
pub calls: usize,
pub cost: f64,
pub estimate: f64,
pub pool_left: Option<f64>,
pub waiting: usize,
pub flagged: usize,
pub flagged_calibrated: usize,
pub routes: BTreeSet<String>,
/// the clips cut (each once, however many calls used it)
pub clips: usize,
}
/// What the runner tells its caller as it goes: an answer, or (dry) a call it would make.
pub enum Event<'a> {
Answer(&'a Answer),
Would(&'a Value),
}
pub struct Opts {
pub jobs: usize,
pub dry: bool,
/// how a call is made: `raea_io_clef::ask` (a test gives its own)
pub ask: fn(&Call) -> Result<Answered, Fail>,
}
impl Opts {
pub fn new(jobs: usize, dry: bool) -> Opts {
Opts { jobs, dry, ask: raea_io_clef::ask }
}
}
const NAMES: [&str; 4] = ["first", "second", "third", "fourth"];
/// A pick's options: the files given, in order (all, or all but the first, the reference).
fn picks(p: Picks, files: usize) -> Vec<String> {
let n = files.min(NAMES.len());
let skip = usize::from(p == Picks::AfterFirst);
NAMES[skip.min(n)..n].iter().map(|s| s.to_string()).collect()
}
/// The batch as calls.
pub fn plan(entries: &[Entry]) -> (Vec<Group>, Vec<Answer>) {
let mut groups: Vec<Group> = Vec::new();
let mut unasked = Vec::new();
let mine = calibrate::local();
for e in entries {
let file = e.piece.file.display().to_string();
for (id, why) in &e.dropped {
unasked.push(Answer { file: file.clone(), id: id.clone(), not_asked: Some(why.clone()), ..Default::default() });
}
for q in &e.questions {
let w = e.window.or(q.window).unwrap_or_default();
let (from, to) = (w.from.unwrap_or(0.0).max(0.0), w.to);
let mut q = q.clone();
calibrate::apply(&mut q, &mine);
if let Some(p) = q.picks {
q.kind = Kind::Choose;
q.options = picks(p, 1 + e.with.len());
}
let compares = q.picks.is_some_and(|_| q.options.len() < 2) || (q.uses.iter().any(|u| u == "with") && e.with.is_empty());
if compares {
unasked.push(Answer { file: file.clone(), version: q.version(), not_asked: Some("it compares files: set one or more beside it (--with)".into()), id: q.id, ..Default::default() });
continue;
}
// one place in each call is kept for the voice question
let same = |g: &&mut Group| Arc::ptr_eq(&g.piece, &e.piece) && g.from == from && g.to == to && g.sees == q.sees && g.with == e.with && g.questions.len() < limits::QUESTIONS - 1;
match groups.iter_mut().find(same) {
Some(g) => {
g.hears |= q.hears;
g.questions.push(q);
}
None => groups.push(Group { piece: e.piece.clone(), from, to, sees: q.sees, hears: q.hears, with: e.with.clone(), questions: vec![q], kept: None }),
}
}
}
for g in &mut groups {
g.hears &= g.piece.probe.sound || g.with.iter().any(|f| media::probe(f).is_ok_and(|p| p.sound));
if g.hears && g.piece.voice.is_none() && g.questions.iter().any(|q| q.when.voice.is_some()) {
g.questions.push(prepare::voice_question());
}
}
(groups, unasked)
}
/// Clips cut once a run, by what they are.
type Cuts = Mutex<HashMap<String, Result<Arc<Vec<u8>>, String>>>;
fn cut(cuts: &Cuts, key: String, make: impl FnOnce() -> Result<Vec<u8>, String>) -> Result<Arc<Vec<u8>>, String> {
if let Some(r) = cuts.lock().unwrap().get(&key) {
return r.clone();
}
let r = make().map(Arc::new);
cuts.lock().unwrap().insert(key, r.clone());
r
}
/// A group's media, and its seconds of video and of sound (for the estimate).
fn media_of(g: &Group, cuts: &Cuts) -> Result<(Media, f64, f64), String> {
if let Some(k) = &g.kept {
return Ok((k.media.clone(), k.video_seconds, k.sound_seconds));
}
let files: Vec<&Path> = std::iter::once(g.piece.file.as_path()).chain(g.with.iter().map(PathBuf::as_path)).collect();
let (from, to) = (g.from, g.to);
let span = |p: &media::Probe| (to.unwrap_or(p.seconds) - from).clamp(0.0, p.seconds.max(0.1));
let mut m = Media::default();
let (mut vs, mut ss) = (0.0, 0.0);
for f in &files {
let p = if *f == g.piece.file.as_path() { g.piece.probe } else { media::probe(f)? };
let k = |what: &str| format!("{what}:{}:{from}:{to:?}", f.display());
match g.sees {
Sees::Video if p.video => {
m.videos.push(cut(cuts, k("video"), || media::video(f, from, to))?.to_vec());
vs += span(&p).min(limits::VIDEO_SECONDS);
}
Sees::Video | Sees::Stills if !p.video => m.stills.push(cut(cuts, k("still"), || media::still(f, None))?.to_vec()),
Sees::Stills if files.len() == 1 => {
let len = span(&p);
for i in 0..limits::STILLS {
let at = from + len * (i as f64 + 0.5) / limits::STILLS as f64;
m.stills.push(cut(cuts, k(&format!("frame{i}")), || media::still(f, Some(at)))?.to_vec());
}
}
Sees::Stills => m.stills.push(cut(cuts, k("frame"), || media::still(f, Some(from + span(&p) / 2.0)))?.to_vec()),
_ => {}
}
if g.hears && p.sound {
m.sounds.push(cut(cuts, k("sound"), || media::sound(f, from, to))?.to_vec());
ss += span(&p).min(limits::SOUND_SECONDS);
}
}
if m.videos.len() > limits::VIDEOS || m.stills.len() > limits::STILLS || m.sounds.len() > limits::SOUNDS {
return Err(format!("too many files for one call: at most {} videos, {} stills and {} sounds", limits::VIDEOS, limits::STILLS, limits::SOUNDS));
}
Ok((m, vs, ss))
}
enum Done {
Asked(Answered, Vec<String>, String),
Would(Value),
Failed(String),
Waits(String),
}
/// Every entry asked, at most `jobs` calls at once, each event told to `out` as it comes (in the caller's thread).
pub fn run(entries: Vec<Entry>, o: &Opts, out: &mut dyn FnMut(Event)) -> Summary {
let (groups, unasked) = plan(&entries);
run_groups(groups, unasked, o, out)
}
/// Planned groups asked, the questions not asked told first.
pub fn run_groups(groups: Vec<Group>, unasked: Vec<Answer>, o: &Opts, out: &mut dyn FnMut(Event)) -> Summary {
let mut sum = Summary::default();
for a in &unasked {
out(Event::Answer(a));
}
let cuts: Cuts = Mutex::default();
let (next, spent) = (AtomicUsize::new(0), AtomicBool::new(false));
let spent_why = Mutex::new(String::new());
let (tx, rx) = mpsc::channel::<(usize, Done)>();
std::thread::scope(|s| {
for _ in 0..o.jobs.clamp(1, 16).min(groups.len().max(1)) {
let (tx, groups, cuts, next, spent, spent_why) = (tx.clone(), &groups, &cuts, &next, &spent, &spent_why);
s.spawn(move || {
loop {
let i = next.fetch_add(1, Ordering::Relaxed);
let Some(g) = groups.get(i) else { break };
let done = if spent.load(Ordering::Relaxed) {
Done::Waits(spent_why.lock().unwrap().clone())
} else {
match media_of(g, cuts) {
Err(e) => Done::Failed(e),
Ok((m, vs, ss)) => {
let state = g.kept.as_ref().map_or_else(|| g.piece.state(), |k| k.state.clone());
let call = Call { state, questions: g.questions.clone(), media: m };
let estimate = limits::estimate(vs, ss, call.media.stills.len(), call.state.len(), call.questions.len());
if o.dry {
Done::Would(would(g, &call, estimate))
} else {
match (o.ask)(&call) {
Ok(a) => Done::Asked(a, kept(&call.media), call.state),
Err(Fail::Spent(why)) => {
spent.store(true, Ordering::Relaxed);
*spent_why.lock().unwrap() = why.clone();
Done::Waits(why)
}
Err(f) => Done::Failed(f.to_string()),
}
}
}
}
};
if tx.send((i, done)).is_err() {
break;
}
}
});
}
drop(tx);
for (i, done) in rx {
told(&groups[i], done, &mut sum, out);
}
});
sum.clips = cuts.lock().unwrap().values().filter(|c| c.is_ok()).count();
sum
}
/// The clips a call sent, kept by hash for `raea ask try`.
fn kept(m: &Media) -> Vec<String> {
let each = |v: &[Vec<u8>], ext: &str| v.iter().map(|b| record::keep_media(b, ext)).collect::<Vec<_>>();
[each(&m.videos, "mp4"), each(&m.stills, "jpg"), each(&m.sounds, "mp3")].concat()
}
fn would(g: &Group, call: &Call, estimate: f64) -> Value {
let sizes = |v: &[Vec<u8>]| v.iter().map(Vec::len).collect::<Vec<_>>();
json!({
"file": g.piece.file.display().to_string(), "from": g.from, "to": g.to,
"questions": call.questions.iter().map(|q| json!({"id": q.id, "ask": q.ask, "type": q.kind})).collect::<Vec<_>>(),
"state": call.state,
"media": {"videos": sizes(&call.media.videos), "stills": sizes(&call.media.stills), "sounds": sizes(&call.media.sounds)},
"estimate_usd": estimate,
})
}
/// A finished call's answers told, kept and counted. When the voice question went along, the variant that doesn't
/// apply (sound where no one speaks, sound-silent where someone does) is set aside.
fn told(g: &Group, done: Done, sum: &mut Summary, out: &mut dyn FnMut(Event)) {
let file = g.piece.file.display().to_string();
// the voice question only decides between variants: it isn't told
let asked: Vec<&Question> = g.questions.iter().filter(|q| q.id != VOICE).collect();
let base = |q: &Question| Answer { file: file.clone(), id: q.id.clone(), version: q.version(), from: g.from, to: g.to, calibrated: q.calibrated(), ..Default::default() };
match done {
Done::Would(v) => {
sum.calls += 1;
sum.estimate += v["estimate_usd"].as_f64().unwrap_or(0.0);
out(Event::Would(&v));
}
Done::Failed(why) | Done::Waits(why) if g.questions.is_empty() => drop(why),
Done::Failed(why) => asked.iter().for_each(|q| out(Event::Answer(&Answer { not_asked: Some(why.clone()), ..base(q) }))),
Done::Waits(why) => {
sum.waiting += asked.len();
asked.iter().for_each(|q| out(Event::Answer(&Answer { waits: Some(format!("waits for the pool: {why}")), ..base(q) })));
}
Done::Asked(a, clips, state) => {
sum.calls += 1;
sum.asked += asked.len();
sum.cost += a.cost;
sum.pool_left = a.pool_left.or(sum.pool_left);
sum.routes.insert(a.route.clone());
let project = g.piece.project.as_ref().map(|p| p.display().to_string());
let call = record::call(&file, project.as_deref(), g.from, g.to, &state, &clips, &a.route, a.cost, a.cached);
let heard = a.answers.get(VOICE).and_then(|v| v["noul"].as_f64());
for q in g.questions.iter().filter(|q| q.id != VOICE) {
let Some(ans) = a.answers.get(&q.id) else {
out(Event::Answer(&Answer { not_asked: Some("no answer came back for it".into()), ..base(q) }));
continue;
};
if let (Some(p), Some(v)) = (heard, q.when.voice) {
if v != (p >= 0.5) {
let who = if p >= 0.5 { "someone speaks" } else { "no one speaks" };
out(Event::Answer(&Answer { not_asked: Some(format!("set aside: {who} ({p:.2})")), ..base(q) }));
continue;
}
}
let r = q.read(ans);
let flagged = q.flagged(&r);
sum.answered += 1;
sum.flagged += usize::from(flagged);
sum.flagged_calibrated += usize::from(flagged && q.calibrated());
let id = record::answer(&call, &file, q, &r, flagged);
out(Event::Answer(&Answer {
answer: Some(id),
says: Some(r.says),
value: Some(r.value),
problem: r.problem,
choice: r.choice,
flagged,
route: Some(a.route.clone()),
cached: a.cached,
..base(q)
}));
}
}
}
}
+174
View File
@@ -0,0 +1,174 @@
use std::path::PathBuf;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use raea_core_ask::{Facts, Kind, Picks, Question, Sees, Window, library};
use raea_io_clef::media::Probe;
use raea_io_clef::{Answered, Call, Fail};
use serde_json::{Map, Value, json};
use crate::prepare::{self, Piece, VOICE};
use crate::runner::{self, Answer, Entry, Event, Opts};
fn rubric() -> String {
std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/../../sdk/guides/craft/rubric.md")).expect("the craft rubric")
}
pub(crate) fn setup() {
static ONCE: std::sync::Once = std::sync::Once::new();
// SAFETY: set once, before any test reads it, to the same value for every test
ONCE.call_once(|| unsafe { std::env::set_var("RAEA_ASK_DIR", std::env::temp_dir().join(format!("raea-ask-test-{}", std::process::id()))) });
}
fn ids(qs: &[Question]) -> Vec<&str> {
qs.iter().map(|q| q.id.as_str()).collect()
}
fn piece(file: &str, voice: Option<bool>) -> Arc<Piece> {
let probe = Probe { seconds: 10.0, video: true, still: false, sound: true };
Arc::new(Piece { file: PathBuf::from(file), probe, voice, ..Default::default() })
}
fn entry(p: &Arc<Piece>, window: Option<Window>, questions: Vec<Question>) -> Entry {
Entry { piece: p.clone(), window, questions, dropped: vec![], with: vec![] }
}
#[test]
fn no_one_speaking_asks_sound_silent_and_a_file_without_sound_isnt_listened_to() {
let r = rubric();
let sound = library::find("sound", Some(&r)).unwrap();
let silent = Facts { voice: Some(false), sound: true, video: true, ..Default::default() };
let (asked, dropped) = prepare::keep(vec![sound.clone()], &silent, Some(&r));
assert_eq!(ids(&asked), ["sound-silent"]);
assert!(dropped[0].1.contains("no one speaks") && dropped[0].1.contains("sound-silent instead"), "{dropped:?}");
let mut listen = Question::plain("loud", "Is it loud?");
listen.sees = Sees::Nothing;
let (asked, dropped) = prepare::keep(vec![listen], &Facts { video: true, ..Default::default() }, None);
assert!(asked.is_empty() && dropped[0].1.contains("no sound"), "{dropped:?}");
// not knowing whether anyone speaks, both are kept, and the plan adds the voice question to their call
let unknown = Facts { sound: true, video: true, ..Default::default() };
let (asked, _) = prepare::keep(vec![sound], &unknown, Some(&r));
assert_eq!(ids(&asked), ["sound", "sound-silent"]);
let (groups, _) = runner::plan(&[entry(&piece("a.mp4", None), None, asked)]);
assert_eq!(groups.len(), 1);
assert_eq!(ids(&groups[0].questions), ["sound", "sound-silent", VOICE]);
}
#[test]
fn the_state_says_what_the_piece_is() {
let mut p = (*piece("a.mp4", Some(false))).clone();
p.brief = json!({"title": "Spring launch", "mode": ["pitch"], "audience": "busy founders", "believe": "it saves them an hour."});
p.extra = Some("raea measured -14 LUFS.".into());
let s = p.state();
for want in ["A pitch piece: \"Spring launch\".", "It's for: busy founders.", "believing: it saves them an hour.", "No one speaks", "runs 10 s", "-14 LUFS"] {
assert!(s.contains(want), "{want}: {s}");
}
assert_eq!(p.facts().modes, ["pitch"]);
// no brief and the caller's own state: the caller says what the piece is
let own = Piece { extra: Some("A game: \"Rover\".".into()), ..(*piece("a.mp4", None)).clone() };
assert_eq!(own.state(), "It runs 10 s. A game: \"Rover\".");
}
#[test]
fn calls_hold_64_questions_and_split_by_window_and_what_they_look_at() {
let p = piece("a.mp4", Some(true));
let many: Vec<Question> = (0..65).map(|i| Question::plain(&format!("q{i}"), "Is it loud?")).collect();
let (groups, _) = runner::plan(&[entry(&p, None, many)]);
assert_eq!(groups.iter().map(|g| g.questions.len()).collect::<Vec<_>>(), [63, 2], "one place a call is kept for the voice question");
let hook = Window { from: Some(0.0), to: Some(3.0) };
let mut still = Question::plain("s", "Is the text readable?");
still.sees = Sees::Stills;
let (groups, _) = runner::plan(&[entry(&p, None, vec![Question::plain("a", "Is it loud?"), still]), entry(&p, Some(hook), vec![Question::plain("b", "Is it loud?")])]);
assert_eq!(groups.len(), 3);
let mut pick = Question::plain("best", "Which suits the brief best?");
pick.picks = Some(Picks::All);
let (groups, unasked) = runner::plan(&[entry(&p, None, vec![pick])]);
assert!(groups.is_empty() && unasked[0].not_asked.as_deref().is_some_and(|n| n.contains("--with")), "{unasked:?}");
let (groups, unasked) = runner::plan(&[entry(&p, None, vec![library::find("decide.changed", None).unwrap()])]);
assert!(groups.is_empty() && !unasked[0].version.is_empty(), "{unasked:?}");
}
/// clef's answers as a fake gives them: yes 0.8 to every yes question (0.9 to the voice question), the lowest level of
/// a grade.
fn answers(call: &Call) -> Map<String, Value> {
call.questions
.iter()
.map(|q| {
let a = match q.kind {
Kind::Yes => json!({"noul": if q.id == VOICE { 0.9 } else { 0.8 }}),
_ => json!({"choice": q.levels()[0], "probabilities": {q.levels()[0].clone(): 1.0}}),
};
(q.id.clone(), a)
})
.collect()
}
fn answered(call: &Call) -> Answered {
Answered { answers: answers(call), cost: 0.001, cached: false, route: "a test".into(), pool_left: Some(1.5) }
}
/// A 2 s clip with a picture and a tone, made with FFmpeg.
fn clip(name: &str) -> PathBuf {
let out = std::env::temp_dir().join(format!("raea-ask-{}-{name}.mp4", std::process::id()));
let ff = raea_io_assets::ffmpeg_tool("ffmpeg", false).expect("FFmpeg");
let ok = std::process::Command::new(ff)
.args(["-y", "-v", "error", "-f", "lavfi", "-i", "testsrc=size=320x240:rate=10:duration=2", "-f", "lavfi", "-i", "sine=frequency=440:duration=2"])
.args(["-c:v", "mpeg4", "-c:a", "aac", "-shortest"])
.arg(&out)
.status()
.expect("FFmpeg ran");
assert!(ok.success());
out
}
fn run(entries: Vec<Entry>, jobs: usize, ask: fn(&Call) -> Result<Answered, Fail>) -> (runner::Summary, Vec<Answer>) {
setup();
let mut got = Vec::new();
let sum = runner::run(entries, &Opts { jobs, dry: false, ask }, &mut |e| {
if let Event::Answer(a) = e {
got.push(a.clone());
}
});
(sum, got)
}
#[test]
fn each_clip_is_cut_once_and_the_voice_answer_sets_a_variant_aside() {
let file = clip("once");
let p = Arc::new(Piece::read(&file, None, None, None, None).unwrap());
assert!(p.probe.video && p.probe.sound && p.voice.is_none());
let r = rubric();
let (asked, _) = prepare::keep(vec![library::find("sound", Some(&r)).unwrap()], &p.facts(), Some(&r));
let mut listen = Question::plain("loud", "Is it too loud?");
listen.sees = Sees::Nothing;
let (sum, got) = run(vec![entry(&p, None, [asked, vec![listen]].concat())], 4, |c| Ok(answered(c)));
assert_eq!((sum.calls, sum.clips), (2, 2), "the picture's call and the sound's call share one cut of the sound");
let by = |id: &str| got.iter().find(|a| a.id == id).unwrap_or_else(|| panic!("{id}: {got:?}"));
assert!(by("sound").says.is_some() && by("loud").flagged);
assert!(by("sound-silent").not_asked.as_deref().is_some_and(|n| n.contains("someone speaks (0.90)")), "{:?}", by("sound-silent"));
assert!(!got.iter().any(|a| a.id == VOICE), "the voice question isn't told");
assert_eq!((sum.answered, sum.cost, sum.pool_left), (2, 0.002, Some(1.5)));
}
static CALLS: AtomicUsize = AtomicUsize::new(0);
#[test]
fn a_pool_spent_partway_keeps_what_came_and_the_rest_waits() {
let file = clip("spent");
let p = Arc::new(Piece::read(&file, None, None, Some(true), None).unwrap());
let at = |s: f64| Some(Window { from: Some(s), to: Some(s + 0.5) });
let entries = (0..4).map(|i| entry(&p, at(i as f64 * 0.4), vec![Question::plain(&format!("w{i}"), "Is it loud?")])).collect();
let (sum, got) = run(entries, 1, |c| match CALLS.fetch_add(1, Ordering::SeqCst) {
2 => Err(Fail::Spent("this month's pool is used up".into())),
_ => Ok(answered(c)),
});
assert_eq!((sum.calls, sum.answered, sum.waiting), (2, 2, 2));
assert_eq!(got.iter().filter(|a| a.waits.as_deref().is_some_and(|w| w.contains("used up"))).count(), 2);
assert_eq!(CALLS.load(Ordering::SeqCst), 3, "nothing is sent after the pool is spent");
}
#[test]
fn own_words_keep_their_id() {
assert_eq!(crate::verbs::own_id("Does the music fight the voice?"), "own-does-the-music-fight-the-voice");
assert_eq!(crate::verbs::own_id("Does the music fight the voice?"), crate::verbs::own_id("does the MUSIC fight the voice"));
}
+385
View File
@@ -0,0 +1,385 @@
//! `raea ask` (docs/ask.feature AK3): questions about a piece's picture and sound, from the command line or a batch,
//! prepared (prepare.rs), asked in parallel (runner.rs) and kept (record.rs). It prints as answers come: words and a
//! probability a line, or with `--json` one JSON object a line (an answer, a call `--dry` would make, then the summary).
//! `--gate` exits 1 when a calibrated question flags (`--gate any`: when any does), for a pipeline. `verdict`,
//! `calibrate` and `try` label the answers, calibrate the questions on them and measure new words (labels.rs,
//! calibrate.rs; AK6-AK7).
use std::collections::{BTreeMap, HashMap};
use std::io::Read as _;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use raea_core_ask::{Kind, Question, Window, library};
use serde_json::{Value, json};
use crate::labels::{self, span};
use crate::prepare::{self, Piece};
use crate::runner::{self, Entry, Event, Opts};
use crate::{calibrate, record};
pub const USAGE: &str = "raea ask FILE [QUESTION...] [--choose A,B,C] [--grade] [--rate N] [--flag ANSWERS] [--set NAME] [--std ID] [--from S] [--to S] [--at S] [--with FILE2] [--brief brief.ts|none] [--words words.json] [--voice yes|no] [--state TEXT] [--dry] [--json] [--gate [any]] [--jobs N] | ask --batch FILE [--dry] [--json] [--gate [any]] [--jobs N] | ask list [SET] [--json] | ask verdict ANSWER WORD [--eye NAME] | ask calibrate [ID] [--json] | ask try WORDS --like ID [--dry] [--json] [--jobs N] (questions about a piece's picture and sound, answered by clef-omni and paid from your raea plan's pool when the app is signed in, else RAEA_AGENT_KEY's, else your own Cloudflare keys: your own words, or the standard sets (rubric, av, defects, platform, decide); every question about one clip goes in one call, --batch (a JSON list or JSON lines, - for stdin) asks many clips in parallel; --dry says what would be sent and spends nothing; answers are advice until a question is calibrated: verdict labels an answer, calibrate holds each question to your verdicts, notes and approvals, try asks new words of its labelled clips)";
const VALUED: [&str; 17] = ["--choose", "--rate", "--flag", "--set", "--std", "--from", "--to", "--at", "--with", "--brief", "--words", "--voice", "--state", "--jobs", "--batch", "--eye", "--like"];
const BARE: [&str; 4] = ["--grade", "--dry", "--json", "--gate"];
/// The arguments: the words that aren't flags, each flag's values, and whether `--gate` is `--gate any`.
#[derive(Default)]
struct Args {
words: Vec<String>,
flags: BTreeMap<String, Vec<String>>,
gate_any: bool,
}
impl Args {
fn parse(args: &[String]) -> Result<Args, String> {
let mut a = Args::default();
let mut i = 0;
while i < args.len() {
let s = args[i].as_str();
if VALUED.contains(&s) {
let v = args.get(i + 1).ok_or_else(|| format!("ask: {s} takes a value\nusage: {USAGE}"))?;
a.flags.entry(s.into()).or_default().push(v.clone());
i += 1;
} else if BARE.contains(&s) {
a.flags.entry(s.into()).or_default();
if s == "--gate" && args.get(i + 1).is_some_and(|v| v == "any") {
a.gate_any = true;
i += 1;
}
} else if s.starts_with("--") {
return Err(format!("ask doesn't take {s}\nusage: {USAGE}"));
} else {
a.words.push(s.into());
}
i += 1;
}
Ok(a)
}
fn has(&self, f: &str) -> bool {
self.flags.contains_key(f)
}
fn one(&self, f: &str) -> Option<&str> {
self.flags.get(f).and_then(|v| v.last()).map(String::as_str)
}
fn num(&self, f: &str) -> Result<Option<f64>, String> {
self.one(f).map(|v| v.parse::<f64>().map_err(|_| format!("ask: {f} takes seconds, got {v:?}"))).transpose()
}
fn list(&self, f: &str) -> Vec<String> {
self.flags.get(f).into_iter().flatten().flat_map(|v| v.split(',')).map(|s| s.trim().to_string()).filter(|s| !s.is_empty()).collect()
}
}
/// The craft rubric's text, where the guides are installed, for the `rubric` set.
pub fn rubric_md() -> Option<String> {
std::fs::read_to_string(raea_io_home::home().join("sdk/guides/craft/rubric.md")).ok()
}
/// A question's id from its words: `own-` and its first words, so the same words keep their id.
pub fn own_id(words: &str) -> String {
let slug: Vec<String> = words.split(|c: char| !c.is_ascii_alphanumeric()).filter(|w| !w.is_empty()).take(6).map(str::to_lowercase).collect();
let mut id = format!("own-{}", slug.join("-"));
id.truncate(raea_core_ask::limits::ID_LEN);
id
}
/// The questions an entry names: its own words (shaped by the kind flags), its sets and its standard ids.
fn named(own: &[Question], sets: &[String], std: &[String], rubric: Option<&str>) -> Result<Vec<Question>, String> {
let mut qs = own.to_vec();
for s in sets {
qs.extend(library::set(s, rubric)?);
}
for id in std {
qs.push(library::find(id, rubric).ok_or_else(|| format!("ask: no standard question {id} (raea ask list)"))?);
}
Ok(qs)
}
fn shaped(words: &str, a: &Args) -> Result<Question, String> {
let mut q = Question::plain(&own_id(words), words);
if let Some(c) = a.one("--choose") {
q.kind = Kind::Choose;
q.options = c.split(',').map(|s| s.trim().to_string()).filter(|s| !s.is_empty()).collect();
} else if let Some(n) = a.one("--rate") {
let n: usize = n.parse().map_err(|_| format!("ask: --rate takes how many levels, got {n:?}"))?;
q.kind = Kind::Rate;
q.options = (1..=n).map(|i| i.to_string()).collect();
} else if a.has("--grade") {
q.kind = Kind::Grade;
}
q.flags = a.list("--flag");
if let Some(why) = raea_core_ask::limits::check(&q) {
return Err(format!("ask: {why}"));
}
Ok(q)
}
/// The window from --from, --to and --at (three seconds around it).
fn window(a: &Args) -> Result<Option<Window>, String> {
if let Some(at) = a.num("--at")? {
return Ok(Some(Window { from: Some((at - 1.5).max(0.0)), to: Some(at + 1.5) }));
}
let (from, to) = (a.num("--from")?, a.num("--to")?);
Ok((from.is_some() || to.is_some()).then_some(Window { from, to }))
}
fn voice(v: Option<&str>) -> Result<Option<bool>, String> {
match v {
None => Ok(None),
Some("yes" | "true") => Ok(Some(true)),
Some("no" | "false") => Ok(Some(false)),
Some(v) => Err(format!("ask: --voice takes yes or no, got {v:?}")),
}
}
/// Pieces read once a run, by what they were read with.
type Pieces = HashMap<String, Arc<Piece>>;
#[allow(clippy::too_many_arguments)]
fn piece(pieces: &mut Pieces, file: &str, brief: Option<&str>, words: Option<&str>, voice: Option<bool>, state: Option<String>) -> Result<Arc<Piece>, String> {
let key = format!("{file}\u{1f}{brief:?}\u{1f}{words:?}\u{1f}{voice:?}\u{1f}{state:?}");
if let Some(p) = pieces.get(&key) {
return Ok(p.clone());
}
let p = Arc::new(Piece::read(Path::new(file), brief.map(Path::new), words.map(Path::new), voice, state).map_err(|e| format!("ask: {e}"))?);
pieces.insert(key, p.clone());
Ok(p)
}
fn entry(p: Arc<Piece>, window: Option<Window>, qs: Vec<Question>, with: Vec<PathBuf>, rubric: Option<&str>) -> Entry {
let (questions, dropped) = prepare::keep(qs, &p.facts(), rubric);
Entry { piece: p, window, questions, dropped, with }
}
/// The command line's one entry.
fn from_args(a: &Args, rubric: Option<&str>, pieces: &mut Pieces) -> Result<Vec<Entry>, String> {
let Some((file, words)) = a.words.split_first() else { return Err(USAGE.into()) };
let own = words.iter().map(|w| shaped(w, a)).collect::<Result<Vec<_>, _>>()?;
let qs = named(&own, &a.list("--set"), &a.list("--std"), rubric)?;
if qs.is_empty() {
return Err(format!("ask: nothing to ask: give a question in words, --set or --std (raea ask list)\nusage: {USAGE}"));
}
let p = piece(pieces, file, a.one("--brief"), a.one("--words"), voice(a.one("--voice"))?, a.one("--state").map(str::to_string))?;
let with = a.flags.get("--with").into_iter().flatten().map(PathBuf::from).collect();
Ok(vec![entry(p, window(a)?, qs, with, rubric)])
}
/// A batch: a JSON list of entries or JSON lines, from a file or stdin (`-`). Each entry is {file, window?, questions?
/// (words or questions), set?, std?, with?, brief?, words?, voice?, state?}.
fn from_batch(path: &str, rubric: Option<&str>, pieces: &mut Pieces) -> Result<Vec<Entry>, String> {
let text = match path {
"-" => {
let mut s = String::new();
std::io::stdin().read_to_string(&mut s).map_err(|e| format!("ask: stdin: {e}"))?;
s
}
p => std::fs::read_to_string(p).map_err(|e| format!("ask: {p}: {e}"))?,
};
let rows: Vec<Value> = match serde_json::from_str::<Value>(text.trim()) {
Ok(Value::Array(a)) => a,
Ok(v @ Value::Object(_)) => vec![v],
_ => text.lines().filter(|l| !l.trim().is_empty()).enumerate().map(|(i, l)| serde_json::from_str(l).map_err(|e| format!("ask: {path} line {}: {e}", i + 1))).collect::<Result<_, _>>()?,
};
let strs = |v: &Value| -> Vec<String> {
match v {
Value::String(s) => s.split(',').map(|s| s.trim().to_string()).collect(),
Value::Array(a) => a.iter().filter_map(Value::as_str).map(str::to_string).collect(),
_ => vec![],
}
};
let mut out = Vec::new();
for (n, r) in rows.iter().enumerate() {
let at = |e: String| format!("ask: {path} entry {}: {e}", n + 1);
let file = r["file"].as_str().ok_or_else(|| at("it has no file".into()))?;
let own = r["questions"].as_array().into_iter().flatten().map(|q| match q {
Value::String(w) => Ok(Question::plain(&own_id(w), w)),
q => serde_json::from_value::<Question>(q.clone()).map_err(|e| e.to_string()),
});
let own = own.collect::<Result<Vec<_>, _>>().map_err(at)?;
let qs = named(&own, &strs(&r["set"]), &strs(&r["std"]), rubric).map_err(at)?;
let window: Option<Window> = serde_json::from_value(r["window"].clone()).ok();
let v = voice(r["voice"].as_str()).map_err(at)?.or(r["voice"].as_bool());
let p = piece(pieces, file, r["brief"].as_str(), r["words"].as_str(), v, r["state"].as_str().map(str::to_string)).map_err(at)?;
out.push(entry(p, window, qs, strs(&r["with"]).into_iter().map(PathBuf::from).collect(), rubric));
}
Ok(out)
}
/// `raea ask list [SET]`: the standard questions.
fn list(a: &Args, rubric: Option<&str>) -> Result<String, String> {
let sets: Vec<String> = match a.words.get(1) {
Some(s) => vec![s.clone()],
None => library::SETS.iter().map(|s| s.to_string()).collect(),
};
let mut out = Vec::new();
let mine = calibrate::local();
for s in &sets {
let mut qs = library::set(s, rubric)?;
qs.iter_mut().for_each(|q| calibrate::apply(q, &mine));
if a.has("--json") {
out.push(json!({"set": s, "questions": qs}).to_string());
continue;
}
out.push(format!("{s}:"));
for q in qs {
let how = if q.calibrated() { "calibrated" } else { "advice" };
out.push(format!(" {:<28} {:<6} {:<10} {}", q.id, format!("{:?}", q.kind).to_lowercase(), how, q.ask));
}
}
Ok(out.join("\n"))
}
/// An event as a line of text.
fn line(e: &Event, files: usize) -> String {
match e {
Event::Would(v) => {
let qs: Vec<&str> = v["questions"].as_array().into_iter().flatten().filter_map(|q| q["id"].as_str()).collect();
let m = &v["media"];
let kb = |k: &str| m[k].as_array().map(|a| a.iter().filter_map(Value::as_u64).map(|b| format!("{} KB", b / 1024)).collect::<Vec<_>>().join(", ")).unwrap_or_default();
format!(
"would ask {} ({}) about {}:\n {}\n videos [{}], stills [{}], sounds [{}], about ${:.4}\n state: {}",
qs.len(),
span(v["from"].as_f64().unwrap_or(0.0), v["to"].as_f64()),
v["file"].as_str().unwrap_or(""),
qs.join(", "),
kb("videos"),
kb("stills"),
kb("sounds"),
v["estimate_usd"].as_f64().unwrap_or(0.0),
v["state"].as_str().unwrap_or("")
)
}
Event::Answer(a) => {
let who = if files > 1 { format!("{}: ", a.file) } else { String::new() };
let what = match (&a.says, &a.not_asked, &a.waits) {
(Some(s), ..) => format!("{s} [{}]{}", span(a.from, a.to), if a.flagged && a.calibrated { " <- finding" } else if a.flagged { " <- flagged" } else { "" }),
(_, Some(n), _) => format!("not asked: {n}"),
(.., Some(w)) => w.clone(),
_ => "no answer".into(),
};
format!("{who}{:<34} {what}", a.id)
}
}
}
/// `raea ask ...` with its exit code: 0, or 1 when it couldn't ask or a gate failed.
pub fn cli(args: &[String]) -> i32 {
match run(args) {
Ok(code) => code,
Err(e) => {
eprintln!("{e}");
1
}
}
}
fn run(args: &[String]) -> Result<i32, String> {
let a = Args::parse(args)?;
let rubric = rubric_md();
let jobs = a.one("--jobs").map(|j| j.parse::<usize>().map_err(|_| format!("ask: --jobs takes a number, got {j:?}"))).transpose()?.unwrap_or(4);
let sub = a.words.first().map(String::as_str).filter(|w| !Path::new(w).exists());
match sub {
Some("list") => {
println!("{}", list(&a, rubric.as_deref())?);
return Ok(0);
}
Some("verdict") => {
let [_, answer, said] = a.words.as_slice() else { return Err(format!("ask verdict ANSWER WORD: the answer's id (from --json or {}) and your answer to its question", record::dir().join("answers.jsonl").display())) };
println!("{}", labels::verdict(answer, said, a.one("--eye"))?);
return Ok(0);
}
Some("calibrate") => return calibrated(&a),
Some("try") => return tried(&a, jobs),
_ => {}
}
let mut pieces = Pieces::new();
let entries = match a.one("--batch") {
Some(b) => from_batch(b, rubric.as_deref(), &mut pieces)?,
None => from_args(&a, rubric.as_deref(), &mut pieces)?,
};
let (json_out, dry) = (a.has("--json"), a.has("--dry"));
let files = pieces.len();
let sum = runner::run(entries, &Opts::new(jobs, dry), &mut |e| {
match (&e, json_out) {
(Event::Answer(r), true) => println!("{}", serde_json::to_string(r).unwrap_or_default()),
(Event::Would(v), true) => println!("{}", json!({"would": v})),
(e, false) => println!("{}", line(e, files)),
}
});
if json_out {
println!("{}", json!({"summary": sum}));
} else if dry {
println!("{} call{}, about ${:.4}; nothing was sent", sum.calls, if sum.calls == 1 { "" } else { "s" }, sum.estimate);
} else if sum.calls > 0 {
let routes: Vec<&str> = sum.routes.iter().map(String::as_str).collect();
let left = sum.pool_left.map(|l| format!(", ${l:.2} left this month")).unwrap_or_default();
let waiting = if sum.waiting > 0 { format!("; {} wait for the pool", sum.waiting) } else { String::new() };
println!(
"asked {} question{} in {} call{} through {}: ${:.4}{left}{waiting}. Answers are advice until a question is calibrated (docs/ask.feature AK7).",
sum.asked,
if sum.asked == 1 { "" } else { "s" },
sum.calls,
if sum.calls == 1 { "" } else { "s" },
routes.join(" and "),
sum.cost
);
}
if !dry && sum.calls == 0 {
return Err("ask: nothing was asked (each question's line says why)".into());
}
// a gate fails on a flag (a calibrated one, or with `any` any), and on questions still waiting for the pool
let flagged = if a.gate_any { sum.flagged } else { sum.flagged_calibrated };
Ok(i32::from(a.has("--gate") && (flagged > 0 || sum.waiting > 0)))
}
/// A version's standing as a line, with its misses below when it doesn't separate.
fn standing_line(s: &calibrate::Standing) -> String {
let auc = s.auc.map_or_else(|| "no AUC".to_string(), |a| format!("AUC {a:.2}"));
let mut out = format!("{} ({}) \"{}\": {}, {auc} on {} labels; {}", s.id, &s.version[..8.min(s.version.len())], s.ask, s.state, s.problems + s.clean, s.why);
if s.others > 0 {
out += &format!(" ({} from other eyes, not counted)", s.others);
}
for m in &s.misses {
let what = if m.bad { "a problem it scored" } else { "clean work it scored" };
out += &format!("\n {what} {:.2}: {} ({}){}", m.problem, m.file, m.span, m.note.as_ref().map(|n| format!(" \"{n}\"")).unwrap_or_default());
}
out
}
/// `raea ask calibrate [ID]`: the feed's labels read again and each labelled question held to its labels.
fn calibrated(a: &Args) -> Result<i32, String> {
let (all, (yes, no)) = calibrate::calibrate(a.words.get(1).map(String::as_str))?;
if a.has("--json") {
println!("{}", json!({"feed": {"problems": yes, "clean": no}}));
all.iter().for_each(|s| println!("{}", serde_json::to_string(s).unwrap_or_default()));
return Ok(0);
}
println!("from the feed: {yes} note{} that saw a problem, {no} approval{} without one", if yes == 1 { "" } else { "s" }, if no == 1 { "" } else { "s" });
if all.is_empty() {
println!("no labelled questions yet: raea ask verdict ANSWER WORD labels one, and your notes on a posted render do too");
}
all.iter().for_each(|s| println!("{}", standing_line(s)));
Ok(0)
}
/// `raea ask try WORDS --like ID`: new words asked of a question's labelled clips, both held to the same labels.
fn tried(a: &Args, jobs: usize) -> Result<i32, String> {
let words = a.words[1..].join(" ");
let like = a.one("--like").ok_or("ask try WORDS --like ID: the question whose labelled clips the new words are asked of")?;
if words.trim().is_empty() {
return Err("ask try WORDS --like ID: the new words".into());
}
let json_out = a.has("--json");
let (sum, both) = calibrate::try_words(like, &words, &Opts::new(jobs, a.has("--dry")), &mut |e| match (&e, json_out) {
(Event::Would(v), true) => println!("{}", json!({"would": v})),
(Event::Answer(r), true) => println!("{}", serde_json::to_string(r).unwrap_or_default()),
(e, false) => println!("{}", line(e, 2)),
})?;
match (both, json_out) {
(None, true) => println!("{}", json!({"summary": sum})),
(None, false) => println!("{} call{}, about ${:.4}; nothing was sent", sum.calls, if sum.calls == 1 { "" } else { "s" }, sum.estimate),
(Some((old, new)), true) => println!("{}", json!({"summary": sum, "old": old, "new": new})),
(Some((old, new)), false) => println!("${:.4} for {} calls\nold words: {}\nnew words: {}", sum.cost, sum.calls, standing_line(&old), standing_line(&new)),
}
Ok(i32::from(!a.has("--dry") && sum.calls == 0))
}
+4 -1
View File
@@ -7,7 +7,6 @@ publish = false
description = "`raea check`: the floor's measurable lines on an export, ranked P0-P3"
[dependencies]
dunce = "1"
# taste.ts rules, as the raea CLI evaluates them (docs/projects.feature PJ0)
raea-core-brief = { path = "../../core/brief" }
# a transcript's words, read as `raea world` reads them (docs/direction.feature DR1)
@@ -21,6 +20,10 @@ raea-io-ffmpeg = { path = "../../io/ffmpeg" }
raea-sys-measure = { path = "../../systems/measure" }
# what it reads of a video, through FFmpeg or raea's own decoders where it isn't installed
raea-app-check-read = { path = "read" }
# who can fix what it finds: the encode's or the picture's own, carried, a source (split out to keep this crate small)
raea-app-check-cause = { path = "cause" }
# the text rules on a render's manifest (split out: raea render holds its own text to them)
raea-app-check-text = { path = "text" }
# the flashing screen (WCAG 2.3.1), split out to keep this crate small
raea-app-check-flash = { path = "flash" }
# what the person sent from the raea app, handed to the agent (split out to keep this crate small)
+15
View File
@@ -0,0 +1,15 @@
[package]
name = "raea-app-check-cause"
version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
publish = false
description = "Who can fix what raea check finds: the encode's or the picture's own, carried from an earlier export, a source rather than a delivery"
[dependencies]
# a project's record of renders and checks (DR3)
raea-core-facts = { path = "../../../core/facts" }
image = { version = "0.25", default-features = false, features = ["png"] }
[dev-dependencies]
serde_json = "1"
+174
View File
@@ -0,0 +1,174 @@
//! Who can fix what `raea check` finds, so a round is spent only on what another render can change (11-19: two
//! Telluride projects took nine renders, five of them for findings no render could move). Three things, for any rule:
//!
//! - **Introduced or there already.** A rule an encode can cause is measured again on the composition's own frames,
//! rendered without encoding (`unencoded`), and the export is set against them (`against`): what the picture already
//! held is the footage's (a note), what the export adds is the encode's (the error, with a fix raea has).
//! - **Carried.** A finding an earlier export of the same composition had at the same moment (`earlier`, `carried`)
//! says since when: the change between them didn't move it, so doing that again won't.
//! - **A source isn't a delivery.** A take or a download checked on its own (`is_source`) isn't held to a delivery's
//! loudness target.
//!
//! None of it changes what a rule measures or where it draws the line.
use std::path::{Path, PathBuf};
use std::process::Command;
use raea_core_facts::{Finding, record};
pub type R<T> = Result<T, String>;
/// Whether a record entry is the render that wrote `out` (a path as the record names it)
fn rendered(e: &record::Entry, out: &str) -> bool {
e.by == "raea render" && e.out.as_deref() == Some(out)
}
/// The composition a video was rendered from, and its project: the newest `raea render` writing it in the project's
/// record (DR3). None outside a project, or for a video no render there wrote (a take, a download).
pub fn composition_of(video: &Path) -> Option<(PathBuf, PathBuf)> {
let project = record::up(video, ".raea/project")?;
let want = record::rel(&project, video);
let made = record::read(&project).into_iter().rev().find(|e| e.kind == "video" && rendered(e, &want))?;
let of = project.join(&made.of);
of.is_file().then_some((project, of))
}
/// Whether a file is one of a project's sources (a take or a download under assets/ or media/ that no render wrote):
/// it isn't a delivery, so a delivery's rules (its loudness target) don't hold it
pub fn is_source(video: &Path) -> bool {
let Some(project) = record::up(video, ".raea/project") else { return false };
let me = record::rel(&project, video);
(me.starts_with("assets/") || me.starts_with("media/")) && !record::read(&project).iter().any(|e| rendered(e, &me))
}
/// Luma as a decoder of raea's export gives it to the check (BT.709, full range: FFmpeg's format=gray of the
/// encoder's limited-range picture), from 8-bit RGBA `width` wide, its top-left `w` x `h`
pub fn luma(rgba: &[u8], width: usize, w: usize, h: usize) -> Vec<u8> {
let mut y = Vec::with_capacity(w * h);
for r in 0..h {
for p in rgba[r * width * 4..][..w * 4].chunks_exact(4) {
y.push((0.2126 * p[0] as f32 + 0.7152 * p[1] as f32 + 0.0722 * p[2] as f32).round().clamp(0.0, 255.0) as u8);
}
}
y
}
/// `frames` as `comp` draws them, never encoded, as luma `w` x `h` (top-left): `raea render COMP --at F,... -o DIR/`
/// (PNG) run by `raea` from the project, kept out of its record as the quick check's stills are
pub fn unencoded(raea: &Path, project: &Path, comp: &Path, frames: &[i64], w: usize, h: usize) -> R<Vec<Vec<u8>>> {
let mut wanted: Vec<i64> = frames.to_vec();
wanted.sort_unstable();
wanted.dedup();
let tmp = std::env::temp_dir().join(format!("raea-unencoded-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&tmp);
std::fs::create_dir_all(&tmp).map_err(|e| format!("{}: {e}", tmp.display()))?;
let at = wanted.iter().map(|f| f.to_string()).collect::<Vec<_>>().join(",");
let read = (|| {
let run = Command::new(raea).arg("render").arg(comp).args(["--at", &at, "-o"]).arg(format!("{}/", tmp.display())).current_dir(project).env("RAEA_RECORD", "off").output().map_err(|e| e.to_string())?;
let mut pngs: Vec<PathBuf> = std::fs::read_dir(&tmp).map_err(|e| e.to_string())?.filter_map(|e| e.ok().map(|e| e.path())).filter(|p| p.extension().is_some_and(|x| x == "png")).collect();
pngs.sort();
if pngs.len() != wanted.len() {
let said = String::from_utf8_lossy(&run.stderr).lines().chain(String::from_utf8_lossy(&run.stdout).lines()).find(|l| l.contains("REFUSED") || l.contains("rror")).unwrap_or("").to_string();
return Err(format!("its render gave {} of {} frames {said}", pngs.len(), wanted.len()).trim_end().to_string());
}
let mut by_frame = std::collections::HashMap::new();
for (f, p) in wanted.iter().zip(&pngs) {
let img = image::open(p).map_err(|e| format!("{}: {e}", p.display()))?.to_rgba8();
let (iw, ih) = (img.width() as usize, img.height() as usize);
if iw < w || ih < h {
return Err(format!("it draws {iw}x{ih}, smaller than the export's {w}x{h}"));
}
by_frame.insert(*f, luma(img.as_raw(), iw, w, h));
}
Ok(frames.iter().map(|f| by_frame[f].clone()).collect())
})();
let _ = std::fs::remove_dir_all(&tmp);
read
}
/// The frame a check reads for each sample taken every `every` seconds from 0: the last frame before the sample's
/// middle, as ffmpeg's fps filter picks it (and raea-app-check-read's readers), held to the picture's `last` frame
pub fn sampled(samples: usize, every: f64, fps: f64, last: i64) -> Vec<i64> {
(0..samples).map(|k| (((k as f64 + 0.5) * every * fps).ceil() as i64 - 1).clamp(0, last.max(0))).collect()
}
/// A sampled measure of the export against the same measure of the unencoded frames.
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Against {
/// samples over the rule's line that the export made worse by more than its noise
pub worse: usize,
/// samples over the line before encoding: the picture's own
pub before: usize,
/// samples compared
pub of: usize,
/// the mean of the export's measure less the unencoded one's
pub added: f64,
}
impl Against {
/// Whether the export added to it, beyond what a clean encode moves: at least three samples (and a tenth) worse,
/// and more than half the noise on average
pub fn by_encode(&self, noise: f64) -> bool {
self.worse >= 3usize.max(self.of / 10) && self.added > noise / 2.0
}
/// The first sample the export made worse
pub fn first(out: &[Option<f64>], before: &[Option<f64>], line: f64, noise: f64) -> Option<usize> {
out.iter().zip(before).position(|(o, b)| o.unwrap_or(0.0) > line && o.unwrap_or(0.0) - b.unwrap_or(0.0) > noise)
}
}
/// Per sample, the export's measure against the unencoded frames' (None: nothing to measure, read as 0), over a
/// rule's `line`, where a clean encode moves it at most `noise`
pub fn against(out: &[Option<f64>], before: &[Option<f64>], line: f64, noise: f64) -> Against {
let n = out.len().min(before.len());
let at = |s: &[Option<f64>], i: usize| s[i].unwrap_or(0.0);
let worse = (0..n).filter(|&i| at(out, i) > line && at(out, i) - at(before, i) > noise).count();
let was = (0..n).filter(|&i| at(before, i) > line).count();
let added = (0..n).map(|i| at(out, i) - at(before, i)).sum::<f64>() / n.max(1) as f64;
Against { worse, before: was, of: n, added }
}
/// The newest check, in the project's record, of an earlier export of the composition `video` was rendered from
pub fn earlier(video: &Path) -> Option<record::Entry> {
let project = record::up(video, ".raea/project")?;
let me = record::rel(&project, video);
let entries = record::read(&project);
let made = entries.iter().rposition(|e| rendered(e, &me))?;
// the composition's exports rendered before this one; a versioned copy (NAME-v2.tsx) is the same piece
let stem = |of: &str| piece(&Path::new(of).file_stem().map(|s| s.to_string_lossy().to_string()).unwrap_or_default());
let comp = stem(&entries[made].of);
let exports: Vec<String> = entries[..made].iter().filter(|e| e.by == "raea render" && e.kind == "video" && stem(&e.of) == comp).filter_map(|e| e.out.clone()).filter(|o| *o != me).collect();
entries.into_iter().rev().find(|e| e.by == "raea check" && exports.contains(&e.of))
}
/// A composition's name without its version: walkaround-v2 is walkaround
pub fn piece(stem: &str) -> String {
match stem.rfind("-v") {
Some(i) if i + 2 < stem.len() && stem[i + 2..].bytes().all(|b| b.is_ascii_digit()) => stem[..i].to_string(),
_ => stem.to_string(),
}
}
/// The same finding in another export: the same rule, about the same thing, at the same moment (within a second; a
/// finding about the whole piece matches one about the whole piece). Its words may differ ("worst 13%", "worst 15%").
pub fn alike(a: &Finding, b: &Finding, fps: f64) -> bool {
let about = |f: &Finding| f.about.iter().map(|a| a.key.clone().unwrap_or_else(|| a.name.clone())).collect::<Vec<_>>();
a.check == b.check && about(a) == about(b) && match (a.frames, b.frames) {
(Some([x, _]), Some([y, _])) => ((x - y).abs() as f64) <= fps.max(1.0),
(None, None) => true,
_ => false,
}
}
/// Each finding an earlier check had at the same moment says so, and that its fix hasn't moved it: rank and words
/// otherwise as measured
pub fn carried(now: &mut [Finding], before: &record::Entry, fps: f64) {
for f in now.iter_mut() {
if before.findings.iter().any(|b| alike(b, f, fps)) {
f.says.push_str(&format!(" [also in {} ({}): what changed between them didn't move it]", before.of, before.id));
}
}
}
#[cfg(test)]
mod tests;
+107
View File
@@ -0,0 +1,107 @@
use super::*;
use raea_core_facts::Level;
// The 28 samples `raea check` takes of the 11-16 Telluride walkaround (55.8 s, 24 fps, phone footage), as its
// blotching measures them: rendered to PNG with no encoding (BEFORE), those PNGs through x264 crf 12, and raea's own
// exports at --quality high and master. Blotching's line is 0.009; x264 moved a sample at most 0.005.
const BEFORE: [Option<f64>; 28] = [Some(0.0), None, Some(0.052), Some(0.062), None, Some(0.062), None, None, Some(0.076), Some(0.009), Some(0.03), Some(0.039), Some(0.068), None, None, None, None, Some(0.077), Some(0.062), None, None, Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0)];
const X264: [Option<f64>; 28] = [Some(0.0), None, Some(0.052), Some(0.062), None, Some(0.059), None, None, Some(0.078), Some(0.008), Some(0.028), Some(0.034), Some(0.071), None, None, None, None, Some(0.078), Some(0.062), None, Some(0.039), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0)];
const HIGH: [Option<f64>; 28] = [Some(0.0), None, Some(0.042), Some(0.024), Some(0.052), Some(0.064), Some(0.05), None, Some(0.126), Some(0.063), Some(0.061), Some(0.122), Some(0.088), Some(0.04), Some(0.029), Some(0.047), Some(0.044), Some(0.096), Some(0.09), None, Some(0.029), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0)];
const MASTER: [Option<f64>; 28] = [Some(0.0), None, Some(0.026), Some(0.002), None, Some(0.03), None, None, Some(0.022), None, None, None, None, None, None, None, None, Some(0.071), Some(0.053), None, None, Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0), Some(0.0)];
const LINE: f64 = 0.009;
const NOISE: f64 = 0.005;
/// What the picture already held is told from what the encode added: a clean encode and raea's master add nothing,
/// its high adds to 14 of 28 samples, and 9 samples hold the footage's own either way
#[test]
fn the_picture_s_own_is_told_from_the_encode_s() {
let clean = against(&X264, &BEFORE, LINE, NOISE);
assert!(!clean.by_encode(NOISE), "{clean:?}");
assert!(clean.added.abs() < 0.002, "{clean:?}");
let high = against(&HIGH, &BEFORE, LINE, NOISE);
assert!(high.by_encode(NOISE), "{high:?}");
assert_eq!((high.worse, high.before, high.of), (14, 9, 28));
assert_eq!(Against::first(&HIGH, &BEFORE, LINE, NOISE), Some(4));
let master = against(&MASTER, &BEFORE, LINE, NOISE);
assert!(!master.by_encode(NOISE), "{master:?}");
assert_eq!(master.worse, 0);
// a small, even addition over a clean picture still counts (VideoToolbox over a dark render, 10-25)
assert!(against(&[Some(0.013); 16], &[Some(0.003); 16], LINE, NOISE).by_encode(NOISE));
}
/// The frame read for each sample is the last before its middle, as the fps filter picks it
#[test]
fn the_sampled_frames_are_the_check_s() {
assert_eq!(sampled(3, 2.0, 24.0, 1338), vec![23, 71, 119]);
assert_eq!(sampled(2, 2.0, 30.0, 1000), vec![29, 89]);
assert_eq!(sampled(2, 2.0, 30000.0 / 1001.0, 1000), vec![29, 89]);
assert_eq!(sampled(2, 2.0, 24.0, 50), vec![23, 50]);
}
/// Luma as the check reads raea's export: BT.709 weights, full range, cropped to the top-left
#[test]
fn luma_is_bt709_cropped() {
let px = |r: u8, g: u8, b: u8| [r, g, b, 255];
let rgba: Vec<u8> = [px(255, 255, 255), px(0, 0, 0), px(255, 0, 0), px(0, 255, 0)].concat();
assert_eq!(luma(&rgba, 2, 2, 2), vec![255, 0, 54, 182]);
assert_eq!(luma(&rgba, 2, 1, 2), vec![255, 54]);
}
fn finding(check: &str, frame: Option<i64>, says: &str) -> Finding {
let f = Finding::new(check, Level::Error, says, "raea check");
match frame {
Some(n) => f.frames(n, n + 1),
None => f,
}
}
/// A finding is carried when the same rule finds the same thing at the same moment, whatever its numbers say
#[test]
fn a_carried_finding_is_the_same_rule_at_the_same_moment() {
let fps = 24.0;
assert!(alike(&finding("blotching", Some(96), "worst 13%"), &finding("blotching", Some(96), "worst 15%"), fps));
assert!(alike(&finding("clipping", Some(624), "9 runs"), &finding("clipping", Some(640), "6 runs"), fps));
assert!(!alike(&finding("clipping", Some(624), "9 runs"), &finding("clipping", Some(1104), "11 runs"), fps));
assert!(!alike(&finding("clipping", Some(624), "x"), &finding("dropout", Some(624), "x"), fps));
assert!(alike(&finding("brand", None, "a"), &finding("brand", None, "b"), fps));
assert_eq!(piece("walkaround-v2"), "walkaround");
assert_eq!(piece("edit-video"), "edit-video");
assert_eq!(piece("telluride-v12"), "telluride");
}
/// A project whose record holds two renders of one composition and a check of the first: the second's check finds
/// that one, its blotching carried and its clipping new; a take under assets/ is a source, an export isn't
#[test]
fn the_earlier_check_is_of_the_composition_s_other_export() {
let dir = std::env::temp_dir().join(format!("raea-cause-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
for d in [".raea/record", "out", "assets/footage", "compositions"] {
std::fs::create_dir_all(dir.join(d)).unwrap();
}
std::fs::write(dir.join(".raea/project"), "[project]\n\tid = pj_test\n").unwrap();
for f in ["out/a-v1.mp4", "out/a-v2.mp4", "assets/footage/take.mov", "compositions/a.tsx", "compositions/a-v2.tsx"] {
std::fs::write(dir.join(f), b"").unwrap();
}
let entry = |id: &str, by: &str, of: &str, out: Option<&str>, kind: &str, findings: Vec<Finding>| record::Entry { id: id.into(), at: 0, by: by.into(), of: of.into(), out: out.map(Into::into), kind: kind.into(), commit: None, findings, despite: vec![] };
let entries = [
entry("20261116-170223-a", "raea render", "compositions/a.tsx", Some("out/a-v1.mp4"), "video", vec![]),
entry("20261116-170252-a-v1", "raea check", "out/a-v1.mp4", None, "check", vec![finding("blotching", Some(96), "worst 13%")]),
entry("20261116-171601-a-v2", "raea render", "compositions/a-v2.tsx", Some("out/a-v2.mp4"), "video", vec![]),
];
for e in &entries {
std::fs::write(dir.join(format!(".raea/record/{}.json", e.id)), serde_json::to_vec(e).unwrap()).unwrap();
}
let v2 = dir.join("out/a-v2.mp4");
assert_eq!(composition_of(&v2).map(|(_, c)| c.ends_with("compositions/a-v2.tsx")), Some(true));
let before = earlier(&v2).expect("the check of a-v1");
assert_eq!(before.of, "out/a-v1.mp4");
let mut now = vec![finding("blotching", Some(96), "worst 15%"), finding("clipping", Some(624), "9 runs")];
carried(&mut now, &before, 24.0);
assert!(now[0].says.contains("also in out/a-v1.mp4 (20261116-170252-a-v1)"), "{}", now[0].says);
assert_eq!(now[1].says, "9 runs");
// nothing was rendered before a-v1, so its check has no earlier one, even with a-v2's check in the record
assert!(earlier(&dir.join("out/a-v1.mp4")).is_none());
assert!(is_source(&dir.join("assets/footage/take.mov")));
assert!(!is_source(&v2));
let _ = std::fs::remove_dir_all(&dir);
}
+6
View File
@@ -11,5 +11,11 @@ serde_json = "1"
raea-io-home = { path = "../../../io/home" }
raea-io-media = { path = "../../../io/media", default-features = false }
raea-app-media = { path = "../../media" }
# ffmpeg's flag for every decoded frame, by its version (the one read's flashing frames)
raea-io-ffmpeg = { path = "../../../io/ffmpeg" }
# caption contrast, as `raea world` measures it (DR2)
raea-sys-measure = { path = "../../../systems/measure" }
[target.'cfg(unix)'.dependencies]
# the one read's named pipes
libc = "0.2"
+35 -4
View File
@@ -3,12 +3,14 @@
//! loudness` do, with nothing to install. 0.1.7 refused any video without FFmpeg, which Windows never has (Shane 11-18:
//! "can we make it so ffmpeg does work the way we need it?"). RAEA_CHECK_NATIVE=1 reads natively with FFmpeg there too;
//! tests/parity.rs holds the two to the same answers. Each reader names the FFmpeg command it stands in for.
pub mod once;
pub use once::{log_level, showinfo_base, showinfo_frame};
use raea_io_media::VideoDecoder;
use serde_json::Value;
use std::path::Path;
use std::process::Command;
type R<T> = Result<T, String>;
pub type R<T> = Result<T, String>;
/// Whether to read natively: FFmpeg's ffmpeg or ffprobe isn't on the PATH, or RAEA_CHECK_NATIVE is on
pub fn native() -> bool {
@@ -41,6 +43,8 @@ pub struct Probe {
/// past the picture, and the container's duration counts that
pub picture: f64,
pub audio: bool,
/// the picture's frames a second (0 when it doesn't say)
pub fps: f64,
}
/// The picture's size, the file's duration, where the picture ends and whether there's sound: ffprobe's stream and
@@ -50,7 +54,7 @@ pub fn probe(video: &str) -> R<Probe> {
let p = raea_app_media::probe_of(Path::new(video))?;
let v = p.video.as_ref().ok_or("no video stream")?;
let picture = p.track.as_ref().map_or(v.duration, |t| t.duration);
return Ok(Probe { w: v.width as f64, h: v.height as f64, duration: p.duration.max(picture), picture, audio: p.audio.is_some() });
return Ok(Probe { w: v.width as f64, h: v.height as f64, duration: p.duration.max(picture), picture, audio: p.audio.is_some(), fps: v.fps });
}
let entries = "stream=codec_type,width,height,r_frame_rate,duration,start_time:format=duration,start_time";
let out = Command::new("ffprobe").args(["-v", "error", "-show_entries", entries, "-of", "json", video]).output().map_err(|e| format!("ffprobe: {e}"))?;
@@ -65,7 +69,11 @@ pub fn probe(video: &str) -> R<Probe> {
None => last_packet_end(video).map_or(duration, |end| end - origin),
};
let audio = streams.iter().any(|s| s["codec_type"] == "audio");
Ok(Probe { w: vid["width"].as_f64().unwrap_or(1920.0), h: vid["height"].as_f64().unwrap_or(1080.0), duration, picture, audio })
let fps = vid["r_frame_rate"].as_str().and_then(|r| {
let (n, d) = r.split_once('/').unwrap_or((r, "1"));
Some(n.parse::<f64>().ok()? / d.parse::<f64>().ok().filter(|d| *d > 0.0)?)
});
Ok(Probe { w: vid["width"].as_f64().unwrap_or(1920.0), h: vid["height"].as_f64().unwrap_or(1080.0), duration, picture, audio, fps: fps.unwrap_or(0.0) })
}
/// Where the picture's last packet ends, for a container that doesn't state the video stream's own length (Matroska)
@@ -146,7 +154,30 @@ pub fn flash_frames(video: &str, w: usize, h: usize, mut each: impl FnMut(f64, &
/// `ffmpeg -i V -vn -ac 1 -ar RATE -f f32le -` (sound.rs sound): the sound folded to mono at `rate`
pub fn mono(video: &str, rate: u32) -> R<Vec<f32>> {
Ok(raea_app_media::audio_folded(Path::new(video), rate, true, None, None, false)?.channels.swap_remove(0))
if native() {
return Ok(raea_app_media::audio_folded(Path::new(video), rate, true, None, None, false)?.channels.swap_remove(0));
}
ffmpeg_f32(video, 1, rate)
}
/// `ffmpeg -i V -vn -ac N -ar R -f f32le -`: the sound as N interleaved channels of floats
fn ffmpeg_f32(video: &str, channels: u32, rate: u32) -> R<Vec<f32>> {
let out = Command::new("ffmpeg").args(["-v", "error", "-i", video, "-vn", "-ac", &channels.to_string(), "-ar", &rate.to_string(), "-f", "f32le", "-"]).output().map_err(|e| format!("ffmpeg: {e}"))?;
if !out.status.success() {
return Err(format!("ffmpeg couldn't read the sound of {video}: {}", String::from_utf8_lossy(&out.stderr).trim()));
}
Ok(out.stdout.chunks_exact(4).map(|b| f32::from_le_bytes([b[0], b[1], b[2], b[3]])).collect())
}
/// `ffmpeg -i V -vn -ac 2 -ar R -f f32le -` (defects.rs clipping): each channel at its own level. Clipping is a
/// channel's: on the mono fold (L + R) * 0.707 a centred voice reads 3 dB hotter than either side, and a master at
/// -1.6 dBTP read as full scale (11-19, the walkaround's flat tops).
pub fn channels(video: &str, rate: u32) -> R<Vec<Vec<f32>>> {
if native() {
return Ok(raea_app_media::audio_folded(Path::new(video), rate, false, None, None, false)?.channels);
}
let x = ffmpeg_f32(video, 2, rate)?;
Ok(vec![x.iter().step_by(2).copied().collect(), x.iter().skip(1).step_by(2).copied().collect()])
}
/// `ffmpeg -i V -vn -af ebur128=metadata=1,ametadata=print:key=lavfi.r128.M:file=- -f null -` (sound.rs sound): the
+205
View File
@@ -0,0 +1,205 @@
//! The picture read once for four of raea check's rules (11-19: flashing, freezes, flash frames and blotching each
//! decoded the whole file, 3.7 s apiece on a 56 s export, and decoding is the machine's whole CPU, so reading them at
//! the same time saved nothing). One FFmpeg decodes it and splits the frames into the four filter chains the rules
//! were tuned on, each to its own output with its own options as when it ran alone, so each rule reads the same bytes:
//!
//! - the flashing screen's area- and point-sampled frames (showinfo, rgb24, passthrough) to stdout, their times on stderr;
//! - freezedetect into a null output, its findings on stderr;
//! - each frame's 32x18 grey (the flash-frame rule) to a named pipe;
//! - every 2 s the grey crop blotching scores, to another.
//!
//! Unix only (named pipes); elsewhere, and where FFmpeg isn't installed, the rules read on their own as before.
#[cfg(unix)]
use std::io::{BufRead, Read};
#[cfg(unix)]
use std::path::Path;
#[cfg(unix)]
use std::process::{Command, Stdio};
use crate::R;
/// What the one read gave the rules beside the frames it handed on
pub struct Once {
/// the flashing screen's frames read, and whether one came without its time (the read was stopped)
pub frames: usize,
pub lost: bool,
/// FFmpeg ran to its end
pub ok: bool,
/// errors decoding the picture, and the first of them
pub errors: usize,
pub first: String,
/// freezedetect's lines
pub freezes: String,
/// each frame's mean brightness, 0 to 1 (defects.rs lumas)
pub lumas: Vec<f32>,
}
/// A frame's number and time from showinfo's log, exact: its `pts` in ticks of the time base. `pts_time` is rounded to six
/// significant digits, which is enough to push a legal third flash across the one-second line.
pub fn showinfo_frame(line: &str, base: Option<(i64, i64)>) -> Option<(usize, f64)> {
let rest = line.split(" n:").nth(1)?;
let n = rest.split_whitespace().next()?.parse().ok()?;
let pts: i64 = rest.split("pts:").nth(1)?.split_whitespace().next()?.parse().ok()?;
let (num, den) = base?;
Some((n, pts as f64 * num as f64 / den as f64))
}
pub fn showinfo_base(line: &str) -> Option<(i64, i64)> {
let (num, den) = line.split("config in time_base:").nth(1)?.split(',').next()?.trim().split_once('/')?;
Some((num.parse().ok()?, den.parse().ok()?))
}
/// A line's severity under `-loglevel level+`: the first bracket after any `[context @ address]`. Searching the whole line
/// would take a file's own metadata for an error when its title happens to say one.
pub fn log_level(line: &str) -> Option<&str> {
let mut rest = line.trim_start();
if rest.starts_with('[') && rest[..rest.find(']')?].contains(" @ ") {
rest = rest[rest.find(']')? + 1..].trim_start();
}
let rest = rest.strip_prefix('[')?;
Some(&rest[..rest.find(']')?])
}
/// Each 32x18 grey frame's mean brightness, 0 to 1 (`scale=32:18:flags=area,format=gray`, defects.rs lumas)
pub fn lumas_of(grey: &[u8]) -> Vec<f32> {
let mut out = Vec::with_capacity(grey.len() / (32 * 18));
for f in grey.as_chunks::<{ 32 * 18 }>().0 {
let mut sum = 0f32;
for &p in f {
sum += p as f32;
}
out.push(sum / (32.0 * 18.0 * 255.0));
}
out
}
/// Whether the four rules can read in one: FFmpeg is the reader, and the system has named pipes
pub fn can() -> bool {
cfg!(unix) && !crate::native()
}
/// The one read: the flashing screen's frames (`flash`, w x h each side) to `screen` with their times, the grey crop
/// (`crop`, w x h; None when blotching doesn't read) every 2 s to `crops`, freezedetect at `still` seconds
#[cfg(not(unix))]
pub fn picture(_: &str, _: (usize, usize), _: Option<(usize, usize)>, _: f64, _: impl FnMut(f64, &[u8]) + Send, _: impl FnMut(&[u8]) + Send) -> R<Once> {
Err("one read needs named pipes".into())
}
#[cfg(unix)]
pub fn picture(video: &str, flash: (usize, usize), crop: Option<(usize, usize)>, still: f64, mut screen: impl FnMut(f64, &[u8]) + Send, mut crops: impl FnMut(&[u8]) + Send) -> R<Once> {
let dir = std::env::temp_dir().join(format!("raea-once-{}-{}", std::process::id(), std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map_or(0, |d| d.as_nanos())));
std::fs::create_dir_all(&dir).map_err(|e| format!("{}: {e}", dir.display()))?;
let (lumas_at, crops_at) = (dir.join("lumas"), dir.join("crops"));
let read = (|| {
fifo(&lumas_at)?;
if crop.is_some() {
fifo(&crops_at)?;
}
let (w, h) = flash;
let mut graph = format!(
"[0:v:0]split={}[f][z][l]{};[f]showinfo,split=2[area][point];[area]scale={w}:{h}:flags=area[a];[point]scale={w}:{h}:flags=neighbor[p];[a][p]hstack=inputs=2,format=rgb24[fo];[z]freezedetect=n=-60dB:d={still}[zo];[l]scale=32:18:flags=area,format=gray[lo]",
if crop.is_some() { 4 } else { 3 },
if crop.is_some() { "[b]" } else { "" }
);
if let Some((cw, ch)) = crop {
graph.push_str(&format!(";[b]fps=0.5,crop={cw}:{ch}:0:0,format=gray[bo]"));
}
let sync = raea_io_ffmpeg::passthrough();
let mut args: Vec<String> = ["-hide_banner", "-nostats", "-nostdin", "-y", "-loglevel", "level+info", "-i", video, "-filter_complex", &graph].map(String::from).to_vec();
args.extend(["-map", "[fo]", sync[0], sync[1], "-f", "rawvideo", "pipe:1", "-map", "[zo]", "-f", "null", "-", "-map", "[lo]", "-f", "rawvideo"].map(String::from));
args.push(lumas_at.display().to_string());
if crop.is_some() {
args.extend(["-map", "[bo]", "-f", "rawvideo"].map(String::from));
args.push(crops_at.display().to_string());
}
let mut child = Command::new("ffmpeg").args(&args).stdin(Stdio::null()).stdout(Stdio::piped()).stderr(Stdio::piped()).spawn().map_err(|e| format!("ffmpeg: {e}"))?;
let (mut out, err) = (child.stdout.take().unwrap(), child.stderr.take().unwrap());
let (times, clock) = std::sync::mpsc::channel();
std::thread::scope(|s| {
// each output read apart from the others, so that none can fill while another is being waited on
let log = s.spawn(move || {
let (mut err, mut line) = (std::io::BufReader::new(err), Vec::new());
let (mut base, mut errors, mut first, mut freezes) = (None, 0usize, String::new(), String::new());
while err.read_until(b'\n', &mut line).is_ok_and(|n| n > 0) {
let text = String::from_utf8_lossy(&line);
if matches!(log_level(&text), Some("error" | "fatal" | "panic")) {
errors += 1;
if first.is_empty() {
first = text.trim().to_string();
}
} else if text.trim_start().starts_with("[Parsed_showinfo") {
base = showinfo_base(&text).or(base);
if let Some(frame) = showinfo_frame(&text, base) {
let _ = times.send(frame);
}
} else if text.contains("freezedetect") {
freezes.push_str(&text);
}
line.clear();
}
(errors, first, freezes)
});
let lumas = s.spawn(|| {
let mut b = Vec::new();
let _ = std::fs::File::open(&lumas_at).and_then(|mut f| f.read_to_end(&mut b));
lumas_of(&b)
});
let crop_reader = crop.map(|(cw, ch)| {
let at = &crops_at;
let crops = &mut crops;
s.spawn(move || {
if let Ok(mut f) = std::fs::File::open(at) {
let mut buf = vec![0u8; cw * ch];
while f.read_exact(&mut buf).is_ok() {
crops(&buf);
}
}
})
});
let mut buf = vec![0u8; w * 2 * h * 3];
let (mut frames, mut lost) = (0usize, false);
while out.read_exact(&mut buf).is_ok() {
// the frame's own line is written before its pixels, so one that doesn't come isn't going to
match clock.recv_timeout(std::time::Duration::from_secs(60)) {
Ok((n, t)) if n == frames => screen(t, &buf),
_ => {
lost = true;
let _ = child.kill();
break;
}
}
frames += 1;
}
drop(out);
let ok = child.wait().is_ok_and(|s| s.success());
// a pipe FFmpeg never opened (it stopped first) would hold its reader in open(): opening it to write lets go
for p in [&lumas_at, &crops_at] {
let _ = unblock(p);
}
let (errors, first, freezes) = log.join().unwrap_or_default();
let lumas = lumas.join().unwrap_or_default();
if let Some(c) = crop_reader {
let _ = c.join();
}
Ok(Once { frames, lost, ok, errors, first, freezes, lumas })
})
})();
let _ = std::fs::remove_dir_all(&dir);
read
}
#[cfg(unix)]
fn fifo(p: &Path) -> R<()> {
let c = std::ffi::CString::new(p.as_os_str().as_encoded_bytes()).map_err(|e| e.to_string())?;
// SAFETY: a NUL-terminated path, and mkfifo reads nothing else
if unsafe { libc::mkfifo(c.as_ptr(), 0o600) } != 0 {
return Err(format!("{}: {}", p.display(), std::io::Error::last_os_error()));
}
Ok(())
}
#[cfg(unix)]
fn unblock(p: &Path) -> std::io::Result<()> {
use std::os::unix::fs::OpenOptionsExt;
std::fs::OpenOptions::new().write(true).custom_flags(libc::O_NONBLOCK).open(p).map(drop)
}
+39
View File
@@ -124,3 +124,42 @@ fn the_native_reads_match_ffmpeg_s() {
}
assert!(off.0.iter().all(|(_, by, most)| by < most), "a native read is further from FFmpeg's than a rule allows");
}
/// The one read (once.rs) against the four reads it stands in for, each run alone as raea check ran it: each rule gets
/// the same bytes, frames and log lines. Away from Unix the rules read alone (no named pipes), and this is skipped.
#[test]
fn one_read_gives_each_rule_what_its_own_read_gave() {
if !raea_app_check_read::once::can() {
eprintln!("skipped: the rules read alone here");
return;
}
let dir = std::env::temp_dir().join(format!("raea-once-test-{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let file = dir.join("clip.mp4").to_string_lossy().into_owned();
ffmpeg(&["-y", "-f", "lavfi", "-i", "testsrc2=size=320x180:rate=30:duration=5,tpad=stop_mode=clone:stop_duration=4", "-c:v", "libx264", "-pix_fmt", "yuv420p", &file]);
let (w, h, cw, ch) = (192usize, 108usize, 320usize, 176usize);
let (mut frames, mut crops) = (Vec::new(), Vec::new());
let once = raea_app_check_read::once::picture(&file, (w, h), Some((cw, ch)), 3.0, |t, b| frames.push((t, b.to_vec())), |b| crops.extend_from_slice(b)).unwrap();
assert!(once.ok && !once.lost && once.errors == 0);
// the flashing screen's frames, as flash.rs read them alone
let sync = raea_io_ffmpeg::passthrough();
let graph = format!("showinfo,split=2[area][point];[area]scale={w}:{h}:flags=area[a];[point]scale={w}:{h}:flags=neighbor[b];[a][b]hstack=inputs=2,format=rgb24");
let (alone, log) = ffmpeg(&["-loglevel", "level+info", "-i", &file, "-map", "0:v:0", "-vf", &graph, sync[0], sync[1], "-f", "rawvideo", "-"]);
assert_eq!(frames.len(), alone.len() / (w * 2 * h * 3));
assert_eq!(frames.iter().flat_map(|f| f.1.iter().copied()).collect::<Vec<u8>>(), alone);
let base = log.lines().find_map(raea_app_check_read::showinfo_base);
let times: Vec<f64> = log.lines().filter(|l| l.trim_start().starts_with("[Parsed_showinfo")).filter_map(|l| raea_app_check_read::showinfo_frame(l, base)).map(|f| f.1).collect();
assert_eq!(frames.iter().map(|f| f.0).collect::<Vec<f64>>(), times);
// each frame's brightness, as defects.rs read it
let (grey, _) = ffmpeg(&["-v", "error", "-i", &file, "-map", "0:v:0", "-vf", "scale=32:18:flags=area,format=gray", "-f", "rawvideo", "-"]);
assert_eq!(once.lumas, raea_app_check_read::once::lumas_of(&grey));
// blotching's crops, as picture.rs read them
let (alone, _) = ffmpeg(&["-v", "error", "-i", &file, "-vf", &format!("fps=0.5,crop={cw}:{ch}:0:0,format=gray"), "-f", "rawvideo", "-"]);
assert_eq!(crops, alone);
// and freezedetect's freeze, as sound.rs read it
let (_, log) = ffmpeg(&["-i", &file, "-an", "-vf", "freezedetect=n=-60dB:d=3", "-f", "null", "-"]);
let starts = |s: &str| s.lines().filter_map(|l| l.split("freeze_start: ").nth(1).map(|x| x.trim().to_string())).collect::<Vec<_>>();
assert_eq!(starts(&once.freezes), starts(&log));
assert!(!starts(&log).is_empty());
let _ = std::fs::remove_dir_all(&dir);
}
+27 -11
View File
@@ -11,8 +11,12 @@ pub(crate) const FULL: f32 = 0.999;
pub(crate) const FLAT_LEVEL: f32 = 0.05;
pub(crate) const CLIP_RUNS: usize = 3;
pub(crate) fn clipped(x: &[f32]) -> Vec<(f64, String)> {
let mut per: Vec<usize> = vec![0; x.len() / SR + 1];
pub(crate) fn clipped(channels: &[Vec<f32>]) -> Vec<(f64, String)> {
let len = channels.iter().map(Vec::len).max().unwrap_or(0);
let mut per: Vec<usize> = vec![0; len / SR + 1];
// each channel's runs, a second's count the most any channel had: clipping is a channel's
for x in channels {
let mut own: Vec<usize> = vec![0; len / SR + 1];
let mut i = 0;
while i < x.len() {
let v = x[i];
@@ -22,18 +26,22 @@ pub(crate) fn clipped(x: &[f32]) -> Vec<(f64, String)> {
j += 1;
}
if j - i >= 3 {
per[i / SR] += 1;
own[i / SR] += 1;
}
} else if v.abs() >= FLAT_LEVEL {
while j < x.len() && x[j].to_bits() == v.to_bits() {
j += 1;
}
if j - i >= 4 {
per[i / SR] += 1;
own[i / SR] += 1;
}
}
i = j;
}
for (p, o) in per.iter_mut().zip(own) {
*p = (*p).max(o);
}
}
let mut out = Vec::new();
let mut s = 0;
while s < per.len() {
@@ -123,20 +131,28 @@ fn lumas(video: &str) -> R<(Vec<f32>, f64)> {
if !out.status.success() {
return Err(format!("ffmpeg couldn't read the picture of {video}: {}", String::from_utf8_lossy(&out.stderr).trim()));
}
let l = out.stdout.as_chunks::<{ 32 * 18 }>().0.iter().map(|f| f.iter().map(|&p| p as f32).sum::<f32>() / (32.0 * 18.0 * 255.0)).collect();
Ok((crate::read::once::lumas_of(&out.stdout), ffmpeg_rate(video)?))
}
/// The frame rate `ffmpeg -i` says
pub(crate) fn ffmpeg_rate(video: &str) -> R<f64> {
let rate = ffmpeg_stderr(&["-hide_banner", "-i", video])?;
let fps = rate.split(" fps").next().and_then(|s| s.rsplit(", ").next()).and_then(|s| s.trim().parse().ok()).unwrap_or(30.0);
Ok((l, fps))
Ok(rate.split(" fps").next().and_then(|s| s.rsplit(", ").next()).and_then(|s| s.trim().parse().ok()).unwrap_or(30.0))
}
pub(crate) fn flash_frame_rule(video: &str, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
let (l, fps) = lumas(video)?;
let found = flash_frames(&l, fps);
flash_frame_from(&l, fps, issues, passed);
Ok(())
}
/// The stray frames each frame's brightness shows
pub(crate) fn flash_frame_from(l: &[f32], fps: f64, issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let found = flash_frames(l, fps);
if found.is_empty() {
passed.push("flash-frame: no stray black or white frame".into());
}
issues.extend(moments("flash-frame", 1, found));
Ok(())
}
/// Each moment a rule found, as an issue of that priority
@@ -145,8 +161,8 @@ pub(crate) fn moments(rule: &'static str, p: u8, found: Vec<(f64, String)>) -> i
}
/// The sound's defects on the decoded mix (sound.rs decodes it once)
pub(crate) fn sound_defects(x: &[f32], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
for (rule, found, ok) in [("clipping", clipped(x), "clipping: no flat-topped runs"), ("dropout", dropouts(x), "dropout: the sound never drops to silence and back")] {
pub(crate) fn sound_defects(x: &[f32], channels: &[Vec<f32>], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
for (rule, found, ok) in [("clipping", clipped(channels), "clipping: no flat-topped runs"), ("dropout", dropouts(x), "dropout: the sound never drops to silence and back")] {
if found.is_empty() {
passed.push(ok.into());
}
+34 -23
View File
@@ -5,35 +5,46 @@ use raea_app_check_flash::FlashScreen;
/// the area sample and the point sample side by side
const FLASH_W: usize = 192;
/// A frame's number and time from showinfo's log, exact: its `pts` in ticks of the time base. `pts_time` is rounded to six
/// significant digits, which is enough to push a legal third flash across the one-second line.
pub(crate) fn showinfo_frame(line: &str, base: Option<(i64, i64)>) -> Option<(usize, f64)> {
let rest = line.split(" n:").nth(1)?;
let n = rest.split_whitespace().next()?.parse().ok()?;
let pts: i64 = rest.split("pts:").nth(1)?.split_whitespace().next()?.parse().ok()?;
let (num, den) = base?;
Some((n, pts as f64 * num as f64 / den as f64))
pub(crate) use crate::read::{log_level, showinfo_base, showinfo_frame};
/// The flashing screen's frame height for the picture's shape
fn flash_h(probe: &Probe) -> usize {
(((FLASH_W as f64 * probe.h / probe.w.max(1.0)) / 2.0).round() as usize * 2).max(6)
}
pub(crate) fn showinfo_base(line: &str) -> Option<(i64, i64)> {
let (num, den) = line.split("config in time_base:").nth(1)?.split(',').next()?.trim().split_once('/')?;
Some((num.parse().ok()?, den.parse().ok()?))
}
/// A line's severity under `-loglevel level+`: the first bracket after any `[context @ address]`. Searching the whole line
/// would take a file's own metadata for an error when its title happens to say one.
pub(crate) fn log_level(line: &str) -> Option<&str> {
let mut rest = line.trim_start();
if rest.starts_with('[') && rest[..rest.find(']')?].contains(" @ ") {
rest = rest[rest.find(']')? + 1..].trim_start();
/// Freezes, flashing, flash frames and blotching, in that order, from one read of the picture (raea-app-check-read
/// once.rs: one decode where there were four); each reads on its own where one read can't be had
pub(crate) fn picture_rules(video: &str, probe: &Probe, taste: Option<&Taste>, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
if !crate::read::once::can() {
freezes(video, probe, taste, issues, passed)?;
flashing(video, probe, issues, passed)?;
flash_frame_rule(video, issues, passed)?;
return blotching(video, probe, issues, passed);
}
let rest = rest.strip_prefix('[')?;
Some(&rest[..rest.find(']')?])
let (w, h) = (FLASH_W, flash_h(probe));
let kept = x264_kept(video);
let (cw, ch) = (probe.w as usize / 8 * 8, probe.h as usize / 8 * 8);
let mut screen = FlashScreen::new(w, h);
let mut scores = Vec::new();
let once = crate::read::once::picture(video, (w, h), kept.is_none().then_some((cw, ch)), taste.map_or(3.0, |t| t.value), |t, buf| screen.push(buf, t), scorer(&mut scores, cw, ch))?;
freezes_from(&once.freezes, probe, taste, issues, passed);
if once.lost {
return Err(format!("{video}: flashing can't be screened, frame {} has no timestamp of its own", once.frames));
}
if !once.ok || once.frames == 0 {
return Err(format!("{video}: flashing can't be screened, FFmpeg decoded {} frames ({})", once.frames, once.first));
}
screened(screen, once.errors, &once.first, issues, passed);
flash_frame_from(&once.lumas, ffmpeg_rate(video)?, issues, passed);
match kept {
Some(crf) => passed.push(format!("blotching: encoded by x264 at crf {crf}, which keeps the darks")),
None => blotching_from(video, probe, &scores, issues, passed),
}
Ok(())
}
pub(crate) fn flashing(video: &str, probe: &Probe, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
let w = FLASH_W;
let h = (((w as f64 * probe.h / probe.w.max(1.0)) / 2.0).round() as usize * 2).max(6);
let (w, h) = (FLASH_W, flash_h(probe));
if crate::read::native() {
let mut screen = FlashScreen::new(w, h);
if crate::read::flash_frames(video, w, h, |t, buf| screen.push(buf, t))? == 0 {
+20 -25
View File
@@ -22,8 +22,10 @@ mod flash;
use flash::*;
mod defects;
use defects::*;
mod text;
use text::*;
/// what a render's text breaks, from its manifest (split out: a render holds its own text to it)
use raea_app_check_text::*;
/// who can fix what it finds: the encode's or the picture's own, carried from an earlier export, a source
use raea_app_check_cause as cause;
/// a video read through FFmpeg, or raea's own decoders where it isn't installed
use raea_app_check_read::{self as read, Probe};
pub mod quick;
@@ -32,15 +34,6 @@ pub use raea_app_check_inbox as inbox;
#[cfg(test)]
mod tests;
type R<T> = Result<T, String>;
#[derive(Clone)]
struct Issue {
rule: &'static str,
p: u8,
at: Option<f64>,
says: String,
}
/// `raea check …` with the person's taste, none or more (taste.ts and the kinds beside it, which the raea CLI evaluates: it owns the engine):
/// its rules' checks hold the export to the person's own lines.
@@ -83,9 +76,10 @@ struct Taste {
line: String,
}
/// The checks among a person's taste rules (taste.ts and its kinds), each with the line it stands for.
/// The checks among a person's taste rules (taste.ts and its kinds) that a video alone shows (the six forms), each
/// with the line it stands for.
fn taste_rules(tastes: &[raea_core_brief::Taste]) -> Vec<Taste> {
tastes.iter().flat_map(|t| &t.sections).flat_map(|s| &s.rules).filter_map(|r| r.check.map(|c| Taste { form: c.form(), value: c.value(), line: r.text.clone() })).collect()
tastes.iter().flat_map(|t| t.checks()).map(|(line, c)| Taste { form: c.form(), value: c.value(), line: line.to_string() }).collect()
}
fn taste_of<'a>(rules: &'a [Taste], form: &str) -> Option<&'a Taste> {
@@ -159,14 +153,17 @@ fn measured(args: &[String], taste: Vec<Taste>) -> R<(String, Vec<Issue>, Vec<St
loudness(&video, taste_of(&taste, "loudness"), &mut issues, &mut passed)?;
sound(&video, words.as_deref(), &mut issues, &mut passed)?;
}
freezes(&video, &probe, taste_of(&taste, "still-max"), &mut issues, &mut passed)?;
flashing(&video, &probe, &mut issues, &mut passed)?;
flash_frame_rule(&video, &mut issues, &mut passed)?;
blotching(&video, &probe, &mut issues, &mut passed)?;
picture_rules(&video, &probe, taste_of(&taste, "still-max"), &mut issues, &mut passed)?;
brand_kit(&[flag(args, "--manifest").unwrap_or(""), video.as_str()], &mut issues, &mut passed);
if let Some(p) = flag(args, "--things") {
things(p, &mut issues, &mut passed)?;
}
// a take or a download isn't a delivery: the mix sets the delivery's level, so its own is said, not held to the target
if cause::is_source(std::path::Path::new(&video)) {
for i in issues.iter_mut().filter(|i| i.rule == "loudness") {
(i.p, i.says) = (3, format!("a source, not a delivery: {} (the mix sets the delivery's level)", i.says));
}
}
if let Some(manifest) = &manifest {
let runs = text_runs(manifest);
let (w, h) = (manifest["width"].as_f64().unwrap_or(probe.w), manifest["height"].as_f64().unwrap_or(probe.h));
@@ -204,19 +201,17 @@ fn things(p: &str, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
/// `fps`), with `more` (a render's own), worst first then by time.
fn findings_of(mut issues: Vec<Issue>, more: Vec<Finding>, fps: f64) -> Vec<Finding> {
issues.sort_by(|a, b| a.p.cmp(&b.p).then(a.at.unwrap_or(0.0).total_cmp(&b.at.unwrap_or(0.0))));
let mut found = Vec::new();
for i in &issues {
// an issue at a second is about the frame it falls on
let (f, fr) = (Finding::new(i.rule, Level::of_rank(i.p), &i.says, "raea check"), (i.at.unwrap_or(0.0) * fps).round() as i64);
found.push(if i.at.is_some() { f.frames(fr, fr + 1) } else { f });
}
finding::ranked(found.into_iter().chain(more).collect())
finding::ranked(issues.iter().map(|i| i.finding("raea check", fps)).chain(more).collect())
}
/// The findings (`findings_of`), written to -o as JSON when asked, and the report's text with the count last. True
/// when an error is among them.
fn report(video: &str, issues: Vec<Issue>, more: Vec<Finding>, passed: Vec<String>, out: Option<&str>, fps: f64) -> R<(String, bool)> {
let found = findings_of(issues, more, fps);
let mut found = findings_of(issues, more, fps);
// what an earlier export of the same composition already had says so: the change between them didn't move it
if let Some(e) = cause::earlier(std::path::Path::new(video)) {
cause::carried(&mut found, &e, fps);
}
let bad = found.iter().any(|f| f.level == Level::Error);
if let Some(out) = out {
let j = json!({"file": video, "fps": fps, "findings": found, "passed": passed});
+94 -27
View File
@@ -101,30 +101,41 @@ pub(crate) fn x264_crf(head: &[u8]) -> Option<f64> {
/// in its darks is the picture's own (8-bit glows and faint panels), which blotch_score can't always tell apart
pub(crate) const X264_KEEPS: f64 = 16.0;
pub(crate) fn blotching(video: &str, probe: &Probe, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
/// How far a clean encode moves a sample's blotching (x264 crf 12 over the walkaround's unencoded frames, 11-19: at most 0.005)
pub(crate) const BLOTCH_NOISE: f64 = 0.005;
/// Blotching's samples against the same frames of the composition drawn without encoding (raea-app-check-cause): None
/// when the video isn't a render in a raea project's record
fn blotching_cause(video: &str, probe: &Probe, scores: &[Option<f64>], w: usize, h: usize) -> Option<R<(cause::Against, Vec<Option<f64>>)>> {
let (project, comp) = cause::composition_of(std::path::Path::new(video))?;
Some((|| {
if probe.fps <= 0.0 {
return Err("the video doesn't say its frame rate".to_string());
}
let frames = cause::sampled(scores.len(), 2.0, probe.fps, (probe.picture * probe.fps).round() as i64 - 1);
let me = std::env::current_exe().map_err(|e| e.to_string())?;
let before: Vec<Option<f64>> = cause::unencoded(&me, &project, &comp, &frames, w, h)?.iter().map(|y| blotch_score(y, w, h)).collect();
Ok((cause::against(scores, &before, BLOTCHY, BLOTCH_NOISE), before))
})())
}
/// The crf an x264 encode that keeps the darks was made at: blotching isn't read for it
pub(crate) fn x264_kept(video: &str) -> Option<f64> {
let mut head = Vec::new();
if let Ok(f) = std::fs::File::open(video) {
let _ = std::io::Read::read_to_end(&mut std::io::Read::take(f, 8 << 20), &mut head);
}
if let Some(crf) = x264_crf(&head).filter(|c| *c <= X264_KEEPS) {
x264_crf(&head).filter(|c| *c <= X264_KEEPS)
}
pub(crate) fn blotching(video: &str, probe: &Probe, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
if let Some(crf) = x264_kept(video) {
passed.push(format!("blotching: encoded by x264 at crf {crf}, which keeps the darks"));
return Ok(());
}
let (w, h) = (probe.w as usize / 8 * 8, probe.h as usize / 8 * 8);
let (mut bad, mut seen, mut worst, mut t) = (Vec::new(), 0, 0f64, 0.0);
let mut frame = |buf: &[u8]| {
if let Some(s) = blotch_score(buf, w, h) {
seen += 1;
worst = worst.max(s);
if std::env::var_os("RAEA_CHECK_DEBUG").is_some() {
eprintln!("blotch {t:6.1}s {s:.3}");
}
if s > BLOTCHY {
bad.push((t, s));
}
}
t += 2.0;
};
let mut scores: Vec<Option<f64>> = Vec::new();
let mut frame = scorer(&mut scores, w, h);
if crate::read::native() {
crate::read::crops(video, w, h, &mut frame)?;
} else {
@@ -140,21 +151,77 @@ pub(crate) fn blotching(video: &str, probe: &Probe, issues: &mut Vec<Issue>, pas
}
let _ = child.wait();
}
drop(frame);
blotching_from(video, probe, &scores, issues, passed);
Ok(())
}
/// Each grey crop's blotching, kept in `scores`
pub(crate) fn scorer(scores: &mut Vec<Option<f64>>, w: usize, h: usize) -> impl FnMut(&[u8]) + Send + '_ {
move |buf| scores.push(blotch_score(buf, w, h))
}
/// What blotching's samples (one every 2 s) found
pub(crate) fn blotching_from(video: &str, probe: &Probe, scores: &[Option<f64>], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let (w, h) = (probe.w as usize / 8 * 8, probe.h as usize / 8 * 8);
let (mut bad, mut seen, mut worst) = (Vec::new(), 0, 0f64);
for (k, s) in scores.iter().enumerate() {
let Some(s) = *s else { continue };
let t = k as f64 * 2.0;
seen += 1;
worst = worst.max(s);
if raea_io_trace::stat("RAEA_CHECK_DEBUG") {
eprintln!("blotch {t:6.1}s {s:.3}");
}
if s > BLOTCHY {
bad.push((t, s));
}
}
if !bad.is_empty() {
let at = bad[0].0;
let share = bad.len() as f64 / seen.max(1) as f64;
issues.push(Issue {
rule: "blotching",
p: if share > 0.2 { 1 } else { 2 },
at: Some(at),
says: format!(
"blocky patches in dark areas in {} of {seen} sampled frames (worst {:.0}% of dark blocks stepping); the encoder starved the near-blacks: export as PNG frames and encode with more bits for darks",
bad.len(),
worst * 100.0
),
});
let found = format!("blocky patches in dark areas in {} of {seen} sampled frames (worst {:.0}% of dark blocks stepping)", bad.len(), worst * 100.0);
let (p, at, says) = match blotching_cause(video, probe, scores, w, h) {
// what the composition draws before any encoding is the picture's own (a phone's compression): no render
// setting removes it, so it's said, not worked on
Some(Ok(a)) if !a.0.by_encode(BLOTCH_NOISE) => (3, Some(at), format!("{found}: the picture's own, there as the composition draws them before any encoding (the footage's compression); the encode added none, so no render setting removes them")),
Some(Ok(a)) => {
let first = cause::Against::first(scores, &a.1, BLOTCHY, BLOTCH_NOISE).map(|i| i as f64 * 2.0);
let own = if a.0.before > 0 { format!("; {} of the samples show the footage's own too, which stays", a.0.before) } else { String::new() };
(if a.0.worse as f64 / a.0.of.max(1) as f64 > 0.2 { 1 } else { 2 }, first.or(Some(at)), format!("the encode added blocky patches in dark areas: {} of {} samples are blotchier than the composition draws them unencoded; render with --quality master, which gives the darks the bits they need{own}", a.0.worse, a.0.of))
}
Some(Err(why)) => (if share > 0.2 { 1 } else { 2 }, Some(at), format!("{found}; whether the encode made them or the picture holds them couldn't be told ({why}): render with --quality master if the encode starved the darks")),
None => (if share > 0.2 { 1 } else { 2 }, Some(at), format!("{found}: the encode starved the near-blacks, or the footage holds them; render with --quality master, and check a render made in a raea project to tell which")),
};
issues.push(Issue { rule: "blotching", p, at, says });
} else if seen > 0 {
passed.push(format!("blotching: dark areas clean in {seen} sampled frames"));
}
Ok(())
}
/// Caption contrast: at each text's middle frame, the pixels behind it against its colour, at least 3:1. The pixels
/// behind are the half of the box least like the text.
pub(crate) fn contrast(video: &str, runs: &[Run], w: f64, h: f64, probe: &Probe, issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let (sx, sy) = (probe.w / w, probe.h / h);
let mut low = 0;
let mut measured = 0;
for r in runs.iter().filter(|r| r.size >= 20.0).take(80) {
let [x, y, bw, bh] = r.box_;
let crop = [(x * sx).max(0.0) as u32, (y * sy).max(0.0) as u32, (bw * sx) as u32, (bh * sy) as u32];
if crop[0] + crop[2] > probe.w as u32 || crop[1] + crop[3] > probe.h as u32 {
continue;
}
let t = (r.from + r.to) / 2.0;
// the same measure `raea world` joins to a text from its render (raea-sys-measure, DR2)
let ratio = if crate::read::native() { crate::read::contrast(video, t, crop, &r.color) } else { raea_sys_measure::contrast(std::path::Path::new(video), t, crop, &r.color) };
let Some(ratio) = ratio else { continue };
measured += 1;
if ratio < 3.0 {
low += 1;
issues.push(Issue { rule: "contrast", p: 1, at: Some(t), says: format!("{} is {ratio:.1}:1 against what's behind it; make it at least 3:1 (a band, a shadow for separation, or another colour)", quote(&r.text)) });
}
}
if measured > 0 && low == 0 {
passed.push(format!("contrast: {measured} texts at 3:1 or better against their pixels"));
}
}
+10 -12
View File
@@ -162,17 +162,9 @@ pub(crate) fn bed_up(rms: &[f64], speak: &[bool]) -> Vec<(f64, String)> {
/// The sound's rules on an export: dead stops always; with the voice's words, a stretch with no voice over it and a bed
/// too close under it
pub(crate) fn sound(video: &str, words: Option<&[Word]>, issues: &mut Vec<Issue>, passed: &mut Vec<String>) -> R<()> {
let x = if crate::read::native() {
crate::read::mono(video, SR as u32)?
} else {
let out = Command::new("ffmpeg").args(["-v", "error", "-i", video, "-vn", "-ac", "1", "-ar", &SR.to_string(), "-f", "f32le", "-"]).output().map_err(|e| format!("ffmpeg: {e}"))?;
if !out.status.success() {
return Err(format!("ffmpeg couldn't read the sound of {video}: {}", String::from_utf8_lossy(&out.stderr).trim()));
}
out.stdout.chunks_exact(4).map(|b| f32::from_le_bytes([b[0], b[1], b[2], b[3]])).collect()
};
let x = crate::read::mono(video, SR as u32)?;
let (rms, bands) = levels(&x);
sound_defects(&x, issues, passed);
sound_defects(&x, &crate::read::channels(video, SR as u32)?, issues, passed);
let found = |list: Vec<(f64, String)>, p: u8| crate::defects::moments("sound", p, list);
let stops = dead_stops(&rms, &bands);
if stops.is_empty() {
@@ -273,7 +265,14 @@ pub(crate) fn freezes(video: &str, probe: &Probe, taste: Option<&Taste>, issues:
} else {
ffmpeg_stderr(&["-hide_banner", "-nostats", "-i", video, "-an", "-vf", &format!("freezedetect=n=-60dB:d={most}"), "-f", "null", "-"])?
};
let stretches = frozen_stretches(&err, probe.picture);
freezes_from(&err, probe, taste, issues, passed);
Ok(())
}
/// The freezes freezedetect's lines found (`taste`'s still-max when the person set one, else 3 s)
pub(crate) fn freezes_from(err: &str, probe: &Probe, taste: Option<&Taste>, issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let most = taste.map_or(3.0, |t| t.value);
let stretches = frozen_stretches(err, probe.picture);
for &(s, d) in &stretches {
let says = format!("nothing changes for {d:.1} s; give it a reason to hold, or cut it shorter");
issues.push(match taste {
@@ -284,5 +283,4 @@ pub(crate) fn freezes(video: &str, probe: &Probe, taste: Option<&Taste>, issues:
if stretches.is_empty() {
passed.push(format!("frozen: nothing holds still for {most} s"));
}
Ok(())
}
+12 -4
View File
@@ -356,15 +356,23 @@ fn a_card_sharing_one_word_with_another_line_isnt_held_to_it() {
fn clipping_is_found_and_a_loud_clean_tone_isnt() {
// a clean tone near full scale, then the same tone clamped (a limiter's flat tops), then pushed past full scale
let loud = tone(3.0, &[(0.0, 3.0, -1.0)]);
assert!(clipped(&loud).is_empty(), "{:?}", clipped(&loud));
let one = |x: &[f32]| clipped(&[x.to_vec()]);
assert!(one(&loud).is_empty(), "{:?}", one(&loud));
let clamped: Vec<f32> = loud.iter().map(|v| (v * 10.0).clamp(-0.3, 0.3)).collect();
assert_eq!(clipped(&clamped).len(), 1);
assert_eq!(one(&clamped).len(), 1);
let over: Vec<f32> = loud.iter().map(|v| (v * 2.0).clamp(-1.0, 1.0)).collect();
assert_eq!(clipped(&over).len(), 1);
assert_eq!(one(&over).len(), 1);
// one transient hitting full scale once isn't clipping
let mut once = tone(3.0, &[(0.0, 3.0, -20.0)]);
once[SR] = 1.0;
assert!(clipped(&once).is_empty());
assert!(one(&once).is_empty());
// clipping is a channel's: one side clipped is found; a centred voice at -1.6 dBFS a side is clean, though the mono
// fold (L + R) * 0.707 takes it past full scale (11-19: the walkaround's master read as clipping)
assert_eq!(clipped(&[loud.clone(), over.clone()]).len(), 1);
let centred: Vec<f32> = loud.iter().map(|v| v * 0.92).collect();
assert!(clipped(&[centred.clone(), centred.clone()]).is_empty());
let folded: Vec<f32> = centred.iter().map(|v| (v + v) * 0.7071).collect();
assert_eq!(one(&folded).len(), 1);
}
#[test]
+13
View File
@@ -0,0 +1,13 @@
[package]
name = "raea-app-check-text"
version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
publish = false
description = "raea check's text rules on a render's manifest: clipped, UI zones, reading time, face, cues, brand kit"
[dependencies]
dunce = "1"
serde_json = "1"
# a transcript's words, read as `raea world` reads them (docs/direction.feature DR1)
raea-core-facts = { path = "../../../core/facts" }
@@ -1,25 +1,56 @@
use super::*;
//! What a render's text breaks, from its manifest alone: clipped, in the platform's UI zones, too brief to read, over
//! the face, off its cue, and the brand kit it was styled from. raea check's text rules, split out of raea-app-check so
//! `raea render --manifest` holds its own text to them as it finishes, a check's round sooner.
use serde_json::Value;
pub type R<T> = Result<T, String>;
use raea_core_facts::{Finding, Level};
/// One thing a rule found: its rule, its rank (P0 breaks the piece to P3 polish), when (seconds) and what to do.
#[derive(Clone, Debug)]
pub struct Issue {
pub rule: &'static str,
pub p: u8,
pub at: Option<f64>,
pub says: String,
}
impl Issue {
/// As a Finding `by` a command (docs/direction.feature DR3: P0 and P1 errors, P2 a warn, P3 a note), about the
/// frame its second falls on at `fps`
pub fn finding(&self, by: &str, fps: f64) -> Finding {
let f = Finding::new(self.rule, Level::of_rank(self.p), &self.says, by);
match self.at {
Some(t) => {
let n = (t * fps).round() as i64;
f.frames(n, n + 1)
}
None => f,
}
}
}
/// A text as it stays on screen: from the frame it comes on to the frame it leaves. Typing (a text growing into the
/// next) and counting (only its digits changing) are one run, judged by its last text.
#[derive(Clone)]
pub(crate) struct Run {
pub(crate) text: String,
pub(crate) from: f64,
pub(crate) to: f64,
pub(crate) box_: [f64; 4],
pub struct Run {
pub text: String,
pub from: f64,
pub to: f64,
pub box_: [f64; 4],
/// where its letters are on every frame it shows its whole text (the manifest's `ink`, else its box: a centred line in
/// a full-width box is nowhere near x = 0, #89): a text the camera carries (a sign on a panning street) moves
/// through the frame's edges and zones, which only counts against it when no frame shows it clear
pub(crate) boxes: Vec<[f64; 4]>,
pub(crate) color: String,
pub(crate) size: f64,
pub boxes: Vec<[f64; 4]>,
pub color: String,
pub size: f64,
}
/// The brand kit the cut was styled from (brand/ at or above the manifest's or the video's folder, as render finds
/// brand.css): a kit `raea brand` read from a thin fetch that nobody corrected by hand is a placeholder, P1; a brand.css
/// with no brand.json beside it wasn't read from the brand at all, P2
pub(crate) fn brand_kit(near: &[&str], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
pub fn brand_kit(near: &[&str], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let mut seen = std::collections::HashSet::new();
for start in near.iter().filter(|p| !p.is_empty()) {
let abs = dunce::canonicalize(&std::path::Path::new(start)).unwrap_or_else(|_| std::path::PathBuf::from(start));
@@ -50,7 +81,7 @@ pub(crate) fn brand_kit(near: &[&str], issues: &mut Vec<Issue>, passed: &mut Vec
}
}
pub(crate) fn text_runs(manifest: &Value) -> Vec<Run> {
pub fn text_runs(manifest: &Value) -> Vec<Run> {
let fps = manifest["fps"].as_f64().unwrap_or(30.0);
let frames = manifest["frames"].as_array().cloned().unwrap_or_default();
let mut open: Vec<Run> = Vec::new();
@@ -95,11 +126,11 @@ pub(crate) fn text_runs(manifest: &Value) -> Vec<Run> {
}
/// The share of the face's area a text may cover before it's a fault (@raea/video's proofBoxes keeps the same 8%)
pub(crate) const FACE_COVER: f64 = 0.08;
pub const FACE_COVER: f64 = 0.08;
/// The face over time from a perception.json (`raea cut`: each clip's first frame, the face at its middle in the
/// edit's px): [from, to) in seconds and the face's box, for the stretches that have one
pub(crate) fn faces_of(perception: &Value, fps: f64) -> Vec<(f64, f64, [f64; 4])> {
pub fn faces_of(perception: &Value, fps: f64) -> Vec<(f64, f64, [f64; 4])> {
let mut keys: Vec<(f64, Option<[f64; 4]>)> = perception.as_object().into_iter().flatten().filter_map(|(k, v)| {
let face = v["face"].as_object().map(|f| ["x", "y", "w", "h"].map(|n| f.get(n).and_then(Value::as_f64).unwrap_or(0.0)));
Some((k.parse::<f64>().ok()? / fps, face))
@@ -110,7 +141,7 @@ pub(crate) fn faces_of(perception: &Value, fps: f64) -> Vec<(f64, f64, [f64; 4])
/// Text over the face: a run that covers more than FACE_COVER of the face's area while that face is up, on every frame
/// that shows it whole (a text the camera carries counts only when no frame shows it clear)
pub(crate) fn face_cover(runs: &[Run], faces: &[(f64, f64, [f64; 4])], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
pub fn face_cover(runs: &[Run], faces: &[(f64, f64, [f64; 4])], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let share = |b: &[f64; 4], f: &[f64; 4]| {
let ox = (b[0] + b[2]).min(f[0] + f[2]) - b[0].max(f[0]);
let oy = (b[1] + b[3]).min(f[1] + f[3]) - b[1].max(f[1]);
@@ -134,7 +165,7 @@ pub(crate) fn face_cover(runs: &[Run], faces: &[(f64, f64, [f64; 4])], issues: &
}
/// the zones where text can't go, as [top, right, bottom, left] at 1080 wide (sdk/guides/craft/floor.md)
pub(crate) fn zones(w: f64, h: f64, shape: Option<&str>, platform: Option<&str>) -> [f64; 4] {
pub fn zones(w: f64, h: f64, shape: Option<&str>, platform: Option<&str>) -> [f64; 4] {
let r = w / h;
let shape = shape.unwrap_or(if r < 0.7 { "9:16" } else if r < 0.9 { "4:5" } else if r < 1.2 { "1:1" } else { "16:9" });
let z = match (shape, platform) {
@@ -153,12 +184,12 @@ pub(crate) fn zones(w: f64, h: f64, shape: Option<&str>, platform: Option<&str>)
/// A caption the voice reads out: every word of the text is said while it's on screen (from a little before it comes
/// on). The viewer hears it as it shows, so it needs no reading time of its own (karaoke groups are up for as long as
/// they take to say).
pub(crate) fn spoken(r: &Run, words: &[Word]) -> bool {
pub fn spoken(r: &Run, words: &[Word]) -> bool {
let tokens: Vec<String> = r.text.split_whitespace().map(norm).filter(|t| !t.is_empty()).collect();
!tokens.is_empty() && tokens.iter().all(|t| words.iter().any(|w| norm(&w.text) == *t && w.start >= r.from - 0.3 && w.start <= r.to + 0.1))
}
pub(crate) fn text_rules(runs: &[Run], heard: Option<&[Word]>, w: f64, h: f64, shape: Option<&str>, platform: Option<&str>, issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
pub fn text_rules(runs: &[Run], heard: Option<&[Word]>, w: f64, h: f64, shape: Option<&str>, platform: Option<&str>, issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let [zt, zr, zb, zl] = zones(w, h, shape, platform);
let (mut clipped, mut unsafe_, mut brief) = (0, 0, 0);
for r in runs {
@@ -194,57 +225,30 @@ pub(crate) fn text_rules(runs: &[Run], heard: Option<&[Word]>, w: f64, h: f64, s
}
}
pub(crate) fn quote(s: &str) -> String {
pub fn quote(s: &str) -> String {
let s: String = s.chars().take(40).collect();
format!("\u{201c}{s}\u{201d}")
}
/// Caption contrast: at each text's middle frame, the pixels behind it against its colour, at least 3:1. The pixels
/// behind are the half of the box least like the text.
pub(crate) fn contrast(video: &str, runs: &[Run], w: f64, h: f64, probe: &Probe, issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let (sx, sy) = (probe.w / w, probe.h / h);
let mut low = 0;
let mut measured = 0;
for r in runs.iter().filter(|r| r.size >= 20.0).take(80) {
let [x, y, bw, bh] = r.box_;
let crop = [(x * sx).max(0.0) as u32, (y * sy).max(0.0) as u32, (bw * sx) as u32, (bh * sy) as u32];
if crop[0] + crop[2] > probe.w as u32 || crop[1] + crop[3] > probe.h as u32 {
continue;
}
let t = (r.from + r.to) / 2.0;
// the same measure `raea world` joins to a text from its render (raea-sys-measure, DR2)
let ratio = if crate::read::native() { crate::read::contrast(video, t, crop, &r.color) } else { raea_sys_measure::contrast(std::path::Path::new(video), t, crop, &r.color) };
let Some(ratio) = ratio else { continue };
measured += 1;
if ratio < 3.0 {
low += 1;
issues.push(Issue { rule: "contrast", p: 1, at: Some(t), says: format!("{} is {ratio:.1}:1 against what's behind it; make it at least 3:1 (a band, a shadow for separation, or another colour)", quote(&r.text)) });
}
}
if measured > 0 && low == 0 {
passed.push(format!("contrast: {measured} texts at 3:1 or better against their pixels"));
}
}
/// A transcript's word: its text, start and end in seconds (its end is its start when the transcript doesn't say).
pub(crate) use raea_core_facts::Word;
pub use raea_core_facts::Word;
/// A transcript's words (raea_core_facts::transcript_words: {text, start} in seconds, or t, start_ms, or {text, from}
/// in frames at `fps`), as the app's words.json and `raea render --words` have them.
pub(crate) fn transcript(path: &str, fps: f64) -> R<Vec<Word>> {
pub fn transcript(path: &str, fps: f64) -> R<Vec<Word>> {
let v: Value = serde_json::from_str(&std::fs::read_to_string(path).map_err(|e| format!("{path}: {e}"))?).map_err(|e| format!("{path}: {e}"))?;
v.as_array().ok_or_else(|| format!("{path}: expected an array of words ({{text, start}} in seconds or {{text, from}} in frames)"))?;
Ok(raea_core_facts::transcript_words(&v, fps))
}
pub(crate) use raea_core_facts::word_key as norm;
pub use raea_core_facts::word_key as norm;
pub(crate) const SMALL: [&str; 24] = ["the", "and", "you", "your", "for", "with", "that", "this", "its", "it's", "are", "was", "our", "out", "from", "into", "then", "than", "but", "not", "all", "can", "has", "have"];
pub const SMALL: [&str; 24] = ["the", "and", "you", "your", "for", "with", "that", "this", "its", "it's", "are", "was", "our", "out", "from", "into", "then", "than", "but", "not", "all", "can", "has", "have"];
/// Cues land on their words: a text whose words the voice says nearby comes on with the first of them, not after it.
/// The text is found by its first word of weight, and then measured from the first word it shows: a caption "of the
/// spend" comes on with "of", when the voice says "of the" just before "spend".
pub(crate) fn cues(runs: &[Run], words: &[Word], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
pub fn cues(runs: &[Run], words: &[Word], issues: &mut Vec<Issue>, passed: &mut Vec<String>) {
let (mut checked, mut off) = (0, 0);
for r in runs {
let shown: Vec<String> = r.text.split_whitespace().map(norm).filter(|t| !t.is_empty()).collect();
+6 -1
View File
@@ -14,11 +14,16 @@ raea-runtime-bundle = { path = "../../runtime/bundle" }
raea-core-facts = { path = "../../core/facts" }
# a render's record named by when it was (UTC)
raea-io-trace = { path = "../../io/trace" }
# frame purity (SG9): the video's frames decoded, the stills read
raea-io-media = { path = "../../io/media", default-features = false, features = ["apple", "soft"] }
image = { version = "0.25", default-features = false, features = ["png"] }
serde_json = "1"
# `raea check PROJECT | EDIT.tsx` (DR4): taste and controllers' rules, the floor on a composition's newest render, the
# `raea check PROJECT | EDIT.tsx` (DR4): the taste files' rules, the floor on a composition's newest render, the
# project's compositions
raea-core-brief = { path = "../../core/brief" }
raea-app-check = { path = "../check" }
# the check's text rules, held to a video render's manifest as it ends
raea-app-check-text = { path = "../check/text" }
raea-app-registry = { path = "../workspace/registry" }
# the project's notes, whose asks' checks raea check runs beside its rules (DR6)
raea-app-notes = { path = "../notes" }
+16 -25
View File
@@ -1,13 +1,13 @@
//! `raea check PROJECT|EDIT.tsx` (docs/direction.feature DR4): every check that applies, run over each
//! composition's worlds. The rules come from raea's floor, the person's taste (and the workspace's), and the
//! workspace's and the project's controllers; each is one of raea's named checks (systems.rs) or a project's TS check
//! (ts.rs), and where it was written changes nothing about how it runs. A check that needs a render runs on the
//! composition's worlds. The rules come from raea's floor and the taste files: the person's, the workspace's and the
//! project's; each is one of raea's named checks (systems.rs) or a project's TS check (ts.rs), and where it was
//! written changes nothing about how it runs. A check that needs a render runs on the
//! composition's newest render; with none, it waits, and the command says what for. `raea check VIDEO.mp4` is the
//! floor alone (apps/check).
use std::path::{Path, PathBuf};
use raea_core_brief::{controller, taste};
use raea_core_brief::taste;
use raea_core_facts::{finding, record, Facts, Finding, Level, Rule, Shot};
use raea_runtime_bundle::flag;
use raea_runtime_world::{Ask, Render};
@@ -18,7 +18,7 @@ use crate::ts;
type R<T> = Result<T, String>;
pub const USAGE: &str = "raea check [PROJECT|EDIT.tsx] [--composition ID] [--only ID] [--taste T] [--render OUT | --no-render] [--json] (every check that applies to each composition, over its frames: raea's floor on its newest render, the person's taste, the workspace's and the project's rules (a controller's rule fields: one of raea's checks by name, or a project's .ts check); what needs a render and has none waits, and says so)";
pub const USAGE: &str = "raea check [PROJECT|EDIT.tsx] [--composition ID] [--only ID] [--taste T] [--render OUT | --no-render] [--json] (every check that applies to each composition, over its frames: raea's floor on its newest render, the person's, the workspace's and the project's taste.ts (each line's check: one of raea's forms or checks by name, or a project's .ts check); what needs a render and has none waits, and says so)";
/// The flags raea check takes with a value (its own, and the floor's on a video).
const TAKES: [&str; 10] = ["--composition", "--only", "--taste", "--render", "--manifest", "--words", "--perception", "--shape", "--platform", "-o"];
@@ -71,7 +71,12 @@ fn tastes(project: &Path, given: Vec<PathBuf>, host: &Host) -> Vec<PathBuf> {
}
}
}
out.extend(record::up(project, ".raea/workspace").map(|ws| ws.join("taste.ts")).filter(|f| f.is_file()));
// the workspace's, then the project's own (the same file when the project is the workspace's folder)
for f in record::up(project, ".raea/workspace").map(|ws| ws.join("taste.ts")).into_iter().chain([project.join("taste.ts")]) {
if f.is_file() && !out.contains(&f) {
out.push(f);
}
}
out
}
@@ -98,8 +103,8 @@ fn rules(project: &Path, given: Vec<PathBuf>, host: &Host) -> (Vec<Rule>, Vec<Fi
(out, bad, notes)
}
/// raea's floor, the person's taste and the workspace's and project's controllers' rules, and a finding for each file
/// of them raea couldn't read.
/// raea's floor and every taste file's rules (the person's, the workspace's, the project's), and a finding for each
/// file of them raea couldn't read.
fn held(project: &Path, given: Vec<PathBuf>, host: &Host) -> (Vec<Rule>, Vec<Finding>) {
// raea's own: the floor, and the reading check (DR28: its findings keep their own levels, so no rule level)
let read = Rule { level: None, ..Rule::named("text-read", "text can be read for as long as it needs, and OCR reads it", Default::default(), Level::Warn, "raea") };
@@ -107,26 +112,12 @@ fn held(project: &Path, given: Vec<PathBuf>, host: &Host) -> (Vec<Rule>, Vec<Fin
let mut bad = Vec::new();
let name = |f: &Path| f.strip_prefix(project).unwrap_or(f).display().to_string();
for f in tastes(project, given, host) {
let (dir, by) = (f.parent().unwrap_or(Path::new(".")).to_path_buf(), format!("taste {}", name(&f)));
match (host.ts.eval)(&f).and_then(|j| raea_core_brief::read::<taste::Taste>(&name(&f), &j)) {
Ok(t) => out.extend(t.sections.iter().flat_map(|s| &s.rules).filter_map(|r| Some(Rule::of_taste(&r.text, r.check?, &name(&f))))),
Ok(t) => out.extend(t.sections.iter().flat_map(|s| &s.rules).filter_map(|r| Rule::of_taste(r, &dir, &by))),
Err(e) => bad.push(Finding::new("taste", Level::Error, format!("raea can't read it: {e}"), "raea check").about(name(&f), None)),
}
}
let ws = record::up(project, ".raea/workspace");
for (dir, scope) in ws.iter().map(|w| (raea_app_registry::shared_dir(w, "controllers"), "workspace")).chain([(project.join("controllers"), "project")]) {
// a workspace's own folder is its project's too: read once
if scope == "project" && ws.as_deref() == Some(project) {
continue;
}
let mut files: Vec<PathBuf> = std::fs::read_dir(&dir).into_iter().flatten().flatten().map(|e| e.path()).filter(|p| p.extension().is_some_and(|x| x == "ts")).collect();
files.sort();
for f in files {
match (host.ts.eval)(&f).and_then(|j| controller::of_json(&j)) {
Ok(c) => out.extend(Rule::of_controller(&c, &dir, &format!("{scope} {}", name(&f)))),
Err(e) => bad.push(Finding::new("controller", Level::Error, format!("raea can't read it: {e}"), "raea check").about(name(&f), None)),
}
}
}
(out, bad)
}
@@ -134,7 +125,7 @@ fn held(project: &Path, given: Vec<PathBuf>, host: &Host) -> (Vec<Rule>, Vec<Fin
fn compositions(target: &Path, args: &[String]) -> R<Vec<(PathBuf, Option<String>)>> {
let one = flag(args, "--composition");
let (dir, file) = if target.is_dir() { (target.to_path_buf(), None) } else { (target.parent().unwrap_or(Path::new(".")).to_path_buf(), Some(dunce::canonicalize(&target).map_err(|e| format!("{}: {e}", target.display()))?)) };
let reg = raea_app_registry::scan(&dir, &[]);
let reg = raea_app_registry::scan(&dir);
let mut out: Vec<(PathBuf, Option<String>)> = Vec::new();
for c in &reg.compositions {
let path = reg.dir.join(&c.file);
+2
View File
@@ -7,6 +7,8 @@ pub use world::{cli, find, Find, USAGE};
// how `raea render` ends: its findings counted last, and 1 on an error not let through (DR3)
mod rendered;
pub use rendered::rendered;
// frame purity at a render's end: a sample of its frames rendered again and held to the video's (SG9)
mod pure;
// `raea findings`: the project's record read back, fixed, new and carried (DR3)
pub mod findings;
+243
View File
@@ -0,0 +1,243 @@
//! SG9 (docs/stage-guards.feature): a frame looks the same however it is reached. When a video render with 3D in it ends,
//! a sample of its frames is rendered again by one more raea (`render --at`: each frame reached by a jump, none by the
//! frames before it) and held to the same frame of the video. A patch that differs beyond the encoder's noise means a
//! part kept state from an earlier frame: a shape, words, a colour or another part's row held over (SG1–SG4's faults,
//! and any later one of their kind). That frame is rendered alone (`--frame N`, in its own process) to be sure, and the
//! error names the frame, the patch, the parts under it (the stills' manifest, raea-sys-stage's on_screen) and where
//! the two pictures are kept. A frame that differs only when reached by a jump is the engine's fault, not the
//! composition's: a warning. RAEA_FRAME_PURE=0 skips the check (the stills it renders set it).
use std::path::Path;
use std::process::Command;
use raea_core_facts::{Finding, Level};
use serde_json::Value;
/// Sampled: every this many frames, the last frame, and the frame after each remount (more than 20 parts mounting or
/// unmounting at once, as the render's manifest lists them), for a render of more than MIN_FRAMES
const EVERY: u64 = 300;
const MIN_FRAMES: u64 = 60;
/// at most this many samples, spread evenly
const MOST: usize = 64;
/// A pixel differs when a channel differs by more than this (of 255) through a 3x3 erosion, which drops lone pixels (a
/// glyph's edge noise, the encoder's, its colour bleeding along an edge) and keeps a patch: tools/frame-pure-3d.sh's
/// bar, where a cut letter was 318. The largest channel, not luma: an orange part over a grey floor differs by 68 in
/// luma and 116 in blue, and a part that kept another frame's colour is often as bright as its own
const LEVELS: f32 = 96.0;
/// A frame differs when more of its pixels than this share differ (207 at 1080p), and at least LEAST
const SHARE: f64 = 1e-4;
const LEAST: usize = 64;
/// The flags of the render the stills repeat (each takes a value, then the bare ones): what it draws and at what size
const KEEP: [&str; 9] = ["--composition", "--w", "--h", "--fps", "--frames", "--words", "--perception", "--input", "--stage"];
const KEEP_BARE: [&str; 2] = ["--clay", "--lite"];
const BY: &str = "raea render (frame-pure)";
/// The frames to sample of a render `length` frames long, given its remounts.
pub(crate) fn samples(length: u64, remounts: &[u64]) -> Vec<u64> {
if length <= MIN_FRAMES {
return Vec::new();
}
let mut s: Vec<u64> = (1..).map(|k| k * EVERY).take_while(|f| *f < length).collect();
s.push(length - 1);
s.extend(remounts.iter().map(|f| f + 1).filter(|f| *f < length));
s.sort_unstable();
s.dedup();
// more than MOST: the last of each of MOST even runs, so the last frame stays
let n = s.len();
if n > MOST {
s = s.into_iter().enumerate().filter(|(i, _)| (i + 1) * MOST / n > i * MOST / n).map(|(_, f)| f).collect();
}
s
}
/// Where two RGBA frames of one size differ: the count of pixels with a channel off by more than LEVELS through a 3x3
/// erosion (every pixel round it differs too), and their box [x0, y0, x1, y1].
pub(crate) fn patch(a: &[u8], b: &[u8], w: usize, h: usize) -> (usize, [usize; 4]) {
let d: Vec<f32> = (0..w * h)
.map(|i| {
let c = |k: usize| (f32::from(a[i * 4 + k]) - f32::from(b[i * 4 + k])).abs();
c(0).max(c(1)).max(c(2))
})
.collect();
let (mut n, mut bx) = (0, [usize::MAX, usize::MAX, 0, 0]);
for y in 1..h.saturating_sub(1) {
for x in 1..w.saturating_sub(1) {
if (y - 1..=y + 1).all(|yy| (x - 1..=x + 1).all(|xx| d[yy * w + xx] > LEVELS)) {
n += 1;
bx = [bx[0].min(x), bx[1].min(y), bx[2].max(x + 1), bx[3].max(y + 1)];
}
}
}
(n, if n == 0 { [0; 4] } else { bx })
}
fn differs(n: usize, w: usize, h: usize) -> bool {
n > LEAST.max((SHARE * (w * h) as f64) as usize)
}
/// The render's own flags the stills repeat.
fn kept(args: &[String]) -> Vec<String> {
let mut out = Vec::new();
for (i, a) in args.iter().enumerate() {
if KEEP.contains(&a.as_str()) {
out.extend(args.get(i..i + 2).into_iter().flatten().cloned());
} else if KEEP_BARE.contains(&a.as_str()) {
out.push(a.clone());
}
}
out
}
/// One more raea rendering `file` at `at` into `dir` (its stills, frame-00000.png on, in `at`'s order, and its
/// manifest); its own errors are let through, since these are pictures to compare, not the render. Stills past 3,600
/// frames make their 3D live at each (render_bundle's LIVE_PAST): 64 of a 13,175-frame film reached by rows went past
/// 30 GB and were killed.
fn stills(file: &str, args: &[String], at: &[u64], dir: &Path) -> Result<Value, String> {
let me = std::env::current_exe().map_err(|e| e.to_string())?;
let list: Vec<String> = at.iter().map(u64::to_string).collect();
std::fs::create_dir_all(dir).map_err(|e| format!("{}: {e}", dir.display()))?;
let manifest = dir.join("stills.json");
let (flag, out) = if at.len() == 1 { ("--frame", dir.join("frame-00000.png").display().to_string()) } else { ("--at", format!("{}/", dir.display())) };
let o = Command::new(me).arg("render").arg(file).args(kept(args)).args([flag, &list.join(","), "-o", &out, "--manifest"]).arg(&manifest).env("RAEA_RECORD", "off").env("RAEA_FRAME_PURE", "0").env("RAEA_DESPITE", "all: frame-pure's own stills")
// nothing here reads the stills' clipping or staging, only their pictures and parts on screen: the checks cost
// the film's 44 stills 1.6 GB, beside the render that's still held (SG4a: its 8.6 GB peak)
.env("RAEA_CLIP_CHECK", "0").env("RAEA_STAGE_CHECK", "0").output().map_err(|e| e.to_string())?;
let m = std::fs::read(&manifest).ok().and_then(|b| serde_json::from_slice::<Value>(&b).ok());
m.ok_or_else(|| format!("the stills didn't render: {}", String::from_utf8_lossy(&o.stderr).lines().rev().find(|l| !l.trim().is_empty()).unwrap_or("no message")))
}
fn png(p: &Path) -> Option<(Vec<u8>, usize, usize)> {
let img = image::open(p).ok()?.into_rgba8();
let (w, h) = img.dimensions();
Some((img.into_raw(), w as usize, h as usize))
}
/// The parts on screen at `frame` whose boxes meet `bx`, most overlap first (the manifest of the frame rendered alone:
/// its `parts` hold that one frame).
fn under(m: &Value, frame: u64, bx: [usize; 4]) -> Vec<String> {
let at = &m["parts"][0];
if at["frame"] != frame {
return Vec::new();
}
let b = bx.map(|v| v as f64);
let mut hit: Vec<(f64, String)> = at["parts"]
.as_array()
.into_iter()
.flatten()
.filter_map(|p| {
let r: Vec<f64> = p[1].as_array()?.iter().filter_map(Value::as_f64).collect();
let r: [f64; 4] = r.try_into().ok()?;
let over = (b[2].min(r[2]) - b[0].max(r[0])).max(0.0) * (b[3].min(r[3]) - b[1].max(r[1])).max(0.0);
(over > 0.0).then(|| (over, p[0].as_str().unwrap_or("a part").to_string()))
})
.collect();
hit.sort_by(|a, b| b.0.total_cmp(&a.0));
hit.into_iter().map(|h| h.1).take(3).collect()
}
/// SG9 on a finished render: its findings, none when it isn't a video with 3D in it of more than MIN_FRAMES.
pub fn check(args: &[String], out: &Path, manifest: &Value) -> Vec<Finding> {
let (Some(file), true) = (args.get(1), manifest["has3d"].as_bool() == Some(true)) else { return Vec::new() };
if std::env::var("RAEA_FRAME_PURE").as_deref() == Ok("0") || args.iter().any(|a| a == "--frame" || a == "--at") {
return Vec::new();
}
let remounts: Vec<u64> = manifest["remounts"].as_array().into_iter().flatten().filter_map(Value::as_u64).collect();
let at = samples(manifest["length"].as_u64().unwrap_or(0), &remounts);
let fps = manifest["fps"].as_f64().unwrap_or(30.0);
if at.is_empty() {
return Vec::new();
}
let dir = std::env::temp_dir().join(format!("raea-frame-pure-{}", std::process::id()));
let found = run(file, args, out, &at, fps, &dir).unwrap_or_else(|e| vec![Finding::new("frame-pure", Level::Note, format!("frame purity wasn't checked: {e}"), BY)]);
let _ = std::fs::remove_dir_all(&dir);
found
}
fn run(file: &str, args: &[String], out: &Path, at: &[u64], fps: f64, dir: &Path) -> Result<Vec<Finding>, String> {
std::fs::create_dir_all(dir).map_err(|e| e.to_string())?;
stills(file, args, at, &dir.join("at"))?;
let mut video = raea_io_media::preferred().into_iter().find_map(|b| b.open_video(out).ok()).ok_or_else(|| format!("{}: no decoder opens it", out.display()))?;
let keep = out.with_extension("frame-pure");
let mut found = Vec::new();
for (i, &f) in at.iter().enumerate() {
let Some((jump, w, h)) = png(&dir.join(format!("at/frame-{i:05}.png"))) else { continue };
let v = video.frame_at((f as f64 + 0.5) / fps)?;
if (v.width as usize, v.height as usize) != (w, h) {
return Err(format!("the video is {}x{}, its stills {w}x{h}", v.width, v.height));
}
if !differs(patch(&v.rgba, &jump, w, h).0, w, h) {
continue;
}
// reached by a jump it differs: rendered alone, in its own process, to be sure
let one = dir.join(format!("alone-{f}"));
let alone_m = stills(file, args, &[f], &one)?;
let Some((alone, _, _)) = png(&one.join("frame-00000.png")) else { continue };
let (n, bx) = patch(&v.rgba, &alone, w, h);
let parts = under(&alone_m, f, bx);
let named = if parts.is_empty() { String::new() } else { format!(" over {}", parts.join(", ")) };
let finding = if differs(n, w, h) {
std::fs::create_dir_all(&keep).map_err(|e| e.to_string())?;
let (seq, own) = (keep.join(format!("frame-{f:05}-render.png")), keep.join(format!("frame-{f:05}-alone.png")));
image::save_buffer(&seq, &v.rgba, w as u32, h as u32, image::ColorType::Rgba8).map_err(|e| e.to_string())?;
std::fs::copy(one.join("frame-00000.png"), &own).map_err(|e| e.to_string())?;
let mut x = Finding::new("frame-pure", Level::Error, format!("{n} pixels{named} (x {}-{}, y {}-{}) differ from the frame rendered alone: a part kept an earlier frame's shape, words, colour or row. The two are {} and {}", bx[0], bx[2], bx[1], bx[3], seq.display(), own.display()), BY).frames(f as i64, f as i64 + 1).measure("pixels", n as f64, "px", Some(LEAST.max((SHARE * (w * h) as f64) as usize) as f64));
for p in &parts {
x = x.about(p.clone(), None);
}
x.fix("find what that part takes from the frames before (a key it keeps, a prop read once), or `raea bug` with both pictures when it's raea's")
} else {
Finding::new("frame-pure-jump", Level::Warn, format!("frame {f}{named} differs when the render jumps to it from frame {}, not alone or in sequence: raea's, not the composition's (`raea bug` with this line)", if i > 0 { at[i - 1].to_string() } else { "0".into() }), BY).frames(f as i64, f as i64 + 1)
};
found.push(finding);
}
Ok(found)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn samples_every_300th_the_last_and_after_each_remount() {
assert!(samples(60, &[]).is_empty());
assert_eq!(samples(180, &[]), vec![179]);
assert_eq!(samples(1000, &[40, 599, 999]), vec![41, 300, 600, 900, 999]);
let many = samples(1_000_000, &[]);
assert_eq!((many.len(), many.last()), (MOST, Some(&999_999)));
}
#[test]
fn a_patch_counts_but_lone_pixels_and_noise_dont() {
let (w, h) = (64, 32);
let a = vec![40u8; w * h * 4];
let mut b = a.clone();
// noise: every pixel off by 20, and lone pixels off by 200
b.iter_mut().for_each(|v| *v += 20);
for i in (0..w * h).step_by(7) {
b[i * 4..i * 4 + 3].copy_from_slice(&[240, 240, 240]);
}
assert_eq!(patch(&a, &b, w, h).0, 0);
// a 10x6 block of words turned white at x 20, y 8: its eroded inside, 8x4
for y in 8..14 {
for x in 20..30 {
b[(y * w + x) * 4..(y * w + x) * 4 + 3].copy_from_slice(&[255, 255, 255]);
}
}
let (n, bx) = patch(&a, &b, w, h);
assert_eq!(n, 32);
assert_eq!(bx, [21, 9, 29, 13]);
}
#[test]
fn the_stills_repeat_what_the_render_draws_and_nothing_else() {
let a: Vec<String> = ["render", "e.tsx", "-o", "out.mp4", "--composition", "k3", "--kbps", "8000", "--clay", "--despite", "type-small", "why", "--frames", "90"].iter().map(|s| s.to_string()).collect();
assert_eq!(kept(&a), ["--composition", "k3", "--clay", "--frames", "90"]);
}
#[test]
fn the_parts_under_a_patch_most_overlap_first() {
let m = serde_json::json!({"parts": [{"frame": 600, "parts": [["floor", [0.0, 500.0, 1920.0, 1080.0]], ["counter", [800.0, 300.0, 1000.0, 400.0]], ["sky", [0.0, 0.0, 1920.0, 200.0]]]}]});
assert_eq!(under(&m, 600, [850, 350, 1000, 520]), ["counter", "floor"]);
assert!(under(&m, 300, [850, 350, 1000, 520]).is_empty());
}
}
+46 -1
View File
@@ -38,7 +38,7 @@ pub fn rendered(args: &[String]) -> i32 {
if args.first().map(String::as_str) != Some("render") {
return 0;
}
let found = finding::taken();
let mut found = finding::taken();
let through = despite(args, std::env::var("RAEA_DESPITE").ok());
let excused: Vec<Despite> = through.iter().map(|(c, w)| Despite { check: c.clone(), why: w.clone() }).collect();
let out = raea_runtime_bundle::flag(args, "-o").or_else(|| raea_runtime_bundle::flag(args, "--review")).map(PathBuf::from);
@@ -46,6 +46,14 @@ pub fn rendered(args: &[String]) -> i32 {
let manifest = raea_runtime_bundle::flag(args, "--manifest").map(PathBuf::from).or_else(|| Some(raea_runtime_world::manifest_for(out.as_deref()?, std::path::Path::new(args.get(1)?))));
if let Some(m) = manifest {
if let Some(mut v) = std::fs::read(&m).ok().and_then(|b| serde_json::from_slice::<Value>(&b).ok()) {
// a video's text, held to the check's text rules as it finishes, a check's round sooner
if let Some(o) = out.as_deref().filter(|o| matches!(o.extension().and_then(|x| x.to_str()), Some("mp4" | "mov"))) {
// and a sample of its frames rendered again, each held to the video's (SG9, pure.rs)
for f in text_found(&v).into_iter().chain(crate::pure::check(args, o, &v)) {
println!("{}", f.line());
found.push(f);
}
}
v["findings"] = json!(found);
if !excused.is_empty() {
v["despite"] = json!(excused);
@@ -63,6 +71,26 @@ pub fn rendered(args: &[String]) -> i32 {
code
}
/// What a video render's text breaks, from its manifest (raea-app-check-text, the rules `raea check` holds it to): text
/// off the frame is an error, as the check has it; text in a UI zone a warn, by the default zones, since the platform's
/// are the check's to decide (`--platform`); reading time waits for the check, which has the transcript to tell a
/// caption the voice reads out from one that has to be read.
fn text_found(manifest: &Value) -> Vec<Finding> {
let runs = raea_app_check_text::text_runs(manifest);
let (w, h, fps) = (manifest["width"].as_f64().unwrap_or(1080.0), manifest["height"].as_f64().unwrap_or(1920.0), manifest["fps"].as_f64().unwrap_or(30.0));
let (mut issues, mut passed) = (Vec::new(), Vec::new());
raea_app_check_text::text_rules(&runs, None, w, h, None, None, &mut issues, &mut passed);
let mut found = Vec::new();
for mut i in issues.into_iter().filter(|i| i.rule != "reading") {
if i.rule == "safe-area" {
i.p = 2;
i.says.push_str(" (by the default zones: `raea check --platform P` holds it to the platform's)");
}
found.push(i.finding("raea render", fps));
}
found
}
#[cfg(test)]
mod tests {
use super::*;
@@ -71,6 +99,23 @@ mod tests {
v.iter().map(|a| a.to_string()).collect()
}
/// A video's text off the frame fails its render, as the check fails it; text in a UI zone is a warn by the
/// default zones; a word on screen too briefly is left to the check, which has the transcript
#[test]
fn a_video_render_holds_its_text_to_the_check_s_rules() {
let text = |t: &str, b: [f64; 4]| json!({"text": t, "box": b, "opacity": 1.0, "size": 60.0, "color": "rgb(255, 255, 255)"});
let frames: Vec<Value> = (0..48).map(|f| json!({"frame": f, "videos": [], "text": [
text("OFF THE EDGE", [900.0, 800.0, 400.0, 80.0]),
text("Per month", [700.0, 1233.0, 318.0, 44.0]),
if f < 3 { text("Two words", [200.0, 900.0, 300.0, 80.0]) } else { json!({"text": "", "box": [0, 0, 0, 0]}) },
]})).collect();
let found = text_found(&json!({"width": 1080, "height": 1920, "fps": 24, "frames": frames}));
let got: Vec<(&str, Level)> = found.iter().map(|f| (f.check.as_str(), f.level)).collect();
assert_eq!(got, vec![("clipped", Level::Error), ("safe-area", Level::Warn)], "{found:?}");
assert!(found[1].says.contains("--platform"));
assert_eq!(found[0].frames, Some([0, 1]));
}
#[test]
fn an_error_fails_the_render_unless_it_is_let_through_and_says_by_what() {
let found = vec![Finding::new("clips", Level::Error, "rider in seat", "raea render"), Finding::new("tilted", Level::Warn, "vase leans", "raea render")];
+1 -1
View File
@@ -53,7 +53,7 @@ fn placement_and_margin_name_the_worst_frame_of_a_run() {
#[test]
fn a_rule_with_no_value_says_so() {
let r = Rule { level: Some(Level::Warn), ..Rule::named("text-hold", "", Map::new(), Level::Error, "project controllers/rules.ts") };
let r = Rule { level: Some(Level::Warn), ..Rule::named("text-hold", "", Map::new(), Level::Error, "taste taste.ts") };
let got = text(&r, &piece(3, |_| vec![]));
assert_eq!((got.len(), got[0].level), (1, Level::Warn));
assert!(got[0].says.contains("needs a value"));
+23
View File
@@ -0,0 +1,23 @@
[package]
name = "raea-app-double"
version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
publish = false
description = "The fingerprint's flags asked again of the decision model (docs/ask.feature AK8): each flagged moment in its axis's own words on its own window, the answers beside the flags and kept as another eye's evidence"
[dependencies]
# the runner every ask goes through, and the question format
raea-app-ask = { path = "../ask" }
raea-core-ask = { path = "../../core/ask" }
# the score's moments, the axes' words and the evidence rows clef's answers become
raea-sys-fingerprint = { path = "../../systems/fingerprint" }
raea-sys-fingerprint-use = { path = "../../systems/fingerprint-use" }
raea-sys-columns = { path = "../../systems/columns" }
serde = { version = "1", features = ["derive"] }
[dev-dependencies]
# a clip made with FFmpeg, and clef's answers as the tests give them
raea-io-assets = { path = "../../io/assets" }
raea-io-clef = { path = "../../io/clef" }
serde_json = "1"
+167
View File
@@ -0,0 +1,167 @@
//! The fingerprint's flags asked again (docs/ask.feature AK8). `raea fingerprint score FILE --ask flags` (or `ask:
//! "flags"` in fingerprint.ts) puts each flagged moment to the decision model in its axis's own words, on that moment's
//! window alone, so it costs by the flags and never by the piece; `--ask unsure` also asks each window an axis puts in
//! its plausible band without flagging it. Moments on the same window share a call. Each flag then says "clef agrees
//! (0.71)" or "clef doesn't see it (0.08)", and each answer becomes an `eye:clef` evidence row, which trains the axis's
//! head and never counts as the person's (FP6d). The question carries the axis's words as its label words, so the
//! person's notes calibrate it as they do any question (AK6, AK7).
use std::path::Path;
use std::sync::Arc;
use raea_app_ask::prepare::Piece;
use raea_app_ask::runner::{self, Entry, Event};
pub use raea_app_ask::runner::Opts;
use raea_core_ask::{Question, Sees, Window};
use raea_sys_columns::Columns;
use raea_sys_columns::window::Modality;
use raea_sys_fingerprint::evidence::{Row, features};
use raea_sys_fingerprint::folder::Folder;
use raea_sys_fingerprint::taxonomy::{Axis, Fingerprint};
use raea_sys_fingerprint_use::score::{Scored, clock};
use serde::Serialize;
/// One moment asked again.
#[derive(Debug, Clone, Serialize)]
pub struct Double {
pub a: f64,
pub b: f64,
pub axis: String,
/// the axis in the person's words
pub words: String,
/// whether the fingerprint flagged it (else it was unsure of it)
pub flagged: bool,
/// clef's problem score, when it answered
pub problem: Option<f64>,
/// clef agrees: past even odds, or past the question's threshold once the person's labels calibrated it
pub agrees: Option<bool>,
/// its answer's id in raea ask's record, for `raea ask verdict`
pub answer: Option<String>,
/// why it wasn't asked or still waits
pub not_asked: Option<String>,
}
impl Double {
/// What clef made of it, as a flag's line says it.
pub fn said(&self) -> String {
match (self.agrees, self.problem, &self.not_asked) {
(Some(true), Some(p), _) => format!("clef agrees ({p:.2})"),
(Some(false), Some(p), _) => format!("clef doesn't see it ({p:.2})"),
(_, _, Some(why)) => format!("clef wasn't asked: {why}"),
_ => "clef gave no answer".into(),
}
}
}
/// The moments asked again, a line each under the score's summary, as its flags are written (the app reads them).
pub fn lines(ds: &[Double]) -> String {
let each = ds.iter().map(|d| format!(" {}-{} {}: {}{}\n", clock(d.a), clock(d.b), d.axis, d.said(), if d.flagged { "" } else { " (the fingerprint was unsure)" }));
format!("asked again of clef ({} moment{}):\n{}", ds.len(), if ds.len() == 1 { "" } else { "s" }, each.collect::<String>())
}
/// The moments to ask: every flag, and with `unsure` each run of windows an axis puts in its plausible band unflagged.
pub fn moments(s: &Scored, fp: &Fingerprint, which: &str) -> Vec<Double> {
let words = |axis: &str| fp.axis(axis).and_then(|a| a.words.first().cloned()).unwrap_or_else(|| axis.to_string());
let one = |a: f64, b: f64, axis: &str, flagged: bool| Double { a, b, axis: axis.into(), words: words(axis), flagged, problem: None, agrees: None, answer: None, not_asked: None };
let mut out: Vec<Double> = s.moments.iter().map(|m| one(m.a, m.b, &m.axis, true)).collect();
if which == "unsure" {
for w in &s.windows {
for x in w.axes.iter().filter(|x| !x.flagged && x.band == Some("plausible")) {
match out.iter_mut().rev().find(|d| d.axis == x.axis && !d.flagged) {
Some(d) if w.a <= d.b => d.b = w.b,
_ => out.push(one(w.a, w.b, &x.axis, false)),
}
}
}
}
out
}
/// An axis as a question: is its defect there (or, for a quality, is it there), looking or listening as it does.
pub fn question(axis: &Axis) -> Question {
let words = axis.words.first().cloned().unwrap_or_else(|| axis.name.replace(['-', '_'], " "));
let good = axis.polarity == "good";
let ask = if good { format!("Is this {words}?") } else { format!("Is there {words} here?") };
let mut q = Question::plain(&format!("fp.{}", axis.name), &ask);
if good {
q.flags = vec!["no".into()];
}
let listens = matches!(axis.modality, Modality::Sound | Modality::Events);
q.sees = if listens { Sees::Nothing } else { Sees::Video };
q.hears = listens;
q.label_words = axis.words.clone();
q
}
/// Each moment asked of `file`, a call a window, at most `o.jobs` at once; the moments with clef's answers. A moment
/// that couldn't be asked (no route, the pool spent, the file unreadable) says why, and the score goes on without it.
pub fn ask(file: &Path, fp: &Fingerprint, mut ds: Vec<Double>, o: &Opts) -> Vec<Double> {
let piece = match Piece::read(file, None, None, None, None) {
Ok(p) => Arc::new(p),
Err(why) => {
for d in &mut ds {
d.not_asked = Some(format!("the file couldn't be read: {why}"));
}
return ds;
}
};
let entries = ds
.iter()
.filter_map(|d| {
let q = question(fp.axis(&d.axis)?);
Some(Entry { piece: piece.clone(), window: Some(Window { from: Some(d.a), to: Some(d.b) }), questions: vec![q], dropped: vec![], with: vec![] })
})
.collect();
runner::run(entries, o, &mut |e| {
let Event::Answer(r) = e else { return };
let Some(d) = ds.iter_mut().find(|d| format!("fp.{}", d.axis) == r.id && d.a == r.from && r.to == Some(d.b)) else { return };
d.problem = r.problem;
d.agrees = r.says.as_ref().map(|_| r.flagged);
d.answer = r.answer.clone();
d.not_asked = r.not_asked.clone().or_else(|| r.waits.clone());
});
ds
}
/// The answered moments kept in the fingerprint's ledger as clef's evidence, over the file's columns; a moment asked
/// again replaces clef's last row for it. How many it kept.
pub fn keep(dir: &Folder, c: &Columns, project: &str, ds: &[Double]) -> Result<usize, String> {
let rows: Vec<Row> = ds.iter().filter_map(|d| row(d, &c.media, project)).collect();
if rows.is_empty() {
return Ok(0);
}
let mut l = dir.ledger().map_err(|e| e.to_string())?;
let mut n = 0;
for r in rows {
l.retain(|x| !(x.source == r.source && x.media == r.media && x.axis == r.axis && x.a == r.a && x.b == r.b));
let f = features(c, r.a, r.b);
l.push(r, &f);
n += 1;
}
dir.write_ledger(&l).map_err(|e| e.to_string())?;
Ok(n)
}
/// An answered moment as another eye's evidence row.
pub fn row(d: &Double, media: &str, project: &str) -> Option<Row> {
Some(Row {
media: media.into(),
a: d.a,
b: d.b,
axis: d.axis.clone(),
bad: d.agrees?,
weight: 1.0,
who: "clef".into(),
source: "eye:clef".into(),
project: project.into(),
kind: None,
region: None,
words: None,
at: 0,
pin: None,
band: None,
})
}
#[cfg(test)]
mod tests;
+88
View File
@@ -0,0 +1,88 @@
use std::path::PathBuf;
use raea_app_ask::runner::Opts;
use raea_core_ask::Sees;
use raea_io_clef::{Answered, Call, Fail};
use raea_sys_fingerprint::taxonomy::base;
use raea_sys_fingerprint_use::score::{AxisScore, Moment, Scored, Window};
use serde_json::json;
use crate::{ask, lines, moments, question, row};
fn moment(a: f64, b: f64, axis: &str) -> Moment {
Moment { a, b, axis: axis.into(), words: String::new(), by: "head", state: "gating".into(), band: Some("strong"), gating: true, peak: 1.0, at: None }
}
fn window(a: f64, axis: &str, band: &'static str, flagged: bool) -> Window {
let s = AxisScore { axis: axis.into(), value: 0.5, by: "head", state: "advice".into(), band: Some(band), flagged, gating: false };
Window { a, b: a + 2.0, axes: vec![s], seen: None, heard: None, level: -20.0, overall: None }
}
fn scored(moments: Vec<Moment>, windows: Vec<Window>) -> Scored {
Scored { file: "a.mp4".into(), media: "m".into(), dur: 10.0, fingerprint: "test".into(), moments, windows }
}
#[test]
fn flags_are_asked_and_unsure_adds_the_plausible_windows_run_together() {
let fp = base("test");
let s = scored(vec![moment(0.0, 3.0, "blur")], vec![window(4.0, "glitch", "plausible", false), window(5.0, "glitch", "plausible", false), window(8.0, "glitch", "weak", false)]);
assert_eq!(moments(&s, &fp, "flags").len(), 1);
let unsure = moments(&s, &fp, "unsure");
assert_eq!(unsure.iter().map(|d| (d.a, d.b, d.axis.as_str(), d.flagged)).collect::<Vec<_>>(), [(0.0, 3.0, "blur", true), (4.0, 7.0, "glitch", false)]);
assert!(unsure[0].words.contains("blurry"), "an axis is asked in its own words: {}", unsure[0].words);
}
#[test]
fn an_axis_asks_as_it_senses_and_a_quality_is_flagged_on_no() {
let fp = base("test");
let blur = question(fp.axis("blur").unwrap());
assert!(blur.ask.starts_with("Is there a blurry") && blur.sees == Sees::Video && !blur.hears && blur.flags.is_empty());
assert_eq!(blur.label_words, fp.axis("blur").unwrap().words, "the person's notes in the axis's words label it");
let muffled = question(fp.axis("muffled voice").unwrap());
assert!(muffled.sees == Sees::Nothing && muffled.hears);
let mut good = fp.axis("blur").unwrap().clone();
good.polarity = "good".into();
let q = question(&good);
assert!(q.ask.starts_with("Is this ") && q.flags == ["no"]);
}
/// clef as a fake: yes to the blur question, no to anything else.
fn blur_only(call: &Call) -> Result<Answered, Fail> {
let answers = call.questions.iter().map(|q| (q.id.clone(), json!({"noul": if q.id == "fp.blur" { 0.8 } else { 0.1 }}))).collect();
Ok(Answered { answers, cost: 0.001, cached: false, route: "a test".into(), pool_left: None })
}
/// A 6 s clip with a picture and a tone.
fn clip() -> PathBuf {
let out = std::env::temp_dir().join(format!("raea-double-{}.mp4", std::process::id()));
let ff = raea_io_assets::ffmpeg_tool("ffmpeg", false).expect("FFmpeg");
let ok = std::process::Command::new(ff)
.args(["-y", "-v", "error", "-f", "lavfi", "-i", "testsrc=size=320x240:rate=10:duration=6", "-f", "lavfi", "-i", "sine=frequency=440:duration=6"])
.args(["-c:v", "mpeg4", "-c:a", "aac", "-shortest"])
.arg(&out)
.status()
.expect("FFmpeg ran");
assert!(ok.success());
out
}
#[test]
fn each_flag_is_asked_on_its_own_window_and_said_beside_it_and_kept_as_clefs() {
// SAFETY: this crate's only test that reads it, set before the runner starts
unsafe { std::env::set_var("RAEA_ASK_DIR", std::env::temp_dir().join(format!("raea-double-ask-{}", std::process::id()))) };
let fp = base("test");
let file = clip();
let s = scored(vec![moment(0.0, 2.0, "blur"), moment(0.0, 2.0, "glitch"), moment(3.0, 5.0, "muffled voice")], vec![]);
let ds = ask(&file, &fp, moments(&s, &fp, "flags"), &Opts { jobs: 2, dry: false, ask: blur_only });
let said: Vec<String> = ds.iter().map(|d| format!("{}: {}", d.axis, d.said())).collect();
assert_eq!(said, ["blur: clef agrees (0.80)", "glitch: clef doesn't see it (0.10)", "muffled voice: clef doesn't see it (0.10)"]);
assert!(lines(&ds).starts_with("asked again of clef (3 moments):\n 0:00-0:02 blur: clef agrees (0.80)\n"), "{}", lines(&ds));
let gone = ask(&std::env::temp_dir().join("raea-double-none.mp4"), &fp, moments(&s, &fp, "flags"), &Opts { jobs: 2, dry: false, ask: blur_only });
assert!(gone.iter().all(|d| d.agrees.is_none() && d.said().starts_with("clef wasn't asked")), "a file it can't read asks nothing: {gone:?}");
let r = row(&ds[0], "m", "p").unwrap();
assert!(r.bad && r.source == "eye:clef" && r.who == "clef" && (r.a, r.b) == (0.0, 2.0));
assert!(!row(&ds[1], "m", "p").unwrap().bad);
let mut unanswered = ds[0].clone();
unanswered.agrees = None;
assert!(row(&unanswered, "m", "p").is_none(), "a moment clef didn't answer isn't evidence");
}
+1 -1
View File
@@ -33,7 +33,7 @@ pub(crate) fn session(entry: &str, file: Option<&Path>, rest: &[String], secs: f
let bridge = blender_bridge::start(&bin, file, rest)?;
*BRIDGE.lock().map_err(|e| e.to_string())? = Some((bridge.port, bridge.token.clone()));
let out = std::env::temp_dir().join(format!("raea-blender-{}.js", std::process::id()));
let ran = raea_runtime_bundle::bundle_entry(entry, &out, &[]).and_then(|_| raea_runtime_export::run_bundle(&out, secs));
let ran = raea_runtime_bundle::bundle_entry(entry, &out, &[]).and_then(|_| raea_runtime_export::run_bundle_to_terminal(&out, secs));
let _ = std::fs::remove_file(&out);
let _ = post(&json!({ "sid": "raea", "ops": [{ "o": "quit" }] }));
*BRIDGE.lock().map_err(|e| e.to_string())? = None;
+2
View File
@@ -13,6 +13,8 @@ raea-io-home = { path = "../../io/home" }
raea-sys-fingerprint = { path = "../../systems/fingerprint" }
# scoring and the sheet, which one judges a piece, diff and profiles
raea-sys-fingerprint-use = { path = "../../systems/fingerprint-use" }
# score --ask: each flag asked again of the decision model (docs/ask.feature AK8)
raea-app-double = { path = "../double" }
raea-sys-fingerprint-things = { path = "../../systems/fingerprint-things" }
# the encoders and the columns they make
raea-sys-columns = { path = "../../systems/columns" }
+1 -1
View File
@@ -21,7 +21,7 @@ use std::path::Path;
pub use serve::serve;
pub const USAGE: &str = "raea fingerprint new NAME [--who W] [--about TEXT] [--extends FP] [--kinds K,K] [--tags T,T] | raea fingerprint bootstrap FILE... [--from LIST] [--per N] | raea fingerprint teach FILE --axis A --at T [--bad|--good] [--span S] [--box x0,y0,x1,y1] [--words W] [--project P] | raea fingerprint approve FILE... [--project P] | raea fingerprint pair WORSE BETTER --axis A [--at T] [--then T2] | raea fingerprint versions V1 V2... | raea fingerprint profile REFS... --as NAME [--against LIST] | raea fingerprint score FILE [--was OLD] [--json] [--sheet out.png] [--timeline] [--profile NAME] | raea fingerprint report [--json] | raea fingerprint which [PATH] [--json] | raea fingerprint use NAME [--in project|workspace] [PATH] | raea fingerprint diff A B [--json] | raea fingerprint share NAME [--in project|workspace] [PATH] | raea fingerprint reembed PLACE... | raea fingerprint read PROJECT [--by kimi|claude] | raea fingerprint readings [PROJECT] [--ask N] [--tally] | raea fingerprint learn-notes [PROJECT] | raea fingerprint move [--fp CHILD] [--to PARENT] [--axis A] [--source S] [--project P] | raea fingerprint postmortem [PROJECT] [--ask N] [--tally] | raea fingerprint things FILE [--project P] [--json] | raea fingerprint stop [--fp NAME] (a person's sense of good work as axes with small heads over on-device encoders, docs/fingerprint.md: new makes ~/.raea/fingerprints/NAME with raea's base taxonomy in fingerprint.ts (or FP's axes with --extends), what it's for, the kinds of piece and project tags it judges, and every axis scoring from its words; bootstrap puts known defects into windows of real work and trains the mechanical axes, held out by source, and patch heads that say where in the frame a picture defect is; teach adds a label at a moment; approve makes approved work clean on every axis, away from its notes; pair says one moment is better than another on an axis (a pick, a hand edit); versions makes weak pairs of noted moments the next version changed; score prints the moments it expects a note on first (where in the frame, and the layers there, when its patch head points held out), then every axis per window with --json, a sheet PNG with --sheet, or the piece second by second in words with --timeline, and with --was OLD whether each of OLD's gating flags is fixed, still there, or looks disguised (nearer the axis's disguised defects than clean work); profile takes the ranges of work you admire (loudness, tilt, cut rate, motion, brightness, contrast, saturation, sharpness), checked leave-one-out, and score --profile says what falls outside them, where and which way; report says each head's held-out score, labels, cheats, gate and what it can't judge; which says the one that judges a piece (its project's, its workspace's, then yours) and why, use pins one there, diff lists the axes two fingerprints rank the same evidence most differently on, and share copies one's taxonomy and evidence (no heads, no media) into a project or workspace for its team; reembed moves a fingerprint's evidence to this machine's encoders, re-embedding the rows whose media it finds; read has a fresh kimi or claude session read a project's pinned notes into kinds and axes, readings puts them to you to check and tallies your answers, and learn-notes makes the defects and praise evidence once you've agreed with 45 kinds and 40 axes in 50, each project's in the fingerprint that judges it; move takes a child's own labels (by axis, source or project) up into a fingerprint it extends, which never reads them otherwise; postmortem scores every version in a project's feed and asks you at most ten yes/no questions in the app, each with its moment playing, where the fingerprint disagrees with your labels or is least sure, and --tally makes your answers evidence and says how each head's held-out score moved; things finds a piece's shots, its things (a render's layers, and the marks drawn on its notes) with their depth, and the camera's path, and says where a thing floats, two pass through each other, the camera lurches mid-move or nothing is on screen, as JSON for `raea check --things` with --json)";
pub const USAGE: &str = "raea fingerprint new NAME [--who W] [--about TEXT] [--extends FP] [--kinds K,K] [--tags T,T] | raea fingerprint bootstrap FILE... [--from LIST] [--per N] | raea fingerprint teach FILE --axis A --at T [--bad|--good] [--span S] [--box x0,y0,x1,y1] [--words W] [--project P] | raea fingerprint approve FILE... [--project P] | raea fingerprint pair WORSE BETTER --axis A [--at T] [--then T2] | raea fingerprint versions V1 V2... | raea fingerprint profile REFS... --as NAME [--against LIST] | raea fingerprint score FILE [--was OLD] [--ask flags|unsure] [--json] [--sheet out.png] [--timeline] [--profile NAME] | raea fingerprint report [--json] | raea fingerprint which [PATH] [--json] | raea fingerprint use NAME [--in project|workspace] [PATH] | raea fingerprint diff A B [--json] | raea fingerprint share NAME [--in project|workspace] [PATH] | raea fingerprint reembed PLACE... | raea fingerprint read PROJECT [--by kimi|claude] | raea fingerprint readings [PROJECT] [--ask N] [--tally] | raea fingerprint learn-notes [PROJECT] | raea fingerprint move [--fp CHILD] [--to PARENT] [--axis A] [--source S] [--project P] | raea fingerprint postmortem [PROJECT] [--ask N] [--tally] | raea fingerprint things FILE [--project P] [--json] | raea fingerprint stop [--fp NAME] (a person's sense of good work as axes with small heads over on-device encoders, docs/fingerprint.md: new makes ~/.raea/fingerprints/NAME with raea's base taxonomy in fingerprint.ts (or FP's axes with --extends), what it's for, the kinds of piece and project tags it judges, and every axis scoring from its words; bootstrap puts known defects into windows of real work and trains the mechanical axes, held out by source, and patch heads that say where in the frame a picture defect is; teach adds a label at a moment; approve makes approved work clean on every axis, away from its notes; pair says one moment is better than another on an axis (a pick, a hand edit); versions makes weak pairs of noted moments the next version changed; score prints the moments it expects a note on first (where in the frame, and the layers there, when its patch head points held out), then every axis per window with --json, a sheet PNG with --sheet, or the piece second by second in words with --timeline, and with --was OLD whether each of OLD's gating flags is fixed, still there, or looks disguised (nearer the axis's disguised defects than clean work), and with --ask flags each flag put to clef again on its own window, whether clef agrees said beside it and kept as clef's evidence (unsure: the moments it's unsure of too); profile takes the ranges of work you admire (loudness, tilt, cut rate, motion, brightness, contrast, saturation, sharpness), checked leave-one-out, and score --profile says what falls outside them, where and which way; report says each head's held-out score, labels, cheats, gate and what it can't judge; which says the one that judges a piece (its project's, its workspace's, then yours) and why, use pins one there, diff lists the axes two fingerprints rank the same evidence most differently on, and share copies one's taxonomy and evidence (no heads, no media) into a project or workspace for its team; reembed moves a fingerprint's evidence to this machine's encoders, re-embedding the rows whose media it finds; read has a fresh kimi or claude session read a project's pinned notes into kinds and axes, readings puts them to you to check and tallies your answers, and learn-notes makes the defects and praise evidence once you've agreed with 45 kinds and 40 axes in 50, each project's in the fingerprint that judges it; move takes a child's own labels (by axis, source or project) up into a fingerprint it extends, which never reads them otherwise; postmortem scores every version in a project's feed and asks you at most ten yes/no questions in the app, each with its moment playing, where the fingerprint disagrees with your labels or is least sure, and --tally makes your answers evidence and says how each head's held-out score moved; things finds a piece's shots, its things (a render's layers, and the marks drawn on its notes) with their depth, and the camera's path, and says where a thing floats, two pass through each other, the camera lurches mid-move or nothing is on screen, as JSON for `raea check --things` with --json)";
/// Evaluates a .ts file's default export to its JSON (the CLI's spec host)
pub type Eval = fn(&Path) -> Result<String, String>;
+14 -1
View File
@@ -303,6 +303,16 @@ fn scored(enc: &mut Encoders, args: &[String], cwd: &Path, eval: Eval) -> Result
let found = checks(&file);
arbitrate(&mut s, &fp, &found);
raea_sys_fingerprint_things::located::locate(enc, &file, &raea_sys_fingerprint_use::patch::load(&dir.dir), &mut s)?;
// AK8: each flag asked again of the decision model on its own window, the answers kept as clef's evidence
let doubles = match flag(args, "--ask").map(str::to_string).or_else(|| fp.ask.clone()) {
Some(which) => {
anyhow::ensure!(which == "flags" || which == "unsure", "--ask takes flags or unsure, not {which}");
let d = raea_app_double::ask(&file, &fp, raea_app_double::moments(&s, &fp, &which), &raea_app_double::Opts::new(4, false));
raea_app_double::keep(&dir, &c, &project_of(&file), &d).map_err(|e| anyhow!(e))?;
d
}
None => Vec::new(),
};
// FP9a: each gating flag on the cut before, judged on this one, and its axis's disguises rerun on the fix
let fixes = match flag(args, "--was") {
Some(old) => {
@@ -314,7 +324,7 @@ fn scored(enc: &mut Encoders, args: &[String], cwd: &Path, eval: Eval) -> Result
None => None,
};
let mut out = if has(args, "--json") {
serde_json::to_string_pretty(&json!({"fingerprint": {"name": fp.name, "about": fp.about, "why": why}, "scored": s, "checks": found.iter().map(|(r, a, b, says)| json!({"check": r, "a": a, "b": b, "says": says})).collect::<Vec<_>>(), "fixes": fixes}))?
serde_json::to_string_pretty(&json!({"fingerprint": {"name": fp.name, "about": fp.about, "why": why}, "scored": s, "clef": doubles, "checks": found.iter().map(|(r, a, b, says)| json!({"check": r, "a": a, "b": b, "says": says})).collect::<Vec<_>>(), "fixes": fixes}))?
} else if let Some(f) = &fixes {
let mut t = format!("judged by {}: {why}\n", fp.name);
t += &raea_sys_fingerprint_use::fixed::said(f);
@@ -323,6 +333,9 @@ fn scored(enc: &mut Encoders, args: &[String], cwd: &Path, eval: Eval) -> Result
} else {
let mut t = format!("judged by {}: {why}\n", fp.name);
t += &summary(&s);
if !doubles.is_empty() {
t += &raea_app_double::lines(&doubles);
}
t += &format!("checks: {}\n", if found.is_empty() { "no findings".to_string() } else { format!("{} findings", found.len()) });
for (r, a, _, says) in &found {
t += &format!(" {} {r}: {says}\n", clock(*a));
+8 -3
View File
@@ -32,6 +32,11 @@ pub const USAGE: &str = "raea export-game EDIT.tsx -o OUT [--target mac-app|mac-
/// `raea export-game EDIT.tsx -o OUT ...`
pub fn export(args: &[String]) -> R<String> {
// its targets are a Mac's, signed with codesign, and raea's Windows and Linux releases carry no game player: there
// it said "no player ... (build it: cargo build ...)", which a person can't act on
if !cfg!(target_os = "macos") {
return Err("raea export-game makes a Mac game (an .app or a command) and runs on a Mac; Windows and Linux games aren't there yet (sdk/react/docs/game-export.md)".into());
}
let usage = USAGE;
let tsx = PathBuf::from(args.get(1).filter(|a| !a.starts_with("--")).ok_or(usage)?);
let tsx = dunce::canonicalize(&tsx).map_err(|e| format!("{}: {e}", tsx.display()))?;
@@ -69,11 +74,11 @@ pub fn export(args: &[String]) -> R<String> {
}
};
if !player.exists() {
return Err(format!("no player at {} (build it: cargo build --profile game -p raea-app-game --bin raea-game --features player)", player.display()));
return Err(format!("no game player at {}: this raea ships without raea-game, which a game's export is made from; `raea bug \"export-game: no player\"` asks for it (docs/nobuild.feature NB3a)", player.display()));
}
// the release build's player is ~128 MB stripped, the game profile's ~74 MB (fat LTO, one codegen unit; lightspeed
// R7): say so when the bigger one ships because it's the newer
if !player.to_string_lossy().contains("/game/") && flag(args, "--player").is_none() {
// R7): say so when the bigger one ships because it's the newer, to a checkout's build (an installed raea has only its own)
if !player.to_string_lossy().contains("/game/") && player.to_string_lossy().contains("/target/") && flag(args, "--player").is_none() {
let mb = std::fs::metadata(&player).map(|m| m.len() as f64 / 1048576.0).unwrap_or(0.0);
eprintln!("raea export-game: shipping the release build's player ({mb:.0} MB before stripping): `cargo build --profile game -p raea-app-game --bin raea-game --features player` makes the ~74 MB one, which ships when it's the newer");
}
+3 -3
View File
@@ -13,6 +13,6 @@ raea-io-home = { path = "../../io/home" }
raea-core-facts = { path = "../../core/facts" }
serde_json = "1"
raea-runtime-bundle = { path = "../../runtime/bundle" }
ureq = { version = "2", features = ["json"] }
base64 = "0.22"
image = { version = "0.25", default-features = false, features = ["png", "jpeg"] }
# the one clef client: the question format and the call, routed to the person's plan first (docs/ask.feature AK1b)
raea-core-ask = { path = "../../core/ask" }
raea-io-clef = { path = "../../io/clef" }
-37
View File
@@ -1,37 +0,0 @@
//! One clef-omni call on Workers AI (as apps/app/host/critique.ts makes it): the state paragraph, the questions by id,
//! the images as data URLs (each made a JPEG at most 1600 px wide first). Keys: CLOUDFLARE_ACCOUNT_ID and
//! CLOUDFLARE_API_TOKEN from raea's settings (the environment, then ~/.raea/env).
use std::path::PathBuf;
use base64::Engine as _;
use serde_json::{Value, json};
fn jpeg(p: &PathBuf) -> Result<String, String> {
let img = image::open(p).map_err(|e| format!("{}: {e}", p.display()))?;
let img = if img.width() > 1600 { img.resize(1600, u32::MAX, image::imageops::FilterType::Triangle) } else { img };
let mut buf = std::io::Cursor::new(Vec::new());
img.to_rgb8().write_to(&mut buf, image::ImageFormat::Jpeg).map_err(|e| e.to_string())?;
Ok(format!("data:image/jpeg;base64,{}", base64::engine::general_purpose::STANDARD.encode(buf.into_inner())))
}
/// The answers by question id, and the call's cost in dollars ($0.15 a million input tokens).
pub fn ask(state: &str, questions: &Value, images: &[PathBuf]) -> Result<(Value, f64), String> {
let (Some(acct), Some(token)) = (raea_io_home::setting("CLOUDFLARE_ACCOUNT_ID"), raea_io_home::setting("CLOUDFLARE_API_TOKEN")) else {
return Err("judge: clef-omni on Workers AI needs CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (the environment or ~/.raea/env)".into());
};
let imgs: Vec<String> = images.iter().map(jpeg).collect::<Result<_, _>>()?;
let body = json!({"state": state, "questions": questions, "images": imgs});
let url = format!("https://api.cloudflare.com/client/v4/accounts/{acct}/ai/run/@cf/cloudflare/clef-omni");
let res = ureq::post(&url).set("authorization", &format!("Bearer {token}")).timeout(std::time::Duration::from_secs(180)).send_json(body);
let j: Value = match res {
Ok(r) => r.into_json().map_err(|e| format!("clef: {e}"))?,
Err(ureq::Error::Status(code, r)) => return Err(format!("clef: HTTP {code}: {}", r.into_string().unwrap_or_default().chars().take(300).collect::<String>())),
Err(e) => return Err(format!("clef: {e}")),
};
if j["success"] != true {
return Err(format!("clef: {}", j["errors"].to_string().chars().take(300).collect::<String>()));
}
let cost = j["result"]["usage"]["input_tokens"].as_f64().unwrap_or(0.0) * 0.15 / 1e6;
Ok((j["result"]["answers"].clone(), cost))
}
+12 -2
View File
@@ -10,7 +10,6 @@
//! each a fresh call) and the stall (the mean up by less than a point over two rounds) are read from it.
mod agent;
mod clef;
mod eye;
pub mod rubric;
@@ -24,6 +23,17 @@ use serde_json::{Value, json};
pub const USAGE: &str = "raea judge DIR [--by clef|kimi|claude] [--brief brief.ts] [--target T.png] [--json] [--dry] | judge eye DIR (CATEGORY=SCORE ... [--pass yes|no] | --by kimi|claude) | judge calibrate [--json] (a --review folder's sheets judged blind: clef-omni on the frozen rubric, or a fresh kimi or claude session on the judge prompt; the pass decided in code; clef advises until calibrated against your eye or an agent's)";
/// One call through raea's one clef client (raea-io-clef: the person's plan first, then their own Cloudflare keys),
/// with the rubric's questions as written and each sheet as a JPEG still.
fn ask(state: &str, questions: &Value, images: &[PathBuf]) -> Result<(Value, f64), String> {
let qs = questions.as_object().ok_or("judge: the questions aren't a map")?;
let questions = qs.iter().map(|(id, w)| raea_core_ask::Question::from_wire(id, w).ok_or(format!("judge: {id} isn't one of clef's question types"))).collect::<Result<_, _>>()?;
let stills = images.iter().map(|p| raea_io_clef::media::still(p, None)).collect::<Result<_, _>>()?;
let call = raea_io_clef::Call { state: state.into(), questions, media: raea_io_clef::Media { stills, ..Default::default() } };
let a = raea_io_clef::ask(&call).map_err(|f| f.to_string())?;
Ok((Value::Object(a.answers), a.cost))
}
/// The brief's words, from `raea spec brief.ts --as brief` (look, logline, notDoing), or nothing.
fn brief_of(path: Option<&str>) -> Result<Value, String> {
let Some(p) = path else { return Ok(json!({})) };
@@ -104,7 +114,7 @@ pub fn cli(args: &[String]) -> Result<String, String> {
let mut photo = Value::Null;
let mut cost = 0.0;
for (sheet, st, q, images) in &calls {
let (answers, c) = clef::ask(st, q, images)?;
let (answers, c) = ask(st, q, images)?;
cost += c;
if *sheet == "blind" {
photo = json!(answers["photo"]["noul"].as_f64().map(|p| (p * 1000.0).round() / 1000.0));
+1 -1
View File
@@ -63,7 +63,7 @@ fn numbered<'a>(project: &Path, notes: &'a [Kept]) -> Vec<(u32, &'a Kept, &'a ra
}
/// The notes' asks that have a check, each as a rule: the ask's id (n3.2) and words, its check (a .ts check's path
/// from the note's folder, as a controller's is from its own), its values, `by` the ask; and each note that can't be
/// from the note's folder, as a taste line's is from its file's), its values, `by` the ask; and each note that can't be
/// read, as a finding.
pub fn rules(project: &Path, notes: &[Kept]) -> (Vec<Rule>, Vec<Finding>) {
let bad = notes.iter().filter_map(|k| k.note.as_ref().err().map(|e| Finding::new("note", Level::Error, format!("raea can't read it: {e}"), "raea notes").about(k.file.display().to_string(), None))).collect();
+18
View File
@@ -0,0 +1,18 @@
[package]
name = "raea-app-scene"
version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
publish = false
description = "raea scene lint|explain|light|stage: a composition's frames stepped without drawing and held to the contact, light and stage checks"
[dependencies]
raea-runtime-bundle = { path = "../../runtime/bundle" }
raea-runtime-export = { path = "../../runtime/export" }
raea-sys-contact = { path = "../../systems/contact" }
raea-sys-light-meter = { path = "../../systems/light-meter" }
raea-sys-stage = { path = "../../systems/stage" }
# its results as Findings (docs/direction.feature DR3)
raea-core-facts = { path = "../../core/facts" }
dunce = "1"
serde_json = "1"
+59
View File
@@ -0,0 +1,59 @@
//! `raea scene lint|explain|light|stage`: a composition's frames stepped without drawing and handed to raea-sys-contact
//! (what each part rests on, and parts that clip), raea-sys-light-meter (the light on a subject) and raea-sys-stage (3D
//! type that can't be read, parts that snap, a camera that lurches, empty frames: docs/stage-guards.feature).
use serde_json::json;
use raea_runtime_bundle::{bundle_composition, comp_opts};
use raea_runtime_export::{frame_of, items};
mod light;
mod stage;
pub const USAGE: &str = "raea scene lint|explain|light|stage EDIT.tsx [--composition ID] [--frame N] [--part NAME] [--from N] [--to N] [--json]";
/// `raea scene lint|explain EDIT.tsx [--composition ID] [--frame N] [--json]`: the frame's parts measured
/// (frame 0 by default). `lint` says the faults (errors fail it: floating, sunk, clipping; warnings: in the air,
/// tilted); `explain` says what every part rests on. --json prints the findings (each part's support, gap and the y
/// that fixes it) instead. `light` and `stage` are light.rs's and stage.rs's.
pub fn cli(args: &[String]) -> Result<String, String> {
let usage = USAGE;
let (Some(mode), Some(edit)) = (args.get(1).map(String::as_str), args.get(2)) else { return Err(usage.into()) };
match mode {
"light" => return light::cli(args),
"stage" => return stage::cli(args),
"lint" | "explain" => {}
_ => return Err(usage.into()),
}
let tsx = dunce::canonicalize(&std::path::PathBuf::from(edit)).map_err(|e| format!("{edit}: {e}"))?;
let dir = tsx.parent().unwrap().to_path_buf();
let frame = frame_of(args)?;
let js = std::env::temp_dir().join(format!("raea-scene-{}.js", std::process::id()));
bundle_composition(&tsx, &js, &comp_opts(args)?, None)?;
// and the frame after it, to see what moves
let got = raea_runtime_export::scene_frames(&js, &dir, frame + 2, false, &[frame, frame + 1]);
let _ = std::fs::remove_file(&js);
let (frames, ..) = got?.ok_or("the composition has no 3D")?;
let k = frames.iter().position(|(f, _)| *f == frame).ok_or_else(|| format!("no frame {frame}"))?;
// the frame, and the next (or the one before, at the end) to see what moves
let other = if k + 1 < frames.len() { k + 1 } else { k.saturating_sub(1) };
let (mut found, errors) = raea_sys_contact::lint(&items(&frames[k].1), &items(&frames[other].1));
// and the Blender steps its models call for (a format raea can't load, triangles over budget for the distance)
let (more, unloadable) = raea_sys_contact::assets(&items(&frames[k].1));
found.extend(more);
let (errors, json_out) = (errors + unloadable, args.iter().any(|a| a == "--json"));
let parts = found.iter().filter(|v| v["check"] != "clips" && v["check"] != "tilted" && v["check"] != "skipped").count();
if mode == "lint" {
// its faults as Findings (DR3), worst first, every one shown, the count last; errors fail it, with nothing after
let fs = raea_core_facts::finding::ranked(raea_sys_contact::lint_findings(&found, frame, "raea scene lint"));
let text = if json_out { serde_json::to_string_pretty(&json!({"frame": frame, "findings": fs})).unwrap_or_default() } else { fs.iter().map(raea_core_facts::Finding::line).chain([format!("frame {frame}: {parts} parts; {}", raea_core_facts::finding::count(&fs))]).collect::<Vec<_>>().join("\n") };
if errors > 0 {
println!("{text}");
std::process::exit(1);
}
return Ok(text);
}
// explain: every part's support
let t: Vec<String> = found.iter().map(|v| format!("{:<8} {}", v["level"].as_str().unwrap_or(""), v["says"].as_str().unwrap_or(""))).collect();
Ok(if json_out { serde_json::to_string_pretty(&json!({"frame": frame, "errors": errors, "found": found})).unwrap_or_default() } else { format!("{}\nframe {frame}: {parts} parts, {errors} errors", t.join("\n")) })
}
+58
View File
@@ -0,0 +1,58 @@
//! `raea scene light`: the light on a shot's subject, metered (raea-sys-light-meter; docs/scene.feature, "A light plan").
use serde_json::{Value, json};
use raea_runtime_bundle::{bundle_composition, comp_opts, flag};
use raea_runtime_export::{Frame, all_items, scene_frames_to};
/// One composition's frames, stepped.
fn frames_of(args: &[String], tsx: &std::path::Path, comp: &str) -> Result<(Vec<(i64, Frame)>, f32), String> {
let dir = tsx.parent().unwrap().to_path_buf();
let mut opts = comp_opts(args)?;
opts.composition = Some(comp.to_string()).filter(|c| !c.is_empty());
let js = std::env::temp_dir().join(format!("raea-light-{}-{comp}.js", std::process::id()));
bundle_composition(tsx, &js, &opts, None)?;
let got = scene_frames_to(&js, &dir, 1);
let _ = std::fs::remove_file(&js);
let (frames, w, h, _) = got?.ok_or("the composition has no 3D")?;
Ok((frames, w as f32 / h.max(1) as f32))
}
/// `raea scene light`: the light on a shot's subject, metered (raea-sys-light-meter; docs/scene.feature, "A light plan").
pub(crate) fn cli(args: &[String]) -> Result<String, String> {
let usage = "raea scene light EDIT.tsx [--composition ID[,ID...]] [--frame N|last] [--part NAME] [--json]";
let Some(edit) = args.get(2) else { return Err(usage.into()) };
let tsx = dunce::canonicalize(&std::path::PathBuf::from(edit)).map_err(|e| format!("{edit}: {e}"))?;
let flag = |k: &str| flag(args, k);
let comps: Vec<String> = flag("--composition").map(|c| c.split(',').map(str::to_string).collect()).unwrap_or_else(|| vec![String::new()]);
let part = flag("--part");
let json_out = args.iter().any(|a| a == "--json");
let pick = |frames: &[(i64, Frame)], which: &str| -> Result<usize, String> {
match which {
"last" => Ok(frames.len() - 1),
f => {
let f: i64 = f.parse().map_err(|_| "--frame takes a frame number or last")?;
frames.iter().position(|(n, _)| *n == f).ok_or_else(|| format!("no frame {f}"))
}
}
};
let mut shots: Vec<(String, Vec<(i64, Value)>)> = Vec::new();
for c in &comps {
let (frames, aspect) = frames_of(args, &tsx, c)?;
let all = all_items(&frames);
// one composition: the frame asked for; a sequence: each shot's first and last, for its cuts
let at: Vec<usize> = if comps.len() == 1 { vec![pick(&frames, flag("--frame").as_deref().unwrap_or("0"))?] } else { vec![0, frames.len() - 1] };
let mut m = Vec::new();
for k in at {
m.push((frames[k].0, raea_sys_light_meter::meter(&all[k], part.as_deref(), aspect).map_err(|e| format!("{c} frame {}: {e}", frames[k].0))?));
}
shots.push((c.clone(), m));
}
let cuts = raea_sys_light_meter::cuts(&shots);
if json_out {
let shots: Vec<Value> = shots.iter().map(|(c, m)| json!({"composition": c, "frames": m.iter().map(|(f, v)| json!({"frame": f, "meter": v})).collect::<Vec<_>>()})).collect();
return Ok(serde_json::to_string_pretty(&json!({"shots": shots, "cuts": cuts, "findings": raea_sys_light_meter::cut_findings(&cuts)})).unwrap_or_default());
}
// each shot's meter, each cut, and the cuts' jumps and drifts as Findings (DR3), counted last
Ok(raea_sys_light_meter::report(&shots, &cuts))
}
+38
View File
@@ -0,0 +1,38 @@
//! `raea scene stage EDIT.tsx [--composition ID] [--from N] [--to N] [--json]`: every frame's scene stepped without
//! drawing and held to the stage checks a render runs at its end (raea-sys-stage, docs/stage-guards.feature SG10-SG14):
//! 3D type that can't be read, parts that snap, a camera that lurches or reverses, frames with nothing composed in
//! them. Errors fail it, as they fail a render, so it's the cheap look before one.
use serde_json::json;
use raea_core_facts::{Level, finding};
use raea_runtime_bundle::{bundle_composition, comp_opts, flag};
use raea_runtime_export::{all_items, scene_frames_to};
pub(crate) fn cli(args: &[String]) -> Result<String, String> {
let usage = "raea scene stage EDIT.tsx [--composition ID] [--from N] [--to N] [--json]";
let Some(edit) = args.get(2) else { return Err(usage.into()) };
let tsx = dunce::canonicalize(&std::path::PathBuf::from(edit)).map_err(|e| format!("{edit}: {e}"))?;
let dir = tsx.parent().unwrap().to_path_buf();
let frame = |k: &str| flag(args, k).map(|v| v.parse::<i64>().map_err(|_| format!("{k} takes a frame number"))).transpose();
let (from, to) = (frame("--from")?.unwrap_or(0), frame("--to")?);
let js = std::env::temp_dir().join(format!("raea-stage-{}.js", std::process::id()));
bundle_composition(&tsx, &js, &comp_opts(args)?, None)?;
let got = scene_frames_to(&js, &dir, 1);
let _ = std::fs::remove_file(&js);
let (frames, w, h, fps) = got?.ok_or("the composition has no 3D")?;
let frames: Vec<_> = frames.into_iter().filter(|(f, _)| *f >= from && to.is_none_or(|t| *f <= t)).collect();
let (Some(first), Some(last)) = (frames.first().map(|f| f.0), frames.last().map(|f| f.0)) else { return Err(format!("no frames from {from}")) };
let nums: Vec<i64> = frames.iter().map(|(f, _)| *f).collect();
let fs = raea_sys_stage::check(&all_items(&frames), &nums, w, h, fps, "raea scene stage");
let text = if args.iter().any(|a| a == "--json") {
serde_json::to_string_pretty(&json!({"frames": [first, last], "findings": fs})).unwrap_or_default()
} else {
fs.iter().map(raea_core_facts::Finding::line).chain([format!("frames {first} to {last}: {}", finding::count(&fs))]).collect::<Vec<_>>().join("\n")
};
if fs.iter().any(|f| f.level == Level::Error) {
println!("{text}");
std::process::exit(1);
}
Ok(text)
}
+1
View File
@@ -16,6 +16,7 @@ serde_json = "1"
raea-runtime-bundle = { path = "../../runtime/bundle" }
# `raea judge`, dispatched with `raea solid` (verb())
raea-app-judge = { path = "../judge" }
raea-app-ask = { path = "../ask" }
# `raea solid export`: the solid built, written as .glb and read back (core/shape), named and coloured (core/meshcheck)
raea-core-shape = { path = "../../core/shape" }
raea-core-meshcheck = { path = "../../core/meshcheck" }
+3 -1
View File
@@ -91,11 +91,13 @@ fn parse_set(s: &str) -> Result<Map<String, Value>, String> {
Ok(m)
}
/// `raea solid ...` and `raea judge ...`, the scene loop's verbs (engine/cli hands them over), or None for another verb.
/// `raea solid ...`, `raea judge ...` and `raea ask ...` (docs/ask.feature AK3, which prints as it goes and exits with
/// its own code), the verbs that build and judge a piece (engine/cli hands them over), or None for another verb.
pub fn verb(args: &[String]) -> Option<Result<String, String>> {
match args.first().map(String::as_str) {
Some("solid") => Some(cli(args)),
Some("judge") => Some(raea_app_judge::cli(args)),
Some("ask") => std::process::exit(raea_app_ask::cli(&args[1..])),
_ => None,
}
}
+1 -1
View File
@@ -56,7 +56,7 @@ pub fn song(args: &[String]) -> R<String> {
}
let bin = raea_io_assets::perceive_bin();
if !bin.is_file() {
return Err("song: the map is made by raea-perceive, which isn't installed beside raea. Update raea (`curl -fsSL https://raea.io/install | sh`: releases ship it in ~/.raea/bin), or from a checkout `cargo build --release -p raea-perceive`, or point RAEA_PERCEIVE at one".into());
return Err("song: the map is made by raea-perceive, which isn't installed beside raea. Update raea (`curl -fsSL https://raea.io/install | sh`: releases ship it in ~/.raea/bin), or point RAEA_PERCEIVE at one".into());
}
// its beat model (Beat This!, MIT): an install keeps it in share/raea/models; raea-perceive reads it from
// raea_io_home::models() (~/.local/share/raea-models; %LOCALAPPDATA%\raea\models on Windows)
+2 -4
View File
@@ -4,17 +4,15 @@ version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
publish = false
description = "`raea workspace`, `raea project` and `raea controller`: a workspace's folders, projects and controllers, each change a commit"
description = "`raea workspace` and `raea project`: a workspace's folders and projects, each change a commit"
[dependencies]
dunce = "1"
# the controller schema (core/brief controller.rs): a controller file is checked and normalized against it
raea-core-brief = { path = "../../core/brief" }
raea-io-home = { path = "../../io/home" }
# git, which a workspace is: the PATH's, else on Windows the app's or raea's own (raea_io_assets::git)
raea-io-assets = { path = "../../io/assets" }
serde_json = "1"
# a project's compositions, components and controllers read from their source (docs/projects.feature PJ8)
# a project's compositions and components read from their source (docs/projects.feature PJ8)
raea-app-registry = { path = "registry" }
# the project's record of what renders and checks found, which raea next reads (docs/direction.feature DR3)
raea-core-facts = { path = "../../core/facts" }
+1 -1
View File
@@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2024"
license = "FSL-1.1-ALv2"
publish = false
description = "A raea project's compositions, components and controllers, read from their source without running it, and lint for what isn't connected (docs/projects.feature PJ8)"
description = "A raea project's compositions and components, read from their source without running it, and lint for what isn't connected (docs/projects.feature PJ8)"
[dependencies]
dunce = "1"
+16 -33
View File
@@ -1,13 +1,11 @@
//! A project's compositions, components and controllers, registered by reading its files (docs/projects.feature PJ8),
//! A project's compositions and components, registered by reading its files (docs/projects.feature PJ8),
//! so the raea app, `raea project scan`, `raea doctor` and `raea next` agree on what each file is:
//! - a composition is each <Composition> a registerRoot registers (its props read from the source, not rendered), or a
//! .tsx's default export with none that no other file imports, registered for it under its file's name (versions
//! NAME-vN.tsx are one composition), sized from its newest render's manifest when it has one;
//! - a component is a .tsx a composition imports, directly or through another;
//! - a controller is a module whose default export is `controller({...})` from "raea/brief".
//! What isn't connected is linted (lint.rs), each with its file and line and the fix. raea-app-workspace wraps `scan`
//! with the project's controller overrides (read from .raea/project's git config) and runs it for `raea project scan`,
//! `raea doctor`, `raea next` and `raea context`.
//! - a component is a .tsx a composition imports, directly or through another.
//! What isn't connected is linted (lint.rs), each with its file and line and the fix. raea-app-workspace runs `scan`
//! for `raea project scan`, `raea doctor`, `raea next` and `raea context`.
use std::collections::{BTreeMap, BTreeSet};
use std::path::{Path, PathBuf};
@@ -22,9 +20,9 @@ pub use read::{Facts, Prop};
/// The nearest folder at or above a path that holds a marker (.raea/workspace, .raea/project), as the record finds it.
pub use raea_core_facts::record::up;
/// The workspace's shared folder of one kind (docs/layout.feature: shared/compositions, components, controllers, assets,
/// artifacts), which every project can call on as @shared/<kind>/. A workspace from before shared/ keeps that kind at
/// its root (controllers/, artifacts/) until `raea workspace tidy` moves it, and it's read there meanwhile.
/// The workspace's shared folder of one kind (docs/layout.feature: shared/compositions, components, assets, artifacts),
/// which every project can call on as @shared/<kind>/. A workspace from before shared/ keeps that kind at its root
/// (artifacts/) until `raea workspace tidy` moves it, and it's read there meanwhile.
pub fn shared_dir(ws: &Path, kind: &str) -> PathBuf {
let old = ws.join(kind);
if !ws.join("shared").is_dir() && old.is_dir() {
@@ -33,7 +31,7 @@ pub fn shared_dir(ws: &Path, kind: &str) -> PathBuf {
ws.join("shared").join(kind)
}
/// A name as a folder: lowercase, dashes. A controller's id from its title is this (core/brief fills it the same way).
/// A name as a folder: lowercase, dashes.
pub fn slug(s: &str) -> String {
let mut out = String::new();
for c in s.trim().to_lowercase().chars() {
@@ -82,13 +80,6 @@ pub struct Component {
pub used_by: Vec<String>,
}
#[derive(Debug, Clone)]
pub struct Controller {
pub id: Option<String>,
pub file: String,
pub line: usize,
}
#[derive(Debug)]
pub struct Registry {
pub dir: PathBuf,
@@ -96,7 +87,6 @@ pub struct Registry {
pub project: bool,
pub compositions: Vec<Composition>,
pub components: Vec<Component>,
pub controllers: Vec<Controller>,
pub lint: Vec<Lint>,
}
@@ -180,9 +170,8 @@ fn manifest(path: &Path) -> Option<Value> {
serde_json::from_str(&std::fs::read_to_string(f).ok()?).ok()
}
/// The folder's registry. `overridden`: the controller ids the project's overrides name, each checked against the
/// controllers there (the folder's and its workspace's controllers/).
pub fn scan(dir: &Path, overridden: &[String]) -> Registry {
/// The folder's registry.
pub fn scan(dir: &Path) -> Registry {
let dir = dunce::canonicalize(dir).unwrap_or_else(|_| dir.to_path_buf());
let project = up(&dir, ".raea/project").is_some();
let mut found = Vec::new();
@@ -243,10 +232,9 @@ pub fn scan(dir: &Path, overridden: &[String]) -> Registry {
.filter(|f| f.rel.ends_with(".tsx") && !comp_files.contains(f.rel.as_str()) && used_by.contains_key(&f.rel))
.map(|f| Component { file: f.rel.clone(), used_by: used_by[&f.rel].iter().cloned().collect() })
.collect();
let controllers = files.iter().filter_map(|f| f.facts.controller.as_ref().map(|c| Controller { id: c.id.clone(), file: f.rel.clone(), line: c.line })).collect();
let mut reg = Registry { dir, project, compositions, components, controllers, lint: Vec::new() };
reg.lint = lint::lint(&reg, &files, &used_by, overridden);
let mut reg = Registry { dir, project, compositions, components, lint: Vec::new() };
reg.lint = lint::lint(&reg, &files, &used_by);
reg
}
@@ -280,13 +268,12 @@ impl Registry {
"component": c.component, "width": p(&c.width), "height": p(&c.height), "fps": p(&c.fps), "frames": p(&c.frames),
})).collect::<Vec<_>>(),
"components": self.components.iter().map(|c| json!({ "file": c.file, "usedBy": c.used_by })).collect::<Vec<_>>(),
"controllers": self.controllers.iter().map(|c| json!({ "id": c.id, "file": c.file, "line": c.line })).collect::<Vec<_>>(),
"findings": self.lint.iter().map(Lint::finding).collect::<Vec<_>>(),
})
}
/// For an agent (`raea context`): each composition with its id, file, size, fps and length, the components and
/// controllers, and what isn't connected (its warnings, at most ten; the notes are `raea project scan`'s).
/// For an agent (`raea context`): each composition with its id, file, size, fps and length, the components, and
/// what isn't connected (its warnings, at most ten; the notes are `raea project scan`'s).
pub fn summary(&self) -> String {
let p = |v: &Option<Prop>| match v {
Some(Prop::Num(n)) => format!("{n}"),
@@ -304,9 +291,6 @@ impl Registry {
if !self.components.is_empty() {
out.push_str(&format!("components: {}\n", self.components.iter().map(|c| c.file.as_str()).collect::<Vec<_>>().join(", ")));
}
if !self.controllers.is_empty() {
out.push_str(&format!("controllers: {}\n", self.controllers.iter().map(|c| format!("{} ({})", c.id.as_deref().unwrap_or("?"), c.file)).collect::<Vec<_>>().join(", ")));
}
let warn: Vec<&Lint> = self.warnings().collect();
if !warn.is_empty() {
out.push_str(&format!("\nnot connected ({}; raea doctor --fix fixes what it can):\n", warn.len()));
@@ -321,11 +305,10 @@ impl Registry {
/// each about its file:line with the fix, and their count last.
pub fn text(&self) -> String {
let mut out = format!(
"{}: {} compositions, {} components, {} controllers",
"{}: {} compositions, {} components",
self.dir.display(),
self.compositions.len(),
self.components.len(),
self.controllers.len()
self.components.len()
);
for c in &self.compositions {
out.push_str(&format!("\n composition {} ({}:{}{})", c.id, c.file, c.line, if c.how == How::Default { ", its default export" } else { "" }));
+3 -61
View File
@@ -20,8 +20,6 @@ pub enum Level {
pub enum Fix {
/// registers a default export: an import line at the top (when one is missing) and a registerRoot at the end
Register { file: PathBuf, import: Option<String>, root: String },
/// a controller moved to the workspace's (or the project's) controllers/
Move { from: PathBuf, to: PathBuf },
}
#[derive(Debug, Clone)]
@@ -66,13 +64,12 @@ fn warn(file: &str, line: usize, rule: &'static str, says: String, fix: impl Int
Lint { file: file.into(), line, rule, level: Level::Warn, says, fix: fix.into(), action: None }
}
pub(super) fn lint(reg: &Registry, files: &[File], used_by: &BTreeMap<String, BTreeSet<String>>, overridden: &[String]) -> Vec<Lint> {
pub(super) fn lint(reg: &Registry, files: &[File], used_by: &BTreeMap<String, BTreeSet<String>>) -> Vec<Lint> {
let mut out = Vec::new();
if !reg.project && !(reg.compositions.is_empty() && reg.controllers.is_empty()) {
if !reg.project && !reg.compositions.is_empty() {
out.push(warn("", 0, "not-a-project", "this folder isn't in a raea project (no .raea/project at or above it)".into(), "raea project new NAME and move the files in, or raea workspace adopt the folder"));
}
let comp_files: BTreeSet<&str> = reg.compositions.iter().map(|c| c.file.as_str()).collect();
let controller_files: BTreeSet<&str> = reg.controllers.iter().map(|c| c.file.as_str()).collect();
// the workspace's shared/, which a project reaches as @shared/
let shared = super::up(&reg.dir, ".raea/workspace").map(|w| {
let s = w.join("shared");
@@ -89,7 +86,7 @@ pub(super) fn lint(reg: &Registry, files: &[File], used_by: &BTreeMap<String, BT
out.push(Lint { file: f.rel.clone(), line: 1, rule: "computed-root", level: Level::Info, says: "registers its root through code the scan doesn't follow (a helper that makes its <Composition>s), so its compositions aren't listed".into(), fix: "known when it renders; write each <Composition> inside registerRoot to have them listed before".into(), action: None });
}
// a .tsx that is neither a composition nor reached from one
if f.rel.ends_with(".tsx") && !f.facts.roots && !comp_files.contains(f.rel.as_str()) && !used_by.contains_key(&f.rel) && !controller_files.contains(f.rel.as_str()) {
if f.rel.ends_with(".tsx") && !f.facts.roots && !comp_files.contains(f.rel.as_str()) && !used_by.contains_key(&f.rel) {
out.push(warn(&f.rel, 1, "orphan", "isn't a composition, and no composition imports it".into(), "register it (a default export or a registerRoot <Composition>), import it from a composition, or delete it"));
}
for (spec, line) in f.facts.imports.iter().filter(|(s, _)| is_path(s)) {
@@ -197,54 +194,6 @@ pub(super) fn lint(reg: &Registry, files: &[File], used_by: &BTreeMap<String, BT
}
}
// controllers: where they're kept, one id each, and every override naming one that's there
let ws = super::up(&reg.dir, ".raea/workspace");
// a project keeps its own (its controllers/); the workspace's own folder keeps the shared ones (docs/layout.feature LY3)
let home = match &ws {
Some(w) if w != &reg.dir => reg.dir.join("controllers"),
Some(w) => super::shared_dir(w, "controllers"),
None => reg.dir.join("controllers"),
};
let mut ids: BTreeMap<String, Vec<&str>> = BTreeMap::new();
for c in &reg.controllers {
let f = files.iter().find(|f| f.rel == c.file).expect("a controller's file was read");
if let Some(id) = &c.id {
ids.entry(id.clone()).or_default().push(&c.file);
}
let in_home = f.path.parent().and_then(Path::file_name).is_some_and(|n| n == "controllers");
if !in_home {
let id = c.id.clone().unwrap_or_else(|| stem(&c.file));
let to = home.join(format!("{id}.ts"));
out.push(Lint {
file: c.file.clone(),
line: c.line,
rule: "controller-home",
level: Level::Warn,
says: "a controller outside controllers/: `raea controller` and the app don't read it".into(),
fix: format!("move it to {}", to.display()),
action: (!to.exists()).then(|| Fix::Move { from: f.path.clone(), to }),
});
}
}
for (id, at) in ids.iter().filter(|(_, at)| at.len() > 1) {
for f in at {
out.push(warn(f, 1, "controller-duplicate", format!("controller \"{id}\" is declared in {} files", at.len()), "keep one: the others' fields override nothing"));
}
}
// the workspace's controllers too, read the same way, for overrides naming them
let mut known: BTreeSet<String> = ids.keys().cloned().collect();
for e in std::fs::read_dir(&home).into_iter().flatten().flatten() {
let src = std::fs::read_to_string(e.path()).unwrap_or_default();
if let Some(id) = super::read::read(&src, false).controller.and_then(|c| c.id) {
known.insert(id);
}
}
let mut named = BTreeSet::new();
for id in overridden {
if !known.contains(id) && named.insert(id.clone()) {
out.push(warn(".raea/project", 0, "override-missing", format!("overrides controller \"{id}\", which isn't there"), format!("raea controller ls lists the ones there; remove the override with git config --file .raea/project --remove-section controller.{id}")));
}
}
out
}
@@ -257,12 +206,5 @@ pub fn apply(fix: &Fix) -> Result<String, String> {
std::fs::write(file, text).map_err(|e| format!("{}: {e}", file.display()))?;
Ok(format!("registered {}", file.display()))
}
Fix::Move { from, to } => {
if let Some(d) = to.parent() {
std::fs::create_dir_all(d).map_err(|e| e.to_string())?;
}
std::fs::rename(from, to).map_err(|e| format!("{}: {e}", from.display()))?;
Ok(format!("moved {} to {}", from.display(), to.display()))
}
}
}
+2 -42
View File
@@ -1,8 +1,7 @@
//! What one .tsx or .ts file declares, read from its source without running it (docs/projects.feature PJ8): the
//! compositions its registerRoot registers, each <Composition>'s id, component, size, fps and length (a value written
//! out, or the expression that computes it); its default export; what it imports; and whether its default export is a
//! controller (`export default controller({...})` from "raea/brief"). A prop written as a top-level constant, or simple
//! arithmetic on them (`const FPS = 30; … durationInFrames={15 * FPS}`), is read as its value.
//! out, or the expression that computes it); its default export; and what it imports. A prop written as a top-level
//! constant, or simple arithmetic on them (`const FPS = 30; … durationInFrames={15 * FPS}`), is read as its value.
use oxc::allocator::Allocator;
use oxc::ast::ast::*;
use oxc::ast_visit::{Visit, walk};
@@ -43,13 +42,6 @@ pub struct Registered {
pub frames: Option<Prop>,
}
/// A controller the file's default export declares: its id (written, else from its title), at a line.
#[derive(Debug, Clone)]
pub struct Declared {
pub line: usize,
pub id: Option<String>,
}
#[derive(Debug, Default)]
pub struct Facts {
pub registered: Vec<Registered>,
@@ -57,7 +49,6 @@ pub struct Facts {
pub default: Option<Option<String>>,
/// each import or re-export's module, at its line
pub imports: Vec<(String, usize)>,
pub controller: Option<Declared>,
/// the names it imports from "raea" (a fix that registers its default export adds only what's missing)
pub raea_names: Vec<String>,
/// why it didn't parse (the first diagnostic), when it didn't
@@ -78,7 +69,6 @@ pub fn read(source: &str, tsx: bool) -> Facts {
f.broken = Some(d.to_string());
return f;
}
let mut controller_fn = None;
for s in &parsed.program.body {
match s {
Statement::ImportDeclaration(d) => {
@@ -86,15 +76,6 @@ pub fn read(source: &str, tsx: bool) -> Facts {
if d.source.value == "raea" {
f.raea_names.extend(d.specifiers.iter().flatten().map(|sp| sp.local().name.to_string()));
}
if d.source.value == "raea/brief" {
for sp in d.specifiers.iter().flatten() {
if let ImportDeclarationSpecifier::ImportSpecifier(x) = sp
&& x.imported.name() == "controller"
{
controller_fn = Some(sp.local().name.to_string());
}
}
}
}
Statement::ExportFromDeclaration(d) => f.imports.push((d.source.value.to_string(), line(d.span.start))),
Statement::ExportAllDeclaration(d) => f.imports.push((d.source.value.to_string(), line(d.span.start))),
@@ -110,12 +91,6 @@ pub fn read(source: &str, tsx: bool) -> Facts {
ExportDefaultDeclarationKind::Identifier(x) => Some(x.name.to_string()),
_ => None,
});
if let ExportDefaultDeclarationKind::CallExpression(c) = &d.declaration
&& let Expression::Identifier(callee) = &c.callee
&& controller_fn.as_deref() == Some(callee.name.as_str())
{
f.controller = Some(Declared { line: line(d.span.start), id: controller_id(c) });
}
}
_ => {}
}
@@ -130,21 +105,6 @@ pub fn read(source: &str, tsx: bool) -> Facts {
f
}
/// A controller's id as written, else from its title (core/brief fills an id in from the title the same way).
fn controller_id(c: &CallExpression) -> Option<String> {
let Some(Argument::ObjectExpression(o)) = c.arguments.first() else { return None };
let text = |key: &str| {
o.properties.iter().find_map(|p| match p {
ObjectPropertyKind::ObjectProperty(p) if p.key.static_name().as_deref() == Some(key) => match &p.value {
Expression::StringLiteral(s) => Some(s.value.to_string()),
_ => None,
},
_ => None,
})
};
text("id").or_else(|| text("title").map(|t| super::slug(&t)))
}
/// The file's top-level numeric constants, in order: `const FPS = 30`, `const DUR = 15 * FPS`, and an object constant's
/// numeric properties as `NAME.prop` (`const edit = { fps: 30 }`).
fn consts(p: &Program) -> HashMap<String, f64> {
+16 -29
View File
@@ -1,4 +1,4 @@
//! PJ8: a project's files read as compositions, components and controllers, and what isn't connected linted.
//! PJ8: a project's files read as compositions and components, and what isn't connected linted.
use super::*;
fn project() -> (tempdir::Dir, PathBuf) {
@@ -21,8 +21,6 @@ fn project() -> (tempdir::Dir, PathBuf) {
w("bare.render.json", "{\"width\": 1080, \"height\": 1080, \"fps\": 30, \"frames\": [{}, {}, {}]}");
w("anon.tsx", "export default () => <div />;\n");
w("broken.tsx", "export default function (\n");
w("controllers/delivery.ts", "import { controller } from \"raea/brief\";\nexport default controller({ id: \"delivery\", title: \"Delivery\", groups: [] });\n");
w("settings/look.ts", "import { controller } from \"raea/brief\";\n\nexport default controller({ title: \"Look and feel\", groups: [] });\n");
std::fs::write(t.0.join("outside.tsx"), "export const far = 1;\n").unwrap();
(t, p)
}
@@ -46,9 +44,9 @@ mod tempdir {
}
#[test]
fn compositions_components_and_controllers_are_read_from_the_files() {
fn compositions_and_components_are_read_from_the_files() {
let (_t, p) = project();
let r = scan(&p, &[]);
let r = scan(&p);
assert!(r.project);
let comps: Vec<(&str, &str, How)> = r.compositions.iter().map(|c| (c.id.as_str(), c.file.as_str(), c.how)).collect();
assert!(comps.contains(&("promo", "promo.tsx", How::Registered)));
@@ -65,14 +63,12 @@ fn compositions_components_and_controllers_are_read_from_the_files() {
// card is imported by promo, glyph through card (a default export, but imported): both components, used by promo
let comps: Vec<(&str, Vec<&str>)> = r.components.iter().map(|c| (c.file.as_str(), c.used_by.iter().map(String::as_str).collect())).collect();
assert_eq!(comps, [("card.tsx", vec!["promo.tsx"]), ("lib/glyph.tsx", vec!["promo.tsx"])]);
let ctl: Vec<(Option<&str>, &str)> = r.controllers.iter().map(|c| (c.id.as_deref(), c.file.as_str())).collect();
assert_eq!(ctl, [(Some("delivery"), "controllers/delivery.ts"), (Some("look-and-feel"), "settings/look.ts")]);
}
#[test]
fn what_isnt_connected_is_linted_with_its_place_and_fix() {
let (_t, p) = project();
let r = scan(&p, &[]);
let r = scan(&p);
let has = |rule: &str, file: &str, line: usize| r.lint.iter().any(|l| l.rule == rule && l.file == file && l.line == line);
assert!(has("orphan", "stray.tsx", 1));
assert!(!r.lint.iter().any(|l| l.rule == "orphan" && ["card.tsx", "lib/glyph.tsx", "promo.tsx"].contains(&l.file.as_str())));
@@ -83,8 +79,6 @@ fn what_isnt_connected_is_linted_with_its_place_and_fix() {
assert!(has("duplicate-id", "teaser.tsx", 4));
assert!(r.lint.iter().filter(|l| l.rule == "duplicate-id").all(|l| l.says.contains("teaser") || l.file == "teaser.tsx"));
assert!(has("computed", "promo.tsx", 5));
assert!(has("controller-home", "settings/look.ts", 3));
assert!(!r.lint.iter().any(|l| l.file == "controllers/delivery.ts"));
// a default export with a render is registered by --fix; a nameless one says how
let bare = r.lint.iter().find(|l| l.rule == "unregistered" && l.file == "bare.tsx").unwrap();
assert!(bare.action.is_some());
@@ -94,44 +88,37 @@ fn what_isnt_connected_is_linted_with_its_place_and_fix() {
assert!(!r.lint.iter().any(|l| l.rule == "orphan" && l.file == "shots.tsx"));
assert!(has("computed-root", "shots.tsx", 1));
// as Findings (DR3): about the file at its line, a fix --fix applies saying so, the count last
let home = r.lint.iter().find(|l| l.rule == "controller-home").unwrap().finding();
assert_eq!((home.about[0].key.as_deref(), home.fix.as_deref().map(|f| f.starts_with("raea doctor --fix does it: move it to"))), (Some("settings/look.ts:3"), Some(true)));
let stray = r.lint.iter().find(|l| l.rule == "orphan" && l.file == "stray.tsx").unwrap().finding();
assert_eq!((stray.about[0].key.as_deref(), stray.fix.as_deref().map(|f| f.starts_with("register it"))), (Some("stray.tsx:1"), Some(true)));
let bare = bare.finding();
assert_eq!((bare.about[0].key.as_deref(), bare.fix.as_deref().map(|f| f.starts_with("raea doctor --fix registers it"))), (Some("bare.tsx:1"), Some(true)), "a fix --fix applies says so");
assert!(r.text().lines().last().unwrap().starts_with("raea project scan: 0 errors, "));
}
#[test]
fn fixes_register_a_default_export_and_move_a_controller_home() {
fn a_fix_registers_a_default_export() {
let (_t, p) = project();
let r = scan(&p, &[]);
let r = scan(&p);
for l in r.lint.iter().filter(|l| l.action.is_some()) {
lint::apply(l.action.as_ref().unwrap()).unwrap();
}
let bare = std::fs::read_to_string(p.join("bare.tsx")).unwrap();
assert!(bare.starts_with("import { Composition, registerRoot } from \"raea\";\nimport { AbsoluteFill }"), "{bare}");
assert!(bare.ends_with("registerRoot(() => <Composition id=\"bare\" component={Bare} width={1080} height={1080} fps={30} durationInFrames={3} />);\n"), "{bare}");
assert!(p.join("controllers/look-and-feel.ts").is_file() && !p.join("settings/look.ts").exists());
let again = scan(&p, &[]);
let again = scan(&p);
assert_eq!(again.compositions.iter().find(|c| c.file == "bare.tsx").unwrap().how, How::Registered);
assert!(!again.lint.iter().any(|l| l.rule == "controller-home" || (l.rule == "unregistered" && l.file == "bare.tsx")));
assert!(!again.lint.iter().any(|l| l.rule == "unregistered" && l.file == "bare.tsx"));
}
#[test]
fn a_folder_outside_any_project_says_so() {
let t = tempdir::Dir::new();
std::fs::write(t.0.join("a.tsx"), "export default function A() { return null; }\n").unwrap();
let r = scan(&t.0, &[]);
let r = scan(&t.0);
assert!(!r.project);
assert!(r.lint.iter().any(|l| l.rule == "not-a-project"));
}
#[test]
fn an_override_naming_a_controller_that_isnt_there_is_linted() {
let (_t, p) = project();
let r = scan(&p, &["delivery".into(), "gone".into(), "gone".into()]);
let named: Vec<&str> = r.lint.iter().filter(|l| l.rule == "override-missing").map(|l| l.says.as_str()).collect();
assert_eq!(named, ["overrides controller \"gone\", which isn't there"], "once, and not for one that's there");
}
#[test]
fn versions_share_a_stem() {
assert_eq!(stem("promo-v12.tsx"), "promo");
@@ -145,7 +132,7 @@ fn versions_share_a_stem() {
fn real_folder() {
let Some(dir) = std::env::var_os("RAEA_SCAN_DIR") else { return };
let t = std::time::Instant::now();
let r = scan(Path::new(&dir), &[]);
let r = scan(Path::new(&dir));
println!("{}\n({} ms)", r.text(), t.elapsed().as_millis());
}
@@ -165,7 +152,7 @@ fn a_project_in_the_layout_reaches_shared_and_says_whats_out_of_place() {
w("projects/a/compositions/main.tsx", "import { Desk } from \"@shared/components/desk\";\nimport { Leg } from \"../components/leg\";\nimport { Desk as D2 } from \"../../../shared/components/desk\";\nexport default () => <><Desk /><Leg /><D2 /></>;\n");
w("projects/a/components/leg.tsx", "export function Leg() { return <i />; }\n");
w("projects/a/loose.tsx", "export default () => <b />;\n");
let r = scan(&t.0.join("projects/a"), &[]);
let r = scan(&t.0.join("projects/a"));
let says = |rule: &str| r.lint.iter().filter(|l| l.rule == rule).map(|l| format!("{} {}: {}", l.file, l.says, l.fix)).collect::<Vec<_>>();
assert!(says("unresolved").is_empty(), "{:?}", says("unresolved"));
let outside = says("outside");
@@ -177,7 +164,7 @@ fn a_project_in_the_layout_reaches_shared_and_says_whats_out_of_place() {
w("projects/old/.raea/project", "[project]\n\tid = pj-old\n");
w("projects/old/promo.tsx", "import { Card } from \"./card\";\nexport default () => <Card />;\n");
w("projects/old/card.tsx", "export function Card() { return <i />; }\n");
let r = scan(&t.0.join("projects/old"), &[]);
let r = scan(&t.0.join("projects/old"));
let old: Vec<_> = r.lint.iter().filter(|l| l.rule == "old-layout").collect();
assert!(old.len() == 1 && old[0].says.contains("2 files loose") && old[0].fix.contains("raea project tidy"), "{:?}", r.lint);
assert!(!r.lint.iter().any(|l| l.rule == "misplaced"));
-209
View File
@@ -1,209 +0,0 @@
//! A workspace's controllers on disk (docs/projects.feature PJ2): shared/controllers/<id>.ts (docs/layout.feature; a
//! workspace from before shared/ keeps controllers/ at its root), each `export default
//! controller({...})` from "raea/brief", checked by core/brief's normalize. A project overrides a field's value in its
//! .raea/project (`[controller "delivery.format"] aspect-ratio = 16:9`), so the project's value wins, as git config's
//! own scopes do. Every change is a commit by who made it ("you", or the agent's name with --by).
use super::*;
use raea_core_brief::controller::{self as ctl, Controller, Field, Kind};
use std::process::Command;
const USAGE: &str = "usage: raea controller ls [--json] | get PATH [--json] | set PATH VALUE [--project] [--by NAME] | write FILE.ts [--by NAME] | rm ID [--by NAME]\n (PATH is controller.group.field; a VALUE is JSON for numbers, toggles and lists, else text)";
fn workspace_dir() -> R<PathBuf> {
let here = std::env::current_dir().map_err(|e| e.to_string())?;
workspace::up(&here, ".raea/workspace").ok_or_else(|| "not in a workspace: raea workspace init NAME makes one".to_string())
}
/// Every controller in the workspace, checked, in file order.
pub fn load(ws: &Path, eval: Eval) -> R<Vec<(PathBuf, Controller)>> {
let mut files: Vec<PathBuf> = std::fs::read_dir(raea_app_registry::shared_dir(ws, "controllers")).into_iter().flatten().flatten().map(|e| e.path()).filter(|p| p.extension().is_some_and(|x| x == "ts")).collect();
files.sort();
files.into_iter().map(|f| read(&f, eval).map(|c| (f, c))).collect()
}
fn read(f: &Path, eval: Eval) -> R<Controller> {
ctl::of_json(&eval(f)?).map_err(|e| format!("{}: {e}", f.display()))
}
/// The module a controller is kept as.
pub fn module(c: &Controller) -> String {
format!("import {{ controller }} from \"raea/brief\";\n\nexport default controller({});\n", ts_literal(&serde_json::to_value(c).unwrap_or_default(), 0))
}
/// A field's value as JSON (its kind's `value`).
fn value_of(f: &Field) -> serde_json::Value {
serde_json::to_value(&f.kind).ok().and_then(|v| v.get("value").cloned()).unwrap_or_default()
}
/// The git-config key for a field's override: `controller.<controller>.<group>.<field>`, which git reads as section
/// controller, subsection "<controller>.<group>", key <field>.
fn key(path: &str) -> String {
format!("controller.{path}")
}
/// A value as typed on the command line or kept in git config: JSON when it parses as JSON of the field's kind, else
/// the text itself (a choice, a text field).
fn parse(f: &Field, s: &str) -> R<serde_json::Value> {
let v = match (&f.kind, serde_json::from_str::<serde_json::Value>(s)) {
(Kind::Text { .. } | Kind::Choice { .. }, Ok(serde_json::Value::String(t))) => serde_json::Value::String(t),
(Kind::Text { .. } | Kind::Choice { .. }, _) => serde_json::Value::String(s.to_string()),
(_, Ok(v)) => v,
(_, Err(_)) => serde_json::Value::String(s.to_string()),
};
ctl::check_value(f, &v)
}
/// The overrides of the project `from` is in, by path.
pub(crate) fn overrides(from: &Path) -> Vec<(String, String)> {
let Some(p) = workspace::up(from, ".raea/project") else { return vec![] };
let text = workspace::config(Some(&p.join(".raea/project")), &["--get-regexp", "^controller\\."]).unwrap_or_default();
text.lines().filter_map(|l| l.split_once(' ')).map(|(k, v)| (k.trim_start_matches("controller.").to_string(), v.to_string())).collect()
}
fn commit(ws: &Path, paths: &[&Path], what: &str, by: &str) -> R<()> {
let mut add = Command::new(workspace::program());
add.arg("-C").arg(ws).args(["add", "-A", "--"]).args(paths);
add.status().map_err(workspace::missing)?;
let ok = workspace::git_cmd().arg("-C").arg(ws).args(["-c", &format!("user.name={by}"), "commit", "-q", "-m", &format!("{by}: {what}"), "--"]).args(paths).status().map_err(workspace::missing)?;
if ok.success() { Ok(()) } else { Err(format!("couldn't commit {what}")) }
}
/// `raea controller …`, its specs evaluated by `eval`
pub fn controller(args: &[String], eval: Eval) -> R<String> {
let json_out = args.iter().any(|a| a == "--json");
let by = workspace::flag(args, "--by").unwrap_or("you").trim_start_matches('@').to_string();
let w: Vec<&str> = args.iter().enumerate().filter(|(i, a)| !a.starts_with("--") && !(*i > 0 && args[i - 1] == "--by")).map(|(_, a)| a.as_str()).collect();
let ws = workspace_dir()?;
match w.as_slice() {
["ls"] | [] => ls(&ws, json_out, eval),
["get", path] => get(&ws, path, json_out, eval),
["set", path, value] => set(&ws, path, value, args.iter().any(|a| a == "--project"), &by, eval),
["write", file] => write(&ws, Path::new(file), &by, eval),
["rm", id] => rm(&ws, id, &by),
_ => Err(USAGE.into()),
}
}
/// The controllers as `raea controller ls` prints them, with the overrides of the project `from` is in: what `raea
/// context` shows an agent. None outside a workspace or when it has no controllers.
pub fn summary(from: &Path, eval: Eval) -> Option<String> {
let ws = workspace::up(from, ".raea/workspace")?;
load(&ws, eval).ok().filter(|cs| !cs.is_empty())?;
ls_from(&ws, from, false, eval).ok()
}
fn ls(ws: &Path, json_out: bool, eval: Eval) -> R<String> {
ls_from(ws, &std::env::current_dir().map_err(|e| e.to_string())?, json_out, eval)
}
fn ls_from(ws: &Path, from: &Path, json_out: bool, eval: Eval) -> R<String> {
let cs = load(ws, eval)?;
let over = overrides(from);
let mut rows = vec![];
for (_, c) in &cs {
for g in &c.groups {
for f in &g.fields {
let path = format!("{}.{}.{}", c.id, g.id, f.id);
let mine = over.iter().find(|(k, _)| *k == path).and_then(|(_, v)| parse(f, v).ok());
rows.push((path, f, mine.clone().unwrap_or_else(|| value_of(f)), mine.is_some()));
}
}
}
if json_out {
let fields: Vec<_> = rows.iter().map(|(p, f, v, o)| json!({"path": p, "label": f.label, "type": serde_json::to_value(&f.kind).ok().and_then(|k| k.get("type").cloned()), "value": v, "project": o})).collect();
let list: Vec<_> = cs.iter().map(|(_, c)| serde_json::to_value(c).map(|v| tidy_deep(&v)).unwrap_or_default()).collect();
return Ok(json!({"controllers": list, "fields": fields}).to_string());
}
if cs.is_empty() {
return Ok("no controllers yet: raea controller write FILE.ts adds one (`export default controller({ title, groups })` from \"raea/brief\")".into());
}
let mut out = String::new();
for (_, c) in &cs {
out.push_str(&format!("{} ({})\n", c.title, c.id));
for (p, f, v, o) in rows.iter().filter(|r| r.0.starts_with(&format!("{}.", c.id))) {
out.push_str(&format!(" {p} {}: {}{}\n", f.label, tidy(v), if *o { " (this project)" } else { "" }));
}
}
Ok(out.trim_end().to_string())
}
/// Where a path's field is: its controller, group and field, by index.
fn locate(cs: &[(PathBuf, Controller)], path: &str) -> R<(usize, usize, usize)> {
let mut p = path.splitn(3, '.');
let (c, g, f) = (p.next().unwrap_or(""), p.next().unwrap_or(""), p.next().unwrap_or(""));
let ci = cs.iter().position(|x| x.1.id == c);
let gi = ci.and_then(|ci| cs[ci].1.groups.iter().position(|y| y.id == g));
let fi = ci.zip(gi).and_then(|(ci, gi)| cs[ci].1.groups[gi].fields.iter().position(|z| z.id == f));
match (ci, gi, fi) {
(Some(c), Some(g), Some(f)) => Ok((c, g, f)),
_ => Err(format!("no field at {path}: raea controller ls lists the paths (controller.group.field)")),
}
}
fn find<'a>(cs: &'a [(PathBuf, Controller)], path: &str) -> R<&'a Field> {
let (c, g, f) = locate(cs, path)?;
Ok(&cs[c].1.groups[g].fields[f])
}
fn get(ws: &Path, path: &str, json_out: bool, eval: Eval) -> R<String> {
let cs = load(ws, eval)?;
let f = find(&cs, path)?;
let here = std::env::current_dir().map_err(|e| e.to_string())?;
let mine = overrides(&here).into_iter().find(|(k, _)| k == path).map(|(_, v)| parse(f, &v)).transpose()?;
let v = mine.clone().unwrap_or_else(|| value_of(f));
let v = tidy(&v);
Ok(if json_out { json!({"path": path, "value": v, "project": mine.is_some()}).to_string() } else { v.to_string() })
}
fn set(ws: &Path, path: &str, value: &str, project: bool, by: &str, eval: Eval) -> R<String> {
let mut cs = load(ws, eval)?;
let v = parse(find(&cs, path)?, value)?;
if project {
let here = std::env::current_dir().map_err(|e| e.to_string())?;
let p = workspace::up(&here, ".raea/project").ok_or("--project: not in a project")?;
let text = match &v {
serde_json::Value::String(s) => s.clone(),
v => v.to_string(),
};
let file = p.join(".raea/project");
workspace::set(&file, &key(path), &text)?;
// a submodule project is its own repo; an inline one commits in the workspace
let repo = if p.join(".git").exists() { p.clone() } else { ws.to_path_buf() };
commit(&repo, &[&file], &format!("{path} = {text} for this project"), by)?;
return Ok(format!("{path} = {text} (this project)"));
}
let (c, g, f) = locate(&cs, path)?;
let (file, ctrl) = &mut cs[c];
let field = &mut ctrl.groups[g].fields[f];
let mut kind = serde_json::to_value(&field.kind).map_err(|e| e.to_string())?;
kind["value"] = v.clone();
field.kind = serde_json::from_value(kind).map_err(|e| e.to_string())?;
std::fs::write(&*file, module(ctrl)).map_err(|e| format!("{}: {e}", file.display()))?;
let file = file.clone();
let v = tidy(&v);
let said = v.as_str().map(String::from).unwrap_or_else(|| v.to_string());
commit(ws, &[&file], &format!("{path} = {said}"), by)?;
Ok(format!("{path} = {v}"))
}
fn write(ws: &Path, file: &Path, by: &str, eval: Eval) -> R<String> {
let c = read(file, eval)?;
let to = raea_app_registry::shared_dir(ws, "controllers").join(format!("{}.ts", c.id));
let new = !to.exists();
std::fs::create_dir_all(raea_app_registry::shared_dir(ws, "controllers")).map_err(|e| e.to_string())?;
std::fs::write(&to, module(&c)).map_err(|e| format!("{}: {e}", to.display()))?;
commit(ws, &[&to], &format!("{} controller {}", if new { "add" } else { "rewrite" }, c.id), by)?;
let n = |k: usize, what: &str| format!("{k} {what}{}", if k == 1 { "" } else { "s" });
Ok(format!("{}: {} ({}, {})", to.display(), c.title, n(c.groups.len(), "group"), n(c.groups.iter().map(|g| g.fields.len()).sum(), "field")))
}
fn rm(ws: &Path, id: &str, by: &str) -> R<String> {
let file = raea_app_registry::shared_dir(ws, "controllers").join(format!("{id}.ts"));
if !file.is_file() {
return Err(format!("no controller {id}: raea controller ls lists them"));
}
std::fs::remove_file(&file).map_err(|e| format!("{}: {e}", file.display()))?;
commit(ws, &[&file], &format!("remove controller {id}"), by)?;
Ok(format!("removed {id} (git revert brings it back)"))
}
+33 -6
View File
@@ -3,7 +3,8 @@
//! repo's git config), and an agent's copy of the raea skill from another version. `raea context` runs the same checks
//! and prints CONTEXT_STALE when any finds something, so they stay cheap: file reads and git config, no engine.
//! It also lists what in the project isn't connected to raea's project system (docs/projects.feature PJ8, registry.rs):
//! `--fix` registers a default export and moves a stray controller to controllers/, as a commit.
//! `--fix` registers a default export, as a commit. A controller left from before 11-20 is listed with where its parts
//! go, and kept: raea reads none since, and only the person knows which still hold.
use super::*;
use crate::workspace::{get, git, include, new_id, set};
@@ -69,6 +70,32 @@ fn format(repo: &Path, file: &Path, keys: &[(&str, String)], out: &mut Vec<Findi
}
}
/// Controllers, which raea no longer reads (11-20): each .ts in the project's or the workspace's controllers/ (or the
/// workspace's shared/controllers/), with where its parts go. Nothing is moved or deleted.
fn old_controllers(base: &Path, ws: Option<&Path>, out: &mut Vec<Finding>) {
let mut dirs = vec![base.join("controllers")];
dirs.extend(ws.into_iter().flat_map(|w| [w.join("controllers"), w.join("shared/controllers")]));
dirs.dedup();
for d in dirs {
let mut files: Vec<PathBuf> = std::fs::read_dir(&d).into_iter().flatten().flatten().map(|e| e.path()).filter(|p| p.extension().is_some_and(|x| x == "ts")).collect();
files.sort();
for f in files {
let says = format!("{}: a controller, which raea no longer reads; move what still holds (a standing rule or preference to a line in taste.ts, with a check when raea can measure it; a decision for now to a feed post with an ask; a piece's settings into its composition), then delete it", f.display());
out.push(Finding { says, fix: Fix::No });
}
}
}
/// A brief.ts that still keeps tasks in `stages` (docs/plan.feature PL8a): they read, unread, and belong in plan.org.
fn briefs_with_tasks(base: &Path, out: &mut Vec<Finding>) {
let f = base.join("brief.ts");
let Ok(text) = std::fs::read_to_string(&f) else { return };
if text.lines().any(|l| l.trim_start().starts_with("stages:") || l.trim_start().starts_with("\"stages\":")) {
let says = format!("{}: keeps tasks in `stages`, which raea no longer reads; move each to the project's plan.org (an Org heading under its stage, its mark as TODO, DONE or DROPPED), then delete `stages`", f.display());
out.push(Finding { says, fix: Fix::No });
}
}
/// The `version:` in a SKILL.md's front matter.
fn skill_version(md: &Path) -> Option<String> {
let text = std::fs::read_to_string(md).ok()?;
@@ -83,6 +110,8 @@ pub fn findings(from: &Path, skills: &[(&str, PathBuf)], version: &str) -> Vec<F
let project = up(from, ".raea/project");
let base = project.clone().or_else(|| ws.clone()).unwrap_or_else(|| from.to_path_buf());
old_briefs(&base, if project.is_some() { 2 } else { 1 }, &mut out);
old_controllers(&base, ws.as_deref(), &mut out);
briefs_with_tasks(&base, &mut out);
if let Some(ws) = &ws {
let name = ws.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default();
let keys = [("workspace.id", new_id("ws")), ("workspace.name", name), ("workspace.layout", "monorepo".to_string())];
@@ -154,7 +183,7 @@ pub fn doctor(args: &[String], skills: &[(&str, PathBuf)], version: &str, reinst
let mut found = findings(&from, skills, version);
found.extend(registry_findings(&from));
if found.is_empty() {
return Ok("CHECKED nothing to fix: this folder's files and the agents' raea skill match this raea, and its compositions, components and controllers are connected".into());
return Ok("CHECKED nothing to fix: this folder's files and the agents' raea skill match this raea, and its compositions and components are connected".into());
}
let mut touched = Vec::new();
let mut lines = Vec::new();
@@ -165,10 +194,8 @@ pub fn doctor(args: &[String], skills: &[(&str, PathBuf)], version: &str, reinst
(Fix::Include(repo, file), true) => include(repo, file).map(|_| true),
(Fix::Skills(agent), true) => reinstall(agent).map(|_| true),
(Fix::Registry(r), true) => {
touched.extend(match r {
crate::registry::Fix::Register { file, .. } => vec![file.clone()],
crate::registry::Fix::Move { from, to } => vec![from.clone(), to.clone()],
});
let crate::registry::Fix::Register { file, .. } = r;
touched.push(file.clone());
crate::registry::apply(r).map(|_| true)
}
_ => Ok(false),
+2 -10
View File
@@ -1,28 +1,20 @@
//! A workspace's folders and files (docs/projects.feature PJ1-PJ4): `raea workspace`, `raea project` (with split and
//! join) and `raea controller`. A workspace is a git repo raea changes by commits; its controllers are spec modules,
//! which the raea CLI evaluates on the engine and hands in as an `Eval`, so this crate needs no engine of its own.
//! A workspace's folders and files (docs/projects.feature PJ1-PJ4): `raea workspace` and `raea project` (with split
//! and join). A workspace is a git repo raea changes by commits.
use std::path::{Path, PathBuf};
use serde_json::json;
mod controllers;
pub mod doctor;
mod literal;
mod repair;
pub mod next;
pub mod registry;
mod storage;
mod workspace;
pub use controllers::{controller, module, summary};
pub use registry::context;
pub use literal::{tidy, tidy_deep, ts_literal};
pub use workspace::{default_root, project, projects, root, slug, up, workspace};
pub type R<T> = Result<T, String>;
/// A spec module's default export as JSON: the raea CLI's spec_json, which runs it on the engine.
pub type Eval = fn(&Path) -> R<String>;
#[cfg(test)]
mod tests;
-37
View File
@@ -1,37 +0,0 @@
//! Spec modules as raea writes them: a value as a TypeScript literal, and whole numbers kept whole.
/// A value as a TypeScript literal for a spec module: unquoted keys where they can be, nulls and empty lists left out.
pub fn ts_literal(v: &serde_json::Value, indent: usize) -> String {
use serde_json::Value;
let (pad, end) = (" ".repeat(indent + 1), " ".repeat(indent));
match v {
Value::Array(a) if a.iter().all(Value::is_string) && v.to_string().len() < 70 => format!("[{}]", a.iter().map(Value::to_string).collect::<Vec<_>>().join(", ")),
Value::Array(a) => format!("[\n{}{end}]", a.iter().map(|x| format!("{pad}{},\n", ts_literal(x, indent + 1))).collect::<String>()),
Value::Object(o) => {
let ident = |k: &str| k.chars().next().is_some_and(|c| c.is_ascii_alphabetic() || c == '_') && k.chars().all(|c| c.is_ascii_alphanumeric() || c == '_');
let kept = o.iter().filter(|(_, x)| !x.is_null() && !x.as_array().is_some_and(Vec::is_empty));
let body: String = kept.map(|(k, x)| format!("{pad}{}: {},\n", if ident(k) { k.clone() } else { Value::String(k.clone()).to_string() }, ts_literal(x, indent + 1))).collect();
format!("{{\n{body}{end}}}")
}
v => tidy(v).to_string(),
}
}
/// A number that's whole (as f64 values from Rust are, 45.0) written as an integer.
pub fn tidy(v: &serde_json::Value) -> serde_json::Value {
match v.as_f64() {
Some(n) if v.is_f64() && n.fract() == 0.0 && n.abs() < 1e15 => serde_json::Value::from(n as i64),
_ => match v {
serde_json::Value::Array(a) => serde_json::Value::Array(a.iter().map(tidy).collect()),
v => v.clone(),
},
}
}
/// `tidy` through a whole value: objects and arrays too.
pub fn tidy_deep(v: &serde_json::Value) -> serde_json::Value {
match v {
serde_json::Value::Object(o) => serde_json::Value::Object(o.iter().filter(|(_, x)| !x.is_null()).map(|(k, x)| (k.clone(), tidy_deep(x))).collect()),
serde_json::Value::Array(a) => serde_json::Value::Array(a.iter().map(tidy_deep).collect()),
v => tidy(v),
}
}
+5 -21
View File
@@ -1,25 +1,9 @@
//! A project's compositions, components and controllers (docs/projects.feature PJ8): raea-app-registry's reading of
//! its files, with the project's controller overrides from .raea/project checked against the controllers there.
//! A project's compositions and components (docs/projects.feature PJ8): raea-app-registry's reading of its files.
use std::path::Path;
use crate::Eval;
pub use raea_app_registry::{Component, Composition, Controller, Fix, How, Level, Lint, Prop, Registry, apply};
pub use raea_app_registry::{Component, Composition, Fix, How, Level, Lint, Prop, Registry, apply, scan};
/// The folder's registry.
pub fn scan(dir: &Path) -> Registry {
let ids: Vec<String> = crate::controllers::overrides(dir).into_iter().filter_map(|(path, _)| path.split('.').next().map(str::to_string)).collect();
raea_app_registry::scan(dir, &ids)
}
/// What `raea context` reads of the workspace, as (section, text): its controllers with this project's overrides, and
/// the project's compositions, components and controllers as raea reads them.
pub fn context(from: &Path, eval: Eval) -> Vec<(String, String)> {
let mut out = Vec::new();
if let Some(text) = crate::summary(from, eval) {
out.push(("CONTROLLERS (raea controller ls; a project's own values marked)".to_string(), text));
}
if let Some(dir) = crate::doctor::registry_dir(from) {
out.push(("PROJECT FILES (raea project scan)".to_string(), scan(&dir).summary()));
}
out
/// What `raea context` reads of the project, as (section, text): its compositions and components as raea reads them.
pub fn context(from: &Path) -> Vec<(String, String)> {
crate::doctor::registry_dir(from).map(|dir| ("PROJECT FILES (raea project scan)".to_string(), scan(&dir).summary())).into_iter().collect()
}
+9 -19
View File
@@ -6,20 +6,6 @@ fn a_name_is_its_folder() {
assert_eq!(slug(" CJ / Reel 2 "), "cj-reel-2");
}
#[test]
fn a_spec_module_is_tidy_typescript() {
// keys unquoted where they can be, nulls and empty lists left out, whole numbers whole, short string lists inline
let v = json!({"id": "delivery", "help": null, "tags": [], "n": 45.0, "options": ["9:16", "16:9"], "odd-key": 1});
// the keys' order is serde_json's: sorted on its own, as written when a crate built alongside turns on
// preserve_order (raea-cli does), so the lines are held as a set (#90)
fn lines(s: &str) -> Vec<&str> {
let mut l: Vec<&str> = s.lines().collect();
l.sort_unstable();
l
}
assert_eq!(lines(&ts_literal(&v, 0)), lines("{\n id: \"delivery\",\n n: 45,\n \"odd-key\": 1,\n options: [\"9:16\", \"16:9\"],\n}"));
}
#[test]
fn up_finds_the_nearest_marker() {
let root = dunce::canonicalize(std::env::temp_dir()).unwrap().join(format!("raea-ws-up-{}", std::process::id()));
@@ -95,15 +81,19 @@ fn doctor_connects_a_projects_files() {
std::fs::create_dir_all(d.join(".raea")).unwrap();
std::fs::write(d.join(".raea/project"), "").unwrap();
std::fs::write(d.join("loose.tsx"), "export const Loose = () => null;\n").unwrap();
std::fs::write(d.join("pace.ts"), "import { controller } from \"raea/brief\";\nexport default controller({ title: \"Pace\", fields: {} });\n").unwrap();
std::fs::create_dir_all(d.join("controllers")).unwrap();
std::fs::write(d.join("controllers/pace.ts"), "import { controller } from \"raea/brief\";\nexport default controller({ title: \"Pace\", fields: {} });\n").unwrap();
std::fs::write(d.join("brief.ts"), "import { brief } from \"raea/brief\";\nexport default brief({\n title: \"Old\",\n stages: [{ name: \"\", tasks: [{ text: \"Write the plan\" }] }],\n});\n").unwrap();
let found = doctor::registry_findings(&d);
let says: Vec<&String> = found.iter().map(|f| &f.says).collect();
assert_eq!(found.len(), 2, "{says:?}");
assert_eq!(found.len(), 1, "{says:?}");
assert!(says[0].contains("loose.tsx:1: isn't a composition") && !found[0].fixable(), "{says:?}");
assert!(says[1].contains("pace.ts:2: a controller outside controllers/") && found[1].fixable(), "{says:?}");
// a controller from before 11-20 is told where its parts go, and kept
let out = doctor::doctor(&["--fix".into(), d.display().to_string()], &[], "0.0.1", &|_| Ok(String::new())).unwrap();
assert!(out.starts_with("APPLIED 3 of 4 fixed") && out.contains("fixed ") && d.join("controllers/pace.ts").is_file() && !d.join("pace.ts").exists(), "{out}");
assert_eq!(doctor::registry_findings(&d).len(), 1, "only the loose file is left");
assert!(out.starts_with("APPLIED 2 of 5 fixed") && out.contains("controllers/pace.ts: a controller, which raea no longer reads") && out.contains("taste.ts"), "{out}");
// a brief's old tasks are said to belong in plan.org (docs/plan.feature PL8a), and kept
assert!(out.contains("brief.ts: keeps tasks in `stages`") && out.contains("plan.org"), "{out}");
assert!(d.join("controllers/pace.ts").is_file() && std::fs::read_to_string(d.join("brief.ts")).unwrap().contains("stages"), "nothing of the person's is deleted");
let _ = std::fs::remove_dir_all(&d);
}
+6 -11
View File
@@ -98,8 +98,8 @@ fn words(args: &[String]) -> Vec<&str> {
raea_app_check::words(args, &["--layout", "--storage", "--name", "--remote"])
}
// a name as a folder (slug), and the nearest folder holding a marker (up): the registry's, which reads controller ids
// and projects with them
// a name as a folder (slug), and the nearest folder holding a marker (up): the registry's, which reads projects with
// them
pub use raea_app_registry::{slug, up};
/// A new id: the prefix and eight hex digits from the clock and the process.
@@ -188,10 +188,10 @@ pub(crate) fn commit(repo: &Path, paths: &[&str], what: &str) -> R<()> {
git(repo, &["commit", "-q", "-m", &format!("raea: {what}"), "--"]).map(|_| ())
}
const AGENTS_PROJECT: &str = "# Agents\n\nRun `raea context .` here before any work: the taste, this project's brief.ts and script.ts, its look and the guides\nits modes need, in the order to read them. Specs are TypeScript (`export default brief({...})` from \"raea/brief\").\n\nWhere files go (docs/layout.feature):\n\n- compositions/: what renders, a registerRoot <Composition> or a default export; versions are NAME-v2.tsx\n- components/: what compositions import; every prop is a component whose props animate it\n- controllers/: this project's controllers, over the workspace's shared ones by id\n- assets/: media in (footage, stills, audio, models, fonts) and the brand kit in assets/brand/\n- artifacts/: the small React apps posted to the feed\n- out/: renders\n\nThe workspace's shared/ holds the same five folders for every project: import them as\n`@shared/components/desk`, never by a relative path out of this folder.\n";
const AGENTS_PROJECT: &str = "# Agents\n\nRun `raea context .` here before any work: the taste, this project's brief.ts and script.ts, its look and the guides\nits modes need, in the order to read them. Specs are TypeScript (`export default brief({...})` from \"raea/brief\").\n\nWhere files go (docs/layout.feature):\n\n- compositions/: what renders, a registerRoot <Composition> or a default export; versions are NAME-v2.tsx\n- components/: what compositions import; every prop is a component whose props animate it\n- assets/: media in (footage, stills, audio, models, fonts) and the brand kit in assets/brand/\n- artifacts/: the small React apps posted to the feed\n- out/: renders\n\nThe workspace's shared/ holds the same five folders for every project: import them as\n`@shared/components/desk`, never by a relative path out of this folder.\n";
/// The kinds of file a project, and the workspace's shared/, keep a folder each for (docs/layout.feature).
pub const KINDS: [&str; 5] = ["compositions", "components", "controllers", "assets", "artifacts"];
pub const KINDS: [&str; 4] = ["compositions", "components", "assets", "artifacts"];
/// LFS for media in and renders out, at any depth: in each project and in shared/ (a pattern with a slash is anchored to
/// the workspace root, so the old media/** never matched a project's media/)
@@ -362,7 +362,7 @@ pub fn project(args: &[String]) -> R<String> {
Some("new") => new_project(w.get(1).ok_or(USAGE)?, flag(args, "--storage")),
Some("split") => storage::split(w.get(1).ok_or(USAGE)?, flag(args, "--remote")),
Some("join") => storage::join(w.get(1).ok_or(USAGE)?),
// PJ8: the folder's compositions, components and controllers, and what isn't connected
// PJ8: the folder's compositions and components, and what isn't connected
Some("scan") => {
let dir = w.get(1).map(PathBuf::from).map_or_else(|| std::env::current_dir().map_err(|e| e.to_string()), Ok)?;
let r = crate::registry::scan(&dir);
@@ -428,17 +428,12 @@ fn show_project(json_out: bool) -> R<String> {
let dir = up(&here, ".raea/project").ok_or("not in a project: raea project new NAME (in a workspace) makes one")?;
let file = dir.join(".raea/project");
let ws = up(&dir, ".raea/workspace").filter(|w| *w != dir);
let overrides: Vec<(String, String)> = all(&file).into_iter().filter(|(k, _)| k.starts_with("controller.")).collect();
if json_out {
let o: serde_json::Map<String, serde_json::Value> = overrides.iter().map(|(k, v)| (k.trim_start_matches("controller.").to_string(), json!(v))).collect();
return Ok(json!({"path": dir, "id": get(&file, "project.id"), "name": get(&file, "project.name"), "workspace": ws, "controllers": o}).to_string());
return Ok(json!({"path": dir, "id": get(&file, "project.id"), "name": get(&file, "project.name"), "workspace": ws}).to_string());
}
let mut out = format!("{} ({})\n{}\n", get(&file, "project.name").unwrap_or_default(), get(&file, "project.id").unwrap_or_default(), dir.display());
if let Some(ws) = &ws {
out.push_str(&format!("in workspace {}\n", ws.display()));
}
for (k, v) in overrides {
out.push_str(&format!(" {} = {v}\n", k.trim_start_matches("controller.")));
}
Ok(out.trim_end().to_string())
}
@@ -1,19 +0,0 @@
// The proof project's rules (docs/direction.feature DR4): each a rule field naming the check that holds it, a .ts
// check by its path from here, with its values. `raea check FILE.tsx --only ID` runs one.
import { controller } from "raea/brief";
export default controller({
title: "Proof rules",
groups: [
{
title: "What the pieces are held to",
fields: [
{ label: "Sung lines are flat 2D type, inside the frame, behind the subject", type: "rule", check: "../checks/lyric.ts" },
{ label: "Cuts land on a word's end", type: "rule", check: "../checks/cut.ts" },
{ label: "Cues are heard where they are placed", type: "rule", check: "../checks/cue.ts" },
{ label: "Captions clear the button band", type: "rule", check: "../checks/caption.ts", values: { band: 0.8 } },
{ label: "The rider turns with its seat and is in no part of it", type: "rule", check: "../checks/rider.ts", values: { rider: "rider", seat: "seat" } },
],
},
],
});
+4 -3
View File
@@ -1,8 +1,9 @@
#!/usr/bin/env bash
# DR4's proof (docs/direction.feature): five checks written as systems over the world (checks/*.ts, none importing
# Bevy), each run by `raea check` on a piece that holds it and on a cheat that must fail it, and a taste line run as
# the named check of its form beside them. Its media are made here with ffmpeg (nothing downloaded); the two pieces
# whose checks need a render are rendered first. Every case runs in a copy, so the bench folder stays clean.
# Bevy), each a line in the project's taste.ts run by `raea check` on a piece that holds it and on a cheat that must
# fail it, and a taste line run as the named check of its form beside them. Its media are made here with ffmpeg
# (nothing downloaded); the two pieces whose checks need a render are rendered first. Every case runs in a copy, so the
# bench folder stays clean.
#
# RAEA_BIN=path/to/raea bash bench/direction/proof/proof.sh
set -uo pipefail
+1 -1
View File
@@ -1,5 +1,5 @@
// DR4's proof, the 3D scene as asked: a seat turning, and a rider on it that turns with it and sits forward, clear of
// the back (seat.tsx). checks/rider.ts holds it, with the parts named in controllers/rules.ts.
// the back (seat.tsx). checks/rider.ts holds it, with the parts named in taste.ts.
import { Composition, registerRoot, useCurrentFrame } from "raea";
import { Seat } from "./seat";
Loaded 100 of 730 files, more files were not shown because too many files have changed in this diff. Show more