diff --git a/README.md b/README.md index e6b457d..7a0bfce 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,11 @@ flattened to absolute timeline positions when the node executes, so it can be connected directly to `Sequence Prompt` with `Prompt Format = Timeline` (or `Auto`). +All clip tabs use the single `Default chunk duration` control. There is no +per-clip duration because Continuum multi-clip projects are intentionally +uniform; resizing a shot boundary updates its timestamp in the visible prompt +editor immediately. + The editor follows the CSGlide shot-timeline model: one prompt editor per clip, coloured shot bands, and draggable boundary sliders between shots. Use the `@ Add shot` button, or type `@` at the start of a new line in the prompt diff --git a/WORKLOG.md b/WORKLOG.md index 4002bf1..bd77083 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -7,6 +7,8 @@ together. - Add `@ Add shot` plus a line-start `@` keyboard shortcut for rapid prompt authoring without changing the emitted Timeline format. +- Make `Default chunk duration` the only duration control; all clip tabs now + share it and legacy per-clip duration values are ignored. ## 2026-10-15 — Sequence prompt builder diff --git a/prompt_builder.py b/prompt_builder.py index fcbf7cf..4385d3e 100644 --- a/prompt_builder.py +++ b/prompt_builder.py @@ -63,7 +63,10 @@ def normalize_sequence(value: Any, *, clip_count: int, default_seconds: float) - raw_clip = raw_clips[clip_index] if clip_index < len(raw_clips) else {} if not isinstance(raw_clip, Mapping): raise ValueError(f"clip {clip_index + 1} must be an object") - duration = _number(raw_clip.get("duration", fallback_duration), f"clip {clip_index + 1} duration", minimum=0.1) + # Continuum projects use one chunk duration for every clip. Older + # editor state may still contain per-clip durations; ignore them so + # the single node control remains authoritative. + duration = fallback_duration raw_slots = raw_clip.get("slots", []) if not isinstance(raw_slots, list): raise ValueError(f"clip {clip_index + 1} slots must be a list") diff --git a/tests/test_sequence_prompt_builder.py b/tests/test_sequence_prompt_builder.py index 4c2e57f..5e92805 100644 --- a/tests/test_sequence_prompt_builder.py +++ b/tests/test_sequence_prompt_builder.py @@ -33,7 +33,7 @@ def test_builder_emits_one_absolute_timeline_prompt_from_clip_local_slots(): assert "non_diegetic_music: Low cinematic pulse." in result -def test_normalizer_orders_slots_and_fills_missing_clips(): +def test_normalizer_orders_slots_fills_missing_clips_and_shares_duration(): value = normalize_sequence( json.dumps({"clips": [{"duration": 6, "slots": [ {"start": 3, "end": 6, "text": "Second."}, @@ -43,6 +43,7 @@ def test_normalizer_orders_slots_and_fills_missing_clips(): default_seconds=4, ) assert value["clips"][0]["slots"][0]["text"] == "First." + assert value["clips"][0]["duration"] == 4.0 assert value["clips"][1]["duration"] == 4.0 diff --git a/web/sequence_prompt_builder.js b/web/sequence_prompt_builder.js index b762f29..374775f 100644 --- a/web/sequence_prompt_builder.js +++ b/web/sequence_prompt_builder.js @@ -75,17 +75,19 @@ function configure(node) { }; const render = () => { const count = Math.max(1, Math.min(MAX_CLIPS, Number(countWidget.value) || 1)); - while (state.clips.length < count) state.clips.push({ duration: Number(secondsWidget.value) || 4, slots: [] }); + const chunkDuration = Number(secondsWidget.value) || 4; + while (state.clips.length < count) state.clips.push({ duration: chunkDuration, slots: [] }); state.clips = state.clips.slice(0, count); active = Math.min(active, count - 1); panel.replaceChildren(); const tabs = el("div"); tabs.style.cssText = "display:flex;flex-wrap:wrap;gap:3px;margin-bottom:6px"; state.clips.forEach((clip, index) => { const button = el("button", `Clip ${index + 1}`); button.type = "button"; button.disabled = index === active; button.onclick = () => { active = index; render(); }; tabs.append(button); }); panel.append(tabs); const clip = state.clips[active]; - const durationRow = el("div"); durationRow.style.cssText = "display:flex;align-items:center;gap:8px;margin:4px 0"; - durationRow.append(el("strong", `Clip ${active + 1}`), el("span", "duration")); - const duration = input("number", clip.duration, (value) => { clip.duration = Math.max(0.1, Number(value) || 0.1); clip.slots.forEach((slot) => { slot.end = Math.min(slot.end, clip.duration); }); setState(); render(); }); - duration.step = 0.1; duration.style.width = "70px"; durationRow.append(duration, el("span", "seconds")); panel.append(durationRow); + // All clips share the one authoritative project duration widget. + const duration = chunkDuration; + clip.duration = duration; + const durationRow = el("div"); durationRow.style.cssText = "display:flex;align-items:center;gap:8px;margin:4px 0;color:#b7d6bf"; + durationRow.append(el("strong", `Clip ${active + 1}`), el("span", `· ${duration.toFixed(1)}s shared chunk duration`)); panel.append(durationRow); const timeline = el("div"); timeline.style.cssText = "display:flex;height:38px;gap:2px;margin:8px 0 3px;background:#15251a;border-radius:3px;overflow:hidden"; const palette = ["#4b9b67", "#4d7fb1", "#a87945", "#8c5aa8", "#a44f5d", "#3f8e8a"]; clip.slots.forEach((slot, index) => { const segment = el("button", `Shot ${index + 1}\n${(slot.text || "unscripted").slice(0, 18)}`); segment.type = "button"; segment.title = `${slot.start.toFixed(1)}s–${slot.end.toFixed(1)}s`; segment.style.cssText = `flex:${Math.max(0.1, slot.end - slot.start)};border:0;color:white;background:${palette[index % palette.length]};white-space:pre-wrap;font-size:10px;overflow:hidden`; segment.onclick = () => { prompt.focus(); }; timeline.append(segment); }); @@ -104,12 +106,23 @@ function configure(node) { const add = el("button", "@ Add shot"); add.type = "button"; add.onclick = () => { addSlot(clip); setState(); render(); }; actions.append(add); if (clip.slots.length > 1) { const remove = el("button", "Remove last shot"); remove.type = "button"; remove.onclick = () => { clip.slots.pop(); clip.slots.at(-1).end = clip.duration; setState(); render(); }; actions.append(remove); } panel.append(actions); - display.computeSize = (width) => [Math.max(360, Number(width) || 360), Math.min(620, 185 + clip.slots.length * 42)]; + display.computeSize = (width) => [Math.max(360, Number(width) || 360), Math.min(620, 160 + clip.slots.length * 42)]; node.setSize?.([Math.max(360, Number(node.size?.[0]) || 360), Number(node.computeSize?.()[1]) || 420]); }; const refresh = () => { state = readState(stateWidget, Number(countWidget.value) || 2, Number(secondsWidget.value) || 4); render(); setState(); }; countWidget.callback = ((previous) => function(...args) { const result = previous?.apply(this, args); refresh(); return result; })(countWidget.callback); - secondsWidget.callback = ((previous) => function(...args) { const result = previous?.apply(this, args); render(); return result; })(secondsWidget.callback); + secondsWidget.callback = ((previous) => function(...args) { + const result = previous?.apply(this, args); + const duration = Math.max(0.1, Number(secondsWidget.value) || 0.1); + state.clips.forEach((clip) => { + clip.duration = duration; + clip.slots.forEach((slot) => { + slot.start = Math.min(Number(slot.start) || 0, Math.max(0, duration - 0.1)); + slot.end = Math.min(Math.max(Number(slot.end) || duration, slot.start + 0.1), duration); + }); + }); + setState(); render(); return result; + })(secondsWidget.callback); stateWidget.callback = ((previous) => function(...args) { const result = previous?.apply(this, args); render(); return result; })(stateWidget.callback); node.__dumasSequencePromptBuilder = refresh; refresh();