AI media harness for planning, generating, and editing locally
TypeScript
Follow MiniMax frame prompt mapping
Bitti15a243017ed6
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex b6b55b2..1b482d4 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -22,6 +22,7 @@ Changes since 0.3.2.## Fixes and improvements+- First & Last Frame prompts follow MiniMax's I2VA, L2VA and FL2VA formats, with ending anchors timed to the final shot.- Fixed AppImage launcher permissions for users other than the package builder.- Retired Long Shot from scene choices; use Bridge to connect videos. Existing Long Shot scenes remain compatible.diff --git a/docs/scene-types.md b/docs/scene-types.mdindex b30dd80..436fca2 100644--- a/docs/scene-types.md+++ b/docs/scene-types.md@@ -10,7 +10,7 @@ The Scene panel saves a type on each scene. Long Shot is retired; use Bridge to- **Prompt** is the default for ordinary video scenes. It supports shot descriptions, speech, Look, sound, music and references cited in prompts, without start- or last-frame selectors. Stored frame anchors and continuation links are inactive.- **Single Shot** keeps its main prompt in the Shot panel and an optional **Ending prompt** in the Scene panel, both with reference support. It generates an ending first, then anchors the full shot to it; a blank ending prompt uses the main prompt. **Starting video** accepts any generated scene. Its final latents anchor only the beginning; the middle starts from fresh noise and is guided toward the generated ending. The former Continuation strength is ignored. Use matching resolution/upscale settings, at least two seconds, and updated workers. Generate all handles dependency order.-- **First & Last Frame** adds optional start- and last-frame anchors to the same controls. Older scenes without a type retain this type when they have frame selections; otherwise they use Prompt. Switching types retains saved frame selections for later use.+- **First & Last Frame** adds optional start- and last-frame anchors. Prompts follow the [MiniMax base guide](https://huggingface.co/MiniMaxAI/MiniMax-H3/blob/main/docs/VIDEO_PROMPT_WRITING_GUIDE_base_en.md): no frames uses T2VA, first only I2VA, last only L2VA, and both FL2VA. Ending anchors target the final shot at the generated duration, including frame alignment. Additional subject/audio/video references retain their full-reference sections. Older scenes without a type retain this type when they have frame selections; otherwise they use Prompt. Switching types retains saved frame selections for later use.- **Backdrop** generates the described subject and action against a selected green, blue, black or white background (green by default). The compiled prompt requests a uniform color across all shots, with no scenery, floor, horizon, texture, gradients or backdrop shadows. Prompt references guide the subject; their original settings are replaced. Stored frame anchors and continuation links are inactive. Apply Chroma Key to the generated timeline clip and select the matching backdrop or Auto to remove it. Generation still produces ordinary video: transparency is applied by the effect. Choose a color absent from the subject and describe action that fits inside the frame.- **Continue** uses another scene's saved latents. Choose the source scene, beginning or end (default: end), and overlap in frames (default: 22; increments of 17 at 24 fps). Generate the source first, or use Generate All to render dependencies in order. Scene length controls the new segment. The saved video keeps Slopfab's full joined video and audio; adjacent source and continuation clips use that shared decode in preview and export, while trims remain relative to each scene. Regenerate older Continue scenes to preserve both sides of the decoded boundary. Old Previous scene selections become Continue scenes linked to their original source; reordering scenes keeps that link.- **Animate** uses an Animate generator, one driving video and one repainted scene frame. It does not send a text prompt.diff --git a/src/lib/project.prompt.test.ts b/src/lib/project.prompt.test.tsindex 82ce381..d499292 100644--- a/src/lib/project.prompt.test.ts+++ b/src/lib/project.prompt.test.ts@@ -2,6 +2,55 @@ import { expect, it } from "vitest";import { compileGenerationJobPrompt, createDraftGenerationJob, createProjectConfig, parseProjectConfig, sceneGenerationReferences, sceneTypeFor, type ProjectReference } from "./project";import { sceneGenerationRequest } from "./sceneGeneration";+it.each([+ [undefined, undefined, null],+ ["start", undefined, "For the target video, at 0.00 seconds into the target video, <Picture 1> (from [Shot 1]) is fully referenced."],+ [undefined, "end", "How the reference pictures align with the target video — <Picture 1> (from [Shot 2]) aligns with the 6.58-second mark of the target video."],+ ["start", "end", "How the reference pictures align with the target video — Picture 1 (from Shot 1) aligns with the 0.00-second mark of the target video; Picture 2 (from Shot 2) aligns with the 6.58-second mark of the target video."],+] as const)("uses the base prompt mapping for start=%s, end=%s", (startFrameReferenceId, endFrameReferenceId, instruction) => {+ const config = createProjectConfig({ name: "Anchors", prompt: "A cyclist opens an umbrella.", resolution: "416p", aspectRatio: "16:9", targetDurationSeconds: 6 });+ // Library order must not change the picture numbers in the prompt or payload.+ config.references = ["end", "unused", "start"].map((id) => ({ id, name: id, kind: "image", description: "", intendedUse: [], relativePath: `references/${id}.png`, createdAt: config.createdAt }));+ const job = { ...config.generationJobs[0], sceneType: "first-last-frame" as const, durationSeconds: 6,+ startFrameReferenceId, endFrameReferenceId,+ shots: [{ id: "one", startSeconds: 0, action: "A cyclist opens an umbrella." }, { id: "two", startSeconds: 3, action: "Water rolls off the fabric." }] };+ config.generationJobs = [job];+ const request = sceneGenerationRequest(job, config, "C:/Project", 20);+ const preview = compileGenerationJobPrompt(job, config.references);+ expect(request.prompt).toBe(preview);+ expect(request.referencePaths).toEqual([startFrameReferenceId, endFrameReferenceId].filter(Boolean).map((id) => `C:/Project/references/${id}.png`));+ expect(preview).toMatch(/integrated_multimodal_description: \[Shot 1\]/);+ expect(preview).toContain("[Shot 2] At 00:03.000");+ expect(preview).not.toContain("[Shot 3]");+ expect(preview).toContain("A cyclist opens an umbrella.");+ expect(preview).toContain("Water rolls off the fabric.");+ expect(preview).toContain("\n\noverall_soundscape: ");+ expect(preview).toContain("\n\nnon_diegetic_music: ");+ expect(preview).not.toContain("subject_definitions:");+ if (instruction) {+ expect(preview.startsWith(`${instruction}\n\nintegrated_multimodal_description:`)).toBe(true);+ expect(preview).toContain("Use the visual style established by <Picture 1>.");+ } else {+ expect(preview.startsWith("integrated_multimodal_description:")).toBe(true);+ expect(preview).not.toContain("<Picture");+ }+ if (endFrameReferenceId) {+ expect(preview).toContain("6.58 seconds, the end of [Shot 2].");+ expect(preview.indexOf("Gradually converge")).toBeGreaterThan(preview.indexOf("[Shot 2] At"));+ if (!startFrameReferenceId) expect(preview).toContain("this picture is the ending, not the opening");+ }+});++it("uses the aligned duration and keeps anchor citations when both anchors share an image", () => {+ const reference: ProjectReference = { id: "image", name: "Image", kind: "image", description: "", intendedUse: [], relativePath: "references/image.png", createdAt: "2026-10-28T00:00:00Z" };+ const job = { ...createDraftGenerationJob("@[ref:image]comes to life."), sceneType: "first-last-frame" as const, durationSeconds: 8, startFrameReferenceId: "image", endFrameReferenceId: "image" };+ const prompt = compileGenerationJobPrompt(job, [reference]);+ expect(sceneGenerationReferences(job, [reference])).toHaveLength(1);+ expect(prompt.split("\n")[0]).toBe("How the reference pictures align with the target video — Picture 1 (from Shot 1) aligns with the 0.00-second mark of the target video; Picture 1 (from Shot 1) aligns with the 8.00-second mark of the target video.");+ expect(prompt).toContain("<Picture 1> comes to life.");+ expect(prompt).not.toContain("Picture 2");+});+it("defaults ordinary scenes to Prompt while preserving legacy frame-based scenes", () => {const job = createDraftGenerationJob("A dancer spins.");expect(sceneTypeFor(job)).toBe("prompt");diff --git a/src/lib/project.test.ts b/src/lib/project.test.tsindex 610dea2..820f1a0 100644--- a/src/lib/project.test.ts+++ b/src/lib/project.test.ts@@ -564,7 +564,7 @@ describe("project schema", () => {expect(compileGenerationJobPrompt(endOnly, sceneGenerationReferences(endOnly, references))).toContain("<Picture 1> is the last frame of the video.");const same = { ...job, shots: [{ id: "shot", startSeconds: 0, action: "The subject turns." }], endFrameReferenceId: "start", referenceIds: [] };expect(usableReferenceImages(sceneGenerationReferences(same, references))).toHaveLength(1);- expect(compileGenerationJobPrompt(same, sceneGenerationReferences(same, references))).toContain("<Picture 1> is the last frame of the video.");+ expect(compileGenerationJobPrompt(same, sceneGenerationReferences(same, references))).toContain("Picture 1 (from Shot 1) aligns with the 0.00-second mark of the target video; Picture 1 (from Shot 1) aligns with the");});it("resolves scene continuity from board order and the current latent archive", () => {diff --git a/src/lib/project.ts b/src/lib/project.tsindex a9e7502..d4b9c16 100644--- a/src/lib/project.ts+++ b/src/lib/project.ts@@ -1168,6 +1168,8 @@ const addedStop = (text: string): PromptSegment[] => (endSentence(text) === text* to show the same bytes for both. */export interface ScenePrompt {shots: readonly SceneShot[];+ /** Effective generated duration, including H3's temporal frame alignment. */+ durationSeconds?: number;backdropColor?: BackdropColor;poseVideoReferenceId?: string | null;videoTransition?: "extend" | "bridge";@@ -1359,7 +1361,10 @@ export function compileGenerationJobSegments(job: GenerationJob, references: Proif (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);+ const frames = Math.round(sceneDurationSeconds(job) * GENERATION_FRAME_RATE);+ const durationSeconds = Math.max(22, Math.ceil((frames - 5) / 17) * 17 + 5) / GENERATION_FRAME_RATE;+ const boundReferences = sceneTypeFor(job) === "first-last-frame" ? sceneGenerationReferences(job, references) : references;+ return compileScenePromptSegments({ shots: sceneShots(job), durationSeconds, startFrameReferenceId: job.startFrameReferenceId, endFrameReferenceId: job.endFrameReferenceId, soundscape: job.soundscape, music: job.music }, boundReferences, defaultLook);}export function poseBlocker(job: GenerationJob, references: ProjectReference[]): string | null {@@ -1488,6 +1493,23 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Projeconst subjectNumber = new Map(usable.map((reference, index) => [reference.id, index + 1]));const sounds = usableAudioReferences(references);const audioNumber = referenceAudioNumbers(references, !scene.videoTransition);+ const imageReferenceIds = usableImageReferences(references).flatMap((reference) =>+ referenceImages(reference).map(() => reference.id));+ const pictureNumbers = new Map<string, number[]>();+ imageReferenceIds.forEach((referenceId, index) => pictureNumbers.set(referenceId, [...(pictureNumbers.get(referenceId) ?? []), index + 1]));+ const startPicture = startFrame ? pictureNumbers.get(startFrame.id)?.[0] ?? null : null;+ const endPicture = endFrame ? pictureNumbers.get(endFrame.id)?.[0] ?? null : null;+ const finalShot = shots.length;+ const finalTime = (scene.durationSeconds ?? DEFAULT_SCENE_SECONDS).toFixed(2);+ // Base guide §2.1: exactly one alignment instruction, before any core fields.+ const alignment = startPicture && endPicture+ ? `How the reference pictures align with the target video — Picture ${startPicture} (from Shot 1) aligns with the 0.00-second mark of the target video; Picture ${endPicture} (from Shot ${finalShot}) aligns with the ${finalTime}-second mark of the target video.`+ : startPicture+ ? `For the target video, at 0.00 seconds into the target video, <Picture ${startPicture}> (from [Shot 1]) is fully referenced.`+ : endPicture+ ? `How the reference pictures align with the target video — <Picture ${endPicture}> (from [Shot ${finalShot}]) aligns with the ${finalTime}-second mark of the target video.`+ : null;+ const alignmentSegments = alignment ? [frame(`${alignment}\n\n`)] : [];const compiled: CompiledShot[] = shots.map((shot, index) => {const body: PromptSegment[] = [];@@ -1497,7 +1519,7 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Projeif (part.kind === "text") {// Reference chips can touch the following word in the editor. Keep// inserted spacing attributed to Slopus, leaving user text intact.- if (/(?:<Subject \d+>|<Audio \d+>)$/.test(text) && /^[\p{L}\p{N}]/u.test(part.value)) {+ if (/(?:<Subject \d+>|<Audio \d+>|<Picture \d+>)$/.test(text) && /^[\p{L}\p{N}]/u.test(part.value)) {body.push(frame(" "));text += " ";}@@ -1505,9 +1527,13 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Projetext += part.value;continue;}- // A token whose reference is gone, undescribed or tagged as sound only- // has no <Subject N> to become. It is left out rather than guessed at,- // and the editor says so in words above the field — see `danglingTokens`.+ // Frame anchors keep their picture identity rather than becoming subjects.+ const anchor = part.value === startFrame?.id ? startPicture : part.value === endFrame?.id ? endPicture : null;+ if (anchor) {+ body.push(frame(`<Picture ${anchor}>`));+ text += `<Picture ${anchor}>`;+ continue;+ }const sound = audioNumber.get(part.value);if (sound) {body.push(frame(`<Audio ${sound}>`));@@ -1591,23 +1617,33 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Projeconst soundSegment = sound ? own(sound) : frame(DEFAULT_SOUNDSCAPE);const musicSegment = music ? own(music) : frame(DEFAULT_MUSIC);const backdropShot = scene.backdropColor ? [frame(` ${backdropShotDirection(scene.backdropColor)}`)] : [];-- if (usable.length === 0 && sounds.length === 0 && !startFrame && !endFrame) {- // T2VA — base guide §2.2 field list and order.+ const openingDirection = (shot: CompiledShot): PromptSegment[] => shot.index !== 0 ? []+ : startPicture ? [frame(`Begin in the subject positions, appearance, composition and setting of <Picture ${startPicture}>. Develop the described action continuously from this opening state. `)]+ : endPicture ? [frame(`Begin from a plausible earlier state compatible with <Picture ${endPicture}> and the described action; this picture is the ending, not the opening. `)] : [];+ const closingDirection = (shot: CompiledShot): PromptSegment[] => endPicture && shot.index === finalShot - 1+ ? [frame(` Gradually converge through the described action to the subject positions, object states, camera framing and composition of <Picture ${endPicture}> at ${finalTime} seconds, the end of [Shot ${finalShot}].`)] : [];++ if (usable.length === 0 && sounds.length === 0) {+ // T2VA / I2VA / FL2VA / L2VA share the base guide's three core fields.return [+ ...alignmentSegments,frame("integrated_multimodal_description: "),...(scene.backdropColor ? [frame(`${backdropDirection(scene.backdropColor)} `)] : []),...compiled.flatMap((shot) => [frame(shot.index === 0 ? marker(shot) : ` ${marker(shot)}`),- ...(shot.index === 0 ? [styleSegment, frame(", ")] : []),+ ...(shot.index === 0 ? (startPicture || endPicture) && !styleFromTag+ ? [frame(`Use the visual style established by <Picture ${startPicture ?? endPicture}>. `)]+ : [styleSegment, frame(", ")] : []),+ ...openingDirection(shot),// §4.1 order inside the shot: size, angle and lens sit in front of the// subject and its action....(shot.tags.framing.length > 0 ? [tagged(shot.tags.framing.join(", ")), frame(", ")] : []),...shot.body,- ...(scene.backdropColor ? addedStop(shot.text) : stop(shot)),+ ...(scene.backdropColor || (endPicture && shot.index === finalShot - 1) ? addedStop(shot.text) : stop(shot)),...tail(shot),...backdropShot,...dialogue(shot, shot.text.length > 0 || shot.tags.clauses.length > 0),+ ...closingDirection(shot),]),frame("\n\noverall_soundscape: "),soundSegment,@@ -1616,11 +1652,7 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Proje].filter((segment) => segment.value.length > 0);}- const imageReferenceIds = usableImageReferences(references).flatMap((reference) =>- referenceImages(reference).map(() => reference.id));- const pictureNumbers = new Map<string, number[]>();const videoNumbers = new Map(usableVideoReferences(references).map((reference, index) => [reference.id, index + 1]));- imageReferenceIds.forEach((referenceId, index) => pictureNumbers.set(referenceId, [...(pictureNumbers.get(referenceId) ?? []), index + 1]));const listOf = (values: string[]): string => values.length === 1? values[0]: `${values.slice(0, -1).join(", ")} and ${values[values.length - 1]}`;@@ -1670,8 +1702,6 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Projereturn detail ? [frame(`${lead}${label}: `), own(detail), ...addedStop(detail)] : [frame(`${lead}${label} is a reference audio clip.`)];});const definitions = [...subjectDefinitions, ...audioDefinitions];- const startPicture = startFrame ? pictureNumbers.get(startFrame.id)?.[0] ?? null : null;- const endPicture = endFrame ? pictureNumbers.get(endFrame.id)?.[0] ?? null : null;const startDefinition = startPicture? [frame(`<Picture ${startPicture}> is the first frame of the video.${definitions.length > 0 || endPicture ? "\n" : ""}`)]: [];@@ -1751,6 +1781,7 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Proje: "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)}`),+ ...openingDirection(shot),// Framing leads the sentence here, so it takes the capital....(shot.tags.framing.length > 0 ? [tagged(capitalize(shot.tags.framing.join(", "))), frame(", ")] : []),...shot.body,@@ -1764,10 +1795,12 @@ export function compileScenePromptSegments(scene: ScenePrompt, references: Proje...dialogue(shot, shot.text.length > 0 || featured[shot.index].length > 0 || shot.tags.clauses.length > 0),...(shot.index === 0 && startPicture ? [frame(` The opening frame matches <Picture ${startPicture}>.`)] : []),...(shot.index === compiled.length - 1 && endPicture ? [frame(` The closing frame matches <Picture ${endPicture}>.`)] : []),+ ...closingDirection(shot),]),];return [+ ...alignmentSegments,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")] : [])] : []),