animader-cli 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,384 @@
1
+ ; pacer score schema — the transport / target / track / key / scene /
2
+ ; trigger / control forms plus the easing combinators. The `:expr` and
3
+ ; `:pattern` value sources ride as track keys, `:emit` clock lanes as a
4
+ ; transport key.
5
+ ;
6
+ ; Single source of truth for what a pacer score may contain. It is
7
+ ; `@embedFile`'d via the `pacer_schema` build import (the pngine precedent,
8
+ ; `pngine/schema/pngine.sjon`) and PRELOADED once per host by
9
+ ; `src/Schema.zig`, which hands the bundle to every `sjon.validateDocument`
10
+ ; through `HostOptions.preloaded`. So the data forms below are validated
11
+ ; against this plugin with no filesystem (works on wasm32-freestanding),
12
+ ; and every diagnostic span is a score coordinate by construction — the
13
+ ; document is parsed on its own.
14
+ ;
15
+ ; No `:version`: the key exists to be pinned by a `(use-plugin …)` a score
16
+ ; never writes, and pacer's version lives in exactly three places
17
+ ; (package.json / build.zig.zon / src/root.zig), kept in lockstep by test.
18
+ ;
19
+ ; All score forms are now present: the compose-mode `(target …)`
20
+ ; declaration form (below) closed the last roadmapped omission.
21
+ (plugin :name pacer
22
+
23
+ ; ---- numeric / time value kinds ----
24
+ ; Score positions are numbers with a REQUIRED unit so positions read
25
+ ; like a score: `4b` (beats), `2bar` (bars), `1.5s` (seconds). A bare
26
+ ; number in a position slot is a validation error with a span, not a
27
+ ; silently-guessed unit.
28
+ (value-kind :name time-pos
29
+ :description "Score position / duration: a number carrying a required unit — b (beats), bar (bars), or s (seconds)."
30
+ :underlying number
31
+ :unit (unit-shape :required true :allowed [b bar s]))
32
+
33
+ (value-kind :name bpm-value
34
+ :description "Tempo in beats per minute. Fractional tempi are legal (e.g. 128.5)."
35
+ :underlying number
36
+ :numeric (numeric-bounds :min 1 :max 1000)
37
+ :unit (unit-shape :reject true))
38
+
39
+ ; PPC = 720720 subdivides exactly for 1..16, so a meter component in
40
+ ; that range keeps every beat on an exact integer tick.
41
+ (value-kind :name meter-component
42
+ :description "Time-signature component: integer 1..16 (the tick grid subdivides exactly in that range)."
43
+ :underlying number
44
+ :numeric (numeric-bounds :min 1 :max 16 :integer true)
45
+ :unit (unit-shape :reject true))
46
+ (value-kind :name meter-pair
47
+ :description "Time signature as [beats-per-bar note-value], e.g. [4 4]."
48
+ :underlying vector
49
+ :vector (vector-shape :len 2 :element meter-component))
50
+
51
+ (value-kind :name end-behavior
52
+ :description "What the driver does when the playhead passes :dur."
53
+ :underlying symbol
54
+ :members (member-set
55
+ (member :name loop :description "Wrap the playhead back to 0 (requires :dur).")
56
+ (member :name hold :description "Clamp at :dur; tracks keep emitting their final values.")))
57
+
58
+ ; The element is an unconstrained symbol (not a member-set), so an
59
+ ; entry outside the emittable set surfaces as a pacer `transport_invalid`
60
+ ; diagnostic with a span on the offending name — not a schema type
61
+ ; error. Membership (beat/bar/phase/bpm/t), duplicates, and target
62
+ ; arity are all joined at compile.
63
+ (value-kind :name emit-lanes
64
+ :description "Built-in clock lanes: a list of reserved time names, each written every frame to the host target of the same name (before track writes)."
65
+ :underlying vector
66
+ :vector (vector-shape :element symbol))
67
+
68
+ ; ---- key values ----
69
+ ; :repr — the ONE place the f64→f32 truncation at emission is checked.
70
+ ; Range-only, which is exactly right: precision loss is the emitter's
71
+ ; accepted step (the determinism seam), but a value that does not FIT
72
+ ; would reach the write buffer as ±inf. A breach is repr_out_of_range
73
+ ; with a span, at compile, before the narrowing.
74
+ (value-kind :name plain-number
75
+ :description "Unitless number. Narrowed to f32 at write-buffer encode, so it must fit that range."
76
+ :underlying number
77
+ :unit (unit-shape :reject true)
78
+ :repr (repr-shape :type f32))
79
+ (value-kind :name vec-value
80
+ :description "Vector of 1-4 numbers (vec2/vec3/vec4 targets)."
81
+ :underlying vector
82
+ :vector (vector-shape :min-len 1 :max-len 4 :element plain-number))
83
+ (value-kind :name key-value
84
+ :description "Keyframe value: a scalar or a 1-4 component vector. Arity is joined against the resolved target at load."
85
+ :underlying union
86
+ :union (union-shape :alternatives [plain-number vec-value]))
87
+
88
+ ; ---- targets ----
89
+ ; Deliberately an unconstrained symbol: the animatable property space is
90
+ ; defined by the hosts at load() (pngine's uniform reflection table, the
91
+ ; audio engine's param registry), never enumerated here.
92
+ (value-kind :name target-name
93
+ :description "Target resolved at load() against the host registries (visual uniforms, audio params)."
94
+ :underlying symbol)
95
+
96
+ ; ---- compose-mode target declarations ----
97
+ ; A (target …) names an animatable property so a score compiles,
98
+ ; corpus-tests, and lints standalone (no host). At load the declarations
99
+ ; MERGE with the host registries; :name/:arity are schema-optional so a
100
+ ; missing one is a pacer target_decl_invalid (with a span), not a bare
101
+ ; SJON error — the scene/trigger discipline.
102
+ (value-kind :name target-arity
103
+ :description "Component count a declared target expects: integer 1..4."
104
+ :underlying number
105
+ :numeric (numeric-bounds :min 1 :max 4 :integer true)
106
+ :unit (unit-shape :reject true))
107
+ (value-kind :name registry-index
108
+ :description "Host registry a declared-only target routes to: 0 = visual uniforms, 1 = audio params, …"
109
+ :underlying number
110
+ :numeric (numeric-bounds :min 0 :max 255 :integer true)
111
+ :unit (unit-shape :reject true))
112
+
113
+ ; ---- scenes ----
114
+ (value-kind :name scene-name
115
+ :description "Scene identifier: names a window [at, at+dur) on the transport grid. Unique per score; the studio timeline displays it and scene-local expr env keys off it."
116
+ :underlying symbol)
117
+
118
+ ; ---- triggers ----
119
+ ; Explicit event positions for a (trigger …): a vector of time-pos.
120
+ ; No min-len — an empty :at surfaces as a pacer trigger_invalid (with a
121
+ ; span), matching the scene :name/:at/:dur schema-optional discipline.
122
+ (value-kind :name time-pos-list
123
+ :description "Explicit event positions for a (trigger …): a vector of time-pos values (b/bar/s). Emptiness and ordering are joined at compile as trigger_invalid, not schema errors."
124
+ :underlying vector
125
+ :vector (vector-shape :element time-pos))
126
+
127
+ ; ---- controls ----
128
+ (value-kind :name control-id
129
+ :description "Expression-environment binding name for a control. Unique per score; the reserved time names (t, tick, beat, bar, cycle, phase, bpm, dur) are rejected at load."
130
+ :underlying symbol)
131
+ (value-kind :name control-type
132
+ :description "Editor widget hint. The driver carries it through drv_meta and never interprets it."
133
+ :underlying symbol
134
+ :members (member-set
135
+ (member :name slider)
136
+ (member :name xy)
137
+ (member :name color)))
138
+
139
+ ; ---- easing ----
140
+ ; An easing is a unit map e: [0,1] -> R with e(0)=0, e(1)=1; output may
141
+ ; leave [0,1] (overshoot) and the keyframe lerp is unclamped. The :ease
142
+ ; slot is a union: a bare symbol from the closed named set (sugar for a
143
+ ; one-stage program) or a combinator form compiled to a flat stage table.
144
+ (value-kind :name ease-name
145
+ :description "Named easing primitive."
146
+ :underlying symbol
147
+ :members (member-set
148
+ (member :name linear)
149
+ (member :name hold :description "Step at the segment end: e(u)=0 until u=1.")
150
+ (member :name smoothstep)
151
+ (member :name in-quad)
152
+ (member :name out-quad)
153
+ (member :name in-out-quad)
154
+ (member :name in-cubic)
155
+ (member :name out-cubic)
156
+ (member :name in-out-cubic)
157
+ (member :name in-quart)
158
+ (member :name out-quart)
159
+ (member :name in-out-quart)
160
+ (member :name in-sine)
161
+ (member :name out-sine)
162
+ (member :name in-out-sine)
163
+ (member :name in-expo)
164
+ (member :name out-expo)
165
+ (member :name in-out-expo)))
166
+ (value-kind :name ease-form
167
+ :description "Easing combinator form."
168
+ :underlying form
169
+ :heads (head-set :names [seq chain steps cubic-bezier spring]))
170
+ (value-kind :name ease-spec
171
+ :description "An easing: a named primitive or a combinator form."
172
+ :underlying union
173
+ :union (union-shape :alternatives [ease-name ease-form]))
174
+
175
+ (value-kind :name stage-weight
176
+ :description "Relative weight (normalized once at compile, fixed op order). Lands in the f32 program table."
177
+ :underlying number
178
+ :numeric (numeric-bounds :min 0)
179
+ :unit (unit-shape :reject true)
180
+ :repr (repr-shape :type f32))
181
+ (value-kind :name step-count
182
+ :description "Stair-step count."
183
+ :underlying number
184
+ :numeric (numeric-bounds :min 1 :max 64 :integer true)
185
+ :unit (unit-shape :reject true))
186
+ (value-kind :name jump-mode
187
+ :description "Which end of each stair tread jumps (CSS steps() semantics subset)."
188
+ :underlying symbol
189
+ :members (member-set
190
+ (member :name start)
191
+ (member :name end)))
192
+ (value-kind :name bezier-points
193
+ :description "CSS cubic-bezier control points [x1 y1 x2 y2]; x1/x2 must lie in [0,1] (checked at ease compile)."
194
+ :underlying vector
195
+ :vector (vector-shape :len 4 :element plain-number))
196
+ (value-kind :name damping-ratio
197
+ :description "Spring damping ratio in (0,1]: 1 = critically damped, lower = bouncier. Zero never settles and is rejected at ease compile."
198
+ :underlying number
199
+ :numeric (numeric-bounds :min 0 :max 1)
200
+ :unit (unit-shape :reject true))
201
+ (value-kind :name period-count
202
+ :description "Spring oscillation count over the segment."
203
+ :underlying number
204
+ :numeric (numeric-bounds :min 0.5 :max 16)
205
+ :unit (unit-shape :reject true))
206
+
207
+ ; ---- positional head-sets ----
208
+ ; Each of these narrows a positional slot to a closed head set; the
209
+ ; bodies for `key` and `stage` are declared LOCAL to their parent form
210
+ ; (the §5.2 closed-positional-set recipe), so those two heads exist
211
+ ; nowhere but inside a (track …) / (seq …).
212
+ (value-kind :name key-section
213
+ :description "Keyframe children of (track …)."
214
+ :underlying form
215
+ :heads (head-set :names [key]))
216
+ (value-kind :name stage-section
217
+ :description "Stage children of (seq …)."
218
+ :underlying form
219
+ :heads (head-set :names [stage]))
220
+ (value-kind :name scene-section
221
+ :description "Track and trigger children of (scene …); both resolve their positions scene-relative."
222
+ :underlying form
223
+ :heads (head-set :names [track trigger]))
224
+
225
+ ; =====================================================================
226
+ ; Top-level forms
227
+ ; =====================================================================
228
+
229
+ (form :name target
230
+ :description "Compose-mode target declaration: names an animatable property so the score compiles, is corpus-tested, and lints standalone without a host. At load, declared targets MERGE with the host registries — a name the host also provides is host-authoritative (its arity must agree, else target_arity_mismatch; the declared :registry is ignored), and a declared-only name is appended to the join under its :registry. :name and :arity are schema-optional so a missing one — or a duplicate :name — surfaces as target_decl_invalid (with a span)."
231
+ (key :name name :type target-name :optional true
232
+ :description "Target identifier, joined by name against the host registries.")
233
+ (key :name arity :type target-arity :optional true
234
+ :description "Component count (1..4); must match the host's if the host also provides this name.")
235
+ (key :name registry :type registry-index :optional true :default 0
236
+ :description "Registry index for a declared-only target. Ignored for a name the host already provides (host-authoritative)."))
237
+
238
+ (form :name transport
239
+ :description "Global clock: tempo, meter, duration, end behavior. One per score."
240
+ (key :name bpm :type bpm-value
241
+ :description "Beats per minute.")
242
+ (key :name meter :type meter-pair :optional true :default [4 4]
243
+ :description "Time signature. One bar = one tick-grid cycle.")
244
+ (key :name dur :type time-pos :optional true
245
+ :description "Score length. Required when :end is loop.")
246
+ (key :name end :type end-behavior :optional true :default hold
247
+ :description "Playhead behavior past :dur.")
248
+ (key :name emit :type emit-lanes :optional true
249
+ :description "Reserved time names (beat, bar, phase, bpm, t) broadcast as write lanes, each resolved against the host registries by that exact name. Emitted lanes land before track writes, so an explicit (track …) on the same target overrides an emitted lane; controls still land last."))
250
+
251
+ ; A tempo change opens a new transport segment; segment 0 is the
252
+ ; transport's own :bpm at tick 0. Only the seconds↔ticks projection
253
+ ; moves — b/bar positions are exact integer ticks regardless of the
254
+ ; map. :at/:bpm are schema-optional so a missing key — like a
255
+ ; non-positive, seconds-unit, descending, or duplicate :at — surfaces
256
+ ; as a pacer tempo_map_invalid diagnostic (with a span), not a bare
257
+ ; SJON error (the scene/trigger discipline).
258
+ (form :name tempo
259
+ :description "A tempo change: from :at onward the transport runs at :bpm, until the next (tempo …) or the end of the score. One form per change, strictly ascending in document order."
260
+ (key :name at :type time-pos :optional true
261
+ :description "Segment start: > 0, b/bar units only (an s position would need the map being defined), strictly ascending across (tempo …) forms.")
262
+ (key :name bpm :type bpm-value :optional true
263
+ :description "Tempo in effect from :at onward. Fractional tempi are legal."))
264
+
265
+ (form :name scene
266
+ :description "A named window [at, at+dur) on the transport tick grid; child tracks and triggers resolve their positions scene-relative. Scenes may overlap and hand a target off by write order. :name/:at/:dur are schema-optional so a scene missing any surfaces as a pacer scene_invalid diagnostic (with a span), not a bare SJON missing-key error."
267
+ :positional scene-section
268
+ (key :name name :type scene-name :optional true
269
+ :description "Scene identifier; unique per score.")
270
+ (key :name at :type time-pos :optional true
271
+ :description "Window start on the transport grid; beats/bars convert exactly.")
272
+ (key :name dur :type time-pos :optional true
273
+ :description "Window length; the child tracks play over [at, at+dur)."))
274
+
275
+ (form :name track
276
+ :description "One animated target with exactly one value source: keyframe children interpolated with easing programs, XOR an :expr evaluated every frame, XOR a :pattern queried on the bar grid. Hosts receive final values and never interpolate."
277
+ :positional key-section
278
+ ; Slot-local: a keyframe is only ever a child of a track, so its body
279
+ ; is declared here rather than promoted to a plugin-global head.
280
+ (form :name key
281
+ :description "A keyframe. Before the first key a track holds its first value; after the last, its last."
282
+ (key :name at :type time-pos
283
+ :description "Position on the shared tick grid; beats/bars convert exactly, seconds via one documented mul+floor.")
284
+ (key :name value :type key-value
285
+ :description "Value reached exactly at :at.")
286
+ (key :name ease :type ease-spec :optional true :default linear
287
+ :description "Easing applied over the segment ENDING at this key."))
288
+ (key :name target :type target-name
289
+ :description "Resolved at load() against the ordered host registries; unresolved names are a load diagnostic, not a schema error.")
290
+ ; :walk-opaque — the validator never descends into the expression;
291
+ ; its interior is SJON Expr vocabulary, checked by the compile-time
292
+ ; dry-run at t=0 (spans on failure), not by this schema.
293
+ (key :name expr :type any :optional true :walk-opaque true
294
+ :description "Expression evaluated each frame with the time env bound (t, tick, beat, bar, cycle, phase, bpm, dur) plus every (control …) id. Must yield a finite number or an ncomp-component numeric vector. Exclusive with (key …) children and :pattern.")
295
+ ; :walk-opaque — same discipline as :expr: the interior is SJON
296
+ ; Pattern vocabulary (euclid, fastcat, pure, …), checked by the
297
+ ; compile-time dry-run (spans on failure), not by this schema.
298
+ (key :name pattern :type any :optional true :walk-opaque true
299
+ :description "Pattern queried each frame on the shared tick grid, 1 cycle = 1 bar. At tick T the hap active at T with the latest onset supplies the value; no active hap omits the write. Exclusive with (key …) children and :expr.")
300
+ ; at-most-one, not exactly-one: the THIRD source is (key …) children,
301
+ ; which a group counts nothing of. So keys-vs-:expr, keys-vs-:pattern
302
+ ; and "no source at all" stay pacer diagnostics (track_source_conflict
303
+ ; / track_empty); the one pairing a count can see lives here.
304
+ (exclusive-group :cardinality at-most-one
305
+ (alt :keys [expr])
306
+ (alt :keys [pattern])))
307
+
308
+ (form :name trigger
309
+ :description "An event lane. At each frame it finds the last scheduled event <= the playhead and writes (phase, count, gate, beats-since) lanes truncated to the target's ncomp. The schedule is EITHER periodic (:every, phased by optional :offset) XOR an explicit ascending :at list — both keys are schema-optional so a missing/duplicated source, a non-positive :every, or an empty/unsorted :at surface as a pacer trigger_invalid diagnostic (with a span), not a bare SJON error."
310
+ (key :name target :type target-name
311
+ :description "Resolved at load() against the ordered host registries, like a track's target.")
312
+ (key :name every :type time-pos :optional true
313
+ :description "Periodic interval between events; must be > 0 ticks. Exclusive with :at.")
314
+ (key :name offset :type time-pos :optional true :requires [every]
315
+ :description "Phase of the periodic schedule — event k lands at :offset + k*:every; defaults to 0. That default is the one this manifest cannot declare: a :default is unit-free, and dropping the unit off a time-pos would be silent — so it lives in Compile.zig. Meaningless without :every, hence :requires — an :offset beside an explicit :at is dependent_key_missing, not a silent no-op.")
316
+ (key :name at :type time-pos-list :optional true
317
+ :description "Explicit event positions, strictly ascending in time. Exclusive with :every.")
318
+ ; The source COUNT is the schema's: neither is required_one_of_missing,
319
+ ; both is mutually_exclusive_keys_present. What a count cannot see —
320
+ ; a non-positive :every, an empty / unsorted / tied :at — stays a pacer
321
+ ; trigger_invalid.
322
+ (exclusive-group :cardinality exactly-one
323
+ (alt :keys [every])
324
+ (alt :keys [at])))
325
+
326
+ ; Discriminated on :type — the widget decides which keys EXIST. A range
327
+ ; is meaningful for a slider and an xy pad and meaningless for a colour
328
+ ; picker, so `:min`/`:max` live in the variant those two values select;
329
+ ; on a `color` control they are unknown_key rather than 'PACM' noise.
330
+ ; An omitted :type resolves through its `:default slider` (effective
331
+ ; axis D), so the common spelling `(control :id k :min 0 :max 1 :value
332
+ ; …)` keeps working — but an EXPLICIT :type must be written before the
333
+ ; range keys, since the validator selects the variant as it reaches the
334
+ ; discriminant kvpair.
335
+ (form :name control :discriminant type
336
+ :description "A pinned editor widget — pins ARE text. :value is the document authority: written to :target every frame while the control is idle, and bound under :id in every track expression. A live drv_setControl override wins until drv_clearControl returns authority to the document. Control writes land after track writes; consumers apply entries in order, so a pin outranks a track on the same target."
337
+ (key :name id :type control-id
338
+ :description "Binding name in the expression environment.")
339
+ (key :name type :type control-type :optional true :default slider
340
+ :description "Editor widget hint, and the discriminant: slider and xy carry :min/:max, color does not. Write it BEFORE :min/:max — a variant key ahead of its discriminant is unknown_key.")
341
+ (key :name target :type target-name :optional true
342
+ :description "Optional write target, resolved like a track's. Without one the control only feeds expressions (a virtual knob).")
343
+ (variant :when [slider xy]
344
+ (key :name min :type key-value :optional true
345
+ :description "Widget range floor — editor metadata; the driver never clamps. Arity must match :value.")
346
+ (key :name max :type key-value :optional true
347
+ :description "Widget range ceiling — editor metadata; the driver never clamps. Arity must match :value."))
348
+ (key :name value :type key-value
349
+ :description "Document value: scalar or 1-4 component vector. Its byte span rides in drv_meta so the editor can commit a drag back to text."))
350
+
351
+ ; ---- easing combinator forms ----
352
+ (form :name seq
353
+ :description "Stages concatenated in time and value acting as one easing: :t/:v weights are normalized at compile so the program still lands exactly on the key value."
354
+ :positional stage-section
355
+ ; Slot-local, like (track …)'s (key …): a stage exists only inside a seq.
356
+ (form :name stage
357
+ :description "One (seq …) stage."
358
+ (key :name ease :type ease-spec
359
+ :description "Easing shaping this stage (nesting depth is capped at compile).")
360
+ (key :name t :type stage-weight
361
+ :description "Relative time weight.")
362
+ (key :name v :type plain-number
363
+ :description "Relative value span; may be negative (the pull-back of a bounce).")))
364
+
365
+ (form :name chain
366
+ :description "Function composition: (chain E1 E2) evaluates E2(E1(u)). For shaping, e.g. quantizing a spring through steps."
367
+ :positional ease-spec)
368
+
369
+ (form :name steps
370
+ :description "Stair-step easing."
371
+ (key :name n :type step-count)
372
+ (key :name jump :type jump-mode :optional true :default end
373
+ :description "Which end of the tread jumps."))
374
+
375
+ (form :name cubic-bezier
376
+ :description "CSS cubic-bezier(): solved by fixed-count bisection (bit-exact, no epsilon early-exit)."
377
+ (key :name p :type bezier-points))
378
+
379
+ (form :name spring
380
+ :description "Closed-form damped cosine settling exactly on the key value at u=1."
381
+ (key :name damping :type damping-ratio)
382
+ (key :name periods :type period-count :optional true :default 3
383
+ :description "Oscillation count over the segment."))
384
+ )
@@ -0,0 +1,176 @@
1
+ ; animader piece schema - the manifest and the piece's own vocabulary
2
+ ; (old/plans/animader/01-piece.md, road step 5's aggregate loader).
3
+ ;
4
+ ; The manifest is root 0 of the aggregate: `(animader ...)` opens the one
5
+ ; document a piece is, and in the split spelling it is its own file. It
6
+ ; takes no positional children (2026-09-02): it is a header over sibling
7
+ ; roots, nesting in this tier means the spatial parent and nothing else,
8
+ ; and a form written inside it is the schema's own `unknown_form`
9
+ ; diagnostic, which the editor shows as one offer, move it beside.
10
+ ;
11
+ ; Nothing is required: every key has a default or an identity, so
12
+ ; `(animader)` alone is a legal manifest and the cold start of
13
+ ; `09-holes.md` is one word. There is no `:fps` (a second is 100 ticks,
14
+ ; an axiom of the app, `06-world.md`) and no `:canvas` (the default
15
+ ; viewport is the artboard's `:size`, `07-spaces.md`); an `:fps` or
16
+ ; `:canvas` key is SJON's own `unknown_key`, which is the diagnostic the
17
+ ; plan's red wants.
18
+ ;
19
+ ; The `:timeline` key is step 12's first landing (the seventh ruling,
20
+ ; 2026-10-06, landed 2026-10-07): the split spelling's name for tempura's
21
+ ; document, beside which the aggregate spelling carries tempura's roots
22
+ ; inline. The score is derived from it through tempura's own path, the
23
+ ; same entry mistura's lane runs, and `timeline_and_score` fires when a
24
+ ; timeline and a score are both authored, in either spelling; the
25
+ ; positions map the derivation could carry is still tempura's T1 and is
26
+ ; owed there, never faked here.
27
+ ;
28
+ ; `param` is the one piece declaration that lands with the loader (its
29
+ ; register row in `03-vocabulary.md`): it lowers to a pacer
30
+ ; `(control ...)`, and the identity score writes one control per param.
31
+ ; Declarations are designed, not earned, so declaring it now is the
32
+ ; register's own rule. The range is a two-number vector `[lo hi]` and
33
+ ; maps to the control's `:min`/`:max`; `:steps N`, for when the u16
34
+ ; recording grid is too coarse, stays on the param and is never emitted,
35
+ ; because pacer's control has no such key. Scalar for now: a vector
36
+ ; param widens with the verbs that read one (Wave C).
37
+ ;
38
+ ; `(document ...)` and `(file ...)` are slot-local to `animader`
39
+ ; (asks A1): a root `(document ...)` is `unknown_form`, the plan's own
40
+ ; red. Their `:plugin` is checked by the loader (a document's plugin must
41
+ ; be loaded; a file's must have a registered consumer at render), and the
42
+ ; kind check is the loader's `document_kind_mismatch`.
43
+ ;
44
+ ; The world is NOT here: it is `schema/world.sjon` (`06-world.md`'s own
45
+ ; module line), a second manifest declaring the same plugin name, the
46
+ ; machine/bridge/session precedent.
47
+ (plugin :name animader
48
+
49
+ ; ---- value kinds ----
50
+
51
+ (value-kind :name piece-version
52
+ :description "Piece format version; v1 is exactly 1."
53
+ :underlying number
54
+ :numeric (numeric-bounds :min 1 :max 1 :integer true)
55
+ :unit (unit-shape :reject true))
56
+
57
+ ; A path, bare or quoted: the plans' own manifest block spells the
58
+ ; document keys bare (`:program program.sjon`) and the hello piece
59
+ ; quotes its kernel paths, so both are the piece's spelling and the
60
+ ; loader reads either.
61
+ (value-kind :name path-bare
62
+ :description "A bare path, the manifest block's own spelling."
63
+ :underlying symbol)
64
+ (value-kind :name path-quoted
65
+ :description "A quoted path."
66
+ :underlying string
67
+ :string-bounds (string-bounds :min-len 1 :max-len 256))
68
+ (value-kind :name path-string
69
+ :description "A path relative to the piece's own file: program.sjon, kernels/noise.wgsl, song.mid."
70
+ :underlying union
71
+ :union (union-shape :alternatives [path-bare path-quoted]))
72
+
73
+ (value-kind :name kernel-list
74
+ :description "The piece's (wgsl ...) fragment files; each is a fragment, never a module, and is checked inside the shader it assembles into (02-domains.md, Checking a kernel)."
75
+ :underlying vector
76
+ :vector (vector-shape :element path-string))
77
+
78
+ ; `world-name`, not `world-id` (the world manifest's own kind): the
79
+ ; two animader manifests are separate plugins, and a kind name two of
80
+ ; them declare is ambiguous at every referencing site (the eighth
81
+ ; ruling's class, SJON's sixth aggregate walk).
82
+ (value-kind :name world-name
83
+ :description "A world by its name in the aggregate spelling or by its file in the split spelling; `live.world` is the hello piece's spelling of both at once. A param's name is the same shape: a bare word, never a path."
84
+ :underlying symbol)
85
+
86
+ (value-kind :name world-list
87
+ :description "The worlds the piece carries beyond the default; the list exists for the worlds beyond the one :default-world names."
88
+ :underlying vector
89
+ :vector (vector-shape :element world-name))
90
+
91
+ (value-kind :name plugin-name
92
+ :description "The plugin a sidecar belongs to; the loader checks it against the aggregate and the consumer registry. A symbol, so its length is the reader's business, not the schema's."
93
+ :underlying symbol)
94
+
95
+ (value-kind :name param-value
96
+ :description "A param's default or held value; the control's :value. Bare numbers only, the pacer control-value discipline."
97
+ :underlying number
98
+ :unit (unit-shape :reject true))
99
+
100
+ (value-kind :name param-range
101
+ :description "The param's inclusive range `[lo hi]`; the control's :min and :max."
102
+ :underlying vector
103
+ :vector (vector-shape :len 2 :element param-value))
104
+
105
+ (value-kind :name param-steps
106
+ :description "Recording granularity for when the u16 grid is too coarse; carried on the param and never emitted, because pacer's control has no such key."
107
+ :underlying number
108
+ :numeric (numeric-bounds :min 1 :max 65535 :integer true)
109
+ :unit (unit-shape :reject true))
110
+
111
+ ; ---- the manifest ----
112
+
113
+ (form :name animader
114
+ :description "The piece's manifest and root 0 of the aggregate. A header over sibling roots, never their parent: it takes no positional children."
115
+ (key :name name :type world-name :optional true :default untitled
116
+ :description "The piece's name; provisional at step 5 (`untitled` until the editor's naming pass owns it, 11-experience.md, names are offered, not asked).")
117
+ (key :name version :type piece-version :optional true :default 1
118
+ :description "Piece format version.")
119
+ (key :name program :type path-string :optional true
120
+ :description "pngine's document. Present: the split spelling is canonical. Absent: this file is the program and the aggregate is canonical.")
121
+ (key :name audio :type path-string :optional true
122
+ :description "audzio's document, first-class beside :program because audzio is pngine's peer.")
123
+ (key :name timeline :type path-string :optional true
124
+ :description "tempura's document: the timeline the score is derived from, through tempura's own walk, derivation and export (the same entry mistura's lane runs). The aggregate spelling carries tempura's roots inline instead. Never beside an authored score in either spelling (`timeline_and_score`); with neither authored, the lowering writes the identity transport and one control per param, with no tempura in the path. No pacer root is authored beside a timeline: the export is the last lowering stage for pacer's heads.")
125
+ (key :name score :type path-string :optional true
126
+ :description "pacer's document, hand-written. Never beside an authored timeline (`timeline_and_score`, step 12); with neither authored, the lowering writes the identity transport and one control per param, with no tempura in the path.")
127
+ (key :name machine :type path-string :optional true
128
+ :description "The machine document: machine and bridge forms together, validated against their aggregate.")
129
+ (key :name session :type path-string :optional true
130
+ :description "The recorded or authored session.")
131
+ (key :name kernels :type kernel-list :optional true :default []
132
+ :description "(wgsl ...) fragment files the piece carries, so a kernel can be shared by a pass and a compute step without either document owning it.")
133
+ (key :name default-world :type world-name :optional true
134
+ :description "The world the piece renders under when none is given; absent, the built-in live world, the hole rule applied to the manifest.")
135
+ (key :name worlds :type world-list :optional true :default []
136
+ :description "The world documents the piece carries beyond the default; a world :default-world names is carried whether or not listed.")
137
+ ; `:walk-opaque`, the machine's `verb-set` precedent: SJON's
138
+ ; slot-local reach ends at a key's own value, and a vector of
139
+ ; slot-local forms is past it, so the validator checks nothing here
140
+ ; and `Piece.load` shape-checks every entry itself
141
+ ; (`document_kind_mismatch` names a malformed one). The slot-local
142
+ ; declarations below still stand: they are what makes a root
143
+ ; `(document ...)` `unknown_form`, the plan's own red.
144
+ (key :name documents :type any :optional true :walk-opaque true
145
+ :description "Sibling-owned SJON documents, each validated against its own plugin's manifest.")
146
+ (key :name files :type any :optional true :walk-opaque true
147
+ :description "Sibling-owned bytes, handed to the plugin's consumer at load and exported with the piece.")
148
+
149
+ ; Slot-local (asks A1): a sidecar form exists only inside the
150
+ ; manifest, so neither occupies a global head and a root
151
+ ; `(document ...)` is `unknown_form`, which is the plan's red.
152
+ (form :name document
153
+ :description "A sibling-owned SJON document in the piece."
154
+ (key :name plugin :type plugin-name
155
+ :description "The plugin whose manifest validates this document; it must be loaded.")
156
+ (key :name path :type path-string
157
+ :description "The document's path relative to the piece's own file."))
158
+ (form :name file
159
+ :description "Sibling-owned bytes the piece names so it is whole."
160
+ (key :name plugin :type plugin-name
161
+ :description "The plugin whose registered consumer serves these bytes at render.")
162
+ (key :name path :type path-string
163
+ :description "The file's path relative to the piece's own file.")))
164
+
165
+ ; ---- the piece's one declaration at step 5 ----
166
+
167
+ (form :name param
168
+ :description "A knob the world turns: the Params seam's pin row. Lowers to a pacer (control ...) with the default as its :value and the range as its :min/:max; the identity score writes one control per param, in document order."
169
+ (key :name name :type world-name
170
+ :description "The param's name; the control's :id and the pin's target.")
171
+ (key :name default :type param-value
172
+ :description "The value the world holds before anything is written; the control's :value.")
173
+ (key :name range :type param-range :optional true
174
+ :description "Inclusive `[lo hi]`; the control's :min and :max. Optional: a param with no range is a knob with no ends.")
175
+ (key :name steps :type param-steps :optional true
176
+ :description "Recording granularity; carried and never emitted.")))