@melite/models-h3 0.1.5-pre-alpha → 0.2.2-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 +561 -457
- package/README.md +11 -16
- package/lib/actions.d.ts +100 -17
- package/lib/actions.js +1505 -257
- package/lib/chainEdit.d.ts +196 -0
- package/lib/chainEdit.js +334 -0
- package/lib/chainUpscale.d.ts +25 -0
- package/lib/chainUpscale.js +134 -0
- package/lib/extend.d.ts +25 -0
- package/lib/extend.js +221 -0
- package/lib/filmMix.d.ts +28 -12
- package/lib/filmMix.js +47 -16
- package/lib/finalize.js +6 -1
- package/lib/index.d.ts +12 -0
- package/lib/index.js +269 -65
- package/lib/mods/loras.d.ts +18 -95
- package/lib/mods/loras.js +35 -10
- package/lib/refine.d.ts +170 -0
- package/lib/refine.js +775 -0
- package/lib/repair.d.ts +15 -0
- package/lib/repair.js +164 -0
- package/lib/reshoot.d.ts +201 -0
- package/lib/reshoot.js +399 -0
- package/lib/schema.d.ts +70 -13
- package/lib/schema.js +342 -60
- package/lib/swap.d.ts +14 -0
- package/lib/swap.js +95 -0
- package/lib/timelineContract.d.ts +170 -0
- package/lib/timelineContract.js +238 -2
- package/lib/windowSpec.d.ts +23 -0
- package/lib/windowSpec.js +49 -0
- package/package.json +23 -12
package/lib/actions.js
CHANGED
|
@@ -1,30 +1,202 @@
|
|
|
1
1
|
import { fireControlNets } from '@melite/comfyui-card-kit/guard';
|
|
2
2
|
import { saveAudio } from '@melite/comfyui-card-kit';
|
|
3
|
-
import {
|
|
3
|
+
import { mediaKindOf } from '@melite/contracts/mediaKinds';
|
|
4
|
+
import { assertKeyframeRowShape, FAMILIES, paramSchema, wireList, H3_RECOMMENDED_SAMPLERS, REFINE_DENOISE_DEFAULT } from './schema.js';
|
|
4
5
|
import { H3_LORA_ROWS } from '@melite/models-h3/mods/loras';
|
|
5
6
|
import { SAMPLER_OPTIONS, SCHEDULER_OPTIONS } from '@melite/comfyui-card-kit/vocab';
|
|
6
|
-
import { computeFilmMix, parseFilmMixClips, stanzaSecs } from
|
|
7
|
-
import { GRID_REMAINDER, GRID_STEP_FRAMES, IMAGE_BUS_SLOTS, REF_CAPS, assertGridLength, assertSpanGrid, imageReferenceCap, spanStanzaFrames, transitionOverlap
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// default
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
|
|
7
|
+
import { computeFilmMix, parseFilmMixClips, spanOverlap, stanzaSecs } from './filmMix.js';
|
|
8
|
+
import { DOC_FPS_DEFAULT, GRID_REMAINDER, GRID_STEP_FRAMES, IMAGE_BUS_SLOTS, REF_CAPS, assertGridLength, assertSpanGrid, bookSeconds, imageReferenceCap, isGridLength, isMediaRef, spanStanzaFrames, transitionOverlap } from './timelineContract.js';
|
|
9
|
+
import { applyH3ReshootCond, applyH3ReshootModel, buildH3Reshoot, reshootArmed, reshootPrompt, } from './reshoot.js';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// default lora to the silveroxides merge"; SILVEROXIDES IS THE
|
|
14
|
+
// MERGE, LIGHTX2V IS NOT). THE ROW IS `h3_silver_dareties` —
|
|
15
|
+
// silveroxides' OFFICIAL silver_official_releases DARE-TIES merge
|
|
16
|
+
// (label "Silveroxides DARE-TIES Merge", strength 0.8, designed
|
|
17
|
+
|
|
18
|
+
// experimental/ LightX2V-turbo × dareties file (h3_lightx2v_turbo)
|
|
19
|
+
// as "the merge" — the F34b class: a merge row the catalog never
|
|
20
|
+
// held; that row stays pick-only under its honest experimental
|
|
21
|
+
// label. The row is resolved from the
|
|
22
|
+
// family lora CATALOG (mods/loras.ts — the one owner of every lora
|
|
23
|
+
// filename and default strength; the value was restated as a
|
|
24
|
+
// literal here, which is how a catalog edit would have silently
|
|
25
|
+
// missed the default). The wire shape matches a resolved bag row:
|
|
26
|
+
// on, lora (filename), str (default_strength), plus the four fixed
|
|
27
|
+
// mode flags. A missing catalog row refuses at load — the default
|
|
28
|
+
// would have no source.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export const H3_DEFAULT_LORA_ID = 'h3_silver_dareties';
|
|
32
|
+
/** The absent-bag default as a RESOLVED ROW — the same catalog row the
|
|
33
|
+
* compose default builds, exposed so the card can serve it as the
|
|
34
|
+
* ghost chip: the face then shows the adapter the film will actually
|
|
35
|
+
* run instead of an empty bag. One owner: the catalog. */
|
|
36
|
+
export const h3DefaultLoraEntry = () => {
|
|
37
|
+
const row = H3_LORA_ROWS.find((r) => r.id === H3_DEFAULT_LORA_ID);
|
|
38
|
+
if (row === undefined) {
|
|
39
|
+
throw new Error(`h3 action: the lora catalog has no '${H3_DEFAULT_LORA_ID}' row — the absent-bag default has no source; fix the catalog row id`);
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
id: row.id,
|
|
43
|
+
strength: row.default_strength ?? 1,
|
|
44
|
+
steps: row.steps ?? 8,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
17
47
|
const loraStackDefault = () => {
|
|
18
|
-
const row = H3_LORA_ROWS.find((r) => r.id ===
|
|
48
|
+
const row = H3_LORA_ROWS.find((r) => r.id === H3_DEFAULT_LORA_ID);
|
|
19
49
|
if (row === undefined) {
|
|
20
|
-
throw new Error(
|
|
50
|
+
throw new Error(`h3 action: the lora catalog has no '${H3_DEFAULT_LORA_ID}' row — the absent-bag default has no source; fix the catalog row id`);
|
|
21
51
|
}
|
|
22
52
|
return JSON.stringify([{ on: true, lora: row.filename, str: row.default_strength, v: 1, a: 1, t: 1 }]);
|
|
23
53
|
};
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
export function h3LoraStackOf(p) {
|
|
62
|
+
return Array.isArray(p.loras)
|
|
63
|
+
? JSON.stringify(p.loras.map((r) => ({
|
|
64
|
+
// the service resolves every row against the family catalog
|
|
65
|
+
// (unknown ids refuse LOUD upstream) — {name, strength} is
|
|
66
|
+
// the guaranteed wire shape, read directly
|
|
67
|
+
on: true,
|
|
68
|
+
lora: r.name,
|
|
69
|
+
str: r.strength,
|
|
70
|
+
v: 1, a: 1, t: 1,
|
|
71
|
+
})))
|
|
72
|
+
: loraStackDefault();
|
|
73
|
+
}
|
|
74
|
+
/** THE MARRIED SHIFT'S ONE OWNER (same law as the lora plane): the
|
|
75
|
+
* sigma-shift grid the doc's lora plane owns — a pinned shift is the
|
|
76
|
+
* user's word, an unstated one marries the bag's highest-count row
|
|
77
|
+
* (marriedBagKnob), else the doc's own row. Both renderers read this.
|
|
78
|
+
* @param p the walked doc params */
|
|
79
|
+
export function h3ShiftVideoOf(p) {
|
|
80
|
+
const married = marriedBagKnob(p, 'shift_video');
|
|
81
|
+
return p.__shift_pinned === true || married === null
|
|
82
|
+
? p.shift_video
|
|
83
|
+
: married;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// marriage's own math, one spelling for both knobs): while a
|
|
87
|
+
// counting bag row rides, the married knob (steps, shift_video) is
|
|
88
|
+
// the ROW'S — stated on the entry first, else the catalog row's
|
|
89
|
+
// declared default, Math.max across the bag ("8 steps on a 4-step
|
|
90
|
+
// distill is fine, 4 on an 8-step is undercooked"; the shift grid
|
|
91
|
+
// follows the same highest-count-wins law — the 8-step member of a
|
|
92
|
+
// stacked pair owns the grid). The estate's resolver stamps the
|
|
93
|
+
// row's defaults onto resolved wire rows; hand-authored and
|
|
94
|
+
// agent-shaped bags fall back to the catalog row BY FILENAME (the
|
|
95
|
+
// wire's `name` — fictional filenames marry nothing, the
|
|
96
|
+
// door-spec's walk-default law). PURE, no I/O.
|
|
97
|
+
const marriedBagKnob = (p, knob) => {
|
|
98
|
+
if (!Array.isArray(p.loras))
|
|
99
|
+
return null;
|
|
100
|
+
const counts = [];
|
|
101
|
+
for (const row of p.loras) {
|
|
102
|
+
if (row === null || typeof row !== 'object')
|
|
103
|
+
continue;
|
|
104
|
+
const stated = row[knob];
|
|
105
|
+
if (typeof stated === 'number' && Number.isFinite(stated)) {
|
|
106
|
+
counts.push(stated);
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const name = row['name'];
|
|
110
|
+
const fromCatalog = typeof name === 'string'
|
|
111
|
+
? H3_LORA_ROWS.find((r) => r.filename === name)?.[knob]
|
|
112
|
+
: undefined;
|
|
113
|
+
if (typeof fromCatalog === 'number' && Number.isFinite(fromCatalog))
|
|
114
|
+
counts.push(fromCatalog);
|
|
115
|
+
}
|
|
116
|
+
return counts.length > 0 ? Math.max(...counts) : null;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// refine seats were served-but-dead: the schema admits refine_lora /
|
|
120
|
+
// _strength / _steps and the film params row carries them, but
|
|
121
|
+
// nothing built the rider's {name, strength, steps} object, so the
|
|
122
|
+
// T3 rider never mounted and the plain pass rendered under stating
|
|
123
|
+
// seats). The assembly lives HERE — inside renderH3Window, the
|
|
124
|
+
// single choke point both the film loop and the single-window face
|
|
125
|
+
// call — so neither face can mount the rider without it (the G6
|
|
126
|
+
// two-face law). Unknown ids refuse LOUD naming refine_lora (the
|
|
127
|
+
// schema's LORAS-ARE-ONLY-MODS promise); master-off or empty id =
|
|
128
|
+
// no rider (the legacy byte-stable plain pass).
|
|
129
|
+
function resolveRefineSeat(p) {
|
|
130
|
+
if (p.second_pass_enabled !== true)
|
|
131
|
+
return undefined;
|
|
132
|
+
const id = p.refine_lora;
|
|
133
|
+
if (typeof id !== "string" || id === "")
|
|
134
|
+
return undefined;
|
|
135
|
+
const row = H3_LORA_ROWS.find((r) => r.id === id);
|
|
136
|
+
if (row === undefined) {
|
|
137
|
+
throw new Error(`h3 action: refine_lora '${id}' names no served loras row — pick from the flavor catalog, never a hand-spelled id (the compose door refuses unknown ids loud)`);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// refine-steps-range law moves here, its only assembler: a stated
|
|
141
|
+
// count outside the named row's declared [min, max] refuses LOUD
|
|
142
|
+
// naming the domain. The door carries NO steps-required or
|
|
143
|
+
// strength-fallback branches: every served row declares steps +
|
|
144
|
+
// default_strength (the wall's ARM 9 locks the 11/11), so those
|
|
145
|
+
// branches would be dead code refusing coverage. The table is an
|
|
146
|
+
// `as const` union where only domain rows carry steps_min/max, so
|
|
147
|
+
// the bounds read through `in`-narrowing (no cast, no table touch).
|
|
148
|
+
const steps = (p.refine_steps ?? row.steps);
|
|
149
|
+
const lo = ('steps_min' in row) ? row.steps_min : undefined;
|
|
150
|
+
const hi = ('steps_max' in row) ? row.steps_max : undefined;
|
|
151
|
+
if ((lo !== undefined && steps < lo) || (hi !== undefined && steps > hi)) {
|
|
152
|
+
throw new Error(`h3 action: refine_steps ${steps} for refine_lora '${id}' falls outside the row's declared domain [${lo ?? '…'}, ${hi ?? '…'}] — pick a count the instrument serves, never force one (the compose door enforces the row domain)`);
|
|
153
|
+
}
|
|
154
|
+
// THE REFINE WINDOW (SOTA plan limb 1, H3_TIMELINE_RESERACH Stage
|
|
155
|
+
|
|
156
|
+
// rides the DECLARED 0.35 default — the research's refinement
|
|
157
|
+
// window (0.30–0.35: pass 1's structure stays, the rider polishes
|
|
158
|
+
// texture); 1.0 stays stateable, the TaoMate full-denoise mechanic.
|
|
159
|
+
// Domain [0.05, 1] — ONE law
|
|
160
|
+
// with the schema row and the film.params row below (audit
|
|
161
|
+
|
|
162
|
+
// [0.05, 1] disagreed at 0 < d < 0.05, and the walk owned every
|
|
163
|
+
// real-doc refusal before compose — the resolver's voice had no
|
|
164
|
+
// firing arm. Both seats now state the same bounds and ARM 4f
|
|
165
|
+
// judges the resolver at the family plane, its own seat).
|
|
166
|
+
// P2 SHARES THE SEAT (SOTA plan Phase P2): the latent-upscale
|
|
167
|
+
// handoff reads the SAME refine_denoise as its own Stage-2 window
|
|
168
|
+
// (rider or none — pass 1's structure stays either way), so the
|
|
169
|
+
// assembly moves to resolveStage2Denoise below (one owner, two
|
|
170
|
+
// consumers — the rider keeps its voice, the arm borrows it).
|
|
171
|
+
const denoise = resolveStage2Denoise(p);
|
|
172
|
+
return {
|
|
173
|
+
name: row.filename,
|
|
174
|
+
strength: p.refine_strength ?? row.default_strength,
|
|
175
|
+
steps,
|
|
176
|
+
denoise,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
// THE STAGE-2 DENOISE (SOTA plan Phase P2 — one owner, two
|
|
180
|
+
// consumers): the refine rider AND the latent-upscale handoff read the
|
|
181
|
+
// SAME refine_denoise seat. The rider's window over the pass-1 latent;
|
|
182
|
+
// the handoff's own partial-denoise inside the LBH kernel over the
|
|
183
|
+
// upscaled latent (rider or none — pass 1's structure stays either
|
|
184
|
+
// way). Unstated rides the DECLARED 0.35 (the SOTA refinement window);
|
|
185
|
+
// the voice is the rider's (ARM 4f judges it at the family plane),
|
|
186
|
+
// borrowed verbatim by the arm.
|
|
187
|
+
function resolveStage2Denoise(p) {
|
|
188
|
+
const denoise = p.refine_denoise ?? REFINE_DENOISE_DEFAULT;
|
|
189
|
+
if (!(denoise >= 0.05 && denoise <= 1)) {
|
|
190
|
+
throw new Error(`h3 action: refine_denoise ${String(p.refine_denoise)} falls outside the refinement window [0.05, 1] — 1 is the full-denoise taomate mechanic, 0.30–0.35 the SOTA refinement window; a dead or over-terminal second pass never composes`);
|
|
191
|
+
}
|
|
192
|
+
return denoise;
|
|
193
|
+
}
|
|
24
194
|
// His 17k+5 grid, in-graph (ComfyMathExpression): snap latent steps to 2 mod 5
|
|
25
195
|
// (the card's own principles row: "Length snaps to the 17k+5 frame grid
|
|
26
|
-
// at 24fps" — the principles).
|
|
27
|
-
|
|
196
|
+
// at 24fps" — the principles). The seconds→frames multiplier is the
|
|
197
|
+
// caller's DOC CLOCK (a hardcoded *24 scaled every non-24 window —
|
|
198
|
+
// AUDIO-2's fifth seat); the grid snap is clock-independent.
|
|
199
|
+
const mathStepsGold = (fps) => `max(${GRID_REMAINDER}, round(a * ${fps})) + (${GRID_REMAINDER} - (max(${GRID_REMAINDER}, round(a * ${fps})) % ${GRID_STEP_FRAMES})) % ${GRID_STEP_FRAMES}`;
|
|
28
200
|
|
|
29
201
|
// finding #4): MiniMaxH3ImageToVideo exists in the serialized graph
|
|
30
202
|
// ONLY as the t4r family marker (finalizeH3 keys on it to skip the
|
|
@@ -35,10 +207,25 @@ const MATH_STEPS_GOLD = `max(${GRID_REMAINDER}, round(a * 24)) + (${GRID_REMAIND
|
|
|
35
207
|
// switch flipped. Orphan + stub prompt = the marker law kept, the
|
|
36
208
|
// hazard structurally dead.
|
|
37
209
|
const I2V_MARKER_PROMPT = 'i2v marker branch — orphaned, never executed (r2v is the only lane)';
|
|
38
|
-
// ImageSharpenKJ's
|
|
39
|
-
//
|
|
40
|
-
//
|
|
210
|
+
// ImageSharpenKJ's tuned defaults (the rcas operating point the
|
|
211
|
+
// operator's V9 notes bless — strength 0.3 "looks natural" after the
|
|
212
|
+
// upscaler; radius/threshold/iterations ride for the non-rcas
|
|
213
|
+
// methods. These are OURS, not the pack's served defaults).
|
|
41
214
|
const SHARPEN_DEFAULTS = { method: 'rcas', strength: 0.3, radius: 1.0, threshold: 0.05, iterations: 10 };
|
|
215
|
+
// The served V3 DynamicCombo's per-option child seats, off the pack's
|
|
216
|
+
// own declaration (ComfyUI-KJNodes nodes/sharpen_nodes.py
|
|
217
|
+
// define_schema: io.DynamicCombo.Option(key=...) inputs). The
|
|
218
|
+
// composer emits ONLY the selected option's children on dotted wires;
|
|
219
|
+
// the engine folds unexpanded seats silently (never an error), so a
|
|
220
|
+
// non-selected seat would ride dead bytes. The U2 wall diffs this map
|
|
221
|
+
// against the pack declaration — a pack-side child change reds there,
|
|
222
|
+
// never here first.
|
|
223
|
+
const SHARPEN_OPTION_CHILDREN = {
|
|
224
|
+
rcas: ['strength'],
|
|
225
|
+
adaptive_usm: ['strength', 'radius', 'threshold'],
|
|
226
|
+
high_pass: ['strength', 'radius'],
|
|
227
|
+
deconvolution: ['strength', 'radius', 'iterations'],
|
|
228
|
+
};
|
|
42
229
|
|
|
43
230
|
|
|
44
231
|
|
|
@@ -51,7 +238,7 @@ const SHARPEN_DEFAULTS = { method: 'rcas', strength: 0.3, radius: 1.0, threshold
|
|
|
51
238
|
|
|
52
239
|
|
|
53
240
|
|
|
54
|
-
const LANE_FILES = {
|
|
241
|
+
export const LANE_FILES = {
|
|
55
242
|
clip: 'qwen3vl_32b_minimax_h3_int8_convrot.safetensors',
|
|
56
243
|
vae_video: 'minimax_h3_video_vae_int8_convrot.safetensors',
|
|
57
244
|
vae_audio: 'minimax_h3_audio_vae_fp32.safetensors',
|
|
@@ -64,6 +251,25 @@ const LANE_FILES = {
|
|
|
64
251
|
|
|
65
252
|
|
|
66
253
|
const FILM_BIT_DEPTH = 8;
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
export const FILM_AUDIO_RATE = 48000;
|
|
261
|
+
/** THE JOIN-RATE DOOR: one spelling for every audio leg that feeds a
|
|
262
|
+
* join's CreateVideo — the leg passes MeliteAudioResample at
|
|
263
|
+
* FILM_AUDIO_RATE (engine-core bandlimited sinc; equal-rate input
|
|
264
|
+
* passes the SAME dict through, so a leg already at the film rate
|
|
265
|
+
* pays nothing but the stated law).
|
|
266
|
+
* @param g the run's graph builder
|
|
267
|
+
* @param audio the leg's AUDIO output handle */
|
|
268
|
+
export function filmJoinAudio(g, audio) {
|
|
269
|
+
return g.node('MeliteAudioResample', {
|
|
270
|
+
audio, sample_rate: FILM_AUDIO_RATE,
|
|
271
|
+
}).out(0);
|
|
272
|
+
}
|
|
67
273
|
export function parseH3Facts(raw) {
|
|
68
274
|
const lane = (raw ?? {});
|
|
69
275
|
const unet = lane.unet;
|
|
@@ -88,6 +294,63 @@ export const assertOverlayGated = (doc, where) => {
|
|
|
88
294
|
throw new Error(`${where}: ${String(e)}`);
|
|
89
295
|
}
|
|
90
296
|
};
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
export function chainSaveBoundaries(g, saves) {
|
|
309
|
+
if (saves.length === 0) {
|
|
310
|
+
throw new Error('[h3-timeline] the boundary chain needs at least one save — a join with nothing to order refuses loud');
|
|
311
|
+
}
|
|
312
|
+
let boundaryAfter;
|
|
313
|
+
for (const save of saves) {
|
|
314
|
+
boundaryAfter = g.node('MeliteUnload', {
|
|
315
|
+
video: save, unload_models: false,
|
|
316
|
+
...(boundaryAfter !== undefined ? { after: boundaryAfter } : {}),
|
|
317
|
+
}).out(0);
|
|
318
|
+
}
|
|
319
|
+
return boundaryAfter;
|
|
320
|
+
}
|
|
321
|
+
/** THE FILE-JOIN PRIMITIVE, half 2 — the concat + container (the
|
|
322
|
+
* film tail's own law, ONE spelling for every join-by-file seat):
|
|
323
|
+
* MeliteConcatVideos decodes the saved FILES back CPU-side strictly
|
|
324
|
+
* after the boundary token; CreateVideo → SaveVideo delivers the
|
|
325
|
+
* joined film.
|
|
326
|
+
* @param g the run's graph builder
|
|
327
|
+
* @param prefixes the members' SaveVideo prefixes, film order
|
|
328
|
+
* @param after the boundary chain's final token (the ordering proof)
|
|
329
|
+
* @param out the joined film's filename_prefix
|
|
330
|
+
* @param opts.audio an audio override for the container mux (the
|
|
331
|
+
* film's mixed stem); absent = the concat's own decoded audio
|
|
332
|
+
* @param opts.append an exact saved-file path wired as the LAST
|
|
333
|
+
* member after the prefix list (the multi-window extend's assembled
|
|
334
|
+
* extension — ChainAssemble's video_path output; DAG-proven by its
|
|
335
|
+
* own data dependency, no boundary needed)
|
|
336
|
+
* @returns the joined film's SaveVideo passthrough */
|
|
337
|
+
export function concatSavedFilms(g, prefixes, after, out, opts = {}) {
|
|
338
|
+
if (prefixes.length === 0) {
|
|
339
|
+
throw new Error('[h3-timeline] the concat needs at least one member prefix — a join with nothing to stitch refuses loud');
|
|
340
|
+
}
|
|
341
|
+
const concat = g.node('MeliteConcatVideos', {
|
|
342
|
+
videos: prefixes.join(','),
|
|
343
|
+
...(opts.append !== undefined ? { append: opts.append } : {}),
|
|
344
|
+
after,
|
|
345
|
+
});
|
|
346
|
+
const created = g.node('CreateVideo', {
|
|
347
|
+
images: concat.out(0), audio: opts.audio ?? concat.out(1), fps: concat.out(2),
|
|
348
|
+
bit_depth: FILM_BIT_DEPTH,
|
|
349
|
+
});
|
|
350
|
+
return g.node('SaveVideo', {
|
|
351
|
+
video: created.out(), filename_prefix: out, format: 'mp4', codec: 'h264',
|
|
352
|
+
}).out();
|
|
353
|
+
}
|
|
91
354
|
/** THE MERGED FILM: ONE prompt, N windows under `window${k}_`
|
|
92
355
|
* scopes (GraphBuilder.scoped), with real seam edges between scopes
|
|
93
356
|
* (the executor orders windows off the graph) and per-window
|
|
@@ -99,7 +362,23 @@ export const assertOverlayGated = (doc, where) => {
|
|
|
99
362
|
* (the node's context_frames arm). prev_sec scales the carry:
|
|
100
363
|
* picture snapped to the node's legal context lengths (5/22/39/56
|
|
101
364
|
* frames — only whole latent steps), audio at 24 frames/second. */
|
|
102
|
-
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
const isSpell = (s) => s.startsWith('$');
|
|
374
|
+
/** THE WIRED SOUNDTRACK SEAT COUNT — mirrors the pack's own
|
|
375
|
+
* WIRED_CLIP_SEATS (vendor melite-audio-nodes film_mix.py): the mix
|
|
376
|
+
* node declares wired_audio_1..4 optional AUDIO seats, and the
|
|
377
|
+
* compose refuses a spelled clip beyond them loud. Raise BOTH
|
|
378
|
+
* together (the refusal names the pack constant as the second
|
|
379
|
+
* cure). */
|
|
380
|
+
const WIRED_CLIP_SEATS = 4;
|
|
381
|
+
function renderH3Film(p, g, facts, model, runId) {
|
|
103
382
|
// (the compose dispatch guarantees calls is a non-empty array here)
|
|
104
383
|
const calls = p.calls;
|
|
105
384
|
const str = (v) => (typeof v === 'string' ? v : '');
|
|
@@ -150,6 +429,13 @@ function renderH3Film(p, g, facts, model) {
|
|
|
150
429
|
// (the words law), a textless row is music (the historical
|
|
151
430
|
// Music-row behavior, byte-identical for existing docs).
|
|
152
431
|
const clips = parseFilmMixClips(Array.isArray(p.audio_clips) ? p.audio_clips : []);
|
|
432
|
+
// THE RE-SHOOT CHAIN, BUILT ONCE (feature 024): an armed re-shoot
|
|
433
|
+
// builds its depth → warp → mask subgraph ONCE on the run's graph
|
|
434
|
+
// (never per window — a multi-window film pays for the depth model
|
|
435
|
+
// and the reprojection exactly once) and stamps the shared handles
|
|
436
|
+
// onto every stanza (the __prev precedent — the __-prefix internal
|
|
437
|
+
// channel). Every window's sampler then renders from the moved
|
|
438
|
+
// camera through its own apply seat.
|
|
153
439
|
// THE FILM DOC'S SPANS — the clock's own rows, one per call, doc
|
|
154
440
|
// frames with the seam word (filmMix.ts owns the law). The stanza
|
|
155
441
|
// snap rides these (spanStanzaFrames): the render loop below and
|
|
@@ -165,6 +451,37 @@ function renderH3Film(p, g, facts, model) {
|
|
|
165
451
|
// including absent IS extend); no card-side re-encoding
|
|
166
452
|
transition: str(c.transition),
|
|
167
453
|
}));
|
|
454
|
+
// THE RE-SHOOT CHAIN, BUILT ONCE (feature 024): an armed re-shoot
|
|
455
|
+
// builds its depth → warp → mask subgraph ONCE on the run's graph
|
|
456
|
+
// (never per window — a multi-window film pays for the depth model
|
|
457
|
+
// and the reprojection exactly once) and stamps the shared handles
|
|
458
|
+
// onto every stanza (the __prev precedent — the __-prefix internal
|
|
459
|
+
// channel). Every window's sampler then renders from the moved
|
|
460
|
+
// camera through its own apply seat.
|
|
461
|
+
|
|
462
|
+
// length derives from the SHORTEST one this run renders (the stanza
|
|
463
|
+
// snap the render loop and the clock share) — the round-4 burn
|
|
464
|
+
// pinned a 124-frame guide into a 90-frame window and the engine
|
|
465
|
+
// refused at the AddGuide seat, killing every film with a short
|
|
466
|
+
// call.
|
|
467
|
+
// F28 (folded, round-6 audit): a call's knobs.length PIN overrides
|
|
468
|
+
// the span snap for that window, so the shortest-generation min must
|
|
469
|
+
// count the pinned number too — the round-5 cure derived from spans
|
|
470
|
+
// alone and a film whose short call PINNED its length still pinned a
|
|
471
|
+
// longer guide than that call renders.
|
|
472
|
+
const windowFrames = spans.map((s, i) => {
|
|
473
|
+
const pin = (calls[i]?.knobs ?? {})['length'];
|
|
474
|
+
// only a grid-legal pin counts here: an off-grid or mistyped pin
|
|
475
|
+
// is the film loop's own gate to refuse (one voice, the span
|
|
476
|
+
// voice — the loop's assertGridLength names the window and span),
|
|
477
|
+
// so the min falls through to the snap it will never render.
|
|
478
|
+
if (typeof pin === 'number' && isGridLength(pin))
|
|
479
|
+
return pin;
|
|
480
|
+
return spanStanzaFrames(s, i > 0 ? spanOverlap(s) : 0);
|
|
481
|
+
});
|
|
482
|
+
const reshootChain = reshootArmed(p)
|
|
483
|
+
? buildH3Reshoot(p, g, Math.min(...windowFrames), runId)
|
|
484
|
+
: undefined;
|
|
168
485
|
// (the clip text law lives where the text is consumed: THE
|
|
169
486
|
// TRANSCRIPT — dialogue words ride the <d> prompt tag, sfx text
|
|
170
487
|
// the soundscape field, music text non_diegetic_music. In every
|
|
@@ -177,13 +494,78 @@ function renderH3Film(p, g, facts, model) {
|
|
|
177
494
|
// default; a user-stacked pair runs at the HIGHER count — 8 steps
|
|
178
495
|
// on a 4-step distill is fine, 4 on an 8-step is undercooked).
|
|
179
496
|
const loraRows = Array.isArray(p.loras) ? p.loras : [];
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
497
|
+
// THE MARRIED CONSULT (one spelling — marriedBagKnob): the
|
|
498
|
+
// marriage consult goes through the shared helper so the catalog
|
|
499
|
+
// fallback (a row's unstated count read from the family table by
|
|
500
|
+
// filename) is the same math on every face.
|
|
501
|
+
const loraStepsApplied = marriedBagKnob(p, 'steps');
|
|
502
|
+
|
|
503
|
+
// MeliteConcatVideos refuses members at mixed fps LOUD at execute
|
|
504
|
+
// — AFTER every window's GPU is paid and every member file is
|
|
505
|
+
// saved (a split doc composes validate-green and dies with the
|
|
506
|
+
// film rendered: window1_CreateVideo fps 48 against window2's 24,
|
|
507
|
+
// the concat naming both rates). The interp decision is the DOC's
|
|
508
|
+
// voice: the stanza merge ({...p, ...knobs} below) folds per-call
|
|
509
|
+
// pins into the params renderH3Window reads, so a call pinning
|
|
510
|
+
// interpolate_enabled or interp_multiplier against the film — or
|
|
511
|
+
// smuggling second_pass_enabled past the knob vocabulary — renders
|
|
512
|
+
// its member at a foreign clock and the join dies there. This
|
|
513
|
+
// sweep judges the RESULT (each window's computed clock against
|
|
514
|
+
// the film's, with the composer's own reads: strict master,
|
|
515
|
+
// truthy switch, raw multiplier), never the key list — zero nodes
|
|
516
|
+
// built, the first split window refusing with its pin state, the
|
|
517
|
+
// film's clock, and the cure (move the pin to the film level;
|
|
518
|
+
// per-shot interp is unstatable because the join cannot restamp
|
|
519
|
+
// one member silently). Agreement — or silence — rides the film's
|
|
520
|
+
// clock untouched; interp_model stays a per-shot choice (the
|
|
521
|
+
// model never touches the clock). The single-window face needs no
|
|
522
|
+
// seat (no join, no clock to split); an extend-time append file at
|
|
523
|
+
// a foreign rate stays the vendor's own loud refusal (both rates
|
|
524
|
+
// named — the correct seat for a file the film never rendered).
|
|
525
|
+
const filmInterpOn = p.second_pass_enabled === true && Boolean(p.interpolate_enabled);
|
|
526
|
+
const filmInterpMult = p.interp_multiplier;
|
|
527
|
+
for (let i = 0; i < calls.length; i += 1) {
|
|
528
|
+
const call = calls[i];
|
|
529
|
+
const knobs = (call.knobs ?? {});
|
|
530
|
+
const merged = { ...p, ...knobs };
|
|
531
|
+
const winOn = merged.second_pass_enabled === true && Boolean(merged.interpolate_enabled);
|
|
532
|
+
if (winOn !== filmInterpOn) {
|
|
533
|
+
// (the pin voice reads key PRESENCE, never undefined-
|
|
534
|
+
// comparison: an explicit null/undefined pin still overrides
|
|
535
|
+
// the merge — {...p, ...{k: undefined}}.k is undefined — so
|
|
536
|
+
// the composer renders it falsy while a !== undefined filter
|
|
537
|
+
// would report "no pin stated". The no-silent-repair law
|
|
538
|
+
// refuses explicit nulls, never fills them.)
|
|
539
|
+
const isObj = typeof knobs === 'object' && knobs !== null;
|
|
540
|
+
const named = ['interpolate_enabled', 'second_pass_enabled']
|
|
541
|
+
.filter((key) => isObj && key in knobs)
|
|
542
|
+
.map((key) => `knobs.${key} = ${typeof knobs[key] === 'undefined' ? 'undefined' : JSON.stringify(knobs[key])}`)
|
|
543
|
+
.join(', ');
|
|
544
|
+
const stated = named !== '' ? named : `knobs = ${JSON.stringify(knobs).slice(0, 80)}`;
|
|
545
|
+
throw new Error(`h3-timeline window ${i + 1}: ${stated} states a ${winOn ? 'doubled' : 'base-rate'} member against the film's ${filmInterpOn ? 'interpolated' : 'base-rate'} clock — the join shares one clock (MeliteConcatVideos refuses mixed-fps members at execute, after every window renders); move the pin to the film level (interpolate_enabled), per-window interp is unstatable`);
|
|
546
|
+
}
|
|
547
|
+
if (filmInterpOn && winOn) {
|
|
548
|
+
const winMult = merged.interp_multiplier;
|
|
549
|
+
if (winMult !== filmInterpMult) {
|
|
550
|
+
throw new Error(`h3-timeline window ${i + 1}: knobs.interp_multiplier = ${JSON.stringify(knobs.interp_multiplier)} states a ×${String(winMult)} member against the film's ×${String(filmInterpMult)} clock — the join shares one clock (MeliteConcatVideos refuses mixed-fps members at execute, after every window renders); move the pin to the film level (interp_multiplier), per-window interp is unstatable`);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
184
554
|
calls.forEach((call, i) => {
|
|
185
555
|
const k = i + 1;
|
|
186
|
-
|
|
556
|
+
// THE OPENER ANCHOR (cure 8's film arm — session 384a13cd's bread
|
|
557
|
+
// and butter: "turn this image into the video, two short clips
|
|
558
|
+
// combined"). A DOC-level guide is the film's OPENING FRAME:
|
|
559
|
+
// window 1 seats it when its call states none; windows 2+ continue
|
|
560
|
+
// from the generation head and never re-anchor on it (the stanza
|
|
561
|
+
// delete below carries that half). Before this lift the doc-level
|
|
562
|
+
// guide was silently unused by the film loop — the conflict guard
|
|
563
|
+
// then refused the write with a cure ("state no variant") that was
|
|
564
|
+
// already true, the lying-cure class the operator named.
|
|
565
|
+
const callGuide = str(call.image ?? call.ref_image ?? call.image_name);
|
|
566
|
+
const guide = callGuide !== ''
|
|
567
|
+
? callGuide
|
|
568
|
+
: (i === 0 ? str(p.image ?? p.image_name ?? p.ref_image) : '');
|
|
187
569
|
// A CALL OWNS ITS TEXT (the operator's no-fallbacks law, enforced
|
|
188
570
|
|
|
189
571
|
// a source substitution, the exact crime class the law bans). The
|
|
@@ -229,7 +611,13 @@ function renderH3Film(p, g, facts, model) {
|
|
|
229
611
|
const hi = Math.min(clip.start + clip.dur, ef);
|
|
230
612
|
if (hi - lo < 2.4)
|
|
231
613
|
continue; // below the slice node's 0.1s floor
|
|
232
|
-
|
|
614
|
+
// ONE CLOCK (journey audit AUDIO-2): the stamps' seconds
|
|
615
|
+
// speak the DOC CLOCK — p.fps when stated, the schema row's
|
|
616
|
+
// default otherwise. The /24 literal stretched a 16fps
|
|
617
|
+
// film's dialogue and sfx slices by 1.5x (lip-sync drift,
|
|
618
|
+
// the audit's worst burn).
|
|
619
|
+
const stampFps = typeof p.fps === 'number' && p.fps > 0 ? p.fps : DOC_FPS_DEFAULT;
|
|
620
|
+
const ms = (frames) => Math.round((frames / stampFps) * 1000) / 1000;
|
|
233
621
|
stamps[clip.cls] = {
|
|
234
622
|
src: clip.src,
|
|
235
623
|
slice_start_seconds: ms(Math.max(0, genStart - clip.start)),
|
|
@@ -327,9 +715,23 @@ function renderH3Film(p, g, facts, model) {
|
|
|
327
715
|
const hasDirectRefs = wireList(call.ref_images).length + wireList(call.ref_videos).length + wireList(call.ref_audios).length > 0
|
|
328
716
|
|| (typeof call.last_frame === 'string' && call.last_frame.trim() !== '');
|
|
329
717
|
const anyStamp = stamps.dialogue !== undefined || stamps.sfx !== undefined || stamps.music !== undefined;
|
|
330
|
-
|
|
718
|
+
// THE KEYFRAME PIN CHANNEL'S WINDOW RIDES (slice 2): an interior
|
|
719
|
+
// pin is an image guide — the window derives the reference lane by
|
|
720
|
+
// the same seats-beat-stated law the guide spellings ride (the
|
|
721
|
+
// derivation knows every seat the compose knows — one law here and
|
|
722
|
+
// in renderH3Window's family line, never a window that claims
|
|
723
|
+
// t4_open while its chain rides the reference arm).
|
|
724
|
+
const winPins = (p.__keyframe_pins ?? {})[String(k)] ?? [];
|
|
725
|
+
stanza.variant = (guide !== '' || hasRefs || hasDirectRefs || anyStamp || winPins.length > 0) ? 't4r' : chainLike ? 't4_chain' : 't4_open';
|
|
331
726
|
// the distill's steps apply unless this call's knobs pinned steps
|
|
332
|
-
|
|
727
|
+
// — or the DOC did (the __steps_pinned stamp, the walk's own
|
|
728
|
+
// explicit-keys fact; the single-window marriage always consulted
|
|
729
|
+
// it, the film loop did not — the split-brain that stomped a
|
|
730
|
+
// user-stated doc steps with the bag's count on every multi-call
|
|
731
|
+
|
|
732
|
+
// ONLY FOUR STEPS"). One law, both arms: the user's stated steps
|
|
733
|
+
// — doc-level or per-call knob — never loses to the bag.
|
|
734
|
+
if (knobs.steps === undefined && loraStepsApplied !== null && p.__steps_pinned !== true)
|
|
333
735
|
stanza.steps = loraStepsApplied;
|
|
334
736
|
// THE DOOR GUARD, voice arm: a dialogue/sfx-pinned window mutes
|
|
335
737
|
// the user ref audios (film-level and per-call) — the pins own
|
|
@@ -354,6 +756,19 @@ function renderH3Film(p, g, facts, model) {
|
|
|
354
756
|
stanza.image = guide;
|
|
355
757
|
else
|
|
356
758
|
delete stanza.image;
|
|
759
|
+
// THE STATED-FAMILY BYPASS'S LOUD FLOOR (calls-stanza audit #2,
|
|
760
|
+
|
|
761
|
+
// whole shot-law sweep (schema.ts guards every row/span law on
|
|
762
|
+
// variant === undefined) — the agent plane can state a family
|
|
763
|
+
// and hand a reversed span past it. The old guard (ef > sf)
|
|
764
|
+
// SILENTLY SKIPPED assertSpanGrid and the length lift for
|
|
765
|
+
// exactly that shape: the window rendered at the doc length with
|
|
766
|
+
// a span the manifest booked backwards. A stated pair that does
|
|
767
|
+
// not advance refuses LOUD here — the walk's own law, stated at
|
|
768
|
+
// the loop's floor, on the path the walk cannot see.
|
|
769
|
+
if (sf !== null && ef !== null && ef <= sf) {
|
|
770
|
+
throw new Error(`h3-timeline window ${k}: reversed span (end_frame ${String(ef)} <= start_frame ${String(sf)}) — a stated family bypasses the walk's span laws, never the compose's`);
|
|
771
|
+
}
|
|
357
772
|
if (sf !== null && ef !== null && ef > sf) {
|
|
358
773
|
// THE UNIFORM SPAN GATE, second door: a stale or hand-built
|
|
359
774
|
// document re-rides the same law the walk admitted under, so
|
|
@@ -380,10 +795,18 @@ function renderH3Film(p, g, facts, model) {
|
|
|
380
795
|
// (The snap itself is filmMix's spanStanzaFrames — the ONE
|
|
381
796
|
// law the render loop and the film manifest share; the old
|
|
382
797
|
// inline 22+17k twin died here.)
|
|
383
|
-
if (knobs.fps_seconds === undefined) {
|
|
384
|
-
stanza.fps_seconds = Math.round((stanza.length / 24) * 1000) / 1000;
|
|
385
|
-
}
|
|
386
798
|
}
|
|
799
|
+
|
|
800
|
+
// STALE ANYWHERE"): the row is INTERNAL (the declared surface's
|
|
801
|
+
// own words — the per-window rows k, noise_seed, fps_seconds are
|
|
802
|
+
// internal), and the old restatement skipped DEFINED knobs, so a
|
|
803
|
+
// pin stated by an older span outlived every later drag — the
|
|
804
|
+
// render clock (fps_seconds) and the bar clock (the span) then
|
|
805
|
+
// disagreed forever: a 5-second span on the bar rendered a
|
|
806
|
+
// 10-second mush. The compose OWNS internal rows unconditionally
|
|
807
|
+
// — fps_seconds derives at renderH3Window's own head (the one
|
|
808
|
+
// owner, both arms) from the window's actual generation length.
|
|
809
|
+
// No pin survives. No fallback. No silent disagreement.
|
|
387
810
|
// THE GRID GATE (§26): a knob-pinned length bypassed the snap
|
|
388
811
|
// above — validate, never trust. Refuses at compose (zero GPU)
|
|
389
812
|
// with the span, the nearest legal length, and the proven
|
|
@@ -395,6 +818,8 @@ function renderH3Film(p, g, facts, model) {
|
|
|
395
818
|
}
|
|
396
819
|
if (prev !== undefined)
|
|
397
820
|
stanza.__prev = prev;
|
|
821
|
+
if (reshootChain !== undefined)
|
|
822
|
+
stanza.__reshoot = reshootChain;
|
|
398
823
|
|
|
399
824
|
// bed arm retired with the bed the same day): a pinned window
|
|
400
825
|
// owns its audio conditioning — the normal inputs stand down for
|
|
@@ -416,7 +841,7 @@ function renderH3Film(p, g, facts, model) {
|
|
|
416
841
|
stanza.sfx_slice = stamps.sfx;
|
|
417
842
|
if (stamps.music !== undefined)
|
|
418
843
|
stanza.music_slice = stamps.music;
|
|
419
|
-
const h = g.scoped(`window${k}_`, (w) => renderH3Window(stanza, w, facts, model));
|
|
844
|
+
const h = g.scoped(`window${k}_`, (w) => renderH3Window(stanza, w, facts, model, runId));
|
|
420
845
|
prev = h;
|
|
421
846
|
/* v8 ignore next 1 -- both family arms assign the passthrough (every path saves); a future arm that forgets is refused loud at the film tail */
|
|
422
847
|
if (h.savePassthrough !== undefined)
|
|
@@ -474,10 +899,16 @@ function renderH3Film(p, g, facts, model) {
|
|
|
474
899
|
if (windowSaves.length === 0) {
|
|
475
900
|
throw new Error('[h3-timeline] a family arm saved no clip to pass the film boundary — the film tail cannot order its loads');
|
|
476
901
|
}
|
|
902
|
+
// ONE CLOCK (AUDIO-2): the stanza durations and the owner map's
|
|
903
|
+
// joins speak the same doc clock as the stamps above and the
|
|
904
|
+
// container's frame_rate — never a /24 literal beside a 16fps
|
|
905
|
+
// film.
|
|
906
|
+
const docFps = typeof p.fps === 'number' && p.fps > 0 ? p.fps : DOC_FPS_DEFAULT;
|
|
477
907
|
const manifest = computeFilmMix({
|
|
478
908
|
spans,
|
|
479
909
|
clips,
|
|
480
|
-
windowSecs: stanzaSecs(spans),
|
|
910
|
+
windowSecs: stanzaSecs(spans, docFps),
|
|
911
|
+
fps: docFps,
|
|
481
912
|
// the knob's declared default (−14) walks through the schema
|
|
482
913
|
// door; computeFilmMix owns the fallback for the absent key
|
|
483
914
|
duckDb: p.duck_depth_db,
|
|
@@ -487,23 +918,22 @@ function renderH3Film(p, g, facts, model) {
|
|
|
487
918
|
// stitch: 960×576 leftovers globbed as windows) and
|
|
488
919
|
// run-18ea8c810104 (loud no-match refusal on h3_t4_w2): cut
|
|
489
920
|
// windows chain NOTHING and even chained windows' SAVE nodes are
|
|
490
|
-
// not downstream of one another, so the old single boundary on
|
|
491
|
-
//
|
|
492
|
-
//
|
|
493
|
-
|
|
494
|
-
//
|
|
495
|
-
//
|
|
496
|
-
// save
|
|
497
|
-
// own boundary (the §20 law; the
|
|
498
|
-
// stay resident).
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
const after = boundaryAfter;
|
|
921
|
+
// not downstream of one another, so the old single boundary on the
|
|
922
|
+
// LAST save rode a scheduler tie-break — window 2's save was an
|
|
923
|
+
// unordered island the loader could beat). The shared boundary
|
|
924
|
+
|
|
925
|
+
// unification) carries the law: every window's SaveVideo
|
|
926
|
+
// passthrough feeds its OWN boundary and the final token
|
|
927
|
+
// transitively depends on EVERY save, while each window's
|
|
928
|
+
// passthrough tensor dies at its own boundary (the §20 law; the
|
|
929
|
+
// flush is idempotent, weights stay resident).
|
|
930
|
+
|
|
931
|
+
// saves, the windows' saves, and this concat/mix prefix list are
|
|
932
|
+
// ONE truth (`<runId>/h3_t4_w<k>` both sides), so the file tail
|
|
933
|
+
// resolves them under the output root's `<runId>/` subfolder and
|
|
934
|
+
// the harvest walks them run-scoped like every chain save.
|
|
935
|
+
const windowPrefixes = calls.map((_c, i) => `${runId}/h3_t4_w${i + 1}`);
|
|
936
|
+
const after = chainSaveBoundaries(g, windowSaves);
|
|
507
937
|
if (clips.length > 0) {
|
|
508
938
|
|
|
509
939
|
|
|
@@ -519,16 +949,52 @@ function renderH3Film(p, g, facts, model) {
|
|
|
519
949
|
// the MIXED audio wired into CreateVideo — the film mp4 carries
|
|
520
950
|
// the mix, not the raw concat audio. Early return: the
|
|
521
951
|
// clips-free arm below stays byte-frozen.
|
|
952
|
+
// THE SOUNDTRACK WIRE SEATS (GAPS-20 one-way law, face #14's
|
|
953
|
+
|
|
954
|
+
// spelled clip src names a WIRED STAGE INPUT, never a file. The
|
|
955
|
+
// manifest row carries `wired: k` and NO src key (src embedded
|
|
956
|
+
// in the JSON string is dead text to the merge), and the compose
|
|
957
|
+
// seats the spell on a DECLARED MeliteAudioResample at the film's
|
|
958
|
+
// own clock (FILM_AUDIO_RATE) and carries the HOP'S LINK into the
|
|
959
|
+
// pack's optional AUDIO seat wired_audio_k — rewriteSpells lands
|
|
960
|
+
// the producer's link on the hop's audio input, so the seat
|
|
961
|
+
// receives film-rate audio. THE FILM-CLOCK HOP (F-B cure,
|
|
962
|
+
|
|
963
|
+
// refuses a wired seat at a foreign rate LOUD (film_mix.py
|
|
964
|
+
// seat_source — "a wired producer rides the film's own clock …
|
|
965
|
+
// never silently resampled") and a 24 kHz producer arrives
|
|
966
|
+
// exactly foreign; the resample is a visible node the merged
|
|
967
|
+
// graph carries — the declared hop is the opposite of the silent
|
|
968
|
+
// coercion the law bans. A path row keeps the staged-file
|
|
969
|
+
// handoff byte-identical (the estate boundary — lawful, S3
|
|
970
|
+
// freezes it). Seat overflow refuses loud, naming the row and
|
|
971
|
+
// both cures — never a silent drop.
|
|
972
|
+
const wiredSeats = {};
|
|
973
|
+
let nextSeat = 0;
|
|
974
|
+
const mixRows = manifest.placements.map((pl) => {
|
|
975
|
+
const clip = clips[pl.clip];
|
|
976
|
+
if (!isSpell(clip.src)) {
|
|
977
|
+
return { src: clip.src, start_sec: pl.filmSec, dur_sec: pl.durSec, class: pl.cls };
|
|
978
|
+
}
|
|
979
|
+
nextSeat += 1;
|
|
980
|
+
if (nextSeat > WIRED_CLIP_SEATS) {
|
|
981
|
+
throw new Error(`[h3-timeline] audio_clips[${pl.clip}] (${clip.cls}, src ${clip.src}) needs wired soundtrack seat ${nextSeat} but the film mix declares only ${WIRED_CLIP_SEATS} (wired_audio_1..${WIRED_CLIP_SEATS}) — wire fewer soundtrack producers, or raise WIRED_CLIP_SEATS in the melite-audio-nodes pack`);
|
|
982
|
+
}
|
|
983
|
+
wiredSeats[`wired_audio_${nextSeat}`] = g.node('MeliteAudioResample', {
|
|
984
|
+
audio: clip.src,
|
|
985
|
+
sample_rate: FILM_AUDIO_RATE,
|
|
986
|
+
}).out(0);
|
|
987
|
+
return { wired: nextSeat, start_sec: pl.filmSec, dur_sec: pl.durSec, class: pl.cls };
|
|
988
|
+
});
|
|
522
989
|
const mix = g.node('MeliteFilmAudioMix', {
|
|
523
|
-
videos:
|
|
990
|
+
videos: windowPrefixes.join(','),
|
|
524
991
|
after,
|
|
525
992
|
// the manifest rendered verbatim: every placement's source,
|
|
526
993
|
// film seat, duration, and class — doc order kept (the node's
|
|
527
|
-
// two loops read the same order the retired tail did)
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
})),
|
|
994
|
+
// two loops read the same order the retired tail did); spelled
|
|
995
|
+
// rows ride wired: k + the wired_audio_k seats above
|
|
996
|
+
clips_json: JSON.stringify(mixRows),
|
|
997
|
+
...wiredSeats,
|
|
532
998
|
duck_spans: manifest.duckSpanString,
|
|
533
999
|
music_duck_spans: manifest.musicDuckSpanString,
|
|
534
1000
|
duck_db: manifest.duckDb,
|
|
@@ -543,34 +1009,16 @@ function renderH3Film(p, g, facts, model) {
|
|
|
543
1009
|
// calibrated against ffmpeg's ebur128 to within 0.1 LU on tones,
|
|
544
1010
|
// noise, gating, and mono.
|
|
545
1011
|
const meter = g.node('MeliteLoudness', { audio: mix.out(0) });
|
|
546
|
-
saveAudio(g, meter.out(0),
|
|
1012
|
+
saveAudio(g, meter.out(0), `${runId}/h3_t4_film_audio`);
|
|
547
1013
|
// THE FILM MP4 (GAP 1): the same file-tail video join the
|
|
548
1014
|
// clips-free arm rides — container mux only (CreateVideo +
|
|
549
1015
|
// SaveVideo h264/mp4 on the decoded window files), never the
|
|
550
1016
|
// mix. The mix rides it: audio carries the node's output.
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
after,
|
|
1017
|
+
return concatSavedFilms(g, windowPrefixes, after, `${runId}/h3_t4_film`, {
|
|
1018
|
+
audio: meter.out(0),
|
|
554
1019
|
});
|
|
555
|
-
const filmCreated = g.node('CreateVideo', {
|
|
556
|
-
images: join.out(0), audio: meter.out(0), fps: join.out(2), bit_depth: FILM_BIT_DEPTH,
|
|
557
|
-
});
|
|
558
|
-
return g.node('SaveVideo', {
|
|
559
|
-
video: filmCreated.out(), filename_prefix: 'h3_t4_film',
|
|
560
|
-
format: 'mp4', codec: 'h264',
|
|
561
|
-
}).out();
|
|
562
1020
|
}
|
|
563
|
-
|
|
564
|
-
videos: calls.map((_c, i) => `h3_t4_w${i + 1}`).join(','),
|
|
565
|
-
after,
|
|
566
|
-
});
|
|
567
|
-
const filmCreated = g.node('CreateVideo', {
|
|
568
|
-
images: concat.out(0), audio: concat.out(1), fps: concat.out(2), bit_depth: FILM_BIT_DEPTH,
|
|
569
|
-
});
|
|
570
|
-
return g.node('SaveVideo', {
|
|
571
|
-
video: filmCreated.out(), filename_prefix: 'h3_t4_film',
|
|
572
|
-
format: 'mp4', codec: 'h264',
|
|
573
|
-
}).out();
|
|
1021
|
+
return concatSavedFilms(g, windowPrefixes, after, `${runId}/h3_t4_film`);
|
|
574
1022
|
}
|
|
575
1023
|
/** THE FUN-CONTROLNET CHAIN (002 H2/H4 + 007 L7): family-owned,
|
|
576
1024
|
* the LTX_lora_loader precedent — the node pair is the family's
|
|
@@ -608,7 +1056,7 @@ function applyH3FunControlNets(g, model, vae, picks) {
|
|
|
608
1056
|
}
|
|
609
1057
|
return cur;
|
|
610
1058
|
}
|
|
611
|
-
function renderH3Window(p, g, facts, model) {
|
|
1059
|
+
function renderH3Window(p, g, facts, model, runId) {
|
|
612
1060
|
// REFS IMPLY THE R2V LANE (the bundle IS the r2v input): a
|
|
613
1061
|
// refs-carrying window is t4r even without a guide still — the
|
|
614
1062
|
// same law the film renderer applies per call. The DECLARED input
|
|
@@ -632,15 +1080,60 @@ function renderH3Window(p, g, facts, model) {
|
|
|
632
1080
|
const statedFamily = typeof p.variant === 'string' && FAMILIES.includes(p.variant)
|
|
633
1081
|
? p.variant : undefined;
|
|
634
1082
|
const guide0 = [p.image, p.image_name, p.ref_image].some((v) => typeof v === 'string' && v.trim() !== '');
|
|
635
|
-
|
|
1083
|
+
// THE KEYFRAME PIN CHANNEL (slice 2): this window's interior pins —
|
|
1084
|
+
// keyed by the 1-based window k (the mapping's channel). Pins are an
|
|
1085
|
+
// image-guide seat: a pin-carrying window derives the reference lane
|
|
1086
|
+
// (the AddGuide chain only exists on the t4r arm), seats beat stated.
|
|
636
1087
|
const k = (p.k ?? 1);
|
|
1088
|
+
const winPins = (p.__keyframe_pins ?? {});
|
|
1089
|
+
const pinsHere = winPins[String(k)] ?? [];
|
|
1090
|
+
const family = (hasRefs || guide0 || pinsHere.length > 0) ? 't4r' : (statedFamily ?? 't4_open');
|
|
637
1091
|
// THE GRID GATE (§26, defense in depth): no window renders
|
|
638
1092
|
// off-grid — the film loop's pin check voices the call span, this
|
|
639
1093
|
// one catches the single-call path and any direct caller.
|
|
640
1094
|
assertGridLength(p.length, `h3-timeline window ${k}`);
|
|
1095
|
+
|
|
1096
|
+
// STALE ANYWHERE"): fps_seconds is INTERNAL and derives from THIS
|
|
1097
|
+
// window's actual render length, every compose, BOTH arms — the
|
|
1098
|
+
// film loop's stanzas and the frozen single-window doc alike (one
|
|
1099
|
+
// owner: this seat; the film loop's old copy is deleted). The
|
|
1100
|
+
// removed .default(10) left this arm serializing
|
|
1101
|
+
// PrimitiveFloat{value: undefined} — the engine's 400 on every
|
|
1102
|
+
// keyframed single-call doc. No default, no doc pin, no fallback:
|
|
1103
|
+
// the length owns the clock. THE DIVISOR IS THE DOC'S OWN FPS
|
|
1104
|
+
// (audit f1cc1197, the bar-clock mismatch): /24 booked 3.75s while
|
|
1105
|
+
// a stated fps 16 container PLAYED 5.625s — the seconds seat and
|
|
1106
|
+
// the play seat must share one clock or the bar lies. The 24
|
|
1107
|
+
// mirror is the row's own declared default (schema.ts fps
|
|
1108
|
+
// .default(24) — the walk fills it on every real door; raw
|
|
1109
|
+
// walk-bypass callers get the declared default, never an invented
|
|
1110
|
+
// one).
|
|
1111
|
+
const fpsClock = typeof p.fps === 'number' && p.fps > 0 ? p.fps : DOC_FPS_DEFAULT;
|
|
1112
|
+
p.fps_seconds = bookSeconds(p.length, fpsClock);
|
|
641
1113
|
const isT4r = family === 't4r';
|
|
642
1114
|
const isChain = family === 't4_chain';
|
|
643
1115
|
|
|
1116
|
+
// second_pass_enabled AND the upscale_route sub-gate — the vendored
|
|
1117
|
+
// xmarre pack's MinimaxH3LatentUpscaler3DRefineHandoff rides
|
|
1118
|
+
// in-band on the pass-1 joint AV latent (upscale + the low-sigma
|
|
1119
|
+
// refinement inside the 3D-conv kernel, lock_audio true — z_v
|
|
1120
|
+
// through the LBH kernel, z_a preserved).
|
|
1121
|
+
const upscaleOn = p.second_pass_enabled === true && p.upscale_route === "latent_2x";
|
|
1122
|
+
// THE HEAD STAYS STATED UNDER THE ARM (both r2v seats below): the
|
|
1123
|
+
|
|
1124
|
+
// 84x48 | Pixels 1344x768`) convicted the old half-grid stamp —
|
|
1125
|
+
// pass 1 composed 1344×768 → 672×384 and the handoff's 2.0×
|
|
1126
|
+
// restored base tier, so `latent_2x` rendered the plain pass. The
|
|
1127
|
+
// kernel carries full-base grids (run-e49908ddf224: the same
|
|
1128
|
+
// handoff at 2.0× landed 2688×1536; the chain's h3_2x clips feed
|
|
1129
|
+
// it 82×46 latents daily), so the route now rides the STATED
|
|
1130
|
+
// geometry and doubles ON TOP of it — armed, the render lands at
|
|
1131
|
+
// 2× the stated grid. Route off = the same stated geometry (ARM
|
|
1132
|
+
// 41's byte-stable plain pass — the arm touches nothing but the
|
|
1133
|
+
// handoff's mount).
|
|
1134
|
+
const headW = p.width;
|
|
1135
|
+
const headH = p.height;
|
|
1136
|
+
|
|
644
1137
|
// is the fresh-card admission, not a fallback crime. The window
|
|
645
1138
|
// shape's text face is p.prompt (declared required=True, "optional
|
|
646
1139
|
|
|
@@ -651,11 +1144,27 @@ function renderH3Window(p, g, facts, model) {
|
|
|
651
1144
|
// lawfully write p.prompt from call text because in the one-window
|
|
652
1145
|
// shape p.prompt IS the text owner — never a substitute.)
|
|
653
1146
|
const prompt = (p.prompt ?? '');
|
|
1147
|
+
|
|
1148
|
+
// built ONCE per window render — the film loop stamps the shared
|
|
1149
|
+
// handles (__reshoot, one build per film), the single-window
|
|
1150
|
+
// shape builds its own here. Every re-shoot seat below reads this
|
|
1151
|
+
// one const: the r2v prompt trigger, the ref_video_0 override,
|
|
1152
|
+
// the guide pin, the model LoRA. THE PROMPT SEAT: the official
|
|
1153
|
+
// chain's prompt is exactly `crossview.` — the LoRA's trigger
|
|
1154
|
+
// word leads, the estate's own prose follows.
|
|
1155
|
+
const reshootChain = p.__reshoot
|
|
1156
|
+
?? (reshootArmed(p) ? buildH3Reshoot(p, g, Number(p.length), runId) : undefined);
|
|
1157
|
+
const r2vPrompt = reshootChain !== undefined ? reshootPrompt(prompt) : prompt;
|
|
654
1158
|
// card knob first (image), renderer alias second.
|
|
655
1159
|
const guideImage = (p.image ?? p.image_name ?? '');
|
|
656
1160
|
// ── the model chain (family-conditional defaults;
|
|
657
1161
|
// absent = absent on wire) ──
|
|
658
|
-
|
|
1162
|
+
|
|
1163
|
+
// the spec's diagnostic matrix seats "SLA stabilize motion =
|
|
1164
|
+
// Enabled" as the flicker cure's own law — both arms get the true
|
|
1165
|
+
// fallback now (t4r rode false, the timeline's own reference lane
|
|
1166
|
+
// ran the flicker cure off); a doc's explicit false still wins.
|
|
1167
|
+
const stabilize = p.sla_stabilize_motion ?? true;
|
|
659
1168
|
const unet = g.node('UNETLoader', { unet_name: facts.unet, weight_dtype: 'default' }).out();
|
|
660
1169
|
const sla = g.node('H3SLAAttention', {
|
|
661
1170
|
model: unet,
|
|
@@ -669,7 +1178,19 @@ function renderH3Window(p, g, facts, model) {
|
|
|
669
1178
|
dense_backend: p.sla_dense_backend,
|
|
670
1179
|
disable_fp16_accum: p.sla_disable_fp16_accum,
|
|
671
1180
|
stabilize_motion: stabilize,
|
|
672
|
-
|
|
1181
|
+
|
|
1182
|
+
// predicted drift, verified LIVE at the engine door): the
|
|
1183
|
+
// upstream input turned BOOLEAN (its own tooltip: 'ON (Light)
|
|
1184
|
+
// uses fixed 0.85 reference sparsity...') while our schema row
|
|
1185
|
+
// still served the three-string enum — every default compose
|
|
1186
|
+
// (the walk fills 'Heavy Enforcement') fed a STRING into the
|
|
1187
|
+
// boolean input: phase-1 refusal, card dead on lane, every
|
|
1188
|
+
// suite green (no wall fixture carried H3SLAAttention). The
|
|
1189
|
+
// UI vocabulary STAYS the richer enum (saved docs ride
|
|
1190
|
+
// verbatim); the compose translates at the node seat — the
|
|
1191
|
+
// engine's binary is the truth the wire must speak. Only 'Off'
|
|
1192
|
+
// is false; Light and Heavy Enforcement both protect.
|
|
1193
|
+
reference_protection: p.sla_reference_protection !== 'Off',
|
|
673
1194
|
}).out();
|
|
674
1195
|
const chunked = g.node('MiniMaxChunkFeedForward', {
|
|
675
1196
|
model: g.node('MiniMaxLowVRAMAttention', { model: sla, head_chunks: 4 }).out(),
|
|
@@ -681,26 +1202,29 @@ function renderH3Window(p, g, facts, model) {
|
|
|
681
1202
|
// writes the mod bag `loras` — [{id, strength}] rows the service
|
|
682
1203
|
// resolves to {name, strength} filenames against the family's
|
|
683
1204
|
// flavor catalog. Those rows build the upstream stack verbatim
|
|
684
|
-
// ({on, lora, str, v:1, a:1, t:1})
|
|
685
|
-
|
|
1205
|
+
// ({on, lora, str, v:1, a:1, t:1}). THE EMPTY-BAG LAW (J1,
|
|
1206
|
+
|
|
1207
|
+
// operator's "no loras" — the wire carries an EMPTY stack and
|
|
1208
|
+
// nothing loads; only an ABSENT bag (unset) rides the family
|
|
1209
|
+
// catalog's default row (the mod plane's own default, built
|
|
686
1210
|
// from the catalog so the value has one owner). ONE surface, one
|
|
687
|
-
// owner
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
// (unknown ids refuse LOUD upstream) — {name, strength} is
|
|
692
|
-
// the guaranteed wire shape, read directly
|
|
693
|
-
on: true,
|
|
694
|
-
lora: r.name,
|
|
695
|
-
str: r.strength,
|
|
696
|
-
v: 1, a: 1, t: 1,
|
|
697
|
-
})))
|
|
698
|
-
: loraStackDefault();
|
|
1211
|
+
// owner, two honest poles — and since the swap build the stack
|
|
1212
|
+
// string comes from h3LoraStackOf (the plane's ONE owner, shared
|
|
1213
|
+
// with swap.ts; never restated here).
|
|
1214
|
+
const loraStack = h3LoraStackOf(p);
|
|
699
1215
|
// t4r templates carry shift_video 8.0; the t4 family carries the INT
|
|
700
1216
|
// NO SILENT RESOLUTION LAW: the walked shift_video IS the value
|
|
701
1217
|
// (declared default 8; the family literals retired with the
|
|
702
1218
|
// nulling that fed them — 8.0 and 8 serialize identically anyway)
|
|
703
|
-
|
|
1219
|
+
// THE MARRIED SHIFT (SOTA limb 2, the steps marriage's heir):
|
|
1220
|
+
// while a distill rides, the row's own sigma-shift grid wins over
|
|
1221
|
+
// the no-distill default (the 8-step turbos run 12, the 4-step
|
|
1222
|
+
// 6, native rows declare none and keep 8) — UNLESS the doc stated
|
|
1223
|
+
// its own shift (the __shift_pinned stamp: an explicit value is
|
|
1224
|
+
// the user's word, the marriage applies only to the unstated).
|
|
1225
|
+
// One owner since the swap build: h3ShiftVideoOf (shared with
|
|
1226
|
+
// swap.ts).
|
|
1227
|
+
const shiftVideo = h3ShiftVideoOf(p);
|
|
704
1228
|
const clip = g.node('CLIPLoader', {
|
|
705
1229
|
clip_name: facts.clip, type: 'minimax',
|
|
706
1230
|
...(isT4r ? { device: 'default' } : {}), // t4 templates OMIT it
|
|
@@ -710,7 +1234,21 @@ function renderH3Window(p, g, facts, model) {
|
|
|
710
1234
|
let cond;
|
|
711
1235
|
let latent;
|
|
712
1236
|
let sigmaModel;
|
|
713
|
-
|
|
1237
|
+
|
|
1238
|
+
// picked UNET+switch output BEFORE the primary LTX_lora_loader —
|
|
1239
|
+
// the un-distilled base pass 2's Stage-3 law rides (assigned in
|
|
1240
|
+
// both t4 arms; consumed only when a distill rides pass 2 at a
|
|
1241
|
+
// sub-1 window, so the plain pass stays byte-stable).
|
|
1242
|
+
let preLoraModel;
|
|
1243
|
+
|
|
1244
|
+
// non-reference seat was a DEAD STORE: the only fpsInput read sat
|
|
1245
|
+
// inside if (isT4r), so the else-arm's CreateVideo kept its
|
|
1246
|
+
// hardcoded 24 while the cure line sat two blocks above it). The
|
|
1247
|
+
// initializer puts the DOC's clock under every arm; the t4r branch
|
|
1248
|
+
// upgrades it to the walk-first PrimitiveFloat node, and the
|
|
1249
|
+
// else-arm container reads it directly. p.fps is a declared row
|
|
1250
|
+
// (default 24, the walk fills it on every real door).
|
|
1251
|
+
let fpsInput = p.fps;
|
|
714
1252
|
if (isT4r) {
|
|
715
1253
|
// opener: switch(SLABool) picks SLA-direct vs chunked; lora rides
|
|
716
1254
|
// the switch; preview override wired to the in-graph step count.
|
|
@@ -719,19 +1257,31 @@ function renderH3Window(p, g, facts, model) {
|
|
|
719
1257
|
// scalar straight when sla_switch is set. sla_enabled=false
|
|
720
1258
|
// forces the chunked (SLA-off) path; otherwise the legacy
|
|
721
1259
|
// sla_switch spelling rides untouched.
|
|
722
|
-
|
|
1260
|
+
|
|
1261
|
+
// clock rides the DOC's fps — the same clock the bar books — so
|
|
1262
|
+
// the clip's seconds equal the bar's seconds. The old hardcoded
|
|
1263
|
+
// 24 generated a 90-frame window that PLAYED 3.75s under a
|
|
1264
|
+
// 5.6s bar (frames right, seconds stolen by a third). p.fps is
|
|
1265
|
+
// a declared row (default 24, the walk fills it) — never a ??
|
|
1266
|
+
// fallback, never undefined on the wire.
|
|
1267
|
+
const fpsNode = g.node('PrimitiveFloat', { value: p.fps }).out(); // id .0 — CreateVideo.fps walks first
|
|
723
1268
|
let slaSel = p.sla_enabled === false
|
|
724
1269
|
? true
|
|
725
1270
|
: (p.sla_switch ?? null);
|
|
726
1271
|
if (slaSel === null)
|
|
727
1272
|
slaSel = g.node('PrimitiveBoolean', { value: false }).out();
|
|
728
1273
|
const picked = g.node('ComfySwitchNode', { switch: slaSel, on_true: chunked, on_false: sla }).out();
|
|
1274
|
+
preLoraModel = picked;
|
|
729
1275
|
const loraModel = g.node('LTX_lora_loader', {
|
|
730
1276
|
model: picked, mode: 'minimax', stack_data: loraStack, lora_ui: '',
|
|
731
1277
|
}).out();
|
|
732
1278
|
const seconds = g.node('PrimitiveFloat', { value: p.fps_seconds }).out(); // id .1
|
|
1279
|
+
// ONE CLOCK (AUDIO-2): the seconds→frames inverse rides the doc
|
|
1280
|
+
// clock — fps_seconds was BOOKED at fpsClock (:length/fps), so a
|
|
1281
|
+
// hardcoded *24 here scaled a 16fps window's length by 1.5x. The
|
|
1282
|
+
// grid snap itself is clock-independent (frames are frames).
|
|
733
1283
|
const lengthNode = g.node('ComfyMathExpression', {
|
|
734
|
-
expression:
|
|
1284
|
+
expression: mathStepsGold(fpsClock), 'values.a': seconds,
|
|
735
1285
|
}).out(1);
|
|
736
1286
|
const previewed = g.node('ModelPreviewOverrideKJ', {
|
|
737
1287
|
max_resolution: 512, jpeg_quality: 80,
|
|
@@ -814,6 +1364,18 @@ function renderH3Window(p, g, facts, model) {
|
|
|
814
1364
|
throw new Error(`ref_video_trims: entry ${i} duration must be a number — got ${JSON.stringify(dur).slice(0, 40)}`);
|
|
815
1365
|
return { start_time: start ?? 0, duration: dur ?? 0 };
|
|
816
1366
|
});
|
|
1367
|
+
|
|
1368
|
+
// trims index-pair with the EFFECTIVE video lane — the call's
|
|
1369
|
+
// replaced bag when it states one, else the declared lane. A doc
|
|
1370
|
+
// authored against a longer declared list ([A,B,C] + [tA,tB,tC])
|
|
1371
|
+
|
|
1372
|
+
// for A) sliced X, tB/tC fell off — the wrong video's trim, never
|
|
1373
|
+
// a word. A trim row with no video to pair is the mis-slice's
|
|
1374
|
+
// signature; the compose refuses it LOUD, naming both counts.
|
|
1375
|
+
if (videoTrims.length > refVideos.length) {
|
|
1376
|
+
const lane = bagVideos.length > 0 ? 'the call replaced the lane' : 'the declared lane';
|
|
1377
|
+
throw new Error(`ref_video_trims: ${String(videoTrims.length)} trim rows pair with ${String(refVideos.length)} effective videos (${lane}) — a trim row with no video is the silent mis-slice; re-trim against the lane's videos`);
|
|
1378
|
+
}
|
|
817
1379
|
const bagAudios = wireList(refBag.audios);
|
|
818
1380
|
const refAudios = (bagAudios.length > 0 ? bagAudios : declaredAudios).slice(0, REF_CAPS.audios);
|
|
819
1381
|
const bundleInputs = {};
|
|
@@ -826,8 +1388,9 @@ function renderH3Window(p, g, facts, model) {
|
|
|
826
1388
|
// and NEVER builds a loader; files/URLs/estate paths keep the
|
|
827
1389
|
// Load* disk handoff (the per-stage path owns those). Before
|
|
828
1390
|
// this arm the ports validated green at the lattice and died
|
|
829
|
-
// at the merge — the validate-said-nothing disease.
|
|
830
|
-
|
|
1391
|
+
// at the merge — the validate-said-nothing disease. (isSpell is
|
|
1392
|
+
// the module-level test — one owner, shared with the film tail's
|
|
1393
|
+
// wired soundtrack seats.)
|
|
831
1394
|
const imageRef = (src) => isSpell(src) ? src : g.node('LoadImage', { image: src }).out();
|
|
832
1395
|
let anchorRaw;
|
|
833
1396
|
if (guideImage !== '') {
|
|
@@ -919,7 +1482,7 @@ function renderH3Window(p, g, facts, model) {
|
|
|
919
1482
|
|
|
920
1483
|
const refSize = p.ref_image_size;
|
|
921
1484
|
const r2vInputs = {
|
|
922
|
-
prompt, width:
|
|
1485
|
+
prompt: r2vPrompt, width: headW, height: headH,
|
|
923
1486
|
length: lengthNode, ref_image_size: refSize,
|
|
924
1487
|
clip, vae: vaeVideo, audio_vae: vaeAudio,
|
|
925
1488
|
};
|
|
@@ -930,6 +1493,20 @@ function renderH3Window(p, g, facts, model) {
|
|
|
930
1493
|
r2vInputs[`ref_video_audios.ref_video_audio_${i}`] = bout.out(10 + 2 * i);
|
|
931
1494
|
r2vInputs[`ref_audios.ref_audio_${i}`] = bout.out(15 + i);
|
|
932
1495
|
}
|
|
1496
|
+
// THE RE-SHOOT REF OVERRIDE (the official chain's appearance
|
|
1497
|
+
|
|
1498
|
+
// the identity/appearance reference the moved view re-renders
|
|
1499
|
+
// from (the official graph wires exactly this lane, exactly
|
|
1500
|
+
// here). Its audio lane is DELETED, not muted: the official
|
|
1501
|
+
// chain wires NO ref video audio at all, and the bundle's
|
|
1502
|
+
// slot-0 audio would pin sound from a DIFFERENT clip against
|
|
1503
|
+
// the reshoot's own source — an absent lane, never a mismatched
|
|
1504
|
+
// one. The bundle's video slots 1–2 and every ref_audio stay
|
|
1505
|
+
// theirs: the reshoot overrides the APPEARANCE seat only.
|
|
1506
|
+
if (reshootChain !== undefined) {
|
|
1507
|
+
r2vInputs['ref_videos.ref_video_0'] = reshootChain.refFrames;
|
|
1508
|
+
delete r2vInputs['ref_video_audios.ref_video_audio_0'];
|
|
1509
|
+
}
|
|
933
1510
|
|
|
934
1511
|
// their natural lanes above — no slice, no shift, no fourth
|
|
935
1512
|
// anything.)
|
|
@@ -956,33 +1533,52 @@ function renderH3Window(p, g, facts, model) {
|
|
|
956
1533
|
// longer consumes a ref lane: bed + user audios keep the full
|
|
957
1534
|
// 3-lane budget, and the guide is the dialogue's one owner.
|
|
958
1535
|
{
|
|
1536
|
+
|
|
1537
|
+
// same slice law, the same pin law, three prompt fields. The
|
|
1538
|
+
// dialogue stamp keeps the measured shape (walls ride it);
|
|
1539
|
+
// sfx/music stamps are the same machinery on their lanes.
|
|
1540
|
+
// ONE CLOCK (AUDIO-2): the delay's seconds→frame reconverts
|
|
1541
|
+
// speak the doc clock — the stamps were booked at it in the
|
|
1542
|
+
// film loop; a /24 literal here pins a 16fps film's guide rows
|
|
1543
|
+
// late by 1.5x (lip-sync drift at the very pin the model
|
|
1544
|
+
// hears).
|
|
1545
|
+
const pinFps = typeof p.fps === 'number' && p.fps > 0 ? p.fps : DOC_FPS_DEFAULT;
|
|
959
1546
|
const read = (key) => (p[key] ?? null);
|
|
1547
|
+
// THE CONDITIONING TENSOR SEAT (the soundtrack merged-form wire,
|
|
1548
|
+
// session 2 — the interim conditioning door deleted): a spelled
|
|
1549
|
+
// stamp names a WIRED STAGE INPUT — it slices through
|
|
1550
|
+
// MeliteAudioTensorSlice.audio_tensor, a typed AUDIO socket the
|
|
1551
|
+
// merge rewrites (rewriteSpells lands the producer's link
|
|
1552
|
+
// there), never MeliteAudioSlice.audio — a Combo FILE seat
|
|
1553
|
+
// validated against the live input-dir listing, where a link
|
|
1554
|
+
// would die at submit (the F17 class). A path stamp keeps the
|
|
1555
|
+
// file node byte-identical (the estate boundary, the S7 arm
|
|
1556
|
+
// freezes it).
|
|
1557
|
+
const sliceSeat = (src, startSeconds, durationSeconds) => isSpell(src)
|
|
1558
|
+
? g.node('MeliteAudioTensorSlice', {
|
|
1559
|
+
audio_tensor: src,
|
|
1560
|
+
start_seconds: startSeconds,
|
|
1561
|
+
duration_seconds: durationSeconds,
|
|
1562
|
+
}).out(0)
|
|
1563
|
+
: g.node('MeliteAudioSlice', {
|
|
1564
|
+
audio: src,
|
|
1565
|
+
start_seconds: startSeconds,
|
|
1566
|
+
duration_seconds: durationSeconds,
|
|
1567
|
+
}).out(0);
|
|
960
1568
|
const stamp = read('dialogue_slice');
|
|
961
1569
|
if (stamp !== null) {
|
|
962
|
-
dialogueAudio =
|
|
963
|
-
|
|
964
|
-
start_seconds: stamp.slice_start_seconds,
|
|
965
|
-
duration_seconds: stamp.slice_duration_seconds,
|
|
966
|
-
}).out(0);
|
|
967
|
-
dialogueFrameIdx = Math.round(stamp.delay_seconds * 24);
|
|
1570
|
+
dialogueAudio = sliceSeat(stamp.src, stamp.slice_start_seconds, stamp.slice_duration_seconds);
|
|
1571
|
+
dialogueFrameIdx = Math.round(stamp.delay_seconds * pinFps);
|
|
968
1572
|
}
|
|
969
1573
|
const sfxStamp = read('sfx_slice');
|
|
970
1574
|
if (sfxStamp !== null) {
|
|
971
|
-
sfxAudio =
|
|
972
|
-
|
|
973
|
-
start_seconds: sfxStamp.slice_start_seconds,
|
|
974
|
-
duration_seconds: sfxStamp.slice_duration_seconds,
|
|
975
|
-
}).out(0);
|
|
976
|
-
sfxFrameIdx = Math.round(sfxStamp.delay_seconds * 24);
|
|
1575
|
+
sfxAudio = sliceSeat(sfxStamp.src, sfxStamp.slice_start_seconds, sfxStamp.slice_duration_seconds);
|
|
1576
|
+
sfxFrameIdx = Math.round(sfxStamp.delay_seconds * pinFps);
|
|
977
1577
|
}
|
|
978
1578
|
const musicStamp = read('music_slice');
|
|
979
1579
|
if (musicStamp !== null) {
|
|
980
|
-
musicAudio =
|
|
981
|
-
|
|
982
|
-
start_seconds: musicStamp.slice_start_seconds,
|
|
983
|
-
duration_seconds: musicStamp.slice_duration_seconds,
|
|
984
|
-
}).out(0);
|
|
985
|
-
musicFrameIdx = Math.round(musicStamp.delay_seconds * 24);
|
|
1580
|
+
musicAudio = sliceSeat(musicStamp.src, musicStamp.slice_start_seconds, musicStamp.slice_duration_seconds);
|
|
1581
|
+
musicFrameIdx = Math.round(musicStamp.delay_seconds * pinFps);
|
|
986
1582
|
}
|
|
987
1583
|
}
|
|
988
1584
|
const r2v = g.node('MiniMaxH3ReferenceToVideo', r2vInputs);
|
|
@@ -1035,6 +1631,28 @@ function renderH3Window(p, g, facts, model) {
|
|
|
1035
1631
|
audio_vae: vaeAudio, audio: musicAudio,
|
|
1036
1632
|
}).out(0);
|
|
1037
1633
|
}
|
|
1634
|
+
|
|
1635
|
+
// this window's interior pins chain AFTER the audio pins — the
|
|
1636
|
+
// dialogue-measured order (audio first, image guides after; the
|
|
1637
|
+
// chain is positive-flows-through, so order is wiring, visible in
|
|
1638
|
+
// the graph). THE 17K+5 LEGALITY: a single-frame image guide is
|
|
1639
|
+
// lawful at EVERY row of the window's own grid (the engine's
|
|
1640
|
+
// 1-or-17k+5 batch rule — MiniMaxH3AddGuide treats a sub-5-frame
|
|
1641
|
+
// batch as one frame; the latent renders exactly p.length frames,
|
|
1642
|
+
// the 22+17k length law), so the only unlawful row is PAST the
|
|
1643
|
+
// generated tail — reachable only through a knob-pinned length
|
|
1644
|
+
// shorter than the authored span — and that pin SNAPS to the
|
|
1645
|
+
// nearest lawful row (loud comment, silent snap — the length
|
|
1646
|
+
// law's own idiom). The image rides the spell law's own helper:
|
|
1647
|
+
// a $spell rides its tensor slot verbatim, a path keeps the
|
|
1648
|
+
// LoadImage disk handoff (the anchor seat's exact grammar).
|
|
1649
|
+
for (const pin of pinsHere) {
|
|
1650
|
+
cond = g.node('MiniMaxH3AddGuide', {
|
|
1651
|
+
positive: cond, latent,
|
|
1652
|
+
frame_idx: Math.min(pin.frame_idx, p.length - 1),
|
|
1653
|
+
vae: vaeVideo, image: imageRef(pin.image),
|
|
1654
|
+
}).out(0);
|
|
1655
|
+
}
|
|
1038
1656
|
}
|
|
1039
1657
|
else {
|
|
1040
1658
|
// t4 families: the SLA/attention switch rides ABOVE the LoRA
|
|
@@ -1069,6 +1687,7 @@ function renderH3Window(p, g, facts, model) {
|
|
|
1069
1687
|
// the fallback arms were unreachable lies.
|
|
1070
1688
|
switch: p.sla_enabled, on_true: sla, on_false: mab,
|
|
1071
1689
|
}).out();
|
|
1690
|
+
preLoraModel = picked;
|
|
1072
1691
|
const loraModel = g.node('LTX_lora_loader', {
|
|
1073
1692
|
model: picked, mode: 'minimax', stack_data: loraStack,
|
|
1074
1693
|
}).out();
|
|
@@ -1095,42 +1714,96 @@ function renderH3Window(p, g, facts, model) {
|
|
|
1095
1714
|
// film total; fresh: the walked default; the 90/56 family budgets
|
|
1096
1715
|
// retired with the nulling that fed them)
|
|
1097
1716
|
const length = p.length;
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1717
|
+
|
|
1718
|
+
// trigger-led prompt + the prepared source clip as ref_video_0
|
|
1719
|
+
// (the official chain wires the appearance lane even on the
|
|
1720
|
+
// prompt-only arm — a reshoot without its source as reference
|
|
1721
|
+
// is the old low-quality posture). No ref video audio, the
|
|
1722
|
+
// official graph's own absence.
|
|
1723
|
+
const r2vInputs2 = {
|
|
1724
|
+
prompt: r2vPrompt, width: headW,
|
|
1725
|
+
height: headH, length: length,
|
|
1101
1726
|
ref_image_size: p.ref_image_size,
|
|
1102
1727
|
clip, vae: vaeVideo, audio_vae: vaeAudio,
|
|
1103
|
-
}
|
|
1728
|
+
};
|
|
1729
|
+
if (reshootChain !== undefined) {
|
|
1730
|
+
r2vInputs2['ref_videos.ref_video_0'] = reshootChain.refFrames;
|
|
1731
|
+
// F5 (round-6 audit): node 20 takes its width/height from the
|
|
1732
|
+
// PREPARE node's own outputs — the prepared clip's shape is the
|
|
1733
|
+
// render shape, so a source aspect that differs from the doc's
|
|
1734
|
+
// literals cannot feed aspect-faithful refs into a differently
|
|
1735
|
+
// shaped latent. `length` deliberately stays the window's own
|
|
1736
|
+
// (one guide is shared across windows of different lengths:
|
|
1737
|
+
// prep.out(3) would shorten the longer ones — documented
|
|
1738
|
+
// divergence beside duration, F28).
|
|
1739
|
+
r2vInputs2['width'] = reshootChain.prepWidth;
|
|
1740
|
+
r2vInputs2['height'] = reshootChain.prepHeight;
|
|
1741
|
+
}
|
|
1742
|
+
const r2v = g.node('MiniMaxH3ReferenceToVideo', r2vInputs2);
|
|
1104
1743
|
cond = r2v.out(0);
|
|
1105
1744
|
latent = r2v.out(1);
|
|
1106
|
-
|
|
1745
|
+
// FPS IS LAYER A, this arm too: the non-reference arm's container
|
|
1746
|
+
// clock rides the doc's declared fps — same law as the t4r arm's
|
|
1747
|
+
// fpsNode, no arm may hardcode a clock the bar disagrees with.
|
|
1748
|
+
fpsInput = p.fps;
|
|
1749
|
+
}
|
|
1750
|
+
// THE RE-SHOOT GUIDE PIN (the official chain's conditioning seat,
|
|
1751
|
+
|
|
1752
|
+
// own AV latent at row 0 — the H3-native image-guide lane (the
|
|
1753
|
+
// same node the keyframe pins ride), pinned LAST so the camera
|
|
1754
|
+
// geometry closes the guide chain (audio first, keyframes next,
|
|
1755
|
+
// the moved view's spine on top). The official graph's node 21,
|
|
1756
|
+
// verbatim shape; one pin per window, the shared warp handle.
|
|
1757
|
+
if (reshootChain !== undefined) {
|
|
1758
|
+
cond = applyH3ReshootCond(g, cond, latent, vaeVideo, reshootChain);
|
|
1107
1759
|
}
|
|
1108
1760
|
|
|
1109
|
-
// mods
|
|
1110
|
-
//
|
|
1111
|
-
//
|
|
1112
|
-
//
|
|
1113
|
-
//
|
|
1114
|
-
//
|
|
1115
|
-
// CONDITIONING either r2v arm emits and returns the same type).
|
|
1116
|
-
// Paths in, stems out: the loader's combo enumerates
|
|
1117
|
-
// models/refmods/ stems, so a path arrives as its basename minus
|
|
1118
|
-
// .safetensors — anything the engine cannot resolve refuses HERE,
|
|
1119
|
-
// loud, instead of dying server-side as a combo miss (the I2V
|
|
1120
|
-
// census-alignment law).
|
|
1761
|
+
// mods appended to the conditioning's reference tokens through ALL
|
|
1762
|
+
// DiT blocks (the pack rides the model's native ref2va path; it
|
|
1763
|
+
// spends conditioning-side tokens, never a bundle-bus slot, so the
|
|
1764
|
+
// refs-imply-r2v law does not fire on a mod and BOTH arms share
|
|
1765
|
+
// this one seam — Apply accepts the core CONDITIONING either r2v
|
|
1766
|
+
// arm emits and returns the same type).
|
|
1121
1767
|
|
|
1122
|
-
//
|
|
1123
|
-
//
|
|
1124
|
-
//
|
|
1125
|
-
//
|
|
1126
|
-
//
|
|
1768
|
+
// media kind — stills, videos, audio — and THE SYSTEM HANDLES THE
|
|
1769
|
+
// CONVERSION: the pack's own creator node (Create H3 RefMod /
|
|
1770
|
+
// MiniMaxH3RefModExtract) bakes the media into a mod at run time
|
|
1771
|
+
// (refs_image.ref_image_N stills ≤16, refs_video.ref_video_N frame
|
|
1772
|
+
// batches ≤8 — dotted autogrow addressing; audio
|
|
1773
|
+
// rides MiniMaxH3RefModAudioExtract). Forcing operators to
|
|
1774
|
+
// hand-place .safetensors packs was the regression (4f2342f46 →
|
|
1775
|
+
// ce79f052a), not the law. Pre-baked .safetensors stems under
|
|
1776
|
+
// models/refmods/ stay legal currency through the loader (the
|
|
1777
|
+
// listing door's rows) — a REUSE arm, never the only door.
|
|
1778
|
+
|
|
1779
|
+
// its own concept — identity/style/voice packs riding the ref2va
|
|
1780
|
+
// conditioning of every DiT block — never a fourth reference lane.
|
|
1781
|
+
|
|
1782
|
+
// G7: the old either/or REPLACED the declared list whenever a
|
|
1783
|
+
// window stated its own — a stated seat silently dropped, the
|
|
1784
|
+
// purge's kill class): the two spellings of the seat — the
|
|
1785
|
+
// run-level `ref_mods` (declared, rides EVERY window) and the
|
|
1786
|
+
// window's `refs.mods` (the per-call bag) — MERGE: declared
|
|
1787
|
+
// entries first, then the window's own not already present
|
|
1788
|
+
// (deduped by trimmed value), so a stated pack never drops and a
|
|
1789
|
+
// double-stated pack never double-spends a loader slot. Comma
|
|
1790
|
+
// strings (the UI wire form) and arrays (the agent form) both
|
|
1791
|
+
// resolve through wireList; the cap check below guards the UNION.
|
|
1792
|
+
// (The refs-lane REPLACE canon governs the image/video/audio BUS
|
|
1793
|
+
// lanes only — REFMOD IS NOT REFERENCE.)
|
|
1127
1794
|
const bagMods = wireList(rb0.mods);
|
|
1128
|
-
const
|
|
1795
|
+
const declaredMods = wireList(p.ref_mods);
|
|
1796
|
+
const seenMods = new Set(declaredMods.map((m) => m.trim()));
|
|
1797
|
+
const refModsAll = [...declaredMods, ...bagMods.filter((m) => !seenMods.has(m.trim()))];
|
|
1129
1798
|
if (refModsAll.length > 0) {
|
|
1130
1799
|
if (refModsAll.length > REF_CAPS.refmods) {
|
|
1131
1800
|
throw new Error(`[h3-timeline] ref_mods exceeds the loader's ${String(REF_CAPS.refmods)} slots (saw ${String(refModsAll.length)})`);
|
|
1132
1801
|
}
|
|
1133
|
-
const
|
|
1802
|
+
const modStems = [];
|
|
1803
|
+
const modImages = [];
|
|
1804
|
+
const modVideos = [];
|
|
1805
|
+
const modAudios = [];
|
|
1806
|
+
for (const src of refModsAll) {
|
|
1134
1807
|
// Trim, then query-strip (the estate precedent:
|
|
1135
1808
|
// timelineContract's _kindOfFile splits '?' first), then split
|
|
1136
1809
|
// on BOTH separators — a backslash-prefixed or padded entry
|
|
@@ -1138,26 +1811,135 @@ function renderH3Window(p, g, facts, model) {
|
|
|
1138
1811
|
// the stem and die server-side as a combo miss. The two `as`
|
|
1139
1812
|
// casts are total (split always yields a non-empty array), so
|
|
1140
1813
|
// this adds no defensive branches to the coverage face.
|
|
1141
|
-
|
|
1814
|
+
// A data: URL rides VERBATIM past the split (the studio's
|
|
1815
|
+
// upload chips commit data URLs; the run's staging walk
|
|
1816
|
+
// uploads them into the engine's input tree and rewrites the
|
|
1817
|
+
// load nodes' slots — the family reads off the MIME here).
|
|
1818
|
+
const raw = src.trim();
|
|
1819
|
+
const query = raw.split('?')[0];
|
|
1142
1820
|
const base = query.split(/[\\/]/).pop();
|
|
1143
|
-
if (
|
|
1144
|
-
|
|
1821
|
+
if (raw.startsWith('data:')) {
|
|
1822
|
+
const mime = /^data:([^;,]+)[;,]/.exec(raw)?.[1] ?? '';
|
|
1823
|
+
if (mime.startsWith('image/'))
|
|
1824
|
+
modImages.push(raw);
|
|
1825
|
+
else if (mime.startsWith('video/'))
|
|
1826
|
+
modVideos.push(raw);
|
|
1827
|
+
else if (mime.startsWith('audio/'))
|
|
1828
|
+
modAudios.push(raw);
|
|
1829
|
+
else {
|
|
1830
|
+
throw new Error(`[h3-timeline] ref_mods entries are ANY media (image/video/audio — the system bakes the pack) or pre-baked .safetensors stems under models/refmods/ (saw '${src.slice(0, 60)}')`);
|
|
1831
|
+
}
|
|
1832
|
+
continue;
|
|
1833
|
+
}
|
|
1834
|
+
if (base.endsWith('.safetensors')) {
|
|
1835
|
+
modStems.push(base.slice(0, -'.safetensors'.length));
|
|
1836
|
+
continue;
|
|
1837
|
+
}
|
|
1838
|
+
// ANY media kind boards (mediaKindOf — the contracts SSOT):
|
|
1839
|
+
// image → the creator's refs_image.ref_image_N, video →
|
|
1840
|
+
// refs_video.ref_video_N via the component split, audio → the
|
|
1841
|
+
// audio extractor. Anything
|
|
1842
|
+
// the estate does not recognize as media refuses HERE, loud,
|
|
1843
|
+
// instead of dying server-side (the I2V census-alignment law).
|
|
1844
|
+
const kind = mediaKindOf(base);
|
|
1845
|
+
if (kind === 'image')
|
|
1846
|
+
modImages.push(query);
|
|
1847
|
+
else if (kind === 'video')
|
|
1848
|
+
modVideos.push(query);
|
|
1849
|
+
else if (kind === 'audio')
|
|
1850
|
+
modAudios.push(query);
|
|
1851
|
+
else {
|
|
1852
|
+
throw new Error(`[h3-timeline] ref_mods entries are ANY media (image/video/audio — the system bakes the pack) or pre-baked .safetensors stems under models/refmods/ (saw '${src}')`);
|
|
1145
1853
|
}
|
|
1146
|
-
|
|
1854
|
+
}
|
|
1855
|
+
// The chain's law: each mods source appends through its own
|
|
1856
|
+
// Apply (Apply passes conditioning through, one mods input), in
|
|
1857
|
+
// fixed order — pre-baked stems, the baked visual pack, then
|
|
1858
|
+
// each baked audio pack.
|
|
1859
|
+
const applyMods = (mods) => {
|
|
1860
|
+
cond = g.node('MiniMaxH3RefModApply', {
|
|
1861
|
+
conditioning: cond, mods, override: false, retention: 1,
|
|
1862
|
+
curve_direction: 'constant', scramble_seed: -1,
|
|
1863
|
+
curve_shape: 'linear', curve_value: 1,
|
|
1864
|
+
}).out(0);
|
|
1147
1865
|
};
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1866
|
+
if (modStems.length > 0) {
|
|
1867
|
+
const loaderInputs = { show_info: false };
|
|
1868
|
+
for (let i = 0; i < REF_CAPS.refmods; i++) {
|
|
1869
|
+
const stem = modStems[i];
|
|
1870
|
+
loaderInputs[`mod_${i + 1}`] = stem === undefined ? '(none)' : stem;
|
|
1871
|
+
loaderInputs[`strength_${i + 1}`] = 1;
|
|
1872
|
+
loaderInputs[`copies_${i + 1}`] = 1;
|
|
1873
|
+
}
|
|
1874
|
+
applyMods(g.node('MiniMaxH3RefModsLoader', loaderInputs).out(0));
|
|
1875
|
+
}
|
|
1876
|
+
if (modImages.length > 0 || modVideos.length > 0) {
|
|
1877
|
+
// One creator node stacks every visual ref of the seat into a
|
|
1878
|
+
// single video-kind mod (the node's own grammar: stills into
|
|
1879
|
+
// the refs_image autogrow container's grown slots, frame
|
|
1880
|
+
// batches into refs_video's — DOTTED container.slot addressing,
|
|
1881
|
+
// the r2v ref_images.ref_image_0 receipt; a BARE ref_image_1
|
|
1882
|
+
// key is an undeclared input and phase 1 refuses it, the
|
|
1883
|
+
|
|
1884
|
+
// ref's basename, sanitized node-side — a data: upload chip
|
|
1885
|
+
// has no basename, so a data-only seat names the generic
|
|
1886
|
+
// 'mod'. save rides the node default (true) so the baked pack
|
|
1887
|
+
// lands in the loader's dropdown for later reuse.
|
|
1888
|
+
const firstVisual = (modImages[0] ?? modVideos[0]);
|
|
1889
|
+
const nameBase = firstVisual.startsWith('data:') ? 'mod' : firstVisual.split(/[\\/]/).pop()?.replace(/\.[^.]+$/, '') ?? 'mod';
|
|
1890
|
+
// THE STATED BAKE (study §5/§7.2; value-arms ARMs 13/14): the
|
|
1891
|
+
// fidelity dials are DECLARED params (schema.ts, the refmod
|
|
1892
|
+
// group) and ride the node verbatim. Before this, pool and
|
|
1893
|
+
// identity were SILENT engine defaults (nothing named them)
|
|
1894
|
+
// and mode/save were pinned constants — the dials did not
|
|
1895
|
+
// exist on this lane. The fallbacks are the declared defaults
|
|
1896
|
+
// verbatim — one owner, the schema.
|
|
1897
|
+
const bakeMode = typeof p.refmod_mode === 'string' ? p.refmod_mode : 'Compressed Reference';
|
|
1898
|
+
const bakePool = typeof p.refmod_pool === 'number' && Number.isFinite(p.refmod_pool) ? p.refmod_pool : 16;
|
|
1899
|
+
const bakeIdentity = typeof p.refmod_identity === 'number' && Number.isFinite(p.refmod_identity) ? p.refmod_identity : 500;
|
|
1900
|
+
const extractInputs = {
|
|
1901
|
+
name: nameBase,
|
|
1902
|
+
mode: bakeMode, concept_type: 'generic',
|
|
1903
|
+
save: p.refmod_save !== false,
|
|
1904
|
+
pool_h: bakePool, pool_w: bakePool, identity: bakeIdentity,
|
|
1905
|
+
|
|
1906
|
+
// (MiniMax-H3 VAE loader) or a standard VAE' — the engine
|
|
1907
|
+
// refuses the extract at run time without one; both inputs
|
|
1908
|
+
// are schema-optional, so no phase-1 judge can catch it).
|
|
1909
|
+
// The family's own optimized H3 VAE rides (the int8-convrot
|
|
1910
|
+
// video VAE, the same handle the film lane loads); no
|
|
1911
|
+
// MINIMAX_H3_AV_ENCODER loader node exists in this engine's
|
|
1912
|
+
// /object_info, so the standard-VAE input is THE wire.
|
|
1913
|
+
vae: vaeVideo,
|
|
1914
|
+
};
|
|
1915
|
+
modImages.forEach((img, i) => {
|
|
1916
|
+
extractInputs[`refs_image.ref_image_${i}`] = g.node('LoadImage', { image: img, upload: 'image' }).out(0);
|
|
1917
|
+
});
|
|
1918
|
+
modVideos.forEach((vid, i) => {
|
|
1919
|
+
extractInputs[`refs_video.ref_video_${i}`] = g.node('GetVideoComponents', {
|
|
1920
|
+
video: g.node('LoadVideo', { file: vid }).out(),
|
|
1921
|
+
}).out(0);
|
|
1922
|
+
});
|
|
1923
|
+
applyMods(g.node('MiniMaxH3RefModExtract', extractInputs).out(0));
|
|
1924
|
+
}
|
|
1925
|
+
for (const src of modAudios) {
|
|
1926
|
+
// Audio mods are their own extractor (AUDIO in, one mod out);
|
|
1927
|
+
// one node per entry, voice-grade defaults, saved for reuse
|
|
1928
|
+
// (a data: upload chip names the generic 'audio_mod').
|
|
1929
|
+
// budget_policy + concept_type are REQUIRED bare combos in the
|
|
1930
|
+
// engine's /object_info — no declared default, so no primed
|
|
1931
|
+
// builder autofills them (the B7 wall refuses at compose) — the
|
|
1932
|
+
// graph states the pack's own signature defaults
|
|
1933
|
+
// (vendor/ComfyUI-MiniMaxH3Mod/nodes.py:2143: budget_policy
|
|
1934
|
+
// 'error', concept_type 'voice').
|
|
1935
|
+
applyMods(g.node('MiniMaxH3RefModAudioExtract', {
|
|
1936
|
+
audio: g.node('LoadAudio', { audio: src }).out(),
|
|
1937
|
+
audio_vae: vaeAudio,
|
|
1938
|
+
name: src.startsWith('data:') ? 'audio_mod' : src.split(/[\\/]/).pop()?.replace(/\.[^.]+$/, '') ?? 'audio_mod',
|
|
1939
|
+
budget_policy: 'error', concept_type: 'voice',
|
|
1940
|
+
save: true,
|
|
1941
|
+
}).out(0));
|
|
1154
1942
|
}
|
|
1155
|
-
const mods = g.node('MiniMaxH3RefModsLoader', loaderInputs).out(0);
|
|
1156
|
-
cond = g.node('MiniMaxH3RefModApply', {
|
|
1157
|
-
conditioning: cond, mods, override: false, retention: 1,
|
|
1158
|
-
curve_direction: 'constant', scramble_seed: -1,
|
|
1159
|
-
curve_shape: 'linear', curve_value: 1,
|
|
1160
|
-
}).out(0);
|
|
1161
1943
|
}
|
|
1162
1944
|
// ── sampler stack ──────────────────────────────────────────────────
|
|
1163
1945
|
// card knob first (seed), renderer alias second.
|
|
@@ -1183,6 +1965,15 @@ function renderH3Window(p, g, facts, model) {
|
|
|
1183
1965
|
// boarding gate — the rows are the operator's BENCH row, 002 H1)
|
|
1184
1966
|
// and every row fact (schedule capability, strength ceiling, the
|
|
1185
1967
|
// clip/mask channels) arrived stamped by the service resolution.
|
|
1968
|
+
|
|
1969
|
+
// just ahead of it: the CrossView LoRA on the post-shift model —
|
|
1970
|
+
// the official order (distill lora → shift → attention → the
|
|
1971
|
+
// CrossView LoRA LAST) so the camera-trained adapters win, with
|
|
1972
|
+
// any file-based picks refining on top. The hoisted reshootChain
|
|
1973
|
+
// (the window head) is the one build — the film loop's stamped
|
|
1974
|
+
// handles or the single-window's own.
|
|
1975
|
+
if (reshootChain !== undefined)
|
|
1976
|
+
sigmaModel = applyH3ReshootModel(g, sigmaModel, p);
|
|
1186
1977
|
sigmaModel = applyH3FunControlNets(g, sigmaModel, vaeVideo, fireControlNets(model, p));
|
|
1187
1978
|
const schedName = p.sched_name;
|
|
1188
1979
|
const denoiseVal = p.denoise;
|
|
@@ -1227,7 +2018,7 @@ function renderH3Window(p, g, facts, model) {
|
|
|
1227
2018
|
iteration, overlap_frames: overlap,
|
|
1228
2019
|
continue_audio_latent: true,
|
|
1229
2020
|
model: sigmaModel, sigmas: sched,
|
|
1230
|
-
previous_latent: prev.
|
|
2021
|
+
previous_latent: prev.seamLatent,
|
|
1231
2022
|
});
|
|
1232
2023
|
cond = cont.out(0);
|
|
1233
2024
|
targetLatent = cont.out(1);
|
|
@@ -1244,8 +2035,10 @@ function renderH3Window(p, g, facts, model) {
|
|
|
1244
2035
|
// primary stack above NEVER changes), full-denoise short
|
|
1245
2036
|
// schedule from the same noise seed, riding the doc's own
|
|
1246
2037
|
// sampler/scheduler (the rider owns NO solver of its own — one
|
|
1247
|
-
// owner per knob). Mounted ONLY when
|
|
1248
|
-
//
|
|
2038
|
+
// owner per knob). Mounted ONLY when resolveRefineSeat above
|
|
2039
|
+
// assembles the rider (the door's single owner — the engine
|
|
2040
|
+
// service carries no refine assembly of its own); absent = the
|
|
2041
|
+
// graph renders exactly as before.
|
|
1249
2042
|
// The TaoMate refiner thread's mechanics: pass A full, pass B
|
|
1250
2043
|
// closes. The rider sits UPSTREAM of decode AND of the film's
|
|
1251
2044
|
// seam handles — the chained texture is the refined one.
|
|
@@ -1254,16 +2047,99 @@ function renderH3Window(p, g, facts, model) {
|
|
|
1254
2047
|
// refine each AND it with their own switch (legacy docs with
|
|
1255
2048
|
// leaves set but no master render the plain pass, byte-stable).
|
|
1256
2049
|
const secondPassOn = p.second_pass_enabled === true;
|
|
1257
|
-
const refine =
|
|
2050
|
+
const refine = resolveRefineSeat(p);
|
|
2051
|
+
// ── THE P2 LATENT-UPSCALE HANDOFF (SOTA plan Phase P2 — mounts
|
|
2052
|
+
// BEFORE the rider: the rider goes in-band on the UPSCALED
|
|
2053
|
+
// latent, ARM 43): the handoff's latent edge names the pass-1
|
|
2054
|
+
// sampler's output (the sampled joint AV — 24 video ch, ARM 38),
|
|
2055
|
+
// lock_audio true preserves pass-1 audio exactly, and the decode
|
|
2056
|
+
// below rides latOut so it decodes the upscaled latent (ARM 39).
|
|
2057
|
+
|
|
2058
|
+
// spec's diagnostic matrix names the mechanism — "Distilled LoRAs
|
|
2059
|
+
// at low denoise predict invalid noise fields" (the plastic/waxy
|
|
2060
|
+
// skin face); its cure row seats "Un-distilled b30-49 Base
|
|
2061
|
+
// Checkpoint" for pass 2. So whenever the primary bag carries a
|
|
2062
|
+
// counting distill AND the pass-2 window is sub-1 (the handoff's
|
|
2063
|
+
// window is ALWAYS sub-1 — its sigmas law below refuses 1.0), the
|
|
2064
|
+
// refine rider and the latent handoff mount on the PRE-LORA chain
|
|
2065
|
+
// instead of sigmaModel: the picked UNET+switch edge + the AdaLN
|
|
2066
|
+
// fix + the doc's own shift grid + the same fun-controlnet wrap —
|
|
2067
|
+
// every conditioning a pass needs, minus the distill. At denoise
|
|
2068
|
+
// 1.0 the rider keeps the primary stack (the TaoMate full mechanic
|
|
2069
|
+
// — pass A full, pass B closes — unchanged); with no counting row
|
|
2070
|
+
// the primary stack already IS the un-distilled base.
|
|
2071
|
+
// the bag's own truth: absent p.loras = the default
|
|
2072
|
+
// H3_DEFAULT_LORA_ID row (h3_silver_dareties) rides via
|
|
2073
|
+
// loraStackDefault — a counting distill; a stated bag
|
|
2074
|
+
// rides a counting row iff the marriage sees one.
|
|
2075
|
+
const distillRides = Array.isArray(p.loras) ? marriedBagKnob(p, 'steps') !== null : true;
|
|
2076
|
+
const riderSubOne = refine !== undefined && refine.denoise < 1;
|
|
2077
|
+
let pass2Model = sigmaModel;
|
|
2078
|
+
if (distillRides && (upscaleOn || riderSubOne)) {
|
|
2079
|
+
const pass2Adaln = g.node('H3AdaLNLoRAFix', { model: preLoraModel, mode: 'port' }).out();
|
|
2080
|
+
const pass2Shift = g.node('MiniMaxH3SigmaShift', {
|
|
2081
|
+
model: pass2Adaln, shift_video: shiftVideo, shift_audio: p.shift_audio,
|
|
2082
|
+
}).out();
|
|
2083
|
+
pass2Model = applyH3FunControlNets(g, pass2Shift, vaeVideo, fireControlNets(model, p));
|
|
2084
|
+
}
|
|
2085
|
+
if (upscaleOn) {
|
|
2086
|
+
// THE STAGE-2 SCHEDULE: the married steps AT THIS SEAT — the
|
|
2087
|
+
// rider's own count when it mounts (the in-band marriage), else
|
|
2088
|
+
// the doc steps (a riderless stated refine_steps is a cross-gate
|
|
2089
|
+
// leaf, ARM 45's ARM-5 heir — it never reaches this schedule);
|
|
2090
|
+
// the denoise is the shared Stage-2 seat (resolveStage2Denoise
|
|
2091
|
+
// above — rides with or without the rider, the P2 verdict's
|
|
2092
|
+
// core). THE PARTIAL-DENOISE LAW (the vendored sequence node's
|
|
2093
|
+
// own contract — nodes/minimax_h3_refine.py run_h3_refinement:
|
|
2094
|
+
// sigmas must be 1-dim, ≥2 finite entries, and
|
|
2095
|
+
// 0 <= sigmas[0] < 1 STRICT; a full-noise sigma discards the
|
|
2096
|
+
// learned upscaled latent and the node throws at the engine).
|
|
2097
|
+
// A BasicScheduler full schedule (denoise 1.0) opens AT sigma_max
|
|
2098
|
+
// — so denoise 1.0 is ILLEGAL on this arm and refuses HERE, in
|
|
2099
|
+
// the handoff's own voice naming the sigmas law (ARM 46 fires
|
|
2100
|
+
// it). Off-arm 1.0 stays legal (the rider's taomate full-denoise
|
|
2101
|
+
// mechanic never crosses this node).
|
|
2102
|
+
const stage2Denoise = resolveStage2Denoise(p);
|
|
2103
|
+
if (stage2Denoise >= 1) {
|
|
2104
|
+
throw new Error(`h3 action: refine_denoise 1 composes no partial-denoise window — the latent-upscale handoff requires 0 <= sigmas[0] < 1 (vendored MinimaxH3LatentUpscaler3DRefineHandoff, run_h3_refinement: a full-noise sigma discards the upscaled latent); state a window below 1 (the researched 0.30–0.35) or turn upscale_route off for the taomate full-denoise mechanic`);
|
|
2105
|
+
}
|
|
2106
|
+
const stage2Sched = g.node('BasicScheduler', {
|
|
2107
|
+
model: pass2Model, scheduler: schedName,
|
|
2108
|
+
steps: refine !== undefined ? refine.steps : p.steps,
|
|
2109
|
+
denoise: stage2Denoise,
|
|
2110
|
+
}).out();
|
|
2111
|
+
const upscaled = g.node('MinimaxH3LatentUpscaler3DRefineHandoff', {
|
|
2112
|
+
model: pass2Model, noise, sampler: samplerSel, positive: cond,
|
|
2113
|
+
sigmas: stage2Sched, latent: latOut,
|
|
2114
|
+
model_name: p.upscale_model,
|
|
2115
|
+
mode: "scale by multiplier", scale: 2.0,
|
|
2116
|
+
lock_audio: true, precision: "bf16", device: "cuda", cfg: 1.0,
|
|
2117
|
+
|
|
2118
|
+
// the corpus stage-2+3 member's wiring pass reds — the node
|
|
2119
|
+
// composed estate-side without the engine's declared-required
|
|
2120
|
+
// inputs, and the engine refuses the prompt on any of them).
|
|
2121
|
+
// Multiplier mode ignores width/height/megapixels/keep_proportion
|
|
2122
|
+
// — they ride the pass-2 target (full size, aspect kept) and the
|
|
2123
|
+
// engine's own defaults; align is the kernel's latent-alignment
|
|
2124
|
+
// grain (32 = its default, every 3D-conv frame boundary).
|
|
2125
|
+
width: p.width, height: p.height,
|
|
2126
|
+
keep_proportion: true, megapixels: 1,
|
|
2127
|
+
align: 32, offload_after_upscale: false,
|
|
2128
|
+
});
|
|
2129
|
+
latOut = upscaled.out(0);
|
|
2130
|
+
}
|
|
1258
2131
|
if (refine !== undefined) {
|
|
1259
2132
|
const refineModel = g.node('LTX_lora_loader', {
|
|
1260
|
-
model:
|
|
2133
|
+
model: pass2Model, mode: 'minimax',
|
|
1261
2134
|
stack_data: JSON.stringify([{ on: true, lora: refine.name, str: refine.strength, v: 1, a: 1, t: 1 }]),
|
|
1262
2135
|
lora_ui: '',
|
|
1263
2136
|
}).out();
|
|
1264
2137
|
const refineSched = g.node('BasicScheduler', {
|
|
1265
2138
|
model: refineModel, scheduler: schedName,
|
|
1266
|
-
|
|
2139
|
+
// THE REFINE WINDOW (SOTA limb 1): 1.0 = the full-denoise
|
|
2140
|
+
// TaoMate mechanic (unstated, byte-stable); a stated window
|
|
2141
|
+
// (0.30–0.35) keeps pass 1's structure and polishes texture.
|
|
2142
|
+
steps: refine.steps, denoise: refine.denoise,
|
|
1267
2143
|
}).out();
|
|
1268
2144
|
const refineGuider = g.node('BasicGuider', { model: refineModel, conditioning: cond }).out();
|
|
1269
2145
|
const refined = g.node('SamplerCustomAdvanced', {
|
|
@@ -1280,7 +2156,18 @@ function renderH3Window(p, g, facts, model) {
|
|
|
1280
2156
|
let vadecRaw;
|
|
1281
2157
|
// `delivered` fills at the save branches (both families save)
|
|
1282
2158
|
let delivered = null;
|
|
1283
|
-
|
|
2159
|
+
|
|
2160
|
+
// rate fix, no downsample at the seam. The window-2 crash is
|
|
2161
|
+
// structurally certain") ── the continuation above consumes the
|
|
2162
|
+
// previous window's latent at the BASE rate. When the latent-upscale
|
|
2163
|
+
// handoff mounts, latOut is its 2× spatial output — handing that to
|
|
2164
|
+
// window k+1's MiniMaxH3FiniteLatentContinuation composes a
|
|
2165
|
+
// shape-refused graph before any engine run. The seam handle names
|
|
2166
|
+
// pass 1's own sampled latent on the upscale arm; everywhere else it
|
|
2167
|
+
// stays latOut, so the refine rider's chained texture still crosses
|
|
2168
|
+
// the seam at the same rate (the chained-texture law, intact).
|
|
2169
|
+
const seamLatent = upscaleOn ? sampled.out(0) : latOut;
|
|
2170
|
+
const rawHandles = { seamLatent, latOut, vdec, vadec, filmImages: latOut, filmAudio: latOut };
|
|
1284
2171
|
if (isChain || isT4r) {
|
|
1285
2172
|
const prev = p.__prev;
|
|
1286
2173
|
/* v8 ignore next 1 -- the film loop stamps __overlap on every window k≥2 before the render (the block mounts only when it did) */
|
|
@@ -1298,101 +2185,193 @@ function renderH3Window(p, g, facts, model) {
|
|
|
1298
2185
|
vadec = fin.out(2);
|
|
1299
2186
|
}
|
|
1300
2187
|
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
2188
|
+
|
|
2189
|
+
// the operator's gate-11 burn: "THE COMPOSE GATE REFUSED THIS DOC …
|
|
2190
|
+
// the lane refuses it (unsanctioned inject keys)") ── the
|
|
2191
|
+
// image-space finish (sharpen → interp → SeedVR2 → sharpen) used
|
|
2192
|
+
// to live INSIDE the non-reference arm's else block, so a t4r
|
|
2193
|
+
// window (any guide/reference seat) silently composed NO post node
|
|
2194
|
+
// while the doc's keys rode the panel: every door then REFUSED the
|
|
2195
|
+
// doc to hide the omission. The chain is family-agnostic pixel
|
|
2196
|
+
// work on the decoded window — it mounts here for every arm; the
|
|
2197
|
+
// gates are the DOC's own (second_pass_enabled + each limb's
|
|
2198
|
+
// switch), never the lane's. With every gate off this block builds
|
|
2199
|
+
// ZERO nodes and postImage === vdec, so the frozen t4r graphs stay
|
|
2200
|
+
// byte-identical.
|
|
2201
|
+
// sharpen leaves: only the EXPLICITLY-set ones patch the tuned
|
|
2202
|
+
// bag (absent leaves keep SHARPEN_DEFAULTS above). The old
|
|
2203
|
+
// card knob (sharpen_strength) rides the leaf loop like
|
|
2204
|
+
// the renderer alias does.
|
|
2205
|
+
const methodBag = { ...SHARPEN_DEFAULTS };
|
|
2206
|
+
const sharpenLeaves = [
|
|
2207
|
+
['sharpen_method', 'method'], ['sharpen_strength', 'strength'],
|
|
2208
|
+
['sharpen_radius', 'radius'], ['sharpen_threshold', 'threshold'],
|
|
2209
|
+
['sharpen_iterations', 'iterations'],
|
|
2210
|
+
];
|
|
2211
|
+
for (const [src, dst] of sharpenLeaves) {
|
|
2212
|
+
const val = p[src];
|
|
2213
|
+
if (val !== null && val !== undefined)
|
|
2214
|
+
methodBag[dst] = val;
|
|
1318
2215
|
}
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
2216
|
+
|
|
2217
|
+
// upstream moved sharpen LAST: interp → VSR → sharpen → CreateVideo
|
|
2218
|
+
// (V7/ours sharpened FIRST — before the upscaler could soften the
|
|
2219
|
+
// detail away). Sharpen rcas 0.3 after upscale "looks natural"
|
|
2220
|
+
// (his V9 notes). The switches stay ours; the ORDER is his.
|
|
2221
|
+
//
|
|
2222
|
+
|
|
2223
|
+
// VIDEO UI LIE… IT WILL ALWAYS UPSCALE") ── each limb mounts
|
|
2224
|
+
// IFF its own doc gate is on; an off limb composes NO node at
|
|
2225
|
+
// all. The pre-burn shape built every limb unconditionally and
|
|
2226
|
+
// routed a lazy ComfySwitchNode around each — the serialized
|
|
2227
|
+
// graph (a face the operator and the engine queue both read)
|
|
2228
|
+
// carried SeedVR2 + interp + sharpen on EVERY doc, switches or
|
|
2229
|
+
// not: the graph itself said "always upscale". The TS build now
|
|
2230
|
+
// picks the wire at compose time — the same mount-behind-the-
|
|
2231
|
+
// gate law the latent-upscale handoff and the refine rider
|
|
2232
|
+
// already ride — and the V9 ORDER is preserved by threading one
|
|
2233
|
+
// `postImage` handle down the chain.
|
|
2234
|
+
let postImage = vdec;
|
|
2235
|
+
const interpOn = secondPassOn && p.interpolate_enabled;
|
|
2236
|
+
if (interpOn) {
|
|
1340
2237
|
const film = g.node('FrameInterpolationModelLoader', {
|
|
1341
2238
|
model_name: p.interp_model,
|
|
1342
2239
|
}).out();
|
|
1343
2240
|
const interpMultVal = p.interp_multiplier;
|
|
1344
2241
|
const interp = g.node('FrameInterpolate', {
|
|
1345
|
-
interp_model: film, images:
|
|
2242
|
+
interp_model: film, images: postImage, multiplier: interpMultVal,
|
|
1346
2243
|
}).out();
|
|
2244
|
+
postImage = interp;
|
|
2245
|
+
}
|
|
2246
|
+
const srSwOn = secondPassOn && p.sr_switch;
|
|
2247
|
+
if (srSwOn) {
|
|
2248
|
+
const srRes = p.sr_resolution;
|
|
1347
2249
|
|
|
1348
|
-
//
|
|
1349
|
-
//
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
2250
|
+
// "h3 final" press that OOM'd on the operator's 24GB card:
|
|
2251
|
+
// "torch.OutOfMemoryError: CUDA out of memory. Tried to
|
|
2252
|
+
|
|
2253
|
+
// — the h3 stack was STILL RESIDENT when SeedVR2 loaded its
|
|
2254
|
+
// DiT). The upscaler is the one seat that needs the h3
|
|
2255
|
+
// weights GONE: nothing downstream of this image reads them.
|
|
2256
|
+
// A MeliteBoundary (Layer C, the F41 pass-seam primitive)
|
|
2257
|
+
// carries the decoded frame through while evicting the
|
|
2258
|
+
// models, so the eviction is output-reachable (the DAG proves
|
|
2259
|
+
// it waits for the h3 pass) and SeedVR2 loads into free VRAM.
|
|
2260
|
+
// `through` is the wildcard passthrough: the tensor rides
|
|
2261
|
+
// untouched, only the cache is flushed.
|
|
2262
|
+
const srIn = g.node('MeliteBoundary', {
|
|
2263
|
+
through: postImage, unload_models: true,
|
|
1354
2264
|
}).out();
|
|
1355
|
-
const srRes = p.sr_resolution;
|
|
1356
2265
|
const sr = g.node('SeedVR2VideoUpscaler', {
|
|
1357
|
-
image:
|
|
2266
|
+
image: srIn,
|
|
1358
2267
|
dit: g.node('SeedVR2LoadDiTModel', {
|
|
1359
2268
|
model: p.sr_model, device: 'cuda:0',
|
|
1360
2269
|
}).out(),
|
|
2270
|
+
// THE DECODE'S MEMORY LAW: a 90-frame 1080p decode allocates
|
|
2271
|
+
// ~21.9 GiB of activations in one pass and dies on the 23.52
|
|
2272
|
+
|
|
2273
|
+
// even after the seam boundary freed the h3 stack. Tiled
|
|
2274
|
+
// decode is the loader's own declared lever for exactly this.
|
|
1361
2275
|
vae: g.node('SeedVR2LoadVAEModel', {
|
|
1362
|
-
model: LANE_FILES.sr_vae, device: 'cuda:0',
|
|
2276
|
+
model: LANE_FILES.sr_vae, device: 'cuda:0', decode_tiled: true,
|
|
1363
2277
|
}).out(),
|
|
1364
2278
|
seed: 42, resolution: srRes,
|
|
1365
2279
|
max_resolution: 0, batch_size: 5, uniform_batch_size: false,
|
|
1366
2280
|
color_correction: 'lab',
|
|
1367
2281
|
}).out();
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
//
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
2282
|
+
postImage = sr;
|
|
2283
|
+
}
|
|
2284
|
+
// sharpen LAST (V9): the upscaler softens; rcas after it restores.
|
|
2285
|
+
// Renderer alias second (sharpen_* leaves above build the method).
|
|
2286
|
+
if (secondPassOn && p.sharpen_enabled) {
|
|
2287
|
+
// THE V3 COMBO PROJECTION (GAPS-1/F9 cure): the installed
|
|
2288
|
+
// KJNodes serves ImageSharpenKJ.method as a V3 DynamicCombo —
|
|
2289
|
+
// the engine's expansion matches the base wire against the
|
|
2290
|
+
// option keys and folds ONLY the selected option's dotted
|
|
2291
|
+
// children into the execute dict (comfy_api _expand_schema_for_
|
|
2292
|
+
// dynamic + build_nested_inputs; proven against the real _io.py
|
|
2293
|
+
// in the GAPS-1 report). The old flat grouped dict matched no
|
|
2294
|
+
// option key, so the finalized schema dropped `method` outright
|
|
2295
|
+
// and validation failed required_input_missing — every sharpen
|
|
2296
|
+
// compose died there. The option key rides `method`; the
|
|
2297
|
+
// SELECTED option's children ride dotted wires (the F23
|
|
2298
|
+
// mode.scale spelling chainUpscale already rides). Values are
|
|
2299
|
+
// the same bag as before; only the SHAPE changed.
|
|
2300
|
+
const selected = methodBag.method;
|
|
2301
|
+
const sharpenInputs = { image: postImage, method: selected };
|
|
2302
|
+
for (const child of SHARPEN_OPTION_CHILDREN[selected] ?? []) {
|
|
2303
|
+
sharpenInputs[`method.${child}`] = methodBag[child];
|
|
2304
|
+
}
|
|
2305
|
+
const sharpened = g.node('ImageSharpenKJ', sharpenInputs).out();
|
|
2306
|
+
postImage = sharpened;
|
|
2307
|
+
}
|
|
2308
|
+
// THE MUX CLOCK — one owner, both arms (the V9 compensation's one
|
|
2309
|
+
// spelling): an interpolated window plays at base × multiplier. The
|
|
2310
|
+
// t4r arm's clock is the walk-first PrimitiveFloat NODE, the
|
|
2311
|
+
// open/chain arms' is the doc's number; the helper multiplies the
|
|
2312
|
+
// one it was handed. `out(0)` is the expression's FLOAT face.
|
|
2313
|
+
const muxFps = () => {
|
|
2314
|
+
if (!interpOn)
|
|
2315
|
+
return fpsInput;
|
|
2316
|
+
if (typeof fpsInput === 'number')
|
|
2317
|
+
return fpsInput * p.interp_multiplier;
|
|
2318
|
+
return g.node('ComfyMathExpression', {
|
|
2319
|
+
expression: `a * ${String(p.interp_multiplier)}`, 'values.a': fpsInput,
|
|
2320
|
+
}).out(0);
|
|
2321
|
+
};
|
|
2322
|
+
if (isT4r) {
|
|
2323
|
+
const created = g.node('CreateVideo', {
|
|
2324
|
+
|
|
2325
|
+
// as every join leg — the sound VAE's 32 kHz never muxes raw, so
|
|
2326
|
+
// one press and one join emit one standard (48 kHz), equal-rate
|
|
2327
|
+
// legs paying only the stated law.
|
|
2328
|
+
|
|
2329
|
+
|
|
2330
|
+
// post limbs by branch omission — the doc's second-pass keys
|
|
2331
|
+
// composed NO node while every gate refused the doc that
|
|
2332
|
+
// stated them. The mux takes the chain's own output and its
|
|
2333
|
+
// compensated clock.
|
|
2334
|
+
images: postImage, audio: filmJoinAudio(g, vadec), fps: muxFps(), bit_depth: FILM_BIT_DEPTH,
|
|
2335
|
+
// color_space: pin autofill "sRGB"
|
|
2336
|
+
});
|
|
2337
|
+
|
|
2338
|
+
|
|
2339
|
+
// under `<runId>/h3_t4_w<k>` — the t4r arm's legacy
|
|
2340
|
+
// 'video/ComfyUI' prefix died (multi-window anchored films were
|
|
2341
|
+
// unaddressable), then the flat `h3_t4_w<k>` died too (the
|
|
2342
|
+
// harvest outlier: the swap chain's `${runId}/…` prefixes
|
|
2343
|
+
// harvest run-scoped, the film's flat prefixes stranded at the
|
|
2344
|
+
// engine output root). The subfolder is the same run-scope
|
|
2345
|
+
// spelling every chain save rides.
|
|
2346
|
+
const saved = g.node('SaveVideo', {
|
|
2347
|
+
video: created.out(), filename_prefix: `${runId}/h3_t4_w${k}`,
|
|
2348
|
+
format: 'auto', codec: 'h264',
|
|
2349
|
+
'codec.encoding': 're-encode', 'codec.encoding.crf': 10.0,
|
|
2350
|
+
});
|
|
2351
|
+
rawHandles.savePassthrough = saved.out(0);
|
|
2352
|
+
delivered = { images: postImage, audio: vadec };
|
|
2353
|
+
}
|
|
2354
|
+
else {
|
|
1378
2355
|
|
|
1379
2356
|
// CreateVideo.fps = base × interp multiplier (his Enhancements:
|
|
1380
2357
|
// PrimitiveFloat 24 → ComfyMathExpression "a * 2" → fps). Without
|
|
1381
2358
|
// it every interp-on window plays at HALF speed — the frames
|
|
1382
|
-
// double, the fps doesn't.
|
|
1383
|
-
//
|
|
1384
|
-
|
|
1385
|
-
|
|
2359
|
+
// double, the fps doesn't. THE BASE IS THE DOC'S CLOCK, never a
|
|
2360
|
+
// hardcoded 24 (audit f1cc1197: this seat rode a literal while
|
|
2361
|
+
// the fpsInput "cure" above sat dead — the exact dead-store
|
|
2362
|
+
// class: a line that looks like a fix and never fires).
|
|
1386
2363
|
const created = g.node('CreateVideo', {
|
|
1387
|
-
|
|
2364
|
+
// F25: the same join-rate door — the film standard is ONE rate
|
|
2365
|
+
// on every mux seat (t4r above, this window arm, every join).
|
|
2366
|
+
images: postImage, audio: filmJoinAudio(g, vadec), fps: muxFps(), bit_depth: FILM_BIT_DEPTH,
|
|
1388
2367
|
// color_space: pin autofill "sRGB"
|
|
1389
2368
|
});
|
|
1390
2369
|
const saved = g.node('SaveVideo', {
|
|
1391
|
-
video: created.out(), filename_prefix:
|
|
2370
|
+
video: created.out(), filename_prefix: `${runId}/h3_t4_w${k}`,
|
|
1392
2371
|
format: 'mp4', codec: 'h264',
|
|
1393
2372
|
});
|
|
1394
2373
|
rawHandles.savePassthrough = saved.out(0);
|
|
1395
|
-
delivered = { images:
|
|
2374
|
+
delivered = { images: postImage, audio: vadec };
|
|
1396
2375
|
}
|
|
1397
2376
|
// (every family path delivers — both arms save the window's clip;
|
|
1398
2377
|
// no null arm: the family dispatch is exhaustive over FAMILIES.
|
|
@@ -1417,6 +2396,105 @@ function renderH3Window(p, g, facts, model) {
|
|
|
1417
2396
|
* schema's own filter law — a retyped list would be a second
|
|
1418
2397
|
* SSOT). */
|
|
1419
2398
|
const H3_SAMPLER_OPTIONS = SAMPLER_OPTIONS.filter((n) => H3_RECOMMENDED_SAMPLERS.includes(n));
|
|
2399
|
+
|
|
2400
|
+
|
|
2401
|
+
|
|
2402
|
+
|
|
2403
|
+
|
|
2404
|
+
|
|
2405
|
+
|
|
2406
|
+
|
|
2407
|
+
|
|
2408
|
+
|
|
2409
|
+
|
|
2410
|
+
|
|
2411
|
+
|
|
2412
|
+
|
|
2413
|
+
|
|
2414
|
+
|
|
2415
|
+
|
|
2416
|
+
|
|
2417
|
+
function applyKeyframeCompose(p) {
|
|
2418
|
+
const kfRows = Array.isArray(p.keyframes) ? p.keyframes : [];
|
|
2419
|
+
/* v8 ignore next 1 -- the sole caller (the keyframe placement gate) runs only when kfRows.length > 0, so the empty re-entry never fires; the guard stays as the function's own contract */
|
|
2420
|
+
if (kfRows.length === 0)
|
|
2421
|
+
return;
|
|
2422
|
+
const calls = Array.isArray(p.calls) ? p.calls : [];
|
|
2423
|
+
const str = (v) => (typeof v === 'string' ? v.trim() : '');
|
|
2424
|
+
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : null);
|
|
2425
|
+
const wins = calls.map((row, i) => {
|
|
2426
|
+
const sf = num(row.start_frame);
|
|
2427
|
+
const ef = num(row.end_frame);
|
|
2428
|
+
if (sf === null || ef === null || ef <= sf)
|
|
2429
|
+
return null;
|
|
2430
|
+
const carry = i > 0 ? transitionOverlap(typeof row.transition === 'string' ? row.transition : undefined) : 0;
|
|
2431
|
+
return { sf, ef, genStart: sf - carry, rides: { pins: [] }, row, forked: false };
|
|
2432
|
+
});
|
|
2433
|
+
const ridesByK = new Map();
|
|
2434
|
+
const fork = (w) => {
|
|
2435
|
+
if (!w.forked) {
|
|
2436
|
+
w.row = { ...w.row };
|
|
2437
|
+
w.forked = true;
|
|
2438
|
+
}
|
|
2439
|
+
return w.row;
|
|
2440
|
+
};
|
|
2441
|
+
for (const kf of kfRows) {
|
|
2442
|
+
// (the gate above guarantees a finite frame and a covering window)
|
|
2443
|
+
const f = kf.frame;
|
|
2444
|
+
const image = str(kf.image);
|
|
2445
|
+
const w = wins.find((win) => win !== null && f >= win.sf && f <= win.ef - 1);
|
|
2446
|
+
/* v8 ignore next 1 -- unreachable post-gate: the placement gate above refuses any frame without a covering finite window, so the find always lands; the guard stays as the loop's own contract */
|
|
2447
|
+
if (w === undefined)
|
|
2448
|
+
continue; // unreachable post-gate; the gate owns the refusal
|
|
2449
|
+
if (f === w.sf && w.rides.anchor === undefined && !isSeatStated(w, 'anchor')) {
|
|
2450
|
+
fork(w).image = image;
|
|
2451
|
+
w.rides.anchor = image;
|
|
2452
|
+
continue;
|
|
2453
|
+
}
|
|
2454
|
+
if (f === w.ef - 1 && w.rides.endAnchor === undefined && !isSeatStated(w, 'end')) {
|
|
2455
|
+
fork(w).last_frame = image;
|
|
2456
|
+
w.rides.endAnchor = image;
|
|
2457
|
+
continue;
|
|
2458
|
+
}
|
|
2459
|
+
// strictly interior — or a boundary seat already claimed (the first
|
|
2460
|
+
// pin won it): the interior arm, so the image still reaches the graph
|
|
2461
|
+
w.rides.pins.push({ image, frame_idx: f - w.genStart });
|
|
2462
|
+
}
|
|
2463
|
+
for (const [i, w] of wins.entries()) {
|
|
2464
|
+
if (w === null)
|
|
2465
|
+
continue;
|
|
2466
|
+
if (w.forked)
|
|
2467
|
+
calls[i] = w.row;
|
|
2468
|
+
if (w.rides.pins.length > 0) {
|
|
2469
|
+
w.rides.pins.sort((a, b) => a.frame_idx - b.frame_idx);
|
|
2470
|
+
ridesByK.set(i + 1, w.rides);
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
if (ridesByK.size > 0) {
|
|
2474
|
+
const channel = {};
|
|
2475
|
+
for (const [k, rides] of ridesByK)
|
|
2476
|
+
channel[String(k)] = rides.pins;
|
|
2477
|
+
p.__keyframe_pins = channel;
|
|
2478
|
+
}
|
|
2479
|
+
/** A window's own stated seat (the canon's Layer B claim): the row's
|
|
2480
|
+
* guide spellings (the film loop's exact union) or its end anchor;
|
|
2481
|
+
* on the single-window shape the DOC-level seat is the same seat —
|
|
2482
|
+
* a stated one wins over the pin there too. */
|
|
2483
|
+
function isSeatStated(w, seat) {
|
|
2484
|
+
if (seat === 'anchor') {
|
|
2485
|
+
if (str(w.row.image) !== '' || str(w.row.ref_image) !== '' || str(w.row.image_name) !== '')
|
|
2486
|
+
return true;
|
|
2487
|
+
if (calls.length === 1 && str(p.image) !== '')
|
|
2488
|
+
return true;
|
|
2489
|
+
return false;
|
|
2490
|
+
}
|
|
2491
|
+
if (str(w.row.last_frame) !== '')
|
|
2492
|
+
return true;
|
|
2493
|
+
if (calls.length === 1 && str(p.last_frame) !== '')
|
|
2494
|
+
return true;
|
|
2495
|
+
return false;
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
1420
2498
|
export const film = {
|
|
1421
2499
|
id: 'film',
|
|
1422
2500
|
inputs: [],
|
|
@@ -1439,9 +2517,23 @@ export const film = {
|
|
|
1439
2517
|
// fps_seconds) are internal. ref_image_size is the schema's
|
|
1440
2518
|
// const-or-WxH pattern tier — typed as its string spine.
|
|
1441
2519
|
params: [
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
2520
|
+
|
|
2521
|
+
// ui-truth-gap #5): this face advertised a key the card's door
|
|
2522
|
+
// REFUSES — `prompt` rides neither the h3-timeline rider list nor
|
|
2523
|
+
// its admits, and the single-call LIFT writes p.prompt from the
|
|
2524
|
+
// call's own text (card.ts, "if (typeof single.text === ...)").
|
|
2525
|
+
// An agent that trusted this row got 'unknown-param' at the door.
|
|
2526
|
+
// The compose still reads p.prompt (the lift's write); the
|
|
2527
|
+
// ADVERTISED surface is what changed.
|
|
2528
|
+
// THE SCALAR MEDIA SEATS (the NO-DROP law's write half, D8 /
|
|
2529
|
+
// CONTRACTS §4 debt 16 — run-899a8448's burn: the seats declared
|
|
2530
|
+
// plain "string", so the declared plane offered freehand text for
|
|
2531
|
+
// a media seat and the UI wrote a stage name into one). They are
|
|
2532
|
+
// IMAGE seats: a media path at the wire, the form's picker +
|
|
2533
|
+
// upload face — the carrier schema's own `wtype: 'image'` rows
|
|
2534
|
+
// (schema.ts) are the same truth on the serve plane.
|
|
2535
|
+
{ name: "image", type: "image" },
|
|
2536
|
+
{ name: "last_frame", type: "image" },
|
|
1445
2537
|
{ name: "ref_images", type: "image_list" },
|
|
1446
2538
|
{ name: "ref_videos", type: "image_list" },
|
|
1447
2539
|
{ name: "ref_audios", type: "image_list" },
|
|
@@ -1449,7 +2541,7 @@ export const film = {
|
|
|
1449
2541
|
{ name: "duck_depth_db", type: "number", bounds: [-48, 0] },
|
|
1450
2542
|
{ name: "seed", type: "number", rule: "seed-sentinel" },
|
|
1451
2543
|
{ name: "width", type: "number", bounds: [448, 1344] },
|
|
1452
|
-
{ name: "height", type: "number", bounds: [448,
|
|
2544
|
+
{ name: "height", type: "number", bounds: [448, 1344] },
|
|
1453
2545
|
{ name: "length", type: "number", bounds: [22, 362] },
|
|
1454
2546
|
{ name: "steps", type: "number", bounds: [4, 30] },
|
|
1455
2547
|
{ name: "second_pass_enabled", type: "boolean" },
|
|
@@ -1468,9 +2560,26 @@ export const film = {
|
|
|
1468
2560
|
{ name: "refine_lora", type: "string" },
|
|
1469
2561
|
{ name: "refine_strength", type: "number", bounds: [0, 2] },
|
|
1470
2562
|
{ name: "refine_steps", type: "number", bounds: [1, 10] },
|
|
2563
|
+
// THE REFINE WINDOW (SOTA limb 1): [0.05, 1] — ONE domain with
|
|
2564
|
+
// the schema row and the resolver above (parity walled by ARM
|
|
2565
|
+
// 4f); 1 is the full-denoise taomate mechanic (the default)
|
|
2566
|
+
{ name: "refine_denoise", type: "number", bounds: [0.05, 1] },
|
|
2567
|
+
// THE LATENT-UPSCALE ROUTE (SOTA plan Phase P2 — the P2 verdict's
|
|
2568
|
+
// own seats on the family door): the sub-gate + its closed file
|
|
2569
|
+
// surface ride the door like every knob — h3-window-parity's
|
|
2570
|
+
// undeclaredServed arm names them, the census witnesses them at
|
|
2571
|
+
// ARM 37. The route is the OFF-latched union (off default,
|
|
2572
|
+
// byte-stable); the model is the on-disk LBH v1 3D-conv bf16
|
|
2573
|
+
// checkpoint (single-member vocabulary, the sr_model precedent).
|
|
2574
|
+
{ name: "upscale_route", type: "enum", options: ["off", "latent_2x"] },
|
|
2575
|
+
{ name: "upscale_model", type: "enum", options: ["minimax_h3_latent_upscaler_3d_bf16.safetensors"] },
|
|
2576
|
+
// THE RE-SHOOT SURFACE (feature 024): the commission rides the
|
|
2577
|
+
// card's RESHOOT_MOD bag now (the fourth-mod-bag unification,
|
|
2578
|
+
// §8) — the door's flat rows died with the schema group; the
|
|
2579
|
+
// bag's own field rows are the served truth.
|
|
1471
2580
|
{ name: "attention_backend", type: "enum", options: ["comfy kitchen attention", "pytorch attention"] },
|
|
1472
2581
|
{ name: "sr_switch", type: "boolean" },
|
|
1473
|
-
{ name: "sr_resolution", type: "number", bounds: [
|
|
2582
|
+
{ name: "sr_resolution", type: "number", bounds: [768, 2160] },
|
|
1474
2583
|
{ name: "sr_model", type: "enum", options: ["seedvr2_ema_3b_fp16.safetensors", "seedvr2_ema_3b_fp8_e4m3fn.safetensors"] },
|
|
1475
2584
|
{ name: "ref_image_size", type: "string" },
|
|
1476
2585
|
{ name: "shift_video", type: "number", bounds: [1, 20] },
|
|
@@ -1489,12 +2598,68 @@ export const film = {
|
|
|
1489
2598
|
{ name: "interp_switch", type: "boolean" },
|
|
1490
2599
|
{ name: "sharpen_switch", type: "boolean" },
|
|
1491
2600
|
{ name: "sla_switch", type: "boolean" },
|
|
2601
|
+
// THE BAKE'S STATED DIALS (study §5/§7.2; value-arms ARMs 13/14):
|
|
2602
|
+
// the RefMod extract's fidelity dials, declared on the serve plane
|
|
2603
|
+
// (schema.ts, the refmod group) and stated at the node (the
|
|
2604
|
+
// extract inputs). The family door judges them like every knob.
|
|
2605
|
+
{ name: "refmod_mode", type: "enum", options: ["Compressed Reference", "Full Reference"] },
|
|
2606
|
+
{ name: "refmod_pool", type: "number", bounds: [2, 64] },
|
|
2607
|
+
{ name: "refmod_identity", type: "number", bounds: [0, 2000] },
|
|
2608
|
+
{ name: "refmod_save", type: "boolean" },
|
|
1492
2609
|
{ name: "image_name", type: "string" },
|
|
1493
2610
|
],
|
|
1494
2611
|
facts: parseH3Facts,
|
|
1495
|
-
build({ p: docIn, facts, g, model }) {
|
|
2612
|
+
build({ p: docIn, facts, g, model, runId }) {
|
|
1496
2613
|
const p = { ...docIn };
|
|
1497
2614
|
|
|
2615
|
+
// a pin's frame is FILM-absolute and must fall INSIDE some call's
|
|
2616
|
+
// [start_frame, end_frame) span; a pin in a gap has no window to
|
|
2617
|
+
// ride (the lane's whole truth is per-window compose), so it
|
|
2618
|
+
// refuses HERE — the same plan door that refuses a textless call —
|
|
2619
|
+
// never a silent unplaced pin (the no-drop law). Both window
|
|
2620
|
+
// shapes pass through this door (the film plan and the frozen
|
|
2621
|
+
// single-window doc), so one gate owns both. Slice 2 adds the pin
|
|
2622
|
+
// SHAPE arms — a pin must CARRY an image that names media (a
|
|
2623
|
+
// frameless or stage-named row anchors nothing and would silently
|
|
2624
|
+
// vanish or die at the engine door) — and then the pin→seat/
|
|
2625
|
+
// pin-node MAPPING lands below: an endpoint pin rides the window's
|
|
2626
|
+
// existing anchor/end-anchor seats, an interior pin rides the
|
|
2627
|
+
// AddGuide image chain.
|
|
2628
|
+
const kfRows = Array.isArray(p.keyframes) ? p.keyframes : [];
|
|
2629
|
+
if (kfRows.length > 0) {
|
|
2630
|
+
const windows = (Array.isArray(p.calls) ? p.calls : [])
|
|
2631
|
+
.map((c) => ({ start: c.start_frame, end: c.end_frame }))
|
|
2632
|
+
.filter((w) => typeof w.start === 'number' && Number.isFinite(w.start)
|
|
2633
|
+
&& typeof w.end === 'number' && Number.isFinite(w.end));
|
|
2634
|
+
// Row SHAPE is the walk's literal too (assertKeyframeRowShape) —
|
|
2635
|
+
// called here so a doc that skipped the walk (a raw run body)
|
|
2636
|
+
// still speaks the same vocabulary; placement/media stay below.
|
|
2637
|
+
assertKeyframeRowShape(kfRows);
|
|
2638
|
+
for (let ki = 0; ki < kfRows.length; ki++) {
|
|
2639
|
+
const kf = (kfRows[ki] ?? {});
|
|
2640
|
+
const f = kf.frame;
|
|
2641
|
+
const image = kf.image.trim();
|
|
2642
|
+
if (!isMediaRef(image)) {
|
|
2643
|
+
throw new Error(`keyframes[${ki}]: "${image}" names no media — a stage/card name is not an image ` +
|
|
2644
|
+
'(pick the artifact: a file path, URL, or $spell rides; a label never does)');
|
|
2645
|
+
}
|
|
2646
|
+
const covered = windows.some((w) => f >= w.start && f <= w.end - 1);
|
|
2647
|
+
if (!covered) {
|
|
2648
|
+
const plan = windows.length > 0
|
|
2649
|
+
? `[${windows[0].start}, ${windows[windows.length - 1].end})`
|
|
2650
|
+
: 'no windows at all (the doc names no calls)';
|
|
2651
|
+
throw new Error(`keyframes[${ki}]: frame ${f} falls outside every window — the plan covers ${plan}; ` +
|
|
2652
|
+
'a keyframe in a gap has no window to ride (move the pin inside a window)');
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
// THE KEYFRAME→SEAT MAPPING (slice 2): endpoint pins ride the
|
|
2656
|
+
// windows' existing anchor/end-anchor seats (rewritten call rows —
|
|
2657
|
+
// the byte-identical probe: a boundary-pin doc composes the graph
|
|
2658
|
+
// of the same doc stating the seats directly), interior pins ride
|
|
2659
|
+
// the `__keyframe_pins` channel into the AddGuide image chain.
|
|
2660
|
+
applyKeyframeCompose(p);
|
|
2661
|
+
}
|
|
2662
|
+
|
|
1498
2663
|
// single-call doc rides the frozen single-window arm below —
|
|
1499
2664
|
// which renders the DOC surface, never the row. Without this
|
|
1500
2665
|
// unpack the sole call's Layer B seats (refs bag, anchor image,
|
|
@@ -1502,12 +2667,42 @@ export const film = {
|
|
|
1502
2667
|
// the split-brain twin of the film loop's bag gate. One stanza
|
|
1503
2668
|
// law, both arms: the row REPLACES the refs bag / anchor / text
|
|
1504
2669
|
// seats it states (per-lane, per-seat); knobs replace per key;
|
|
1505
|
-
// unstated seats inherit the doc.
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
2670
|
+
// unstated seats inherit the doc. (Runs AFTER the keyframe
|
|
2671
|
+
// mapping so the lift carries the mapped anchor/end-anchor seats
|
|
2672
|
+
// onto the doc surface — the single-window shape's byte-identical
|
|
2673
|
+
// endpoint probe rides this order.)
|
|
2674
|
+
// ONE STANZA LAW, ALL ARMS (journey audit 72b1d88a finding 1,
|
|
2675
|
+
|
|
2676
|
+
// shape (p.k set, calls > 1) renders window k on the DOC surface
|
|
2677
|
+
// — its row is calls[p.k - 1] (1-based, the film loop's own
|
|
2678
|
+
// window${k} naming). Before this arm the row's span, text,
|
|
2679
|
+
// refs and knobs died unread on every frozen multi-window doc,
|
|
2680
|
+
// and the lora bag stomped a knob-pinned steps: the split-brain
|
|
2681
|
+
// twin of the sole-call lift, unwalled only because no studio
|
|
2682
|
+
// gesture authors it — the agent plane and hand-built docs do.
|
|
2683
|
+
const stanzaRow = Array.isArray(p.calls) && p.calls.length === 1
|
|
2684
|
+
? p.calls[0]
|
|
2685
|
+
: Array.isArray(p.calls) && p.calls.length > 1
|
|
2686
|
+
&& typeof p.k === 'number' && Number.isInteger(p.k) && p.k >= 1 && p.k <= p.calls.length
|
|
2687
|
+
? p.calls[p.k - 1]
|
|
1509
2688
|
: null;
|
|
2689
|
+
{
|
|
2690
|
+
const row = stanzaRow;
|
|
1510
2691
|
if (row !== null) {
|
|
2692
|
+
|
|
2693
|
+
// IS ALWAYS LAYER B"): the single call's span OWNS the window
|
|
2694
|
+
// length — lifted here through the same snap the film loop's
|
|
2695
|
+
// span rider uses, BEFORE the knobs assign (a deliberate
|
|
2696
|
+
// knob pin still wins; the walk's declared default and any
|
|
2697
|
+
// stale doc-level length NEVER do). Before this lift the
|
|
2698
|
+
// frozen arm rendered the doc's Layer-A length — a knob tied
|
|
2699
|
+
// to nothing the bar updates — and a 90-frame call generated
|
|
2700
|
+
// whatever the stale row said.
|
|
2701
|
+
const rowSf = typeof row.start_frame === 'number' && Number.isFinite(row.start_frame) ? row.start_frame : null;
|
|
2702
|
+
const rowEf = typeof row.end_frame === 'number' && Number.isFinite(row.end_frame) ? row.end_frame : null;
|
|
2703
|
+
if (rowSf !== null && rowEf !== null && rowEf > rowSf) {
|
|
2704
|
+
p.length = spanStanzaFrames({ start: rowSf, end: rowEf }, 0);
|
|
2705
|
+
}
|
|
1511
2706
|
const rowText = typeof row.text === 'string' ? row.text.trim() : '';
|
|
1512
2707
|
if (rowText !== '')
|
|
1513
2708
|
p.prompt = row.text;
|
|
@@ -1543,15 +2738,42 @@ export const film = {
|
|
|
1543
2738
|
// guide owns the reference lane.
|
|
1544
2739
|
const statedFamily = typeof p.variant === 'string' && FAMILIES.includes(p.variant)
|
|
1545
2740
|
? p.variant : undefined;
|
|
1546
|
-
|
|
2741
|
+
// THE KEYFRAME PIN CHANNEL CARRIES THE LANE (slice 2): a doc with
|
|
2742
|
+
// pins claims the reference lane wherever its pins land — an
|
|
2743
|
+
// endpoint pin maps onto the anchor/end-anchor seats below, an
|
|
2744
|
+
// interior pin composes the AddGuide image arm. Both guards below
|
|
2745
|
+
// count it: the conflict guard refuses a stated non-t4r family
|
|
2746
|
+
// over a pin-carrying doc exactly as over an anchor (the explicit
|
|
2747
|
+
// contract conflict is named, never silently overridden), and the
|
|
2748
|
+
// inverse guard admits a t4r doc whose guides ride the pin channel
|
|
2749
|
+
// alone (an interior pin is an image guide — the window is not
|
|
2750
|
+
// anchorless). (The conflict arm rides the SINGLE-WINDOW shape
|
|
2751
|
+
// only: a film doc's walked variant is t4_chain — the DERIVED film
|
|
2752
|
+
// family, never a stated conflict — and the film loop derives each
|
|
2753
|
+
// window's own family from its seats.)
|
|
2754
|
+
const kfLane = kfRows.length > 0 && Array.isArray(p.calls) && p.calls.length === 1;
|
|
2755
|
+
// THE SINGLE-WINDOW SHAPE ONLY (the lying-cure cure): a film's
|
|
2756
|
+
// doc-level guide is its opener anchor (the film loop seats it on
|
|
2757
|
+
// window 1, above) and each window derives its own family from its
|
|
2758
|
+
// own seats — the doc's walked variant is the DERIVED film family
|
|
2759
|
+
// (t4_chain), never a stated conflict. Refusing here told a
|
|
2760
|
+
// two-clip image-to-video write to "state no variant" when it had
|
|
2761
|
+
// stated none: the transcript's steps 5-7 loop.
|
|
2762
|
+
const callsRaw = p.calls;
|
|
2763
|
+
const isFilmDoc = Array.isArray(callsRaw) && callsRaw.length > 1;
|
|
2764
|
+
if ((guideImage !== '' || kfLane) && !isFilmDoc && statedFamily !== undefined && statedFamily !== 't4r') {
|
|
1547
2765
|
const rbRef = (p.refs ?? {});
|
|
1548
2766
|
const refsCarry = wireList(rbRef.images).length + wireList(rbRef.videos).length + wireList(rbRef.audios).length
|
|
1549
2767
|
+ wireList(p.ref_images).length + wireList(p.ref_videos).length + wireList(p.ref_audios).length > 0
|
|
1550
2768
|
|| (typeof p.last_frame === 'string' && p.last_frame.trim() !== '');
|
|
1551
2769
|
if (!refsCarry) {
|
|
1552
|
-
throw new Error(
|
|
1553
|
-
`
|
|
1554
|
-
|
|
2770
|
+
throw new Error(guideImage !== ''
|
|
2771
|
+
? `h3_window: a guide image ("${guideImage.trim()}") rides only the t4r reference lane — ` +
|
|
2772
|
+
`this doc's variant is '${String(p.variant)}'. State no variant (the walk derives t4r from ` +
|
|
2773
|
+
'the guide) or clear the guide; never a silent text-only render of a reference shot'
|
|
2774
|
+
: `h3_window: keyframe pins ride only the t4r reference lane — this doc's variant is ` +
|
|
2775
|
+
`'${String(p.variant)}'. State no variant (the walk derives t4r from the pins) or clear ` +
|
|
2776
|
+
'the keyframes; never a silent text-only render of a pinned shot');
|
|
1555
2777
|
}
|
|
1556
2778
|
}
|
|
1557
2779
|
|
|
@@ -1567,11 +2789,14 @@ export const film = {
|
|
|
1567
2789
|
// (refs-implied t4r windows carry no anchor — the bundle IS
|
|
1568
2790
|
// the r2v input; the guard admits them via the refs law — the
|
|
1569
2791
|
// legacy stanza bag AND the declared input surface (the rail's
|
|
1570
|
-
// fields) count; the bed rides the audio lane guideless too
|
|
2792
|
+
// fields) count; the bed rides the audio lane guideless too;
|
|
2793
|
+
// slice 2: so do keyframe pins — an interior pin is an image
|
|
2794
|
+
// guide on the window's conditioning chain)
|
|
1571
2795
|
const rbRef = (p.refs ?? {});
|
|
1572
2796
|
const refsCarry = wireList(rbRef.images).length + wireList(rbRef.videos).length + wireList(rbRef.audios).length
|
|
1573
2797
|
+ wireList(p.ref_images).length + wireList(p.ref_videos).length + wireList(p.ref_audios).length > 0
|
|
1574
|
-
|| (typeof p.last_frame === 'string' && p.last_frame.trim() !== '')
|
|
2798
|
+
|| (typeof p.last_frame === 'string' && p.last_frame.trim() !== '')
|
|
2799
|
+
|| kfLane;
|
|
1575
2800
|
if (!refsCarry) {
|
|
1576
2801
|
throw new Error('h3_window(t4r): image-anchored window without a staged guide image — ' +
|
|
1577
2802
|
'compose always injects LoadImage.0.image on this family');
|
|
@@ -1588,7 +2813,7 @@ export const film = {
|
|
|
1588
2813
|
const docCalls = Array.isArray(p.calls) ? p.calls : null;
|
|
1589
2814
|
const isFilm = docCalls !== null && docCalls.length > 1 && p.k === undefined;
|
|
1590
2815
|
if (isFilm)
|
|
1591
|
-
return renderH3Film(p, g, facts, model);
|
|
2816
|
+
return renderH3Film(p, g, facts, model, runId);
|
|
1592
2817
|
|
|
1593
2818
|
// FILM-path consumer (it rides the accumulated film audio).
|
|
1594
2819
|
// On the frozen single-window shape it would be a silent
|
|
@@ -1612,15 +2837,38 @@ export const film = {
|
|
|
1612
2837
|
// never overwrites it.
|
|
1613
2838
|
if (Array.isArray(p.loras)) {
|
|
1614
2839
|
const rows = p.loras;
|
|
1615
|
-
const
|
|
1616
|
-
|
|
1617
|
-
|
|
2840
|
+
const married = marriedBagKnob(p, 'steps');
|
|
2841
|
+
// THE MARRIAGE'S ROW FACE: the sole call's knobs — and, since
|
|
2842
|
+
// the k-marked cure (journey audit 72b1d88a), the FROZEN
|
|
2843
|
+
// window's own row knobs too. One consult, both shapes: the
|
|
2844
|
+
// row the window renders is the row whose steps are the
|
|
2845
|
+
// user's word. The consult rides the shared helper — the
|
|
2846
|
+
// catalog fallback (a row's unstated count by filename) is
|
|
2847
|
+
// the same math here as on the film loop.
|
|
2848
|
+
const singleKnobs = stanzaRow !== null
|
|
2849
|
+
? (stanzaRow.knobs ?? {})
|
|
1618
2850
|
: {};
|
|
1619
|
-
if (
|
|
1620
|
-
p.steps =
|
|
2851
|
+
if (married !== null && p.__steps_pinned !== true && singleKnobs.steps === undefined) {
|
|
2852
|
+
p.steps = married;
|
|
1621
2853
|
}
|
|
1622
2854
|
}
|
|
1623
|
-
|
|
2855
|
+
// THE POST-MARRIAGE RE-WALK (the single-window face's arm of the
|
|
2856
|
+
// film loop's per-window walk — ERROR d, the ~100 burn): the
|
|
2857
|
+
// marriage lands the bag's stated count AFTER the card's one
|
|
2858
|
+
// walk, and without this judgment the mutated count rode into
|
|
2859
|
+
// the returned graph unjudged (the G6 TOCTOU — the estate's
|
|
2860
|
+
// faces let 100 in, the served bound packs.ts:34 is
|
|
2861
|
+
// min(1).max(100), the recipe row declares no steps domain). It
|
|
2862
|
+
// sits AFTER the render's own hand-checked seats so their pinned
|
|
2863
|
+
// voices fire first (the loader cap, the trim-entry shape); the
|
|
2864
|
+
// marriage's mutation is the only delta this re-check can add —
|
|
2865
|
+
// card.ts walked the same doc pre-marriage, so every other
|
|
2866
|
+
// refusal here was already refused upstream. The film loop
|
|
2867
|
+
// judges its stanza post-marriage; this face closes the same
|
|
2868
|
+
// TOCTOU — one schema, one voice.
|
|
2869
|
+
const handles = renderH3Window(p, g, facts, model, runId);
|
|
2870
|
+
assertOverlayGated(p, 'h3-timeline single-window knobs');
|
|
2871
|
+
return handles.savePassthrough;
|
|
1624
2872
|
},
|
|
1625
2873
|
};
|
|
1626
2874
|
//# sourceMappingURL=actions.js.map
|