Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Add Extend and Bridge scenes

Bitti5cebee31f915
diff --git a/docs/scene-types.md b/docs/scene-types.md
index caa9fe7..6df8280 100644
--- a/docs/scene-types.md
+++ b/docs/scene-types.md
@@ -5,9 +5,15 @@ The Scene panel saves a type on each scene:
- **First & Last Frame** keeps the existing shot descriptions, speech, Look, sound, music and optional frame anchors. Older scenes without a type use this type.
- **Animate** uses an Animate generator, one driving video and one repainted scene frame. It does not send a text prompt.
- **Character Replace** gives each shot a source video selector, a new character reference selector and an optional description identifying the character to replace. The character reference must contain an image. Blank target descriptions mean the main character.
+- **Extend** takes a source video in the Scene panel and uses the shot descriptions as the continuation prompt.
+- **Bridge** takes start and end video references in the Scene panel and uses the shot descriptions as the prompt for the connecting segment.
Character Replace sends only references selected by its shots, in project order. Frame anchors, continuation, old action text and style settings are inactive in this mode. Switching back retains the shot descriptions and character selections. The video reference's saved trim and soundtrack setting apply to generation.
The generated prompt follows the [MiniMax H3 full-reference guide](https://huggingface.co/MiniMaxAI/MiniMax-H3/blob/main/docs/VIDEO_PROMPT_WRITING_GUIDE_ref_en.md): six sections, a video-editing task prefix, independently numbered image/video/audio payloads, and explicit retention instructions. It replaces the target's appearance while retaining motion, timing, camera work, environment and other characters. Character images define the replacement identity rather than anchoring a frame. Enabled soundtracks are reused in the corresponding shots.
Generation requires both references for every shot and respects the existing limits of three video references, nine images and 15 seconds of total video reference material. The generator picker still selects the active engine for the queue: incompatible scenes are excluded from Generate All. Changing a scene type selects a compatible downloaded generator when one is available. Character Replace requires reference-capable MiniMax weights, such as References or Singularity; known First/Last Frame weights are rejected.
+
+Extend and Bridge require reference-capable weights and SlopFab API 1.14. The app decodes the selected reference ranges with WebCodecs. At generation time the runtime encodes the start video's last 22 frames into VAE latents at the project canvas. Bridge also encodes the end video's first 22 frames. These guides share the generated segment's spatial coordinates and sit immediately before/after it in the model's temporal coordinates. The encoded boundaries use the existing reference cache. No source latent files or FFmpeg decoding are required.
+
+Each source range must contain at least 22 frames at 24 fps (0.917 seconds); ranges still share the 15-second video-reference budget. Start/end ordering is independent of library order. Frame anchors, previous-scene continuation and other references are inactive in these modes. Sound and speech are generated from the prompt; source soundtracks are not copied. Scene length controls only the new segment, which is the only video added to the timeline. Add the source clips on either side when arranging the complete sequence.
diff --git a/docs/slopfab-compatibility.md b/docs/slopfab-compatibility.md
index 268f0aa..fbe053a 100644
--- a/docs/slopfab-compatibility.md
+++ b/docs/slopfab-compatibility.md
@@ -1,4 +1,29 @@
-# Slopfab 1.13 compatibility
+# Slopfab compatibility
+
+## API 1.14: Extend and Bridge
+
+The bundled runtime now builds from SlopFab commit `103687a` with
+`SLOPFAB_WITH_FFMPEG=OFF`. API 1.14 adds
+`slopfab_request_set_video_transition`: Extend uses the source video's final
+22 frames as a VAE-encoded temporal guide, and Bridge adds the end video's
+opening 22 frames after the target timeline. Both return only the new segment.
+The existing C ABI structures are unchanged. Older DLLs continue to support
+ordinary generation and give a specific upgrade error for these scene types.
+
+Slopus supplies source handles in start/end order, omits unrelated frame
+anchors and refmods, and generates audio from the text prompt. Source boundary
+encodings use SlopFab's existing media cache. The app still demuxes and decodes
+videos with mp4box.js/WebCodecs and encodes/muxes output through WebCodecs.
+
+Validation covers source-boundary selection, temporal guide positions, cache
+identity, the C API, Rust planning on CUDA/Vulkan, project persistence, UI
+selection, and submitted prompts/payloads. Native core/C API suites, Rust
+integration tests, frontend tests and the production build pass. Full model
+inference and visual seam quality were not evaluated; the GPU was busy with
+another workload. The previous locally modified DLL is preserved under
+`.git/runtime-backups/` by its SHA-256 filename.
+
+## API 1.13
Reviewed on 2026-09-20 against Slopfab commit `9b61787` and the local
`lib/slopfab/slopfab.dll`, which reports C API `1.13.0`.
diff --git a/lib/slopfab/slopfab.dll b/lib/slopfab/slopfab.dll
index 8616cf0..14fa320 100644
--- a/lib/slopfab/slopfab.dll
+++ b/lib/slopfab/slopfab.dll
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:06e05f7e694d540275e16587ecfe63d1c1e8bc931db7845c0540473dac68c95f
-size 16543744
+oid sha256:ca2bb4fae3eaa3062f11859fd2156a94cc90415721c1d35bbd3a81a72ccf38ee
+size 16517632
diff --git a/src-tauri/src/project/scenes.rs b/src-tauri/src/project/scenes.rs
index 7590012..4f71d26 100644
--- a/src-tauri/src/project/scenes.rs
+++ b/src-tauri/src/project/scenes.rs
@@ -43,6 +43,10 @@ pub(crate) struct GenerationJob {
pub(crate) id: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub(crate) scene_type: Option<String>,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub(crate) start_video_reference_id: Option<String>,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub(crate) end_video_reference_id: Option<String>,
#[serde(default)]
pub(crate) title: String,
/// A MIRROR of the scene's shot lines for a scene-shaped job, and the user's
@@ -137,6 +141,8 @@ impl GenerationJob {
Self {
id: id.to_string(),
scene_type: None,
+ start_video_reference_id: None,
+ end_video_reference_id: None,
title: title.to_string(),
prompt: String::new(),
status: "draft".into(),
diff --git a/src-tauri/src/project/validation/scenes.rs b/src-tauri/src/project/validation/scenes.rs
index 3561a82..d30e53c 100644
--- a/src-tauri/src/project/validation/scenes.rs
+++ b/src-tauri/src/project/validation/scenes.rs
@@ -5,10 +5,22 @@ use std::collections::BTreeSet;
pub(super) fn validate(config: &mut ProjectConfig) -> Result<(), String> {
for job in &mut config.generation_jobs {
if job.scene_type.as_deref().is_some_and(|value| {
- !matches!(value, "first-last-frame" | "animate" | "character-replace")
+ !matches!(
+ value,
+ "first-last-frame" | "animate" | "character-replace" | "extend" | "bridge"
+ )
}) {
return Err(format!("Scene '{}' has an unsupported scene type.", job.id));
}
+ if [&job.start_video_reference_id, &job.end_video_reference_id]
+ .iter()
+ .any(|id| id.as_deref() == Some(""))
+ {
+ return Err(format!(
+ "Scene '{}' has an empty video reference id.",
+ job.id
+ ));
+ }
let limits = crate::generation::models::for_scene(job.provider_id.as_deref())
.unwrap_or_else(crate::generation::models::default_model)
.capabilities;
diff --git a/src-tauri/src/slopfab/config.rs b/src-tauri/src/slopfab/config.rs
index 3e33755..f00d25b 100644
--- a/src-tauri/src/slopfab/config.rs
+++ b/src-tauri/src/slopfab/config.rs
@@ -87,6 +87,23 @@ impl Configuration {
}
pub(super) fn validate_inputs(&self, request: &GenerationRequest) -> Result<(), String> {
+ if let Some(mode) = request.video_transition.as_deref() {
+ let expected = match mode {
+ "extend" => 1,
+ "bridge" => 2,
+ _ => return Err("Unsupported video transition mode.".into()),
+ };
+ if self.animate
+ || request.still_image
+ || request.continuation_path.is_some()
+ || request.continuation_relative_path.is_some()
+ || !request.refmods.is_empty()
+ || !request.reference_paths.is_empty()
+ || request.reference_video_ids.len() != expected
+ {
+ return Err("Extend/Bridge requires exactly one/two video references without frame anchors, Animate, continuation or refmods.".into());
+ }
+ }
if self.animate && self.motion_cache {
return Err("MotionCache is unavailable in Animate mode.".into());
}
diff --git a/src-tauri/src/slopfab/ffi/mod.rs b/src-tauri/src/slopfab/ffi/mod.rs
index 47123be..ca62b74 100644
--- a/src-tauri/src/slopfab/ffi/mod.rs
+++ b/src-tauri/src/slopfab/ffi/mod.rs
@@ -89,6 +89,10 @@ impl Api {
self.check(r)?;
self.inner.set_frames(r.pointer.as_ptr(), v)
}
+ pub fn set_video_transition(&self, r: &RequestHandle, mode: i32) -> Result<(), String> {
+ self.check(r)?;
+ self.inner.set_video_transition(r.pointer.as_ptr(), mode)
+ }
pub fn set_still_image(&self, r: &RequestHandle) -> Result<(), String> {
self.check(r)?;
self.inner.set_still_image(r.pointer.as_ptr())
diff --git a/src-tauri/src/slopfab/ffi/raw/mod.rs b/src-tauri/src/slopfab/ffi/raw/mod.rs
index 8459805..b9a1562 100644
--- a/src-tauri/src/slopfab/ffi/raw/mod.rs
+++ b/src-tauri/src/slopfab/ffi/raw/mod.rs
@@ -79,6 +79,7 @@ pub struct Api {
set_still_image: Option<unsafe extern "C" fn(*mut Request, i32) -> i32>,
set_save_latents: Option<unsafe extern "C" fn(*mut Request, *const c_char) -> i32>,
set_continuation_file: Option<unsafe extern "C" fn(*mut Request, *const c_char, i32) -> i32>,
+ set_video_transition: Option<unsafe extern "C" fn(*mut Request, i32) -> i32>,
set_steps: unsafe extern "C" fn(*mut Request, i32) -> i32,
set_seed: unsafe extern "C" fn(*mut Request, u64) -> i32,
set_model: unsafe extern "C" fn(*mut Request, i32, *const c_char) -> i32,
@@ -119,6 +120,12 @@ impl Api {
};
}
Ok(Self {
+ set_video_transition: library
+ .get::<unsafe extern "C" fn(*mut Request, i32) -> i32>(
+ b"slopfab_request_set_video_transition\0",
+ )
+ .ok()
+ .map(|symbol| *symbol),
capi_version: symbol!("slopfab_capi_version", unsafe extern "C" fn() -> u32),
version_string: symbol!(
"slopfab_capi_version_string",
@@ -374,6 +381,12 @@ impl Api {
let path = path_cstring(path)?;
self.error(unsafe { set(r, path.as_ptr()) })
}
+ pub fn set_video_transition(&self, r: *mut Request, mode: i32) -> Result<(), String> {
+ let set = self.set_video_transition.ok_or(
+ "Extend and Bridge require slopfab.dll API 1.14 or later. Update the runtime.",
+ )?;
+ self.error(unsafe { set(r, mode) })
+ }
pub fn set_continuation_file(
&self,
r: *mut Request,
diff --git a/src-tauri/src/slopfab/h3.rs b/src-tauri/src/slopfab/h3.rs
index fdf66f6..c0b5396 100644
--- a/src-tauri/src/slopfab/h3.rs
+++ b/src-tauri/src/slopfab/h3.rs
@@ -59,6 +59,9 @@ pub(super) fn configure_request(
api.set_attention(handle, configuration.attention)?;
api.set_motion_cache(handle, configuration.motion_cache)?;
api.set_verbose(handle, false)?;
+ if let Some(mode) = request.video_transition.as_deref() {
+ api.set_video_transition(handle, if mode == "bridge" { 2 } else { 1 })?;
+ }
if let Some(path) = &request.continuation_path {
api.set_continuation_file(
handle,
diff --git a/src-tauri/src/slopfab/tests.rs b/src-tauri/src/slopfab/tests.rs
index d0f1390..6e00680 100644
--- a/src-tauri/src/slopfab/tests.rs
+++ b/src-tauri/src/slopfab/tests.rs
@@ -5,6 +5,65 @@ use super::{
use crate::project::{ProviderOption, ProviderSetting};
use std::collections::BTreeMap;
+#[test]
+fn video_transitions_use_encoded_boundaries_with_the_bundled_runtime() {
+ let references = ReferenceVideos::default();
+ let settings = BTreeMap::new();
+ let configuration = Configuration::from_settings(&settings);
+ let api = ffi::Api::load(&configuration.dll_path).unwrap();
+ let start = references.create_reference_video(3.0, &settings).unwrap();
+ let end = references.create_reference_video(2.0, &settings).unwrap();
+ for id in [&start, &end] {
+ references
+ .append_reference_video(id, &vec![127; 64 * 32 * 4], 64, 32, 0.0)
+ .unwrap();
+ }
+ for mode in ["extend", "bridge"] {
+ let mut request = GenerationRequest {
+ prompt: "The dancer turns and walks toward the door.".into(),
+ video_transition: Some(mode.into()),
+ frames: 39,
+ steps: 4,
+ seed: 1,
+ canvas_width: 64,
+ canvas_height: 32,
+ reference_video_ids: if mode == "extend" {
+ vec![start.clone()]
+ } else {
+ vec![start.clone(), end.clone()]
+ },
+ ..Default::default()
+ };
+ for platform in [ComputePlatform::Cuda13, ComputePlatform::Vulkan] {
+ for purpose in [RequestPurpose::Plan, RequestPurpose::Generate] {
+ let handle = RequestHandle::new(&api).unwrap();
+ configure_request(
+ &api,
+ &handle,
+ &request,
+ &configuration,
+ platform,
+ purpose,
+ &references,
+ )
+ .unwrap();
+ let plan = api.resolve(&handle).unwrap();
+ assert_eq!(
+ scene_frame_window(&request, plan.aligned_frames).unwrap(),
+ (0, 39)
+ );
+ assert!(api
+ .describe(&handle)
+ .unwrap()
+ .contains(&format!("video transition {mode}")));
+ }
+ }
+ request.reference_paths.push("stale-first-frame.png".into());
+ assert!(configuration.validate_inputs(&request).is_err());
+ }
+ references.release_reference_videos(&[start, end]).unwrap();
+}
+
// Minimal table-model header: planning reads descriptors but never executes
// these fixture tensors. Active LoRAs also need a valid SafeTensors header.
fn metadata_checkpoint(path: &std::path::Path, metadata: serde_json::Value) {
diff --git a/src-tauri/src/slopfab/types.rs b/src-tauri/src/slopfab/types.rs
index 22119b2..53c2976 100644
--- a/src-tauri/src/slopfab/types.rs
+++ b/src-tauri/src/slopfab/types.rs
@@ -39,6 +39,8 @@ pub fn gpu_devices() -> Vec<GpuDevice> {
#[serde(rename_all = "camelCase")]
pub struct GenerationRequest {
pub job_id: String,
+ #[serde(default)]
+ pub video_transition: Option<String>,
pub prompt: String,
pub frames: i32,
#[serde(default)]
diff --git a/src-tauri/src/tests/scenes.rs b/src-tauri/src/tests/scenes.rs
index a7bf8ff..678062a 100644
--- a/src-tauri/src/tests/scenes.rs
+++ b/src-tauri/src/tests/scenes.rs
@@ -265,10 +265,18 @@ fn a_shot_name_survives_the_project_round_trip() {
#[test]
fn scene_types_and_character_replacement_inputs_survive_save_and_reopen() {
- for scene_type in ["first-last-frame", "animate", "character-replace"] {
+ for scene_type in [
+ "first-last-frame",
+ "animate",
+ "character-replace",
+ "extend",
+ "bridge",
+ ] {
let mut config = scene_fixture();
let job = &mut config.generation_jobs[0];
job.scene_type = Some(scene_type.into());
+ job.start_video_reference_id = Some("start-video".into());
+ job.end_video_reference_id = Some("end-video".into());
let shot = &mut job.shots.as_mut().unwrap()[0];
shot.video_reference_id = Some("source-video".into());
shot.character_reference_id = Some("new-character".into());
@@ -276,6 +284,18 @@ fn scene_types_and_character_replacement_inputs_survive_save_and_reopen() {
let normalized = validate_and_normalize_config(config).unwrap();
let saved = serde_json::to_string(&normalized).unwrap();
let restored: ProjectConfig = serde_json::from_str(&saved).unwrap();
+ assert_eq!(
+ restored.generation_jobs[0]
+ .start_video_reference_id
+ .as_deref(),
+ Some("start-video")
+ );
+ assert_eq!(
+ restored.generation_jobs[0]
+ .end_video_reference_id
+ .as_deref(),
+ Some("end-video")
+ );
assert_eq!(
restored.generation_jobs[0].scene_type.as_deref(),
Some(scene_type)
diff --git a/src/components/workspace/GeneratorView.test.tsx b/src/components/workspace/GeneratorView.test.tsx
index 9310891..3225add 100644
--- a/src/components/workspace/GeneratorView.test.tsx
+++ b/src/components/workspace/GeneratorView.test.tsx
@@ -152,6 +152,44 @@ it("refuses known first/last-frame weights for Character Replace", () => {
expect(templateSceneBlocker("character-replace", viggleAnimateTemplate())).toContain("MiniMax prompt");
});
+it.each(["extend", "bridge"] as const)("submits %s with ordered video anchors and the shot prompt", (type) => {
+ const initial = project();
+ initial.generationJobs = [createDraftGenerationJob("The dancer turns toward the door.", { id: "transition", title: "Transition" })];
+ initial.references = ["end", "start"].map((id) => ({ id, kind: "video" as const, name: id, description: "", intendedUse: [],
+ sourcePath: `C:/${id}.mp4`, video: { startSeconds: 1, durationSeconds: 3, includeAudio: true }, createdAt: "2026-09-21T00:00:00.000Z" }));
+ let latest = initial;
+ const submitted = vi.fn();
+ function Harness() {
+ const [config, setConfig] = useState(initial);
+ latest = config;
+ return <GeneratorView config={config} folderPath="C:/project" runtime={readyRuntime}
+ onChange={setConfig} onGenerate={submitted} onOpenTimeline={() => undefined} />;
+ }
+ render(<Harness />);
+ fireEvent.change(screen.getByLabelText("Scene type"), { target: { value: type } });
+ expect(screen.queryByLabelText("Start frame for this scene")).toBeNull();
+ const generate = within(screen.getByRole("region", { name: "Transition" })).getByRole("button", { name: "Generate" });
+ expect(generate).toBeDisabled();
+ fireEvent.change(screen.getByLabelText("Start video reference for this scene"), { target: { value: "start" } });
+ if (type === "bridge") {
+ expect(generate).toBeDisabled();
+ fireEvent.change(screen.getByLabelText("End video reference for this scene"), { target: { value: "end" } });
+ } else expect(screen.queryByLabelText("End video reference for this scene")).toBeNull();
+ expect(generate).toBeEnabled();
+ fireEvent.click(generate);
+ const request = submitted.mock.calls[0][0][0].request;
+ expect(request.videoTransition).toBe(type);
+ expect(request.referenceVideos.map((video: { sourcePath: string }) => video.sourcePath)).toEqual(type === "extend" ? ["C:/start.mp4"] : ["C:/start.mp4", "C:/end.mp4"]);
+ expect(request.referenceVideos.every((video: { includeAudio: boolean }) => !video.includeAudio)).toBe(true);
+ expect(request.referencePaths).toEqual([]);
+ expect(request).not.toHaveProperty("previousSceneId");
+ expect(request.prompt).toContain("The dancer turns toward the door.");
+ expect(parseProjectConfig(JSON.parse(JSON.stringify(latest))).generationJobs[0].startVideoReferenceId).toBe("start");
+ fireEvent.click(screen.getByRole("button", { name: "Shot 1 of Transition" }));
+ fireEvent.change(screen.getByLabelText("Describe shot 1"), { target: { value: "" } });
+ expect(generate).toBeDisabled();
+});
+
const project = (): ProjectConfig => {
const base = createProjectConfig({
name: "Drag test",
diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsx
index 4cc26f9..ae1b2b1 100644
--- a/src/components/workspace/GeneratorView.tsx
+++ b/src/components/workspace/GeneratorView.tsx
@@ -1,7 +1,7 @@
import type { GenerationSubmission } from "../../lib/workQueue";
import { loadLoras, subscribeLoras } from "../../lib/loras";
import { refreshDownloadedLoras } from "../../lib/weightDownloads";
-import { characterReplaceBlocker, usableVideoReferences, type SceneType } from "../../lib/project";
+import { characterReplaceBlocker, isVideoTransition, videoTransitionBlocker, usableVideoReferences, type SceneType } from "../../lib/project";
import { referenceRefmodInputs } from "../../lib/project";
import { ChevronDown, Plus, Square, Trash2, WandSparkles } from "lucide-react";
import { invoke } from "@tauri-apps/api/core";
@@ -167,7 +167,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo
if (updates.sceneType && templateSceneBlocker(updates.sceneType, selectedTemplate)) {
const candidates = templateSettings.templates.filter((template) => !templateNeedsDownload(template)
&& !templateSceneBlocker(updates.sceneType!, template));
- const compatible = (updates.sceneType === "character-replace"
+ const compatible = (updates.sceneType === "character-replace" || isVideoTransition(updates)
? candidates.find((template) => /ref2v/i.test(template.paths.transformer)) : undefined) ?? candidates[0];
if (compatible) chooseGeneratorTemplate(compatible.id);
}
@@ -310,6 +310,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo
const canvas = generationDimensions(config.settings.resolution, config.settings.aspectRatio);
return {
jobId: job.id,
+ ...(job.sceneType === "extend" || job.sceneType === "bridge" ? { videoTransition: job.sceneType } : {}),
// Recompiled from current state so edits to a bound reference or a
// retimed shot reach the engine, rather than sending a prompt frozen at
// draft-creation time. This is the ONE string slopfab is given, and it is
@@ -331,7 +332,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo
name: reference.name, relativePath: reference.relativePath, sourcePath: reference.sourcePath,
startSeconds: reference.video?.startSeconds ?? 0,
durationSeconds: reference.video?.durationSeconds ?? 2,
- includeAudio: reference.video?.includeAudio ?? true,
+ includeAudio: isVideoTransition(job) ? false : reference.video?.includeAudio ?? true,
})),
};
};
@@ -398,10 +399,10 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo
const batchScenesReady: GenerationJob[] = [];
for (const [index, job] of jobs.entries()) {
if (job.status === "queued" || job.status === "generating" || job.status === "ready") continue;
- if (job.sceneType !== "character-replace" && job.usePreviousSceneLastFrame && index === 0) continue;
+ if (!isVideoTransition(job) && job.sceneType !== "character-replace" && job.usePreviousSceneLastFrame && index === 0) continue;
if (templateSceneBlocker(sceneTypeFor(job), selectedTemplate) || sendBlocker(job, config.references)) continue;
const previous = jobs[index - 1];
- const previousWillRender = job.usePreviousSceneLastFrame && previous &&
+ const previousWillRender = !isVideoTransition(job) && job.usePreviousSceneLastFrame && previous &&
(batchScenesReady.includes(previous) || ["queued", "generating", "ready"].includes(previous.status));
if (previousWillRender || sceneGenerationSeed(job) === RANDOM_GENERATION_SEED || job.status !== "completed"
|| !job.outputRelativePath
@@ -415,7 +416,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo
const generationBlocker = (job: GenerationJob): string | null => {
if (!runtimeReady) return runtimeError ?? generatorRuntime?.detail ?? "The video generator is not ready.";
if (job.status === "ready") return "This scene is being saved now.";
- if (job.sceneType !== "character-replace" && job.usePreviousSceneLastFrame && jobs[0]?.id === job.id) return "This scene needs a previous scene to continue.";
+ if (!isVideoTransition(job) && job.sceneType !== "character-replace" && job.usePreviousSceneLastFrame && jobs[0]?.id === job.id) return "This scene needs a previous scene to continue.";
return templateSceneBlocker(sceneTypeFor(job), selectedTemplate) ?? sendBlocker(job, config.references);
};
@@ -531,7 +532,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo
index={shotIndex}
endsAt={shotIndex + 1 < selectedShots.length ? selectedShots[shotIndex + 1].startSeconds : sceneDurationSeconds(selected)}
duration={sceneDurationSeconds(selected)}
- references={config.references}
+ references={isVideoTransition(selected) ? sceneGenerationReferences(selected, config.references) : config.references}
disabled={false}
onChange={(updates) => patchShot(selected, openShot.id, updates)}
/>
@@ -631,6 +632,10 @@ function sendBlocker(job: GenerationJob, references: ProjectReference[]): string
const shots = sceneShots(job);
const animate = job.sceneType === "animate";
const characterReplace = job.sceneType === "character-replace";
+ if (isVideoTransition(job)) {
+ const blocker = videoTransitionBlocker(job, references);
+ if (blocker) return blocker;
+ }
if (characterReplace) {
const blocker = characterReplaceBlocker(job, references);
if (blocker) return blocker;
@@ -659,7 +664,7 @@ function sendBlocker(job: GenerationJob, references: ProjectReference[]): string
export function templateSceneBlocker(type: SceneType, template: GeneratorTemplate): string | null {
if (type === "animate" && template.mode !== "animate") return "Select an Animate generator for this scene.";
if (type !== "animate" && template.mode === "animate") return "Select a MiniMax prompt generator for this scene.";
- if (type === "character-replace" && /fl2v/i.test(template.paths.transformer)) return "Select a References or Singularity generator for Character Replace.";
+ if ((type === "character-replace" || type === "extend" || type === "bridge") && /fl2v/i.test(template.paths.transformer)) return `Select a References or Singularity generator for ${type === "character-replace" ? "Character Replace" : type === "extend" ? "Extend" : "Bridge"}.`;
return null;
}
diff --git a/src/components/workspace/SceneEditor.tsx b/src/components/workspace/SceneEditor.tsx
index 82ee43e..a1c3967 100644
--- a/src/components/workspace/SceneEditor.tsx
+++ b/src/components/workspace/SceneEditor.tsx
@@ -5,6 +5,7 @@ import {
danglingReferenceTokens,
isReferenceUsable,
isVisualReference,
+ isVideoTransition,
referenceImages,
usableVideoReferences,
normalizeSceneShots,
@@ -325,6 +326,7 @@ export function SceneInspector({ job, shots, references, previousScene, defaultS
}) {
const animate = sceneType === "animate";
const characterReplace = sceneType === "character-replace";
+ const transition = isVideoTransition({ sceneType });
const look = SHOT_TAG_GROUPS.find((group) => group.id === "visualStyle")!;
// The style is read off the first shot that carries one, so that is where it
// is written. One place, never a second field that could disagree with it.
@@ -345,9 +347,32 @@ export function SceneInspector({ job, shots, references, previousScene, defaultS
<option value="first-last-frame">First &amp; Last Frame</option>
<option value="animate">Animate</option>
<option value="character-replace">Character Replace</option>
+ <option value="extend">Extend</option>
+ <option value="bridge">Bridge</option>
</select>
</label>
{characterReplace && <p>Open a shot to select its source video and new character reference.</p>}
+ {transition && <>
+ <label className="scene-settings__field">
+ <span>{sceneType === "bridge" ? "Start video reference" : "Video reference"}</span>
+ <select aria-label="Start video reference for this scene" value={job.startVideoReferenceId ?? ""} disabled={disabled}
+ onChange={(event) => onChange({ startVideoReferenceId: event.target.value || null })}>
+ <option value="">Select a video</option>
+ {job.startVideoReferenceId && !usableVideoReferences(references).some((reference) => reference.id === job.startVideoReferenceId) && <option value={job.startVideoReferenceId}>Unavailable video reference</option>}
+ {usableVideoReferences(references).map((reference) => <option key={reference.id} value={reference.id}>{reference.name}</option>)}
+ </select>
+ </label>
+ {sceneType === "bridge" && <label className="scene-settings__field">
+ <span>End video reference</span>
+ <select aria-label="End video reference for this scene" value={job.endVideoReferenceId ?? ""} disabled={disabled}
+ onChange={(event) => onChange({ endVideoReferenceId: event.target.value || null })}>
+ <option value="">Select a video</option>
+ {job.endVideoReferenceId && !usableVideoReferences(references).some((reference) => reference.id === job.endVideoReferenceId) && <option value={job.endVideoReferenceId}>Unavailable video reference</option>}
+ {usableVideoReferences(references).map((reference) => <option key={reference.id} value={reference.id}>{reference.name}</option>)}
+ </select>
+ </label>}
+ <p>{sceneType === "bridge" ? "Connect the end of the start video to the beginning of the end video." : "Continue from the end of the selected video."} Open a shot to describe the new action. Scene length controls only the new segment.</p>
+ </>}
{!characterReplace && <>
{animate && <label className="scene-settings__field">
<span>Reference video</span>
@@ -383,7 +408,7 @@ export function SceneInspector({ job, shots, references, previousScene, defaultS
</select>
{!chosen && defaultLook && <small>Using project Look: {look.options.find((option) => option.id === defaultLook)?.label ?? defaultLook}.</small>}
</label>}
- <div className="scene-settings__field">
+ {!transition && <div className="scene-settings__field">
<span>{animate ? "Repainted scene frame" : "Start frame"}</span>
<div className="scene-settings__start-frame">
<select
@@ -416,8 +441,8 @@ export function SceneInspector({ job, shots, references, previousScene, defaultS
<small>{animate ? "Use a frame of the driving video with the character repainted. Keep its pose, framing, background and lighting." : job.usePreviousSceneLastFrame
? previousScene ? `Continues “${previousScene.title}” using its saved latents with 22 overlapping frames. Generate that scene first, or use Generate All.` : "Move this scene after another scene to continue it."
: "The selected image anchors the opening frame."}</small>
- </div>
- {!animate && <div className="scene-settings__field">
+ </div>}
+ {!animate && !transition && <div className="scene-settings__field">
<span>Last frame</span>
<div className="scene-settings__start-frame">
<select value={job.endFrameReferenceId ?? ""} disabled={disabled} aria-label="Last frame for this scene"
diff --git a/src/lib/project.transitions.test.ts b/src/lib/project.transitions.test.ts
new file mode 100644
index 0000000..4162359
--- /dev/null
+++ b/src/lib/project.transitions.test.ts
@@ -0,0 +1,48 @@
+import { expect, it } from "vitest";
+import { compileGenerationJobPrompt, createDraftGenerationJob, generationJobSchema, sceneGenerationReferences,
+ sceneGenerationSnapshot, videoTransitionBlocker, usableReferenceImages, type ProjectReference } from "./project";
+
+const video = (id: string): ProjectReference => ({ id, kind: "video", name: id, description: "", intendedUse: [],
+ sourcePath: `C:/clips/${id}.mp4`, video: { startSeconds: 2, durationSeconds: 3, includeAudio: true }, createdAt: "2026-09-21T00:00:00.000Z" });
+const references = [video("end"), video("start")];
+const scene = (sceneType: "extend" | "bridge") => ({ ...createDraftGenerationJob("The dancer turns and walks toward the door.", { sceneType }),
+ startVideoReferenceId: "start", endVideoReferenceId: "end", startFrameReferenceId: "stale", usePreviousSceneLastFrame: true });
+
+it.each(["extend", "bridge"] as const)("round trips %s and compiles text with explicit temporal roles", (type) => {
+ const job = scene(type);
+ expect(generationJobSchema.parse(JSON.parse(JSON.stringify(job)))).toEqual(job);
+ const bound = sceneGenerationReferences(job, references);
+ expect(bound.map(({ id }) => id)).toEqual(type === "extend" ? ["start"] : ["start", "end"]);
+ const prompt = compileGenerationJobPrompt(job, references);
+ expect(prompt).toContain("The dancer turns and walks toward the door.");
+ expect(prompt).toContain("immediately after the final frame of <Video 1>");
+ expect(prompt.includes("before the opening frame of <Video 2>")).toBe(type === "bridge");
+ expect(prompt).not.toContain("first frame of the video");
+ expect(videoTransitionBlocker(job, references)).toBeNull();
+});
+
+it("keeps preview and submission numbering identical when library order differs", () => {
+ const job = scene("bridge");
+ expect(compileGenerationJobPrompt(job, references)).toBe(compileGenerationJobPrompt(job, sceneGenerationReferences(job, references)));
+ const withStills = references.map((reference) => ({ ...reference, images: [{ id: "still", name: "Still", sourcePath: "C:/still.png" }],
+ refmods: [{ id: "refmod", name: "Old", sourcePath: "C:/old.safetensors", strength: 1, copies: 1 }] }));
+ expect(usableReferenceImages(sceneGenerationReferences(job, withStills))).toEqual([]);
+});
+
+it("blocks absent endpoints, identical references, short sources and unbound citations", () => {
+ expect(videoTransitionBlocker({ ...scene("extend"), startVideoReferenceId: null }, references)).toContain("start video");
+ expect(videoTransitionBlocker({ ...scene("bridge"), endVideoReferenceId: null }, references)).toContain("end video");
+ expect(videoTransitionBlocker({ ...scene("bridge"), endVideoReferenceId: "start" }, references)).toContain("different");
+ expect(videoTransitionBlocker(scene("extend"), [{ ...video("start"), video: { startSeconds: 0, durationSeconds: .5, includeAudio: false } }])).toContain("22 frames");
+ const job = scene("extend");
+ job.shots![0].action = "Follow @[ref:end]";
+ expect(videoTransitionBlocker(job, references)).toContain("cite only");
+});
+
+it("captures the native transition mode in generation snapshots", () => {
+ const job = scene("extend");
+ const input = { prompt: "Continue", frames: 144, steps: 20, seed: 1, canvasWidth: 736, canvasHeight: 416, referencePaths: [] };
+ const extend = sceneGenerationSnapshot(job, { ...input, videoTransition: "extend" });
+ expect(JSON.parse(extend).videoTransition).toBe("extend");
+ expect(extend).not.toBe(sceneGenerationSnapshot(job, { ...input, videoTransition: "bridge" }));
+});
diff --git a/src/lib/project.ts b/src/lib/project.ts
index 3929ce6..9765567 100644
--- a/src/lib/project.ts
+++ b/src/lib/project.ts
@@ -356,8 +356,9 @@ export const SCENE_MIN_SECONDS = 0;
* length is read as — the length every shot has always been generated at. */
export const DEFAULT_SCENE_SECONDS = 6;
-export const sceneTypeSchema = z.enum(["first-last-frame", "animate", "character-replace"]);
+export const sceneTypeSchema = z.enum(["first-last-frame", "animate", "character-replace", "extend", "bridge"]);
export type SceneType = z.infer<typeof sceneTypeSchema>;
+export const isVideoTransition = (job: Pick<GenerationJob, "sceneType">): boolean => job.sceneType === "extend" || job.sceneType === "bridge";
export const sceneShotSchema = z.object({
id: idSchema,
@@ -434,6 +435,8 @@ export function actionReferenceIds(action: string): string[] {
export const generationJobSchema = z.object({
id: idSchema,
sceneType: sceneTypeSchema.nullish(),
+ startVideoReferenceId: idSchema.nullish(),
+ endVideoReferenceId: idSchema.nullish(),
title: z.string().min(1),
// Not `.min(1)` any more, and neither is `creativeBrief`: a scene the user has
// emptied out has no text to mirror here, and inventing one would put words in
@@ -805,6 +808,14 @@ export function usableVideoReferences(references: ProjectReference[]): ProjectRe
* order. Frame anchors use their first image, even on a multi-image reference;
* the same anchor selected for both ends is sent only once. */
export function sceneGenerationReferences(job: GenerationJob, references: ProjectReference[]): ProjectReference[] {
+ if (isVideoTransition(job)) {
+ const ids = [job.startVideoReferenceId, ...(job.sceneType === "bridge" ? [job.endVideoReferenceId] : [])];
+ // Role order, not library order: native video 1 is the tail; video 2 is the head.
+ return ids.flatMap((id) => {
+ const reference = usableVideoReferences(references).find((candidate) => candidate.id === id);
+ return reference ? [{ ...reference, images: [], refmods: [] }] : [];
+ });
+ }
if (job.sceneType === "character-replace") {
const ids = sceneShots(job).flatMap((shot) => [shot.videoReferenceId, shot.characterReferenceId]);
return references.filter((reference) => ids.includes(reference.id));
@@ -819,7 +830,7 @@ export function sceneGenerationReferences(job: GenerationJob, references: Projec
/** Resolve the adjacent scene when preparing a request; queued work captures
* its id so subsequent board edits cannot change the source of that run. */
export function sceneFrameInputs(job: GenerationJob, config: ProjectConfig) {
- if (job.sceneType === "character-replace" || !job.usePreviousSceneLastFrame) return { job, references: sceneGenerationReferences(job, config.references) };
+ if (isVideoTransition(job) || job.sceneType === "character-replace" || !job.usePreviousSceneLastFrame) return { job, references: sceneGenerationReferences(job, config.references) };
const previous = config.generationJobs[config.generationJobs.findIndex((candidate) => candidate.id === job.id) - 1];
const resolved = { ...job, startFrameReferenceId: undefined };
return { job: resolved, references: sceneGenerationReferences(resolved, config.references),
@@ -863,6 +874,7 @@ const addedStop = (text: string): PromptSegment[] => (endSentence(text) === text
* to show the same bytes for both. */
export interface ScenePrompt {
shots: readonly SceneShot[];
+ videoTransition?: "extend" | "bridge";
startFrameReferenceId?: string | null;
endFrameReferenceId?: string | null;
/** Base guide §4.6 / §4.7. Blank or absent falls back to the two default
@@ -912,6 +924,7 @@ export function sceneGenerationSeed(job: GenerationJob): number {
export interface SceneGenerationInput {
prompt: string;
+ videoTransition?: "extend" | "bridge";
frames: number;
steps: number;
seed: number;
@@ -936,6 +949,7 @@ export function sceneGenerationSnapshot(job: GenerationJob, input: SceneGenerati
return JSON.stringify({
...(job.sceneType ? { sceneType: job.sceneType } : {}),
prompt: input.prompt,
+ ...(input.videoTransition ? { videoTransition: input.videoTransition } : {}),
frames: input.frames,
steps: input.steps,
seed: input.seed,
@@ -981,9 +995,26 @@ export function compileMiniMaxH3PromptSegments(
export function compileGenerationJobSegments(job: GenerationJob, references: ProjectReference[] = [], defaultLook?: string | null): PromptSegment[] {
if (job.sceneType === "character-replace") return compileCharacterReplaceSegments(job, references);
+ if (job.sceneType === "extend" || job.sceneType === "bridge") return compileScenePromptSegments({
+ shots: sceneShots(job), videoTransition: job.sceneType, soundscape: job.soundscape, music: job.music,
+ }, sceneGenerationReferences(job, references), defaultLook);
return compileScenePromptSegments({ shots: sceneShots(job), startFrameReferenceId: job.startFrameReferenceId, endFrameReferenceId: job.endFrameReferenceId, soundscape: job.soundscape, music: job.music }, references, defaultLook);
}
+export function videoTransitionBlocker(job: GenerationJob, references: ProjectReference[]): string | null {
+ const videos = usableVideoReferences(references);
+ const start = videos.find((reference) => reference.id === job.startVideoReferenceId);
+ const end = videos.find((reference) => reference.id === job.endVideoReferenceId);
+ if (!start) return "Select a start video reference for this scene.";
+ if (job.sceneType === "bridge" && !end) return "Select an end video reference for this scene.";
+ if (job.sceneType === "bridge" && start.id === end?.id) return "Choose different start and end video references. Use separate trimmed references to bridge within one video.";
+ const bound = sceneGenerationReferences(job, references);
+ if (bound.some((reference) => (reference.video?.durationSeconds ?? 2) < 22 / GENERATION_FRAME_RATE)) return "Each source clip needs at least 22 frames (0.917 seconds) for latent encoding.";
+ if (bound.reduce((total, reference) => total + (reference.video?.durationSeconds ?? 2), 0) > 15) return "Source clips must total no more than 15 seconds. Shorten their ranges in References.";
+ if (danglingReferenceTokens(sceneShots(job), bound).length) return "These shots can cite only the selected start and end video references.";
+ return null;
+}
+
export function characterReplaceBlocker(job: GenerationJob, references: ProjectReference[]): string | null {
const videos = usableVideoReferences(references);
const characters = usableImageReferences(references).filter((reference) => reference.kind !== "video");
@@ -1245,7 +1276,8 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Proje
// optional opening picture additionally anchors the first frame. The summary
// reuses existing labels only and carries the user's lines through in order.
const summary: PromptSegment[] = [
- frame("[reference generation] "),
+ frame(scene.videoTransition === "extend" ? "[video continuation] Continue from the final frame of <Video 1>. "
+ : scene.videoTransition === "bridge" ? "[video continuation + reference generation] Generate the missing segment after <Video 1> and before <Video 2>. " : "[reference generation] "),
...compiled.flatMap((shot) => [
...(shot.index === 0 ? [] : [frame(" ")]),
...shot.body,
@@ -1281,6 +1313,9 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Proje
frame("The target video is in a "),
styleFromTag ? tagged(midSentenceStyle(style)) : frame(midSentenceStyle(style)),
frame(" style.\n"),
+ ...(scene.videoTransition ? [frame(scene.videoTransition === "extend"
+ ? "Begin immediately after the final frame of <Video 1>, continuing its subject identity, pose, motion, lighting and camera trajectory. Follow the text direction below. Output only the new continuation; do not replay the source clip.\n"
+ : "Begin immediately after the final frame of <Video 1>. Follow the text direction below, developing continuous action that reaches the subject positions, motion, lighting and camera framing immediately before the opening frame of <Video 2>. Output only the new connecting segment; do not replay either source clip.\n")] : []),
...compiled.flatMap((shot) => [
frame(shot.index === 0 ? marker(shot) : `\n${marker(shot)}`),
// Framing leads the sentence here, so it takes the capital.
@@ -1300,12 +1335,16 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Proje
return [
frame("subject_definitions:\n"),
+ ...(scene.videoTransition ? [frame("<Video 1> is the starting source video; its final frames provide the temporal latent anchor for the new segment.\n"),
+ ...(scene.videoTransition === "bridge" ? [frame("<Video 2> is the ending source video; its opening frames provide the temporal latent anchor for the end of the new segment.\n")] : [])] : []),
...startDefinition,
...endDefinition,
...definitions,
frame("\n\nsummary:\n"),
...summary,
frame(`\n\nretention_analysis:\n${retention.join("\n")}`),
+ ...(scene.videoTransition ? [frame("\n<Video 1>: partially_preserved - continue from its ending state without copying its completed action."),
+ ...(scene.videoTransition === "bridge" ? [frame("\n<Video 2>: partially_preserved - approach its opening state with continuous motion; do not repeat the ending clip.")] : [])] : []),
frame("\n\ndetailed_description:\n"),
...detailed,
frame("\n\noverall_soundscape:\n"),
diff --git a/src/lib/runtime.ts b/src/lib/runtime.ts
index fc8070e..ac1819b 100644
--- a/src/lib/runtime.ts
+++ b/src/lib/runtime.ts
@@ -81,6 +81,7 @@ export interface AgentTurnResponse {
export interface SlopfabGenerationRequest {
jobId: string;
+ videoTransition?: "extend" | "bridge";
prompt: string;
frames: number;
stillImage?: boolean;