Importable effect registry, the meadow as an effect, and ambience-paint #21

Merged
merge-queue merged 2 commits from att-43-paint into main 2026-11-28 13:42:50 -08:00
Owner

Work package: ATT-43

ambience's side of ambience effects as at-terminal tab backgrounds, run locally (not synced with the server).

Removed: the effect registry in package main (cmd/ambience/effects.go's register, the 37 cmd/ambience/effect_*.go adapters, effect_frames.go) and the WASM build's hand-kept effect list and constructor switch (cmd/ambience-wasm/effects_all.go, its makeTypedRuntime).

Added:

  • effects/: importable registry. Each effect's Definition and runtime adapter (moved as-is, plus Resize, and rain's OverlayFrame), listed once in effects.All(). The server, the full WASM bundle and the painter all read that list; the rainonly bundle names only effects.Rain and effects.RainOnWindow, so the linker still drops the rest (3.55 MB before, 3.58 MB after; the full bundle 6.64 to 7.01 MB, the meadow included). Definition.GridHeight records a calibrated grid height (rain 180, meadow 216).
  • cmd/ambience/scene_*.go: the authority's scene generation and config drift, split out of the old adapters unchanged and registered with registerScenes; atmosphere.go looks transitions up there instead of by interface assertion.
  • sim/meadow.go, sim/meadow_paint.go: at-terminal's dusk meadow (frontends/rioterm/src/meadow/scene.rs) ported line for line in float32 with Rust's saturating casts. Compared against a build of scene.rs itself: 0 differing pixels in 11 cases (sizes 1x1 to 640x360, frames 0 to 250000). Steady effect (lifecycle always running), knobs fps (8) and speed (1) whose defaults are scene.rs's meadow; a grid taller than 216 rows draws each art pixel as a square, scene.rs's scale_for. scene.rs's tests are ported.
  • cmd/ambience-paint: one painter process holding every effect, for at-terminal to start directly. list; stdin size W H, show <effect>, hold; stdout only frames, "AMBF" + LE u32 width, height, scale + RGBA8. Only the shown effect steps (60 ticks/s), frames at -fps (12); held, it has no timer at all. Every pixel is held under a fifth of white's luminance, hue kept; a test holds that for every effect. Protocol: docs/ambience-paint.md.

Changed docs: cookbook, scaffold (scripts/agent/scaffold-effect.sh now writes effects/<effect>.go), AGENTS.md, CLAUDE.md, README, effect-candidates, terminal-integration-status. Dockerfile copies effects/.

Left alone: server behaviour and every test's assertion. One test line changed form: persistence_test.go read rain's sim through the unexported runtime type, and now reads the same config through Snapshot(). No release or delivery wiring for the painter (pipeline-templates, machine/state.json) is in this PR.

Not done here: the meadow joins the server's rotation pool like every registered effect, so it can come up on ambience.romaine.life once this ships.

Checks: ci-check passed (go format/vet, web-app tests); go test ./... passed; both WASM artifacts built and the Node smoke test ran all 38 effects; the painter was driven as a child process (first frame within 10 ms of show, 12 frames/s, none while held, clean exit on EOF, about 5% of one core while animating).

Work package: [ATT-43](https://openproject.home.romaine.life/wp/ATT-43) ambience's side of ambience effects as at-terminal tab backgrounds, run locally (not synced with the server). **Removed:** the effect registry in package main (`cmd/ambience/effects.go`'s `register`, the 37 `cmd/ambience/effect_*.go` adapters, `effect_frames.go`) and the WASM build's hand-kept effect list and constructor switch (`cmd/ambience-wasm/effects_all.go`, its `makeTypedRuntime`). **Added:** - `effects/`: importable registry. Each effect's `Definition` and runtime adapter (moved as-is, plus `Resize`, and rain's `OverlayFrame`), listed once in `effects.All()`. The server, the full WASM bundle and the painter all read that list; the `rainonly` bundle names only `effects.Rain` and `effects.RainOnWindow`, so the linker still drops the rest (3.55 MB before, 3.58 MB after; the full bundle 6.64 to 7.01 MB, the meadow included). `Definition.GridHeight` records a calibrated grid height (rain 180, meadow 216). - `cmd/ambience/scene_*.go`: the authority's scene generation and config drift, split out of the old adapters unchanged and registered with `registerScenes`; `atmosphere.go` looks transitions up there instead of by interface assertion. - `sim/meadow.go`, `sim/meadow_paint.go`: at-terminal's dusk meadow (`frontends/rioterm/src/meadow/scene.rs`) ported line for line in float32 with Rust's saturating casts. Compared against a build of scene.rs itself: 0 differing pixels in 11 cases (sizes 1x1 to 640x360, frames 0 to 250000). Steady effect (lifecycle always running), knobs `fps` (8) and `speed` (1) whose defaults are scene.rs's meadow; a grid taller than 216 rows draws each art pixel as a square, scene.rs's `scale_for`. scene.rs's tests are ported. - `cmd/ambience-paint`: one painter process holding every effect, for at-terminal to start directly. `list`; stdin `size W H`, `show <effect>`, `hold`; stdout only frames, "AMBF" + LE u32 width, height, scale + RGBA8. Only the shown effect steps (60 ticks/s), frames at `-fps` (12); held, it has no timer at all. Every pixel is held under a fifth of white's luminance, hue kept; a test holds that for every effect. Protocol: `docs/ambience-paint.md`. **Changed docs:** cookbook, scaffold (`scripts/agent/scaffold-effect.sh` now writes `effects/<effect>.go`), AGENTS.md, CLAUDE.md, README, effect-candidates, terminal-integration-status. Dockerfile copies `effects/`. **Left alone:** server behaviour and every test's assertion. One test line changed form: `persistence_test.go` read rain's sim through the unexported runtime type, and now reads the same config through `Snapshot()`. No release or delivery wiring for the painter (pipeline-templates, machine/state.json) is in this PR. **Not done here:** the meadow joins the server's rotation pool like every registered effect, so it can come up on ambience.romaine.life once this ships. Checks: `ci-check` passed (go format/vet, web-app tests); `go test ./...` passed; both WASM artifacts built and the Node smoke test ran all 38 effects; the painter was driven as a child process (first frame within 10 ms of `show`, 12 frames/s, none while held, clean exit on EOF, about 5% of one core while animating).
Move the effect registry and runtime adapters out of package main into
package effects: one list (effects.All) for the server, the WASM bundle and
the new painter. Scene generation stays with the authority (scene_*.go).
Port at-terminal's meadow as the meadow effect, bit-exact with scene.rs.
Add cmd/ambience-paint, a local painter writing AMBF frames to stdout for
at-terminal's tab backgrounds (docs/ambience-paint.md).
Restore the effect definitions' doc comments
All checks were successful
Suite web-app / scope (push) Has been skipped
Suite web-app / check-image (push) Has been skipped
Suite web-app / publish (push) Has been skipped
Suite web-app / publish-static (push) Has been skipped
Suite web-app / reused-checks (push) Has been skipped
Suite go / check-format (pull_request) Successful in 19s
Suite tofu / check-plan (push) Has been skipped
Suite tofu / apply (push) Has been skipped
Suite tofu / reused-checks (push) Has been skipped
Suite tofu / apply (pull_request) Has been skipped
Suite tofu / scope (pull_request) Successful in 14s
Suite default / scope (pull_request) Successful in 16s
Suite go / scope (pull_request) Successful in 14s
Suite go / check-test-windows (pull_request) Has been skipped
Suite go / check-services (pull_request) Has been skipped
Suite web-app / publish (pull_request) Has been skipped
Suite tofu / check-plan (pull_request) Has been skipped
Suite web-app / publish-static (pull_request) Has been skipped
Suite web-app / scope (pull_request) Successful in 16s
Suite tofu / reused-checks (pull_request) Successful in 15s
Suite go / reused-checks (pull_request) Successful in 32s
Suite default / check-fetches (pull_request) Successful in 16s
Suite default / check-rules (pull_request) Successful in 15s
Suite go / check-test-linux (pull_request) Successful in 59s
Suite default / check-logs (pull_request) Successful in 16s
Suite web-app / check-test (.) (pull_request) Successful in 30s
Suite default / reused-checks (pull_request) Successful in 30s
Suite web-app / check-image (pull_request) Successful in 2m24s
merge-queue landed on main
Suite web-app / reused-checks (pull_request) Successful in 28s
c467d8f591
merge-queue deleted branch att-43-paint 2026-11-28 13:42:50 -08:00
Sign in to join this conversation.
No description provided.