@melite/models-h3 0.0.0-stage → 0.1.5-pre-alpha
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.
- package/LICENSE +557 -0
- package/README.md +38 -2
- package/lib/actions.d.ts +57 -0
- package/lib/actions.js +1626 -0
- package/lib/filmMix.d.ts +80 -0
- package/lib/filmMix.js +183 -0
- package/lib/finalize.d.ts +10 -0
- package/lib/finalize.js +38 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +401 -0
- package/lib/mods/loras.d.ts +98 -0
- package/lib/mods/loras.js +51 -0
- package/lib/schema.d.ts +269 -0
- package/lib/schema.js +555 -0
- package/lib/timelineContract.d.ts +79 -0
- package/lib/timelineContract.js +216 -0
- package/package.json +58 -4
package/lib/schema.js
ADDED
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
// The h3 schema plane — the film card's declared knob surface,
|
|
2
|
+
// moved family-side with the atom-vocabulary video stroke (the
|
|
3
|
+
// family's action re-validates each film stanza against THIS
|
|
4
|
+
// carrier; the card's wrap + compose gate import the same object —
|
|
5
|
+
// ONE spelling, never a second copy).
|
|
6
|
+
import z from '@deepseek-ai/schemastery';
|
|
7
|
+
import { SAMPLER_OPTIONS, SCHEDULER_OPTIONS } from '@melite/comfyui-card-kit/vocab';
|
|
8
|
+
import { vocabulary } from '@melite/comfyui-card-kit/vocab';
|
|
9
|
+
import { samplingExtra } from '@melite/comfyui-card-kit/fields';
|
|
10
|
+
import { bag } from '@melite/contracts/extraKeys';
|
|
11
|
+
import { coerceWireArrays } from '@melite/comfyui-card-kit';
|
|
12
|
+
import { CALL_KEYS, GRID_BASE_FRAMES, GRID_MAX_FRAMES, GRID_STEP_FRAMES, REF_CAPS, assertGridLength, assertSpanGrid, normalizeDeclaredRefs, transitionOverlap } from "./timelineContract.js";
|
|
13
|
+
// the window families this renderer builds (three shapes:
|
|
14
|
+
// t4r opener / t4_open window / t4_chain window).
|
|
15
|
+
export const FAMILIES = ['t4r', 't4_open', 't4_chain'];
|
|
16
|
+
export const wireList = normalizeDeclaredRefs;
|
|
17
|
+
export const H3_RECOMMENDED_SAMPLERS = [
|
|
18
|
+
"euler", "euler_cfg_pp", "euler_ancestral", "dpmpp_2m", "dpmpp_2m_sde", "heun",
|
|
19
|
+
// THE TIER-1/2 WINNERS (arena + Comfy-Org's own t2v/i2v/r2v
|
|
20
|
+
// templates; every name verified against the live engine's
|
|
21
|
+
|
|
22
|
+
// res_multistep is what the official templates run; er_sde +
|
|
23
|
+
// the beta scheduler (already on sched_name) is Parasyte's
|
|
24
|
+
// README rec (beta57); seeds_2/seeds_3 are the "dual clock"
|
|
25
|
+
// family the arena's top i2v runs rode with larryvrh v4.
|
|
26
|
+
"res_multistep", "res_multistep_cfg_pp", "er_sde", "seeds_2", "seeds_3",
|
|
27
|
+
];
|
|
28
|
+
export const JSON_ARRAY_PARAMS = ['calls', 'audio_clips'];
|
|
29
|
+
const T4_ONLY_KEYS = [
|
|
30
|
+
'sharpen_switch', 'sharpen_method', 'sharpen_strength', 'sharpen_radius',
|
|
31
|
+
'sharpen_threshold', 'sharpen_iterations', 'interp_switch',
|
|
32
|
+
'interp_multiplier', 'interp_model', 'sr_switch', 'sr_model', 'sr_resolution',
|
|
33
|
+
];
|
|
34
|
+
// ── the params schema — H3TimelineCard mirrored 1:1 ─────────────────────────
|
|
35
|
+
// the declared field order and defaults. Bare (defaultless) keys are the
|
|
36
|
+
// ABSENT / required surface (prompt required=True; image
|
|
37
|
+
// default=None): the image-gen precedent — optional at parse, refused
|
|
38
|
+
// loud at compose where the lane needs them, and every read below
|
|
39
|
+
// normalizes with ?? so the served shape stays byte-identical.
|
|
40
|
+
|
|
41
|
+
// below are the declared constants (width 1344, height 768,
|
|
42
|
+
// sharpen_enabled false, shift_video 8.0) and the served shape
|
|
43
|
+
// carries the same values. shift_video's declared .default(8.0)
|
|
44
|
+
// (historical shape); at runtime schema() normalizes an
|
|
45
|
+
// omitted key back to null so the body resolves the family's literal
|
|
46
|
+
// (t4 INT 8 / t4r 8.0 — the served structural values).
|
|
47
|
+
export const paramSchema = z.object({
|
|
48
|
+
prompt: z.string().description("Prompt").extra('extra', bag({ order: null, wtype: 'textarea', placeholder: "the courier pushes off and rolls forward through the lantern glow; rain hisses on the stall awnings, a vendor calls out", tooltip: "The window's text (single-call shape). A film's calls carry their own text — a textless call refuses at compose; this field never substitutes for one." })),
|
|
49
|
+
image: z.string().role('path').description("First frame (keyframe lanes)").extra('extra', bag({ order: null, wtype: 'image', tooltip: "Absolute path to the PNG the video must start on (first-frame anchoring). Optional for h3/h3-timeline." })),
|
|
50
|
+
// THE INPUT SURFACE (the H3 architecture truth — two DIFFERENT
|
|
51
|
+
// mechanics, the FL2VA latent anchors vs the Ref2VA conditioning
|
|
52
|
+
// bus): first_frame/last_frame are PIXEL anchors (bundle inputs
|
|
53
|
+
// 1-2, VAE-written into the latent ends — the i2v branch reads
|
|
54
|
+
// them verbatim); references ride the REMAINING image bus (inputs
|
|
55
|
+
// 3-9 → <Picture 3..9>) plus the video/audio lanes (<Video 1-3>,
|
|
56
|
+
// <Audio 1-3>) as AdaLN/cross-attention conditioning. Typed
|
|
57
|
+
// arrays, door-enforced: a non-string entry or an over-cap stack
|
|
58
|
+
// refuses LOUD at the gate (the probe-proven law —
|
|
59
|
+
// `expected array length <= 8`), never rides silent. The legacy
|
|
60
|
+
// `refs` stanza bag keeps its compose-side wireList readers; the
|
|
61
|
+
// declared fields are the primary surface.
|
|
62
|
+
last_frame: z.string().role('path').description("Last frame (end anchor)").extra('extra', bag({ order: null, wtype: 'image', tooltip: "FL2VA end anchor — bundle input 2. Locks the final frame's pixels; H3 generates the motion between the two anchors." })),
|
|
63
|
+
ref_images: z.array(z.string().role('path')).description("Reference images").max(REF_CAPS.images).extra('extra', bag({ order: null, wtype: 'image_list', max_stack: REF_CAPS.images, tooltip: "Loose references (identity, style, costume) → <Picture 3..9> via the bundle. 8 fills the bus; with a last frame set the cap is 7 (anchor + end + 7 = the 9-slot bus)." })),
|
|
64
|
+
ref_videos: z.array(z.string().role('path')).description("Reference videos").max(REF_CAPS.videos).extra('extra', bag({ order: null, wtype: 'image_list', media: 'video', max_stack: REF_CAPS.videos, tooltip: "Motion guides → <Video 1-3>: camera moves, timing, choreography." })),
|
|
65
|
+
|
|
66
|
+
// index-paired with ref_videos — entry i slices guide i through
|
|
67
|
+
// the engine's own Video Slice node BEFORE GetVideoComponents
|
|
68
|
+
// conditions on it (thread the motion guide to the span that
|
|
69
|
+
// matters; a whole 3-minute clip as a guide wastes the window).
|
|
70
|
+
// start_time/duration are SECONDS; duration 0 with start_time 0
|
|
71
|
+
// (or an absent entry) = the whole clip, no slice node built.
|
|
72
|
+
// strict_duration rides false: a duration past the clip's end
|
|
73
|
+
// clamps at the engine, never refuses the film. The trims are
|
|
74
|
+
// stage params, so the run body records them verbatim.
|
|
75
|
+
ref_video_trims: z.array(z.object({
|
|
76
|
+
start_time: z.number().min(0).default(0).description('Start (s)'),
|
|
77
|
+
duration: z.number().min(0).default(0).description('Duration (s)'),
|
|
78
|
+
})).max(REF_CAPS.videos).description("Reference video trims").extra('extra', bag({ order: null, tooltip: "Per-video trims, index-paired with Reference videos — entry i slices guide i (start seconds + duration seconds) before conditioning. duration 0 = to the clip's end; an absent entry = the whole clip." })),
|
|
79
|
+
ref_audios: z.array(z.string().role('path')).description("Reference audios").max(REF_CAPS.audios).extra('extra', bag({ order: null, wtype: 'image_list', media: 'audio', max_stack: REF_CAPS.audios, tooltip: "Sound references → <Audio 1-3>: timbre, cadence, musical tone." })),
|
|
80
|
+
|
|
81
|
+
// mods — .safetensors packs extracted under the engine's
|
|
82
|
+
// models/refmods/ (identity, style, voice). The pack injects
|
|
83
|
+
// them as reference tokens through ALL DiT blocks on the
|
|
84
|
+
// conditioning side: no bundle-bus slot is spent, so a mod does
|
|
85
|
+
// NOT fire the refs-imply-r2v law (a mod-only film stays open).
|
|
86
|
+
|
|
87
|
+
// the file face with a .safetensors accept filter (the stack
|
|
88
|
+
// row's own grammar) — the owner-local seat stays a path list
|
|
89
|
+
// and compose stems it (the loader resolves stems against its
|
|
90
|
+
// own models/refmods/).
|
|
91
|
+
ref_mods: z.array(z.string().role('path')).description("RefMods (reusable reference mods)").max(REF_CAPS.refmods).extra('extra', bag({ order: null, wtype: 'image_list', media: 'mod', max_stack: REF_CAPS.refmods, tooltip: "Reusable reference mods → models/refmods/ (extracted identity/style/voice packs). Injected as reference tokens through all DiT blocks — strength 1 per mod; spends no bundle-bus slot, so it combines freely with the picture/video/audio references above. 8 max (the loader's slot count). Pack-documented limits, never silent: attributes can still mix across mods (identity, clothing, background, composition); strength blends, it never replaces outright; voice transfer does not work reliably (music references carry, speaker identity does not). A picked path commits its stem." })),
|
|
92
|
+
|
|
93
|
+
// input. We don't use that, that is a bug that is there." Film
|
|
94
|
+
// music rides the D-M-E lanes' MUSIC clips, pinned per window;
|
|
95
|
+
// reference timbre rides ref_audios. No film-wide bed, no cuts,
|
|
96
|
+
// no MeliteAudioSlice in the graph.)
|
|
97
|
+
// DUCK DEPTH (roadmap §14, was a pinned −14 literal): how far the
|
|
98
|
+
// generated voice yields under a conditioned clip at its film
|
|
99
|
+
// span. −14dB is the natural mix-desk default; deeper for dense
|
|
100
|
+
// dialogue, shallower when the generated voice should hold.
|
|
101
|
+
duck_depth_db: z.number().description("Duck depth (dB)").min(-48).max(0).step(1).default(-14).extra('extra', bag({ order: null, wtype: 'number', columns: 2, width: 1, tooltip: "How far the generated voice ducks under a dialogue clip (−14 is the mix-desk default)." })),
|
|
102
|
+
seed: z.number().description("Seed").step(1).default(42).extra('extra', bag({ order: null, columns: 2, width: 1, tooltip: "Same seed across re-rolls = same world texture" })),
|
|
103
|
+
width: z.number().description("Width").min(448).max(1344).step(64).default(1344).extra('extra', bag({ order: null, wtype: 'number', columns: 2, width: 1 })),
|
|
104
|
+
height: z.number().description("Height").min(448).max(768).step(64).default(768).extra('extra', bag({ order: null, wtype: 'number', columns: 2, width: 1 })),
|
|
105
|
+
|
|
106
|
+
// (min 21, step 5) contradicted the card's own declared law — the
|
|
107
|
+
// 17k+5 frame grid (identity principle + tooltip: 56/90/124/362).
|
|
108
|
+
// Schemastery step is offset-from-min, so step(5) from 21 admitted
|
|
109
|
+
// {21, 26, ...} and REFUSED the documented values (90, 124, 362 —
|
|
110
|
+
// the compose door's `expected number multiple of 5` on a user-set
|
|
111
|
+
// Frames). min(22).step(17) admits exactly (L-5) % 17 === 0 — the
|
|
112
|
+
// served stepper now walks the true grid 22/39/56/.../362 and the
|
|
113
|
+
// explicit 90 passes the walk. 56 (the declared
|
|
114
|
+
// default) is on-grid; the omitted-key path normalizes to null in
|
|
115
|
+
// schema() so the body computes the family's frame budget.
|
|
116
|
+
length: z.number().description("Frames").min(GRID_BASE_FRAMES).max(GRID_MAX_FRAMES).step(GRID_STEP_FRAMES).default(56).extra('extra', bag({ order: null, columns: 2, width: 1, tooltip: "17k+5 grid at 24fps: 56 = 2.33s, 124 = 5.17s, 362 = 15s", wtype: 'number' })),
|
|
117
|
+
steps: z.number().description("Steps").min(4).max(30).default(12).extra('extra', samplingExtra('steps', { tooltip: "12 for draft; 30 standard; a boarded distill lora applies its own steps (edit them on the lora entry)" })),
|
|
118
|
+
|
|
119
|
+
// needs an on/off switch, it is very unclear if it is on or off"):
|
|
120
|
+
// one boolean heads the tab. Off (default) = the whole post chain
|
|
121
|
+
// is inert: the leaves hide AND the compose gates hard (sharpen,
|
|
122
|
+
// interp, VSR, refine all read the master FIRST — a legacy doc
|
|
123
|
+
// with leaves set but no master renders the plain pass).
|
|
124
|
+
second_pass_enabled: z.boolean().description("Second pass").default(false).extra('extra', bag({ order: null, group: 'second_pass', wtype: 'boolean', tooltip: "Master switch for the entire post chain — FSR sharpening, FILM interpolation, SeedVR2 super-res, and the refine lora. Off (default) = the film lands straight from the sampler. On = the pass controls below arm." })),
|
|
125
|
+
sharpen_enabled: z.boolean().description("FSR Sharpening").default(false).extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true", tooltip: "Apply AMD FidelityFX RCAS sharpening to the final output. Strength 0.3 looks natural." })),
|
|
126
|
+
sharpen_strength: z.number().description("Sharpen Strength").min(0).max(1).step(0.05).default(0.3).extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true&sharpen_enabled=true", tooltip: "RCAS sharpening intensity. 0.3 = natural; 0.5 = crisp; 0.0 = off.", wtype: 'number' })),
|
|
127
|
+
// interpolate_enabled: HONEST DEFAULT (hour 20): the card's
|
|
128
|
+
// `bool = False` — `default(false)`, not the "false"-as-boolean
|
|
129
|
+
// cast-lie. An absent key now fills the boolean NATIVELY (no
|
|
130
|
+
|
|
131
|
+
// The wire-string tolerance (the bench add-door rides the served
|
|
132
|
+
// literal "false"/"true" as an explicit key) is a DOC-level law —
|
|
133
|
+
// coerceWireBoolean below — because schemastery field transforms
|
|
134
|
+
// classify as type 'json' in the served taxonomy (the
|
|
135
|
+
// knob-freshness wall pins the honest 'boolean').
|
|
136
|
+
interpolate_enabled: z.boolean().description("FILM Interpolation").default(false).extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true", wtype: 'boolean', tooltip: "Apply FILM (Feature-aware Interpolation for Large Motion) frame interpolation to double the frame rate. Doubles render time." })),
|
|
137
|
+
|
|
138
|
+
// every key the compose READS rides the declared surface at its
|
|
139
|
+
// exact wire name — the studio's historical spellings
|
|
140
|
+
// (sampling_steps / sampler / scheduler / interpolate_model /
|
|
141
|
+
// interpolate_multiplier / rtx_vsr_enabled) never matched these,
|
|
142
|
+
// were never read, and die with the studio rework.
|
|
143
|
+
|
|
144
|
+
// sampler and scheduler next to each other but here they're on
|
|
145
|
+
// different rows?"): the sampling layout truth (group/columns/
|
|
146
|
+
// width/zone) is the KIT's — steps/sampler/scheduler ride
|
|
147
|
+
// samplingExtra() like every normal card; h3-only knobs (denoise,
|
|
148
|
+
// the shifts) declare the SAME layout facts inline (card-owned
|
|
149
|
+
// kinds, one place each). The 2-column grid seats sampler +
|
|
150
|
+
// scheduler side by side on EVERY face that honors the grammar.
|
|
151
|
+
denoise: z.number().description("Denoise").min(0).max(1).step(0.05).default(1.0).extra('extra', bag({ order: 4, group: 'sampling', columns: 2, width: 1, zone: 'params', wtype: 'number', tooltip: "How much of the latent the sampler rewrites. 1.0 = full denoise (fresh windows); lower inherits structure." })),
|
|
152
|
+
// CLOSED TYPES (hour 22 incident): these were
|
|
153
|
+
// z.string() with a DECORATIVE extra options list — the gate accepted
|
|
154
|
+
// any string (no membership refusal), the face showed the hand-stamped
|
|
155
|
+
// six, the engine accepts the pin's 45: three truths for one key. The
|
|
156
|
+
// union of consts is the ONE truth now — the face reads the members,
|
|
157
|
+
// the gate refuses off-set values at the compose door (the kit's own
|
|
158
|
+
// law: sampler/scheduler knobs ride vocabulary()), and the declared
|
|
159
|
+
// default stays reachable (fill === walk by construction).
|
|
160
|
+
// THE TIER WINNERS, TAKEN FROM THE KIT'S OWN 45 (the census's H2):
|
|
161
|
+
|
|
162
|
+
// engine vocabulary (regen-vocab.ts owns that file) left the film
|
|
163
|
+
// card's menu stale — and a name the engine had dropped would still
|
|
164
|
+
// be offered and then 400. The subset is NAMED here (a card's
|
|
165
|
+
// recommendation is real curation) but every member is READ from
|
|
166
|
+
// the SSOT, and a wall asserts the subset survives a regen.
|
|
167
|
+
sampler_name: vocabulary([
|
|
168
|
+
// the membership test widens the tuple's read view (a readonly
|
|
169
|
+
// literal tuple's includes() demands the literal union — the
|
|
170
|
+
// filter's n is string; the WALL, not the tuple's type, keeps
|
|
171
|
+
// every member honest against the SSOT)
|
|
172
|
+
...SAMPLER_OPTIONS.filter((n) => H3_RECOMMENDED_SAMPLERS.includes(n)),
|
|
173
|
+
]).description("Sampler").default("euler").extra('extra', samplingExtra('sampler', { tooltip: "The KSampler solver. euler family pairs with turbo adapters; res_multistep is the official-template solver; er_sde+beta is the Parasyte rec; seeds_2/3 are the dual-clock family." })),
|
|
174
|
+
// the same law for the scheduler: the kit's engine vocabulary,
|
|
175
|
+
// read (the census's H2 — a retyped list is a second SSOT)
|
|
176
|
+
sched_name: vocabulary([...SCHEDULER_OPTIONS]).description("Scheduler").default("simple").extra('extra', samplingExtra('scheduler', { tooltip: "The sigma schedule shape." })),
|
|
177
|
+
// ── THE T3 REFINE RIDER (roadmap item 2; ledger #30 §3(2)) —
|
|
178
|
+
// the crowd's third tier: a short CLOSING pass over each
|
|
179
|
+
// window's output latent, the refiner lora on its OWN loader
|
|
180
|
+
// (the primary stack never changes). Empty refine_lora = no
|
|
181
|
+
// rider, the graph renders exactly as before. The instrument:
|
|
182
|
+
// the catalog's refiner rows (h3_taomate_3step — 0.7 @ 3 steps,
|
|
183
|
+
// the arena's refiner operating point). ONE OWNER PER KNOB:
|
|
184
|
+
// refine_lora picks the instrument; strength/steps default from
|
|
185
|
+
// THE ROW (no silent overrides); the pass rides the doc's own
|
|
186
|
+
// sampler/scheduler.
|
|
187
|
+
refine_lora: z.string().description("Refine lora").default("").extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true", wtype: 'select', optionsFrom: 'loras', tooltip: "Catalog id of a refiner lora (e.g. h3_taomate_3step). Empty = no refine pass. Strength/steps default from the row. LORAS ARE ONLY MODS — the pick serves from the loras flavor rows, never a hand-spelled id (the compose door refuses unknown ids loud)." })),
|
|
188
|
+
refine_strength: z.number().description("Refine strength").min(0).max(2).step(0.05).extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true", wtype: 'number', tooltip: "Override the refiner row's strength. Rides only when refine_lora is set." })),
|
|
189
|
+
refine_steps: z.number().description("Refine steps").min(1).max(10).step(1).extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true", wtype: 'number', tooltip: "Override the refiner row's step count (taomate: 3). Rides only when refine_lora is set." })),
|
|
190
|
+
// ── THE ATTENTION BACKEND (roadmap item 3; the h3_attention
|
|
191
|
+
// "sage/sol" folklore was FICTION — no such knob, and the engine
|
|
192
|
+
// enumerates only 'pytorch attention' on ModelAttentionBackend;
|
|
193
|
+
// sage/sol are NOT served). This knob owns the ONE input the
|
|
194
|
+
// non-SLA arm actually pins: 'comfy kitchen attention' is the
|
|
195
|
+
// estate-proven literal (plaguekind's template value, silicon
|
|
196
|
+
// receipts on the t4 arm); 'pytorch attention' is the engine's
|
|
197
|
+
// own enumeration. Values the engine refuses are NOT offered.
|
|
198
|
+
attention_backend: vocabulary(["comfy kitchen attention", "pytorch attention"]).description("Attention backend").default("comfy kitchen attention").extra('extra', bag({ order: null, group: 'sampling', wtype: 'select', tooltip: "The non-SLA arm's ModelAttentionBackend — used when the SLA sparse attention switch (Sla group) is OFF. ck-kitchen is the estate-proven default; pytorch is the engine's enumerated literal." })),
|
|
199
|
+
interp_model: vocabulary(["film_net_fp16.safetensors", "rife47.pth"]).description("Interp model").default("film_net_fp16.safetensors").extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true&interpolate_enabled=true", wtype: 'select', tooltip: "FILM or RIFE frame-interpolation weights." })),
|
|
200
|
+
interp_multiplier: z.number().description("Interp multiplier").min(2).max(4).step(1).default(2).extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true&interpolate_enabled=true", wtype: 'number', tooltip: "Frame multiple (2 = double the frame rate)." })),
|
|
201
|
+
sr_switch: z.boolean().description("Super-Res (SeedVR2)").default(false).extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true", tooltip: "Upscale the final film through SeedVR2 before saving." })),
|
|
202
|
+
sr_resolution: z.number().description("Super-Res target").min(720).max(2160).step(360).default(1080).extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true&sr_switch=true", wtype: 'number', tooltip: "The SeedVR2 output height in px." })),
|
|
203
|
+
// CLOSED FILE SURFACE (the operator's dropdown law — a free-text
|
|
204
|
+
// weights row is a guess box): the two SeedVR2 DiT files the estate
|
|
205
|
+
// actually runs (both proven in shipped _flow.json receipts: the fp16
|
|
206
|
+
// 3B default + the fp8_e4m3fn 3B the lane walked). The union owns the
|
|
207
|
+
// dropdown AND the membership refusal (an off-set value fails at the
|
|
208
|
+
// schema door, never as a ComfyUI 400). Gated behind sr_switch like
|
|
209
|
+
// every other post leaf.
|
|
210
|
+
sr_model: vocabulary(["seedvr2_ema_3b_fp16.safetensors", "seedvr2_ema_3b_fp8_e4m3fn.safetensors"]).description("Super-Res model").default("seedvr2_ema_3b_fp16.safetensors").extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true&sr_switch=true", wtype: 'select', tooltip: "SeedVR2 weights (models/upscale_models/): fp16 3B default, fp8_e4m3fn 3B leaner." })),
|
|
211
|
+
// the R2V COMBO size mode — the literals OR a concrete WxH dimension
|
|
212
|
+
// ("704x1280" rides in real runs; a number or a typo refuses LOUD at
|
|
213
|
+
// the gate now, not as a ComfyUI 400). The select face serves the
|
|
214
|
+
// two literals; WxH stays reachable by patch, exactly as before.
|
|
215
|
+
ref_image_size: z.union([z.const("match"), z.const("max"), z.string().pattern(/^\d+x\d+$/).description("WxH")]).description("Ref size").default("match").extra('extra', bag({ order: null, group: 'sampling', wtype: 'select', tooltip: "How the bundle resizes ref images: match the anchor, take the max edge, or an explicit WxH." })),
|
|
216
|
+
|
|
217
|
+
// one truth, one owner. shift_video is a NUMBER, default 8, served
|
|
218
|
+
// and walked identically. The old z.const(null) arm — the
|
|
219
|
+
// "family-literal resolution path" that walked empty docs to null
|
|
220
|
+
// so the renderer's ?? floor could silently pick the family's own
|
|
221
|
+
// literal — is deleted. An explicit null in a draft now REFUSES
|
|
222
|
+
// LOUD at the walk. The hour-22 double-default (same 8 spelled on
|
|
223
|
+
// the union and the inner arm) never made the walk fill 8; it
|
|
224
|
+
// bought the face a number while the call kept the body literal.
|
|
225
|
+
shift_video: z.number().description("Video Shift").min(1).max(20).step(0.5).default(8).extra('extra', bag({ order: 5, group: 'sampling', columns: 2, width: 1, zone: 'params', wtype: 'number', tooltip: "Timestep shift for video attention. Higher = more coherent motion." })),
|
|
226
|
+
shift_audio: z.number().description("Audio Shift").min(1).max(10).step(0.5).default(3).extra('extra', bag({ order: 6, group: 'sampling', columns: 2, width: 1, zone: 'params', wtype: 'number', tooltip: "Timestep shift for audio attention. Lower = more detailed sound.", })),
|
|
227
|
+
// ── the SLA family (hour 16, item 3): compose-read knobs, now
|
|
228
|
+
// EMITTED — the studio's advanced panel rides the served spec
|
|
229
|
+
// (SpecFieldRow) instead of hand-rolled rows. Defaults are the
|
|
230
|
+
// compose's own ?? fallbacks, byte-for-byte; the h3_ prefix is the
|
|
231
|
+
// studio's LayerA spelling (docModel), never the card's.
|
|
232
|
+
|
|
233
|
+
// to turn SLA on/off or is it always on" — it was always on): the
|
|
234
|
+
// one boolean heads the sla group; every tuning leaf below rides
|
|
235
|
+
// visible_when behind it. Default true = today's behavior for
|
|
236
|
+
// every existing doc (absent = on at compose).
|
|
237
|
+
sla_enabled: z.boolean().description("SLA sparse attention").default(true).extra('extra', bag({ order: null, group: "sla", tooltip: "Block-sparse attention on the DiT (the primary speed arm, ~1.75x). Off falls back to the Attention backend row." })),
|
|
238
|
+
sla_sparsity: z.number().description("SLA sparsity").min(0).max(0.95).step(0.05).default(0.9).extra('extra', bag({ order: null, group: "sla", visible_when: "sla_enabled=true", wtype: 'slider', tooltip: "Block-sparse attention density. 0.90 ≈ 1.75x speedup, no quality loss." })),
|
|
239
|
+
sla_block_size: vocabulary(["32", "64", "128"]).description("SLA block size").default("32").extra('extra', bag({ order: null, group: "sla", visible_when: "sla_enabled=true", wtype: 'select', tooltip: "64 = clean audio; 128 = faster, robotic." })),
|
|
240
|
+
sla_min_seq_len: z.number().description("SLA min seq length").min(512).step(512).default(12288).extra('extra', bag({ order: null, group: "sla", visible_when: "sla_enabled=true", wtype: 'number', tooltip: "Sequences shorter than this skip sparsity." })),
|
|
241
|
+
sla_dense_last_steps: z.number().description("SLA dense last steps").min(0).max(10).step(1).default(1).extra('extra', bag({ order: null, group: "sla", visible_when: "sla_enabled=true", wtype: 'number', tooltip: "Final steps run dense for convergence." })),
|
|
242
|
+
sla_dense_steps: z.string().description("SLA dense steps (explicit)").default("0").extra('extra', bag({ order: null, group: "sla", visible_when: "sla_enabled=true", tooltip: "e.g. 0,1 or 0-2 — explicit dense step indices." })),
|
|
243
|
+
sla_dense_backend: vocabulary(["comfy_kitchen", "pytorch", "auto"]).description("SLA dense backend").default("comfy_kitchen").extra('extra', bag({ order: null, group: "sla", visible_when: "sla_enabled=true", wtype: 'select' })),
|
|
244
|
+
sla_reference_protection: vocabulary(["Off", "Light", "Heavy Enforcement"]).description("SLA ref protection").default("Heavy Enforcement").extra('extra', bag({ order: null, group: "sla", visible_when: "sla_enabled=true", wtype: 'select', tooltip: "Protects reference frames from sparse-attention drift." })),
|
|
245
|
+
sla_protect_audio: z.boolean().description("SLA protect audio").default(true).extra('extra', bag({ order: null, group: "sla", visible_when: "sla_enabled=true", tooltip: "Keep the audio stream out of the sparse path." })),
|
|
246
|
+
sla_stabilize_motion: z.boolean().description("SLA stabilize motion").extra('extra', bag({ order: null, group: "sla", visible_when: "sla_enabled=true", tooltip: "Default on except t4r openers (the family-conditional compose fallback stays the truth at run)." })),
|
|
247
|
+
sla_disable_fp16_accum: z.boolean().description("SLA full-precision accum").default(true).extra('extra', bag({ order: null, group: "sla", visible_when: "sla_enabled=true", tooltip: "Full-precision accumulation inside the sparse kernel." })),
|
|
248
|
+
// ── the sharpen leaves (compose: only EXPLICITLY-set leaves patch
|
|
249
|
+
// ImageSharpenKJ's grouped dict — bare emission defaults do NOT
|
|
250
|
+
// change a run that never sets them). VISIBILITY rides the
|
|
251
|
+
// declaration's own visible_when grammar (&-ANDed guards, |-SET
|
|
252
|
+
// values) — no hand-rolled predicates anywhere.
|
|
253
|
+
sharpen_method: vocabulary(["rcas", "adaptive_usm", "high_pass", "deconvolution"]).description("Sharpen Method").extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true&sharpen_enabled=true", wtype: 'select' })),
|
|
254
|
+
sharpen_radius: z.number().description("Sharpen Radius").min(0.5).max(5).step(0.5).extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true&sharpen_enabled=true&sharpen_method=adaptive_usm|high_pass|deconvolution", wtype: 'number', tooltip: "adaptive_usm / high_pass / deconvolution only." })),
|
|
255
|
+
sharpen_threshold: z.number().description("Sharpen Noise Gate").min(0).max(1).step(0.05).extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true&sharpen_enabled=true&sharpen_method=adaptive_usm", wtype: 'number', tooltip: "adaptive_usm only." })),
|
|
256
|
+
sharpen_iterations: z.number().description("Sharpen Iterations").min(1).max(100).step(1).extra('extra', bag({ order: null, group: 'second_pass', visible_when: "second_pass_enabled=true&sharpen_enabled=true&sharpen_method=deconvolution", wtype: 'number', tooltip: "deconvolution only." })),
|
|
257
|
+
// NOTE: the calls[] SHOTS surface is deliberately NOT a carrier
|
|
258
|
+
// knob — the carrier feeds the studio's frozen form-spec (the
|
|
259
|
+
// studio owns its own shots editor, ui/studio/docModel) and the
|
|
260
|
+
// served manifests. The AGENT plane declares calls in the tool
|
|
261
|
+
// face (src/tool.ts); the SHOT LAWS are the card gate's (schema()
|
|
262
|
+
// below — the model_validator port), so every composer
|
|
263
|
+
// agent tool, studio, any future caller — meets the same gate.
|
|
264
|
+
|
|
265
|
+
// schema enforces EVERY key the renderer reads — no blind casts, no
|
|
266
|
+
// silent rides): the stanza/film vocabulary below was historically
|
|
267
|
+
// undeclared (it rode `admits` and every walk passed it verbatim
|
|
268
|
+
// while renderH3Window blind-cast it). Types mirror the renderer's
|
|
269
|
+
// reads exactly; NO defaults — the renderer's ?? fallback chains
|
|
270
|
+
// stay authoritative, the walk only REFUSES garbage. HIDDEN FROM
|
|
271
|
+
|
|
272
|
+
// INDEX, WHY IS IT BLANK"): validation-only keys never render; a
|
|
273
|
+
// default-less blank row on the form is a lie.
|
|
274
|
+
k: z.number().description("Window index (film vocabulary)").step(1).extra('extra', bag({ hidden: true })),
|
|
275
|
+
noise_seed: z.number().description("Per-window noise seed").step(1).extra('extra', bag({ hidden: true })),
|
|
276
|
+
fps_seconds: z.number().description("Clip seconds (fps rail)").min(1).max(60).default(10).extra('extra', bag({ order: null, wtype: 'number', tooltip: "The clip's duration in seconds (the fps rail's duration primitive)." })),
|
|
277
|
+
// THE LEGACY ALIASES (renderer-era spellings of the mod switches)
|
|
278
|
+
// — gate-admitted for old drafts, never user surface: the MODS
|
|
279
|
+
|
|
280
|
+
interp_switch: z.boolean().description("Interpolate switch (legacy alias)").extra('extra', bag({ hidden: true })),
|
|
281
|
+
sharpen_switch: z.boolean().description("Sharpen switch (legacy alias)").extra('extra', bag({ hidden: true })),
|
|
282
|
+
sla_switch: z.boolean().description("SLA switch (legacy alias)").extra('extra', bag({ hidden: true })),
|
|
283
|
+
// (no wtype: hidden fields never render — the kind mapping rides
|
|
284
|
+
// flowKinds.legacyAliases, pinned in input-surface.spec.ts; a wtype
|
|
285
|
+
// here is dead surface the estate wtype judge refuses.)
|
|
286
|
+
image_name: z.string().role('path').description("Guide image (renderer alias)").extra('extra', bag({ hidden: true, tooltip: "The renderer's guide-image spelling — gate-admitted for old docs; the rail's First frame is the user face." })),
|
|
287
|
+
});
|
|
288
|
+
/** Schemastery objects are lenient (unknown/missing keys ride); the
|
|
289
|
+
* family-admission laws are the renderer's own validators, ported:
|
|
290
|
+
* unknown variant + family-conditional key admission on EXPLICIT
|
|
291
|
+
* params only (the python gate reads model_fields_set). The t4r
|
|
292
|
+
* staged-image law rides compose (it reads the merged value). The
|
|
293
|
+
* renderer-vocabulary keys (variant, k, ctx_*, sla_*, ...) are NOT
|
|
294
|
+
* declared knobs — old drafts keep working because the schema admits
|
|
295
|
+
* them and the compose door overlays explicit params last (the
|
|
296
|
+
* img-to-mesh filename_prefix precedent). */
|
|
297
|
+
// THE WIRE LAW (hour 20 — ONE definition, every door): a fresh stage
|
|
298
|
+
// from the bench add-door rides the served wire literal ("false"/"true")
|
|
299
|
+
// as an EXPLICIT key; coerce it to the runtime boolean before the
|
|
300
|
+
// boolean walk refuses it. Absent keys need nothing — default(false)
|
|
301
|
+
// fills natively. (A schemastery field transform would classify the
|
|
302
|
+
// served knob as type 'json' — the honest 'boolean' taxonomy wins,
|
|
303
|
+
// so the law lives here, shared by schema() and the compose gate.)
|
|
304
|
+
export const coerceWireBoolean = (raw) => {
|
|
305
|
+
if (typeof raw.interpolate_enabled === 'string') {
|
|
306
|
+
|
|
307
|
+
// the TWO wire literals only — any other string refused LOUD
|
|
308
|
+
// (silent garbage-to-false was a walk bypass, never the wire law).
|
|
309
|
+
const v = raw.interpolate_enabled;
|
|
310
|
+
if (v !== 'true' && v !== 'false') {
|
|
311
|
+
throw new Error(`interpolate_enabled must be a boolean or the wire literal "true"/"false" — got ${JSON.stringify(v).slice(0, 40)}`);
|
|
312
|
+
}
|
|
313
|
+
return { ...raw, interpolate_enabled: v === 'true' };
|
|
314
|
+
}
|
|
315
|
+
return raw;
|
|
316
|
+
};
|
|
317
|
+
export function schema(v) {
|
|
318
|
+
const raw = (v ?? {});
|
|
319
|
+
if (raw.calls !== undefined && !Array.isArray(raw.calls)) {
|
|
320
|
+
throw new Error('h3-timeline: calls must be an array of shot rows');
|
|
321
|
+
}
|
|
322
|
+
if (raw.audio_clips !== undefined && !Array.isArray(raw.audio_clips)) {
|
|
323
|
+
throw new Error('h3-timeline: audio_clips must be an array of clip rows');
|
|
324
|
+
}
|
|
325
|
+
// length null SURVIVES this walk on purpose (the walk-shadow fix:
|
|
326
|
+
// multi-call docs keep null — per-window spans compute at compose).
|
|
327
|
+
|
|
328
|
+
// names the array keys — a wire "" (the empty-array corruption)
|
|
329
|
+
// fills to [], an {item:[…]} wrapper unwraps — same law as the
|
|
330
|
+
// boolean wire tolerance above (receipts: commission 034's
|
|
331
|
+
// run-9953f652410d-d365af74, `$.ref_images expected array but
|
|
332
|
+
// got [object Object]` ×4 and `calls: ""`).
|
|
333
|
+
const out = paramSchema(coerceWireArrays(paramSchema, coerceWireBoolean(raw)));
|
|
334
|
+
|
|
335
|
+
// break): `variant` on the wire carries TWO vocabularies — the
|
|
336
|
+
// model axis ('timeline', the stamp the add door seeds onto every
|
|
337
|
+
// fresh stage) and the window family (t4r/t4_open/t4_chain). A
|
|
338
|
+
// stated FAMILY rides; an axis string is not a family claim — the
|
|
339
|
+
// doc's seats derive the family, model metadata never picks a
|
|
340
|
+
// render lane, and 'unknown window family' never fires on it.
|
|
341
|
+
let variant = typeof raw.variant === 'string' && FAMILIES.includes(raw.variant)
|
|
342
|
+
? raw.variant : undefined;
|
|
343
|
+
// variant DERIVATION (opener_family/chain_family): the studio calls shape carries no variant; the card derives it.
|
|
344
|
+
// An image-anchored opener rides t4r; a text-only single call is t4_open; multiple calls chain (t4_chain).
|
|
345
|
+
|
|
346
|
+
// a freshly added card holds params {} — calls is NOT a form knob,
|
|
347
|
+
// so the bench tile's Run composed no shots and the door refused
|
|
348
|
+
// "no calls to compose" before the studio ever persisted its doc).
|
|
349
|
+
// ABSENT calls compose the card's own fresh-card document: ONE
|
|
350
|
+
// window 0→90 — the t4_open fresh-card draft budget (
|
|
351
|
+
// display = render, 3.8s). A user authoring a LONGER single window
|
|
352
|
+
|
|
353
|
+
// gates; if a user wants a long window, they should get a long
|
|
354
|
+
// window"); the span-vs-engine receipts live in the ledger as
|
|
355
|
+
// knowledge, never enforcement. An
|
|
356
|
+
// EXPLICIT empty array keeps the retired compose refusal verbatim
|
|
357
|
+
// ("%s: no calls to compose"): a caller naming
|
|
358
|
+
// zero shots is garbage; a caller naming none is a fresh card.
|
|
359
|
+
if (variant === undefined) {
|
|
360
|
+
let calls = [];
|
|
361
|
+
if (Array.isArray(raw.calls)) {
|
|
362
|
+
calls = raw.calls;
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
calls = [{ start_frame: 0, end_frame: 90 }];
|
|
366
|
+
out['calls'] = calls;
|
|
367
|
+
}
|
|
368
|
+
if (calls.length === 0) {
|
|
369
|
+
throw new Error('h3-timeline: no calls to compose');
|
|
370
|
+
}
|
|
371
|
+
// THE ROW-LEVEL NUMERIC RESTORE (attempt-035/009's stop-law
|
|
372
|
+
|
|
373
|
+
// DELIBERATELY undeclared on paramSchema (the agent plane owns
|
|
374
|
+
// them) — the dict-driven wire fill has no license on undeclared
|
|
375
|
+
// keys, so a stringified `start_frame: "0"` rode into the shot
|
|
376
|
+
// laws and refused `start_frame is required (int frames — text
|
|
377
|
+
// alone is not a shot)` EVEN THOUGH the caller sent the number.
|
|
378
|
+
// The card OWNS the int law here — it restores the strict-grammar
|
|
379
|
+
// int-string itself (same fill law as the kit's, scoped to the
|
|
380
|
+
// row fields the shot laws read).
|
|
381
|
+
const INT_STRING = /^[+-]?\d+$/;
|
|
382
|
+
const wireInt = (x) => (typeof x === 'string' && INT_STRING.test(x.trim()) ? Number(x.trim()) : x);
|
|
383
|
+
for (let wi = 0; wi < calls.length; wi++) {
|
|
384
|
+
const wc = (calls[wi] ?? {});
|
|
385
|
+
for (const wn of ['start_frame', 'end_frame']) {
|
|
386
|
+
const wv = wireInt(wc[wn]);
|
|
387
|
+
if (wv !== wc[wn]) {
|
|
388
|
+
wc[wn] = wv;
|
|
389
|
+
calls[wi] = wc;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
// THE SHOT LAWS (the ranges are the card gate's, never a silent re-default: an out-of-range seam is refused and a reversed span is refused; both banned).
|
|
394
|
+
// (the seam_carry law died with the MotionContext seam — the
|
|
395
|
+
// drift-control continuation owns the chaining now, overlap is
|
|
396
|
+
// automatic, never user-authored lane physics)
|
|
397
|
+
for (let i = 0; i < calls.length; i++) {
|
|
398
|
+
const c = (calls[i] ?? {});
|
|
399
|
+
const unknown = Object.keys(c).filter((key) => !CALL_KEYS.has(key)).sort();
|
|
400
|
+
if (unknown.length > 0) {
|
|
401
|
+
throw new Error(`calls[${i}]: unknown per-call key(s): ${unknown.join(', ')}`);
|
|
402
|
+
}
|
|
403
|
+
for (const name of ['start_frame', 'end_frame']) {
|
|
404
|
+
const v = c[name];
|
|
405
|
+
if (v === undefined || v === null || typeof v !== 'number' || !Number.isInteger(v)) {
|
|
406
|
+
throw new Error(`calls[${i}]: ${name} is required (int frames — text alone is not a shot)`);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
if (c.end_frame <= c.start_frame) {
|
|
410
|
+
throw new Error(`calls[${i}]: end_frame ${c.end_frame} <= start_frame ${c.start_frame} — a reversed or empty span is not a shot`);
|
|
411
|
+
}
|
|
412
|
+
if (i > 0) {
|
|
413
|
+
// the previous row was already validated as an int-span object
|
|
414
|
+
// (a hole at i-1 refused at its own iteration), so no fallback
|
|
415
|
+
const previous = calls[i - 1];
|
|
416
|
+
if (c.start_frame !== previous.end_frame) {
|
|
417
|
+
throw new Error(`calls[${i}]: start_frame ${String(c.start_frame)} must equal previous end_frame ${String(previous.end_frame)} — calls tile the film timeline; gaps and overlaps are refused`);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const transition = typeof c.transition === 'string' ? c.transition : undefined;
|
|
421
|
+
// THE GRID GATE (§26, the walk arm): a call's knobs.length pin
|
|
422
|
+
// bypasses every snap arm downstream — validate at the walk so
|
|
423
|
+
// `validate` refuses what the engine would kill at GPU cost.
|
|
424
|
+
const cknobs = (c.knobs ?? {});
|
|
425
|
+
if (cknobs.length !== undefined && cknobs.length !== null) {
|
|
426
|
+
assertGridLength(cknobs.length, `calls[${i}].knobs.length`);
|
|
427
|
+
}
|
|
428
|
+
// THE UNIFORM SPAN GATE: one grid law for every window shape —
|
|
429
|
+
// carried windows (i>0, non-cut) generate span+22, first/cut
|
|
430
|
+
// windows generate their span, and an off-grid authored span is
|
|
431
|
+
// refused at admission instead of silently snapped.
|
|
432
|
+
assertSpanGrid({
|
|
433
|
+
start: c.start_frame,
|
|
434
|
+
end: c.end_frame,
|
|
435
|
+
}, `calls[${i}]`, i > 0 ? transitionOverlap(transition) : 0);
|
|
436
|
+
|
|
437
|
+
// a guide seat must NAME MEDIA — a path, URL, data: URI, or
|
|
438
|
+
// $spell. The UI's reference picker once wrote the SOURCE
|
|
439
|
+
// STAGE's name ("image-gen") into the anchor seat and the run
|
|
440
|
+
// rendered text-only (the compose read the guide, the engine
|
|
441
|
+
// had no such file). A bare word with no slash, dot, or scheme
|
|
442
|
+
// is a label, never media — refuse here, naming the value and
|
|
443
|
+
// the cure, at admission (zero GPU) instead of the engine door.
|
|
444
|
+
const isMediaRef = (v) => v.startsWith('$') || v.startsWith('data:') || v.includes('/') || /\.[A-Za-z0-9]+$/.test(v);
|
|
445
|
+
for (const gkey of ['image', 'ref_image', 'image_name']) {
|
|
446
|
+
const gv = c[gkey];
|
|
447
|
+
if (typeof gv === 'string' && gv.trim() !== '' && !isMediaRef(gv.trim())) {
|
|
448
|
+
throw new Error(`calls[${i}].${gkey}: "${gv.trim()}" names no media — a stage/card name is not an image ` +
|
|
449
|
+
`(pick the artifact: a file path, URL, or $spell rides; a label never does)`);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
for (const garr of ['ref_images']) {
|
|
453
|
+
for (const entry of wireList(c[garr])) {
|
|
454
|
+
if (!isMediaRef(entry.trim())) {
|
|
455
|
+
throw new Error(`calls[${i}].${garr}: "${entry.trim()}" names no media — a stage/card name is not an image ` +
|
|
456
|
+
`(pick the artifact: a file path, URL, or $spell rides; a label never does)`);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
// (the shot-law loop above guarantees every row is a shaped
|
|
462
|
+
// object with pinned int spans — no gap-arms needed here)
|
|
463
|
+
// variant is a WINDOW property: a single-call doc's guide makes the
|
|
464
|
+
// whole (one-window) graph t4r; a MULTI-call doc is a film — its
|
|
465
|
+
// variant is t4_chain and each window derives its own family in
|
|
466
|
+
// the merged renderer (a guide call renders as its own t4r window)
|
|
467
|
+
|
|
468
|
+
// compose reads FOUR guide spellings (call.image ?? call.ref_image
|
|
469
|
+
// ?? call.image_name — actions.ts:268/:1635); the derivation must
|
|
470
|
+
// know every spelling the compose knows, or a guide silently
|
|
471
|
+
// derives a text-only window (run-899a8448: the UI wrote `image`,
|
|
472
|
+
// the derivation checked the other three, variant fell t4_open and
|
|
473
|
+
// the reference never became a node).
|
|
474
|
+
const hasGuide = calls.some((c) => {
|
|
475
|
+
const cc = c;
|
|
476
|
+
return Boolean(cc.image) || Boolean(cc.ref_images) || Boolean(cc.ref_image) || Boolean(cc.image_name);
|
|
477
|
+
})
|
|
478
|
+
// THE DECLARED INPUT SURFACE (the input rail's law): card-level
|
|
479
|
+
// refs / an end anchor / the audio bed imply the r2v lane by the
|
|
480
|
+
// same law as a per-call guide — the window re-checks, but the
|
|
481
|
+
// derivation owns it first
|
|
482
|
+
|| wireList(raw.ref_images).length + wireList(raw.ref_videos).length + wireList(raw.ref_audios).length > 0
|
|
483
|
+
|| (typeof raw.last_frame === 'string' && raw.last_frame.trim() !== '');
|
|
484
|
+
variant = calls.length > 1 ? 't4_chain' : hasGuide ? 't4r' : 't4_open';
|
|
485
|
+
out.variant = variant;
|
|
486
|
+
}
|
|
487
|
+
if (!FAMILIES.includes(variant)) {
|
|
488
|
+
throw new Error(`unknown window family '${variant}' (known: ${[...FAMILIES].sort().join(', ')})`);
|
|
489
|
+
}
|
|
490
|
+
const explicit = new Set(Object.keys(raw));
|
|
491
|
+
|
|
492
|
+
// default(8) is THE owner. The old nulling — "an omitted key
|
|
493
|
+
// normalizes back to null so the body resolves the family's
|
|
494
|
+
// literal (t4 INT 8 / t4r 8.0) and the frozen graphs stay
|
|
495
|
+
// byte-identical" — was the two-owner disease in its purest form:
|
|
496
|
+
// the declaration promised 8, the walk delivered null, the body
|
|
497
|
+
// invented 8 back. JS serializes 8.0 and 8 identically, so the
|
|
498
|
+
// nulling bought nothing but the lie. The no-cheat door refuses
|
|
499
|
+
// this card shape on sight now.
|
|
500
|
+
|
|
501
|
+
// declared .default(56) is the declared default,
|
|
502
|
+
// but the body computes the family's frame budget where the python
|
|
503
|
+
// computes it (t4_open 90 / else 56 — "None = absent on wire").
|
|
504
|
+
// Without this normalization the schemastery walk materializes 56 on
|
|
505
|
+
// every doc that omits the key and the t4_open 90 branch is dead —
|
|
506
|
+
// a hand-authored single text window silently rendered 56 frames.
|
|
507
|
+
|
|
508
|
+
// default may never walk null. Single-call docs keep the span
|
|
509
|
+
// rider (the window's grid-snapped span, EXPLICIT — the doc's span
|
|
510
|
+
// IS the film). Multi-call docs let the walked default stand INERT
|
|
511
|
+
// — the doc-level length is a WINDOW knob and multi-call films
|
|
512
|
+
// have no doc-level window; the per-window stanza lengths own the
|
|
513
|
+
// film (each call's span), and the studio's timeline readouts
|
|
514
|
+
// compute off the calls, never this key. (An earlier arm of this
|
|
515
|
+
// rework filled the FILM TOTAL here — wrong law: the 17k+5 grid
|
|
516
|
+
// belongs to windows, a total is arbitrary span arithmetic, and
|
|
517
|
+
// the walk's grid validation rightly refused off-grid totals.)
|
|
518
|
+
if (!explicit.has('length')) {
|
|
519
|
+
const rows = Array.isArray(out.calls) ? out.calls : [];
|
|
520
|
+
if (rows.length === 1) {
|
|
521
|
+
// (the shot laws above guarantee valid int spans — direct
|
|
522
|
+
// reads, no defensive re-validation)
|
|
523
|
+
const sf = rows[0].start_frame;
|
|
524
|
+
const ef = rows[0].end_frame;
|
|
525
|
+
// (the shot laws above guarantee valid int spans — every
|
|
526
|
+
// single-call doc rides the snap arm; no defensive else)
|
|
527
|
+
out.length = ef - sf;
|
|
528
|
+
}
|
|
529
|
+
// rows.length !== 1: the walked default stands (56 fresh-card,
|
|
530
|
+
// inert for multi-call chains — spans own the film)
|
|
531
|
+
}
|
|
532
|
+
const bad = (keys) => keys.filter((kk) => explicit.has(kk)).sort();
|
|
533
|
+
if (variant === 't4r') {
|
|
534
|
+
const b = bad(T4_ONLY_KEYS);
|
|
535
|
+
if (b.length)
|
|
536
|
+
throw new Error(`h3_window(t4r): unsanctioned inject keys: ${b.join(', ')}`);
|
|
537
|
+
}
|
|
538
|
+
// THE STEPS-PIN STAMP (007-H3-LoRA-PLANE L3): whether the caller
|
|
539
|
+
// pinned steps is a fact only this walk owns (the raw keys —
|
|
540
|
+
// defaults materialize downstream and the film build can no
|
|
541
|
+
// longer tell a pinned count from the walked default). The
|
|
542
|
+
// single-window marriage reads it: an explicit count is the
|
|
543
|
+
// user's word and the distill default never overwrites it. The
|
|
544
|
+
// __-prefix internal channel (the film loop's
|
|
545
|
+
// __iteration/__overlap precedent) — faces project the carrier's
|
|
546
|
+
// declared knobs only, so no served surface changes.
|
|
547
|
+
out.__steps_pinned = explicit.has('steps');
|
|
548
|
+
return out;
|
|
549
|
+
}
|
|
550
|
+
// THE TOOL-FACE EXPORTS: the carrier (paramSchema — the same object
|
|
551
|
+
// the registry's schemaCarrier hands the served-manifest projection;
|
|
552
|
+
// ONE spelling, two doors) + the identity rung (the ring's label/
|
|
553
|
+
// description prose, stated once).
|
|
554
|
+
export const carrier = paramSchema;
|
|
555
|
+
//# sourceMappingURL=schema.js.map
|