@melite/models-h3 0.2.2-alpha → 0.2.3-rc.4
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/lib/actions.js +116 -178
- package/lib/chainEdit.d.ts +94 -0
- package/lib/chainEdit.js +184 -13
- package/lib/chainUpscale.js +4 -1
- package/lib/edit.d.ts +103 -0
- package/lib/edit.js +645 -0
- package/lib/extend.d.ts +1 -8
- package/lib/extend.js +111 -32
- package/lib/filmMix.d.ts +25 -0
- package/lib/filmMix.js +76 -21
- package/lib/index.d.ts +2 -1
- package/lib/index.js +25 -6
- package/lib/refine.d.ts +99 -8
- package/lib/refine.js +75 -54
- package/lib/refmodBake.d.ts +29 -0
- package/lib/refmodBake.js +176 -0
- package/lib/repair.js +84 -77
- package/lib/reshoot.js +7 -2
- package/lib/schema.d.ts +34 -0
- package/lib/schema.js +75 -3
- package/lib/secondPass.d.ts +31 -0
- package/lib/secondPass.js +59 -0
- package/lib/swap.js +63 -34
- package/lib/timelineContract.d.ts +271 -2
- package/lib/timelineContract.js +365 -2
- package/package.json +7 -3
package/lib/extend.d.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import type { GraphBuilder } from '@melite/comfyui-card-kit/graph';
|
|
2
2
|
import type { H3Facts } from './actions.js';
|
|
3
3
|
export { solveWindowComposition, type WindowComposition } from './timelineContract.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare const LAST_FRAME_BATCH_INDEX = 16384;
|
|
4
|
+
export { LAST_FRAME_BATCH_INDEX } from './timelineContract.js';
|
|
12
5
|
/** The extend renderer: validates the bound entry, then composes the
|
|
13
6
|
* fresh-continuation chain plus the join. Like the swap and repair,
|
|
14
7
|
* the film path never reaches here (the card branches on a non-empty
|
package/lib/extend.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { chainSaveBoundaries, concatSavedFilms, filmJoinAudio } from './actions.js';
|
|
2
|
-
import { assertGridLength, solveWindowComposition, CONTEXT_OVERLAP_FRAMES, GRID_MAX_FRAMES, } from './timelineContract.js';
|
|
2
|
+
import { assertGridLength, solveWindowComposition, CONTEXT_OVERLAP_FRAMES, GRID_MAX_FRAMES, LAST_FRAME_BATCH_INDEX, resolveCarryOverlap } from './timelineContract.js';
|
|
3
|
+
import { outputNameTailOf } from './schema.js';
|
|
3
4
|
export { solveWindowComposition } from './timelineContract.js';
|
|
4
|
-
|
|
5
|
+
// the last-frame spelling re-exported from its ONE home (timelineContract —
|
|
6
|
+
// actions.ts reads it there too; the public face keeps this name)
|
|
7
|
+
export { LAST_FRAME_BATCH_INDEX } from './timelineContract.js';
|
|
8
|
+
import { contexMaskedTarget, loadVideo, renderMaskedEditChain, resolvePlanTier, sheetRefSlots } from './chainEdit.js';
|
|
5
9
|
|
|
6
10
|
|
|
7
11
|
|
|
@@ -9,15 +13,35 @@ import { loadVideo, renderMaskedEditChain } from './chainEdit.js';
|
|
|
9
13
|
|
|
10
14
|
|
|
11
15
|
|
|
12
|
-
export const LAST_FRAME_BATCH_INDEX = 16384;
|
|
13
16
|
/** The extend entry's required seats (the reshoot/repair idiom: an
|
|
14
17
|
* armed doc with an empty seat refuses loud naming the seat). */
|
|
15
18
|
const REQUIRED_SEATS = [
|
|
16
19
|
['source_clip', 'the clip whose seconds are extended — ONE staged leaf: the VHS loader + the core LoadVideo read it by staged name, and the timeline reads it back off the native VIDEO wire'],
|
|
17
20
|
['extend_prompt', 'the continuation text — MOTION+SOUND for the appended seconds (the R2V prompt seat; agent-composed, user-confirmed)'],
|
|
18
21
|
];
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
/** Reads one optional number seat: absent falls to the documented
|
|
23
|
+
* default; a stated non-number REFUSES — a defaulting fallback would
|
|
24
|
+
* swallow a bypassed door's wrong-typed value as a silent error. */
|
|
25
|
+
const statedNumber = (p, k, d) => {
|
|
26
|
+
const v = p[k];
|
|
27
|
+
if (v === undefined)
|
|
28
|
+
return d;
|
|
29
|
+
if (typeof v !== 'number' || !Number.isFinite(v)) {
|
|
30
|
+
throw new Error(`h3-timeline extend: '${k}' is stated as ${JSON.stringify(v)} — a number seat carries a number (absent falls to ${d}); a wrong-typed value never silently defaults`);
|
|
31
|
+
}
|
|
32
|
+
return v;
|
|
33
|
+
};
|
|
34
|
+
/** Reads one required seat NARROWED by its own refusal — the seat
|
|
35
|
+
* is a string or the door never composes (no fallback arm exists:
|
|
36
|
+
* a validated seat re-read through a forgiving helper would be a
|
|
37
|
+
* second, weaker validator below the law). */
|
|
38
|
+
const requiredSeat = (entry, seat, what) => {
|
|
39
|
+
const v = entry[seat];
|
|
40
|
+
if (typeof v !== 'string' || v.trim() === '') {
|
|
41
|
+
throw new Error(`h3-timeline extend: '${seat}' names no media — ${what}; an extend needs both seats bound (source_clip, extend_prompt)`);
|
|
42
|
+
}
|
|
43
|
+
return v;
|
|
44
|
+
};
|
|
21
45
|
/** The extend renderer: validates the bound entry, then composes the
|
|
22
46
|
* fresh-continuation chain plus the join. Like the swap and repair,
|
|
23
47
|
* the film path never reaches here (the card branches on a non-empty
|
|
@@ -31,17 +55,42 @@ const str = (p, k) => typeof p[k] === 'string' ? p[k] : '';
|
|
|
31
55
|
* @param g the run's graph builder
|
|
32
56
|
* @param runId the run tree's id (the join prefixes ride it) */
|
|
33
57
|
export function renderH3Extend(entry, p, facts, g, runId) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
58
|
+
// THE RAIL ADMISSION LAW (friction-2-infra D-01): this arm derives
|
|
59
|
+
// its own anchors (ref_image_0 = the prior clip's last frame,
|
|
60
|
+
// ref_video_0 = the whole clip) and the chain spine reads exactly
|
|
61
|
+
// one stated rail here — ref_images, the SHEET (P0-1: operator
|
|
62
|
+
|
|
63
|
+
// the AI, they are input slots", wired at the first free slot
|
|
64
|
+
// after the anchor). The FILM-lane rails ref_videos/ref_audios
|
|
65
|
+
// reach no conditioning on this arm — the audit's silent-no-op
|
|
66
|
+
// class — so they refuse LOUD here at the compose door, teaching
|
|
67
|
+
// the recipe-of-record instead of dropping the rail silently.
|
|
68
|
+
// (The audit's "ref_images is read by nothing" half was stale at
|
|
69
|
+
// write time: P0-1 had landed the sheet seat a week earlier; the
|
|
70
|
+
// correction rides this row's receipt.)
|
|
71
|
+
const STATED_RAILS = [
|
|
72
|
+
['ref_videos', 'motion guides'],
|
|
73
|
+
['ref_audios', 'voice references'],
|
|
74
|
+
];
|
|
75
|
+
for (const [rail, what] of STATED_RAILS) {
|
|
76
|
+
const stated = p[rail];
|
|
77
|
+
if (Array.isArray(stated) && stated.length > 0) {
|
|
78
|
+
throw new Error(`h3-timeline extend: ${rail} is stated (${what}) but the extend arm serves no such rail — its anchors are derived (ref_image_0 IS the prior clip's last frame, ref_video_0 the whole clip) and the one stated image rail it reads is ref_images (the identity sheet, slot 1 after the anchor); a stated ${rail} reaches no conditioning on this arm (the pixel-proven no-op class). The recipe of record: identity rides the prior clip itself (or the ref_images sheet), per-window pins ride the calls lane's keyframes, and motion/voice guides ride the film lane's windows. Leave ${rail} unstated`);
|
|
38
79
|
}
|
|
39
80
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
81
|
+
// NO FALLBACK READS: every required seat narrows through its own
|
|
82
|
+
// refusal (a validated seat re-read through a forgiving helper is
|
|
83
|
+
// a second, weaker validator below the law — a silent error). An
|
|
84
|
+
// absent optional seat falls to its documented default; a STATED
|
|
85
|
+
// seat of the wrong type refuses loud (the schema walk types every
|
|
86
|
+
// lawful doc, so a wrong-typed value means a bypassed door).
|
|
87
|
+
const sourceClipSeat = requiredSeat(entry, 'source_clip', REQUIRED_SEATS[0][1]);
|
|
88
|
+
const extendPromptSeat = requiredSeat(entry, 'extend_prompt', REQUIRED_SEATS[1][1]);
|
|
89
|
+
const seed = statedNumber(entry, 'seed', 0);
|
|
90
|
+
const steps = statedNumber(entry, 'steps', 6);
|
|
91
|
+
const overlapFrames = resolveCarryOverlap(entry);
|
|
92
|
+
const resolution = resolvePlanTier(entry, p);
|
|
93
|
+
const statedFrames = Math.round(statedNumber(entry, 'extend_seconds', 56 / 24) * 24);
|
|
45
94
|
// THE COMPOSITION DOOR: one window keeps the landed grid law
|
|
46
95
|
// verbatim; beyond it the solver composes N uniform windows and
|
|
47
96
|
// refuses every non-exact landing by name. The solver ALWAYS
|
|
@@ -59,11 +108,42 @@ export function renderH3Extend(entry, p, facts, g, runId) {
|
|
|
59
108
|
throw new Error(`h3-timeline extend: overlap_frames ${overlapFrames} — the multi-window composition law carries the policy's ${CONTEXT_OVERLAP_FRAMES}f context overlap (every law-home pins 39; the knob feeds only the single-window plan head); re-state overlap_frames 39`);
|
|
60
109
|
}
|
|
61
110
|
const clipSeconds = composition.windowFrames / 24;
|
|
111
|
+
// ── THE WINDOW ROSTER (friction-2-infra D-03 R4b: extend had no
|
|
112
|
+
// per-segment roster, so figure count and scale drift were
|
|
113
|
+
// structurally unreachable — one prompt minted every window and
|
|
114
|
+
// "the same girl twice at two scales" had no lever). The roster is
|
|
115
|
+
// a TEXT seat, one prompt per line, exactly one line per composed
|
|
116
|
+
// window; window i rides line i. ABSENT (or empty) the standing
|
|
117
|
+
// law holds: the one extend_prompt serves EVERY window. A wrong
|
|
118
|
+
// line count or a blank line refuses LOUD at this door, naming
|
|
119
|
+
// both numbers — the exactness law's own voice. Per-window SEED
|
|
120
|
+
// stays the engine's own derivation (base_seed + the chain's
|
|
121
|
+
// per-window advance) — the roster is a prompt seat, never a seed
|
|
122
|
+
// matrix. ──
|
|
123
|
+
const rosterRaw = entry['window_prompts'];
|
|
124
|
+
if (rosterRaw !== undefined && typeof rosterRaw !== 'string') {
|
|
125
|
+
throw new Error(`h3-timeline extend: 'window_prompts' is stated as ${JSON.stringify(rosterRaw)} — the roster is a text seat, one prompt per line; a wrong-typed value never silently reads as unbound`);
|
|
126
|
+
}
|
|
127
|
+
let roster = null;
|
|
128
|
+
if (typeof rosterRaw === 'string' && rosterRaw.trim() !== '') {
|
|
129
|
+
const lines = rosterRaw.split('\n').map((l) => l.trim());
|
|
130
|
+
if (lines.at(-1) === '')
|
|
131
|
+
lines.pop(); // ONE trailing newline — the textarea's own artifact
|
|
132
|
+
for (const [i, line] of lines.entries()) {
|
|
133
|
+
if (line === '') {
|
|
134
|
+
throw new Error(`h3-timeline extend: window_prompts line ${i + 1} is blank — every composed window needs its own prompt line; a blank line never silently falls to extend_prompt`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (lines.length !== composition.windows) {
|
|
138
|
+
throw new Error(`h3-timeline extend: window_prompts states ${lines.length} ${lines.length === 1 ? 'line' : 'lines'} but the composition serves ${composition.windows} ${composition.windows === 1 ? 'window' : 'windows'} — one line per window (window i rides line i); leave window_prompts unstated and the one extend_prompt serves every window`);
|
|
139
|
+
}
|
|
140
|
+
roster = lines;
|
|
141
|
+
}
|
|
62
142
|
// ── the staged media: the WHOLE prior clip on the VHS seat
|
|
63
143
|
// (force_rate 24 — the one clock) and its LAST FRAME as the
|
|
64
144
|
// in-graph anchor (a positive out-of-band index the engine clamps
|
|
65
145
|
// to the final row — see LAST_FRAME_BATCH_INDEX) ──
|
|
66
|
-
const [priorFrames, priorAudio] = loadVideo(g,
|
|
146
|
+
const [priorFrames, priorAudio] = loadVideo(g, sourceClipSeat);
|
|
67
147
|
const lastFrame = g.node('ImageFromBatch', {
|
|
68
148
|
image: priorFrames, batch_index: LAST_FRAME_BATCH_INDEX, length: 1,
|
|
69
149
|
}).out(0);
|
|
@@ -72,7 +152,7 @@ export function renderH3Extend(entry, p, facts, g, runId) {
|
|
|
72
152
|
// source slicing is the swap's semantics, never a continuation's;
|
|
73
153
|
// the cure for the re-slice bug the unification's survey found) ──
|
|
74
154
|
const shots = Array.from({ length: composition.windows }, (_k, i) => ({
|
|
75
|
-
id: `extend-${i + 1}`, prompt:
|
|
155
|
+
id: `extend-${i + 1}`, prompt: roster ? roster[i] : extendPromptSeat,
|
|
76
156
|
}));
|
|
77
157
|
const planJson = JSON.stringify({ shots });
|
|
78
158
|
const { trimmed, assemblePath, planShape } = renderMaskedEditChain(g, {
|
|
@@ -81,7 +161,7 @@ export function renderH3Extend(entry, p, facts, g, runId) {
|
|
|
81
161
|
overlapFrames,
|
|
82
162
|
resolution, seed, steps,
|
|
83
163
|
roles: '',
|
|
84
|
-
sourceClip:
|
|
164
|
+
sourceClip: sourceClipSeat,
|
|
85
165
|
windowStart: 0,
|
|
86
166
|
picture1: lastFrame,
|
|
87
167
|
srcFrames: priorFrames,
|
|
@@ -96,7 +176,7 @@ export function renderH3Extend(entry, p, facts, g, runId) {
|
|
|
96
176
|
assemble: composition.windows >= 2
|
|
97
177
|
? { audioSource: 'generated', filename: `${runId}/extend_chain` }
|
|
98
178
|
: null,
|
|
99
|
-
body: ({ cur, clip, vaeVideo, vaeAudio, mutedChainAudio, sliceAudio }) => {
|
|
179
|
+
body: ({ cur, clip, vaeVideo, vaeAudio, mutedChainAudio, sliceAudio, refImages }) => {
|
|
100
180
|
// The everywhere-generate mask: an all-white SolidMask sized
|
|
101
181
|
// to the chain's own geometry (nothing held — extended
|
|
102
182
|
// seconds are new content). `.out(0)`: a mask SEAT takes an
|
|
@@ -111,30 +191,26 @@ export function renderH3Extend(entry, p, facts, g, runId) {
|
|
|
111
191
|
// (ref_image_0) and the whole clip as the motion identity
|
|
112
192
|
// (ref_video_0), the swap/repair spine's own seats ──
|
|
113
193
|
const r2v = g.node('MiniMaxH3ReferenceToVideo', {
|
|
114
|
-
prompt:
|
|
194
|
+
prompt: extendPromptSeat,
|
|
115
195
|
width: cur.out(8), height: cur.out(9), length: cur.out(6),
|
|
116
196
|
ref_image_size: 'match',
|
|
117
197
|
clip, vae: vaeVideo, audio_vae: vaeAudio,
|
|
118
198
|
'ref_images.ref_image_0': lastFrame,
|
|
119
199
|
'ref_videos.ref_video_0': priorFrames,
|
|
120
200
|
'ref_video_audios.ref_video_audio_0': mutedChainAudio,
|
|
201
|
+
// THE SHEET (P0-1): the pixel anchor owns slot 0 — the
|
|
202
|
+
// declared sheet follows (the seam pin below is untouched:
|
|
203
|
+
// it rides the conditioning AFTER the r2v, not this slot).
|
|
204
|
+
...sheetRefSlots(refImages, 1),
|
|
121
205
|
});
|
|
122
206
|
const slice = g.node('H3SourceSlice', {
|
|
123
207
|
source_fps: 24, crop: 'center',
|
|
124
208
|
state: cur.out(0), latent: r2v.out(1),
|
|
125
209
|
audio_vae: vaeAudio, source_frames: priorFrames, source_audio: sliceAudio,
|
|
126
210
|
});
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
audio_vae: vaeAudio, audio: slice.out(1),
|
|
131
|
-
}).out(0);
|
|
132
|
-
const target = g.node('MiniMaxH3ContexMaskedTarget', {
|
|
133
|
-
mask_meaning: 'white = generate',
|
|
134
|
-
audio_mode: 'generate all audio',
|
|
135
|
-
mask_conversion: 'H3 exact (causal/token max)',
|
|
136
|
-
target_latent: edit, mask: whiteMask,
|
|
137
|
-
}).out(0);
|
|
211
|
+
const target = contexMaskedTarget(g, { vaeVideo, vaeAudio }, {
|
|
212
|
+
frames: slice.out(0), audio: slice.out(1), mask: whiteMask, keepAudio: false,
|
|
213
|
+
});
|
|
138
214
|
|
|
139
215
|
// ref_image ride above is a SOFT prior — the model is free to
|
|
140
216
|
// introduce new content in the appended clip's FIRST frame, and
|
|
@@ -193,7 +269,10 @@ export function renderH3Extend(entry, p, facts, g, runId) {
|
|
|
193
269
|
format: 'mp4', codec: 'h264',
|
|
194
270
|
}).out();
|
|
195
271
|
const after = chainSaveBoundaries(g, [priorSaved]);
|
|
196
|
-
|
|
272
|
+
|
|
273
|
+
// film is BORN named (`extend_film_<slug>`) — x0/x1 parts stay
|
|
274
|
+
// machinery prefixes (chain intermediates).
|
|
275
|
+
concatSavedFilms(g, [`${runId}/x0`], after, `${runId}/extend_film${outputNameTailOf(p)}`, {
|
|
197
276
|
append: assemblePath,
|
|
198
277
|
});
|
|
199
278
|
return;
|
|
@@ -216,6 +295,6 @@ export function renderH3Extend(entry, p, facts, g, runId) {
|
|
|
216
295
|
format: 'mp4', codec: 'h264',
|
|
217
296
|
}).out();
|
|
218
297
|
const after = chainSaveBoundaries(g, [newSaved, priorSaved]);
|
|
219
|
-
concatSavedFilms(g, [`${runId}/x0`, `${runId}/x1`], after, `${runId}/extend_film`);
|
|
298
|
+
concatSavedFilms(g, [`${runId}/x0`, `${runId}/x1`], after, `${runId}/extend_film${outputNameTailOf(p)}`);
|
|
220
299
|
}
|
|
221
300
|
//# sourceMappingURL=extend.js.map
|
package/lib/filmMix.d.ts
CHANGED
|
@@ -7,6 +7,11 @@ export interface FilmMixClip {
|
|
|
7
7
|
readonly start: number;
|
|
8
8
|
/** duration (frames; 0 = overlay-only, unsized). */
|
|
9
9
|
readonly dur: number;
|
|
10
|
+
/** the SOURCE in-point (frames at the DOC CLOCK; 0 = play from the
|
|
11
|
+
* head — the only behavior before the field existed). One TTS
|
|
12
|
+
* source can contribute its middle: the conditioning slice AND the
|
|
13
|
+
* pristine overlay both start here. */
|
|
14
|
+
readonly srcIn: number;
|
|
10
15
|
readonly text: string;
|
|
11
16
|
readonly cls: FilmMixClipClass;
|
|
12
17
|
}
|
|
@@ -73,6 +78,26 @@ export interface FilmMixInput {
|
|
|
73
78
|
readonly fps?: number;
|
|
74
79
|
readonly duckDb?: number;
|
|
75
80
|
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
export declare function chooseLaneClips(clips: readonly FilmMixClip[], spanStart: number, spanEnd: number, genStart: number): Partial<Record<FilmMixClipClass, number>>;
|
|
76
101
|
/** The duck span string — "start:end" at ms precision, ';'-joined. */
|
|
77
102
|
export declare function formatDuckSpan(start: number, end: number): string;
|
|
78
103
|
/** Per-window stanza seconds — THE compose-time windowSecs
|
package/lib/filmMix.js
CHANGED
|
@@ -40,6 +40,7 @@ export function parseFilmMixClips(rows) {
|
|
|
40
40
|
const row = c;
|
|
41
41
|
row['start_frame'] = wireInt(row['start_frame']);
|
|
42
42
|
row['dur_frames'] = wireInt(row['dur_frames']);
|
|
43
|
+
row['in_frames'] = wireInt(row['in_frames']);
|
|
43
44
|
const src = typeof row.src === 'string' ? row.src.trim() : '';
|
|
44
45
|
if (src === '') {
|
|
45
46
|
const positioned = row.start_frame !== undefined ||
|
|
@@ -72,17 +73,80 @@ export function parseFilmMixClips(rows) {
|
|
|
72
73
|
const dur = typeof row.dur_frames === 'number' && Number.isFinite(row.dur_frames) && row.dur_frames > 0
|
|
73
74
|
? row.dur_frames
|
|
74
75
|
: 0;
|
|
76
|
+
|
|
77
|
+
// in_frames — where in the SOURCE the clip starts. Absent or 0 =
|
|
78
|
+
// the head, byte-identical to every film composed before the
|
|
79
|
+
// field existed; a negative or non-numeric value refuses loud
|
|
80
|
+
// (an in-point is a real seat, never a silent clamp — the same
|
|
81
|
+
// law as start_frame).
|
|
82
|
+
let srcIn = 0;
|
|
83
|
+
if (row.in_frames !== undefined) {
|
|
84
|
+
if (typeof row.in_frames !== 'number' || !Number.isFinite(row.in_frames) || row.in_frames < 0) {
|
|
85
|
+
throw new Error(`audio_clips: a clip with in_frames ${JSON.stringify(row.in_frames)} — the source in-point must be a non-negative number of frames (omit to play from the head)`);
|
|
86
|
+
}
|
|
87
|
+
srcIn = row.in_frames;
|
|
88
|
+
}
|
|
75
89
|
const text = typeof row.text === 'string' ? row.text.trim() : '';
|
|
76
90
|
const clsRaw = typeof row.class === 'string' ? row.class.trim().toLowerCase() : '';
|
|
77
91
|
if (clsRaw !== '' && clsRaw !== 'dialogue' && clsRaw !== 'sfx' && clsRaw !== 'music') {
|
|
78
92
|
throw new Error(`audio_clips: unknown class "${clsRaw}" — dialogue | sfx | music (omit for auto: text → dialogue, else music)`);
|
|
79
93
|
}
|
|
80
94
|
const cls = (clsRaw !== '' ? clsRaw : text !== '' ? 'dialogue' : 'music');
|
|
81
|
-
clips.push({ src, start: row.start_frame, dur, text, cls });
|
|
95
|
+
clips.push({ src, start: row.start_frame, dur, srcIn, text, cls });
|
|
82
96
|
}
|
|
83
97
|
return clips;
|
|
84
98
|
}
|
|
85
99
|
const round3 = (v) => Math.round(v * 1000) / 1000;
|
|
100
|
+
/** The minimum overlap (frames at the DOC CLOCK) that can size a
|
|
101
|
+
* slice for the stamp pin — the audio slice node's 0.1s floor. */
|
|
102
|
+
const SLICE_FLOOR_FRAMES = 2.4;
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
export function chooseLaneClips(clips, spanStart, spanEnd, genStart) {
|
|
123
|
+
const starters = {};
|
|
124
|
+
const crossers = {};
|
|
125
|
+
for (let ci = 0; ci < clips.length; ci++) {
|
|
126
|
+
const clip = clips[ci];
|
|
127
|
+
if (clip.dur <= 0)
|
|
128
|
+
continue;
|
|
129
|
+
const lo = Math.max(clip.start, genStart);
|
|
130
|
+
const hi = Math.min(clip.start + clip.dur, spanEnd);
|
|
131
|
+
if (hi - lo < SLICE_FLOOR_FRAMES)
|
|
132
|
+
continue;
|
|
133
|
+
const bucket = clip.start >= spanStart && clip.start < spanEnd ? starters : crossers;
|
|
134
|
+
const row = (bucket[clip.cls] ??= []);
|
|
135
|
+
row.push(ci);
|
|
136
|
+
}
|
|
137
|
+
const lanes = {};
|
|
138
|
+
for (const cls of ['dialogue', 'sfx', 'music']) {
|
|
139
|
+
const started = starters[cls];
|
|
140
|
+
if (started !== undefined && started.length > 1) {
|
|
141
|
+
const named = started.map((ci) => `"${clips[ci].src}"`).join(' and ');
|
|
142
|
+
throw new Error(`audio_clips: two ${cls} clips start inside one window (doc frames ${spanStart}–${spanEnd}) — ${named}; one lane per class per window: end the first inside the window, merge the rows, or move the seam`);
|
|
143
|
+
}
|
|
144
|
+
const winner = started?.[0] ?? crossers[cls]?.[0];
|
|
145
|
+
if (winner !== undefined)
|
|
146
|
+
lanes[cls] = winner;
|
|
147
|
+
}
|
|
148
|
+
return lanes;
|
|
149
|
+
}
|
|
86
150
|
/** The duck span string — "start:end" at ms precision, ';'-joined. */
|
|
87
151
|
export function formatDuckSpan(start, end) {
|
|
88
152
|
return `${round3(start)}:${round3(end)}`;
|
|
@@ -136,31 +200,22 @@ export function computeFilmMix(input) {
|
|
|
136
200
|
}
|
|
137
201
|
const filmSec = round3(elapsed);
|
|
138
202
|
// CONDITIONED clips (the stamp law's overlay half): every window
|
|
139
|
-
// whose generation span a clip rides HEARD that clip —
|
|
140
|
-
//
|
|
141
|
-
//
|
|
142
|
-
// dur (or a sub-0.1s overlap) cannot size a slice
|
|
143
|
-
// overlay-only. The generation render starts at doc
|
|
144
|
-
// sf − carry (the carry head included).
|
|
203
|
+
// whose generation span a clip rides HEARD that clip — the lane
|
|
204
|
+
// law lives in chooseLaneClips (starts-inside owns the lane; a
|
|
205
|
+
// crosser owns only an uncontested window; two starters refuse).
|
|
206
|
+
// A clip with no dur (or a sub-0.1s overlap) cannot size a slice
|
|
207
|
+
// and stays overlay-only. The generation render starts at doc
|
|
208
|
+
// frame sf − carry (the carry head included).
|
|
145
209
|
const conditioned = new Set();
|
|
146
210
|
spans.forEach((span, i) => {
|
|
147
211
|
if (!Number.isFinite(span.start) || !Number.isFinite(span.end) || span.end <= span.start)
|
|
148
212
|
return;
|
|
149
213
|
const carry = i > 0 ? overlaps[i] : 0;
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
continue;
|
|
156
|
-
if (won[clip.cls] !== undefined)
|
|
157
|
-
continue;
|
|
158
|
-
const lo = Math.max(clip.start, genStart);
|
|
159
|
-
const hi = Math.min(clip.start + clip.dur, span.end);
|
|
160
|
-
if (hi - lo < 2.4)
|
|
161
|
-
continue;
|
|
162
|
-
won[clip.cls] = true;
|
|
163
|
-
conditioned.add(ci);
|
|
214
|
+
const lanes = chooseLaneClips(clips, span.start, span.end, span.start - carry);
|
|
215
|
+
for (const cls of ['dialogue', 'sfx', 'music']) {
|
|
216
|
+
const ci = lanes[cls];
|
|
217
|
+
if (ci !== undefined)
|
|
218
|
+
conditioned.add(ci);
|
|
164
219
|
}
|
|
165
220
|
});
|
|
166
221
|
// PLACEMENTS: doc frame → film seat through the owner map — the
|
package/lib/index.d.ts
CHANGED
|
@@ -5,8 +5,9 @@ export declare const family: Plugin;
|
|
|
5
5
|
export { finalizeH3, H3_T4_STRIP } from "./finalize.js";
|
|
6
6
|
export { renderH3Swap } from "./swap.js";
|
|
7
7
|
export { renderH3Repair } from "./repair.js";
|
|
8
|
+
export { renderH3Edit, EDIT_IDENTITY_BOIL_FLOOR, type EditMaskDial, type EditReferenceDial, } from "./edit.js";
|
|
8
9
|
export { renderH3Extend, LAST_FRAME_BATCH_INDEX } from "./extend.js";
|
|
9
|
-
export { refineArmed, renderH3Refine, renderH3RefineBag, renderH3RefineCarry, renderH3RefineWindow, renderH3RefineWindows, refineWindowCount, refineWindowStarts, tokenExactCarry, nextTokenExact, lawfulCarryStart, REFINE_UPSCALE_MODEL, REFINE_2X_OOM_FRAMES, REFINE_DEFAULT_CLIP_SECONDS, REFINE_DEFAULT_OVERLAP_FRAMES } from "./refine.js";
|
|
10
|
+
export { refineArmed, renderH3Refine, renderH3RefineBag, renderH3RefineCarry, renderH3RefineWindow, renderH3RefineWindows, refineWindowCount, refineWindowStarts, tokenExactCarry, nextTokenExact, lawfulCarryStart, REFINE_UPSCALE_MODEL, REFINE_2X_OOM_FRAMES, REFINE_DEFAULT_CLIP_SECONDS, REFINE_DEFAULT_OVERLAP_FRAMES, REFINE_WORKAROUND_WIDE_FRAMES } from "./refine.js";
|
|
10
11
|
export { refinePlaneSchema, REFINE_PLANE_KEYS } from "./schema.js";
|
|
11
12
|
export { MAX_COMPOSED_WINDOWS, SEAM_OVERLAP_FRAMES } from "./timelineContract.js";
|
|
12
13
|
export type { RefineWindowSeat } from "./refine.js";
|
package/lib/index.js
CHANGED
|
@@ -68,13 +68,26 @@ export const DECL = {
|
|
|
68
68
|
"refmod_identity",
|
|
69
69
|
"refmod_save",
|
|
70
70
|
"loras",
|
|
71
|
-
// THE
|
|
71
|
+
// THE OPERATOR-AUTHORED MOD BAGS (the modleaf-add journey
|
|
72
72
|
|
|
73
|
+
// LIVES in the studio rail (ModifiersSection), and its only
|
|
73
74
|
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
75
|
+
// unification retired these seats saying "the studio projects
|
|
76
|
+
// but never authors the bag", which left the operator's Add
|
|
77
|
+
// press unwritable on BOTH planes (the serializer's vocabulary
|
|
78
|
+
// stripped it; this row refused it at the estate door). The
|
|
79
|
+
// studio now authors the modern bag keys; the legacy
|
|
80
|
+
// pre-collapse spellings (replace/repair/extend/refine/
|
|
81
|
+
// upscale) stay off this row by law — they ride the doc
|
|
82
|
+
// merge-patch preserved and the compose door translates them.
|
|
83
|
+
"edit",
|
|
84
|
+
"reshoot",
|
|
85
|
+
|
|
86
|
+
// the deliverable slug — served (group 'naming'), hydrated,
|
|
87
|
+
// emitted by the Layer-A generic loop, threaded by compose into
|
|
88
|
+
// every deliverable save prefix. The studio authors it; the
|
|
89
|
+
// A7 arm derives the account.
|
|
90
|
+
"output_name",
|
|
78
91
|
"document"
|
|
79
92
|
],
|
|
80
93
|
"kind": "custom",
|
|
@@ -373,6 +386,11 @@ export const DECL = {
|
|
|
373
386
|
|
|
374
387
|
// knob→seat map mirrors DECL params, and the bag's law is
|
|
375
388
|
// witnessed by tests/reshoot.spec.ts, not by this census.
|
|
389
|
+
|
|
390
|
+
// the family declares the deliverable-naming stem — consumed at
|
|
391
|
+
// the DELIVERABLE save prefixes (film/extend/re-shoot plates via
|
|
392
|
+
// outputNameTailOf, schema.ts), witnessed by tests/output-name.spec.ts.
|
|
393
|
+
"output_name",
|
|
376
394
|
],
|
|
377
395
|
"provisions": [
|
|
378
396
|
{
|
|
@@ -584,8 +602,9 @@ export const family = {
|
|
|
584
602
|
export { finalizeH3, H3_T4_STRIP } from "./finalize.js";
|
|
585
603
|
export { renderH3Swap } from "./swap.js";
|
|
586
604
|
export { renderH3Repair } from "./repair.js";
|
|
605
|
+
export { renderH3Edit, EDIT_IDENTITY_BOIL_FLOOR, } from "./edit.js";
|
|
587
606
|
export { renderH3Extend, LAST_FRAME_BATCH_INDEX } from "./extend.js";
|
|
588
|
-
export { refineArmed, renderH3Refine, renderH3RefineBag, renderH3RefineCarry, renderH3RefineWindow, renderH3RefineWindows, refineWindowCount, refineWindowStarts, tokenExactCarry, nextTokenExact, lawfulCarryStart, REFINE_UPSCALE_MODEL, REFINE_2X_OOM_FRAMES, REFINE_DEFAULT_CLIP_SECONDS, REFINE_DEFAULT_OVERLAP_FRAMES } from "./refine.js";
|
|
607
|
+
export { refineArmed, renderH3Refine, renderH3RefineBag, renderH3RefineCarry, renderH3RefineWindow, renderH3RefineWindows, refineWindowCount, refineWindowStarts, tokenExactCarry, nextTokenExact, lawfulCarryStart, REFINE_UPSCALE_MODEL, REFINE_2X_OOM_FRAMES, REFINE_DEFAULT_CLIP_SECONDS, REFINE_DEFAULT_OVERLAP_FRAMES, REFINE_WORKAROUND_WIDE_FRAMES } from "./refine.js";
|
|
589
608
|
export { refinePlaneSchema, REFINE_PLANE_KEYS } from "./schema.js";
|
|
590
609
|
export { MAX_COMPOSED_WINDOWS, SEAM_OVERLAP_FRAMES } from "./timelineContract.js";
|
|
591
610
|
export { H3_DEFAULT_LORA_ID, h3DefaultLoraEntry } from "./actions.js";
|
package/lib/refine.d.ts
CHANGED
|
@@ -5,19 +5,48 @@ import type { H3Facts } from './actions.js';
|
|
|
5
5
|
* seat carries this same single option — one file, one spelling, no
|
|
6
6
|
* hand-spelled alternatives). */
|
|
7
7
|
export declare const REFINE_UPSCALE_MODEL = "minimax_h3_latent_upscaler_3d_bf16.safetensors";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
15
18
|
export declare const REFINE_2X_OOM_FRAMES = 141;
|
|
16
19
|
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export declare const REFINE_DEFAULT_CLIP_SECONDS = 2.33;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export declare const REGION_REPAIR_GREEN_FRAMES = 362;
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
export declare const REFINE_WORKAROUND_WIDE_FRAMES = 90;
|
|
21
50
|
/** The refine auto-tile's default carried overlap, in frames at the
|
|
22
51
|
* film clock — the film's own seam (SEAM_OVERLAP_FRAMES), which is
|
|
23
52
|
* also token-exact (5, 22, 39 …), so the default auto-tile takes the
|
|
@@ -101,6 +130,68 @@ export declare function renderH3Refine(entry: Record<string, unknown>, p: Record
|
|
|
101
130
|
|
|
102
131
|
|
|
103
132
|
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
104
195
|
export declare const tokenExactCarry: (frames: number) => boolean;
|
|
105
196
|
/** The next token-exact carry at or above a measured span — the rung
|
|
106
197
|
* a refusal names so the fix is a stated number, not a search.
|