AI media harness for planning, generating, and editing locally
TypeScript
Add scene history strip and primary take actions
Bitti879d88dc1798
diff --git a/README.md b/README.mdindex e4c0ecf..a460a13 100644--- a/README.md+++ b/README.md@@ -28,7 +28,7 @@ Slopus brings an AI assistant, a scene generator, reusable references, a timelin- **One workspace.** Every project has **Timeline**, **Video**, **Image**, **References** and **Export** tabs.- **Agent.** Plan scenes, create references and edit projects with Claude Code, Codex, OpenRouter or a local OpenAI-compatible model. Open the agent pane with Ctrl+Shift+A.-- **Scene generator.** Generate scenes with First & last frame, Animate, Pose, Character replace, Extend or Bridge. Set steps, seeds and presets; manage jobs in the **Work queue**.+- **Scene generator.** Generate scenes with First & last frame, Animate, Pose, Character replace, Extend or Bridge. Set steps, seeds and presets; manage jobs in the **Work queue**. Each scene keeps four takes and an editable Draft in its history strip. Select a take to restore its scene settings, use **Make Primary** to choose its timeline video, or **Duplicate** the scene.- **Shot controls.** Set timing, action, dialogue, language, camera and performance. Add scene-wide look, sound and music, and cite references with smart chips.- **References.** Reuse descriptions, images and video clips across scenes. Start from searchable presets, see where references are used, and trim clips with optional sound.- **RefMods.** Use pre-encoded H3 `.safetensors` references with Ref2VA generators for video, images, edits and icons. Set **Strength** and **Copies** per attachment.diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 6f2956e..c54dd1f 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -4,6 +4,8 @@ This alpha update adds Prompt video scenes, agent image drafts, Sol attention an## What's new+- **Scene generation history.** Each Video scene has a thumbnail strip on its right with up to four completed takes and a separate Draft for edits. Select a take to restore its shots, prompts and scene settings, or right-click and choose Make Primary to use its video on the timeline. Duplicate creates a new scene with independent copies of the selected scene's settings and shots.+- **Motions.** Create an empty Motion on the timeline and ask the agent to animate it with JavaScript. Edit named elements in the preview, adjust exposed parameters and view or change the full source in the inspector. Motions support transparent layering, scrubbing and video export. Render a Motion as a reference video to add it to References for MiniMax generation.- **Fibo 2.0 Base and editing capabilities.** Added the Base generator with the Dev transformer and shared Fibo encoder/VAE. A per-template Editing model switch controls image editing and Zoom, defaults off for Base and MOSS, and is preserved when sharing templates. Fibo Edit Turbo now supports Zoom with masked border generation that preserves the source image.diff --git a/src/components/ProjectWorkspace.test.ts b/src/components/ProjectWorkspace.test.tsindex a6a13a6..524893d 100644--- a/src/components/ProjectWorkspace.test.ts+++ b/src/components/ProjectWorkspace.test.ts@@ -348,7 +348,7 @@ describe("project workspace timecode", () => {// shot the user has no way to tell apart.expect(screen.getByRole("heading", { name: "First scene" })).not.toBeNull();expect(screen.queryByRole("heading", { name: "New scene draft" })).toBeNull();- expect(screen.queryByText("Draft")).toBeNull();+ expect(screen.getByRole("button", { name: "Draft of First scene" })).toBeInTheDocument();});it("leaves the monitor empty rather than explaining the emptiness", () => {diff --git a/src/components/workspace/GeneratorView.test.tsx b/src/components/workspace/GeneratorView.test.tsxindex 30e532f..afa0c7b 100644--- a/src/components/workspace/GeneratorView.test.tsx+++ b/src/components/workspace/GeneratorView.test.tsx@@ -1,4 +1,5 @@// @vitest-environment jsdom+import { completeSceneGeneration, sceneInput } from "../../lib/sceneHistory";import "@testing-library/jest-dom/vitest";import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";@@ -861,8 +862,8 @@ describe("Generator scene controls", () => {it("selects a scene from its header and keeps confirmed removal in the inspector", async () => {const state = setup();- expect(screen.queryByText("Draft")).not.toBeInTheDocument();- expect(screen.queryByText(/^Draft/)).not.toBeInTheDocument();+ expect(screen.getByRole("button", { name: "Draft of First scene" })).toBeInTheDocument();+ expect(screen.getByRole("button", { name: "Draft of Second scene" })).toBeInTheDocument();fireEvent.change(screen.getByRole("slider", { name: "First scene length in seconds" }), { target: { value: "10" } });expect(state.latest().generationJobs[0].durationSeconds).toBe(10);@@ -1250,3 +1251,42 @@ it("shows template shifts and locks active LoRA overrides without replacing saveexpect(JSON.parse(state.latest().generationJobs[0].generationSnapshot!)).toMatchObject({ videoSigmaShift: 6, audioSigmaShift: 3.5 });expect(state.latest().generationJobs[0].videoSigmaShift).toBe(8);});+++it("restores older takes and drafts, makes a take primary, and duplicates a scene", () => {+ let config = project();+ const id = config.generationJobs[0].id;+ const saveTake = (takeId: string) => {+ const job = config.generationJobs[0];+ config = completeSceneGeneration(config, id, { id: takeId, scene: sceneInput(job), createdAt: config.createdAt,+ media: { id: `asset-${id}`, kind: "generated", name: job.title, mimeType: "video/mp4", relativePath: `media/${takeId}.mp4`, createdAt: config.createdAt } });+ };+ config.generationJobs[0].music = "First music"; config.generationJobs[0].steps = 4; saveTake("one");+ config = { ...config, generationJobs: config.generationJobs.map((job, i) => i ? job : { ...job, music: "Second music", steps: 8 }) }; saveTake("two");+ const state = setup(config);+ fireEvent.change(screen.getByLabelText("The music of this scene"), { target: { value: "Draft music" } });+ fireEvent.click(screen.getByRole("button", { name: "Generation 1 of First scene" }));+ expect(state.latest().generationJobs[0]).toMatchObject({ music: "First music", steps: 4, outputRelativePath: "media/two.mp4" });+ fireEvent.click(screen.getByRole("button", { name: "Draft of First scene" }));+ expect(state.latest().generationJobs[0].music).toBe("Draft music");+ fireEvent.contextMenu(screen.getByRole("button", { name: "Generation 1 of First scene" }));+ fireEvent.click(screen.getByRole("menuitem", { name: "Make Primary" }));+ expect(state.latest().generationJobs[0].outputRelativePath).toBe("media/one.mp4");+ expect(state.latest().generationJobs[0].music).toBe("Draft music");+ fireEvent.contextMenu(screen.getByRole("region", { name: "First scene" }).querySelector(".scene-rule")!);+ fireEvent.click(screen.getByRole("menuitem", { name: "Duplicate" }));+ const copy = state.latest().generationJobs[1];+ expect(copy).toMatchObject({ title: "First scene copy", music: "Draft music", steps: 8, status: "draft" });+ expect(copy.generationHistory).toBeUndefined(); expect(copy.outputRelativePath).toBeFalsy();+});+++it("keeps scene-type changes when automatically choosing a compatible generator", async () => {+ vi.mocked(getEngineStatus).mockResolvedValue(readyRuntime);+ const prompt = { ...minimaxOriginalTemplate(), id: "prompt-template", name: "Prompt template", sources: {}, paths: { transformer: "prompt-transformer", textEncoder: "text", videoVae: "vae", audioVae: "audio", tokenizer: "tokens" } };+ const animate = { ...viggleAnimateTemplate(), id: "animate-template", name: "Animate template", sources: {}, loras: [], additionalSafetensors: [], paths: { transformer: "animate-transformer", textEncoder: "text", videoVae: "vae", audioVae: "audio", tokenizer: "tokens" } };+ saveGeneratorTemplateSettings({ templates: [prompt, animate], defaultTemplateId: prompt.id, catalogVersion: 10 });+ const state = setup();+ choose("Scene type", "Animate");+ await waitFor(() => expect(state.latest().generationJobs[0]).toMatchObject({ sceneType: "animate", generatorTemplateId: "animate-template" }));+});diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsxindex 7ce84cb..55ceb59 100644--- a/src/components/workspace/GeneratorView.tsx+++ b/src/components/workspace/GeneratorView.tsx@@ -1,3 +1,4 @@+import { duplicateScene, makeSceneGenerationPrimary, saveSceneDrafts, selectSceneGeneration } from "../../lib/sceneHistory";import { sceneGenerationRequest, sendBlocker, templateSceneBlocker } from "../../lib/sceneGeneration";import { longShotBlocker, longShotDependencies, longShotPosition } from "../../lib/longShot";export { templateSceneBlocker } from "../../lib/sceneGeneration";@@ -61,8 +62,10 @@ const readDensity = (): BoardDensity => {* one place to change any given thing. */export function GeneratorView({ config, folderPath, runtime = null, generationCompletionTimes = {}, onChange, selectedJobId, onSelectedJobChange, onRuntimeChange, onGenerate, onCancelGeneration, cancellingJobIds = new Set() }: GeneratorViewProps) {const jobs = config.generationJobs;+ const [selection, setSelection] = useState<GeneratorSelection>(() => ({ jobId: selectedJobId ?? jobs.find((job) => job.status === "generating")?.id ?? jobs[0]?.id ?? "", shotId: null }));const [templateSettings, setTemplateSettings] = useState(loadGeneratorTemplateSettings);- const selectedTemplate = defaultGeneratorTemplate(templateSettings, "video");+ const templateFor = (job?: GenerationJob) => templateSettings.templates.find(t => t.id === job?.generatorTemplateId) ?? defaultGeneratorTemplate(templateSettings, "video");+ const selectedTemplate = templateFor(jobs.find(j => j.id === selection.jobId));const defaultGenerationSteps = selectedTemplate.defaultSteps;const [generatorRuntime, setGeneratorRuntime] = useState<SlopfabStatus | null>(runtime);const [runtimeError, setRuntimeError] = useState<string | null>(null);@@ -76,7 +79,6 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo/* A scene is always what is named; the shot inside it is what a card opens.Opening the Generator, or arriving from a clip in the timeline, opens theSCENE — the thing that has a state, a prompt and a Generate button. */- const [selection, setSelection] = useState<GeneratorSelection>(() => ({ jobId: selectedJobId ?? jobs.find((job) => job.status === "generating")?.id ?? jobs[0]?.id ?? "", shotId: null }));const [density, setDensity] = useState<BoardDensity>(readDensity);const chooseDensity = (next: BoardDensity) => {setDensity(next);@@ -109,12 +111,13 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCoreturn () => { window.removeEventListener("focus", refresh); window.clearInterval(timer); };}, []);- const chooseGeneratorTemplate = (templateId: string) => {+ const chooseGeneratorTemplate = (templateId: string, updates: Partial<GenerationJob> = {}) => {const template = templateSettings.templates.find((candidate) => candidate.id === templateId);- if (!template || !(templateSupportsVideo(template) && templateUsable(template)) || template.id === templateSettings.defaultTemplateId) return;+ if (!template || !(templateSupportsVideo(template) && templateUsable(template))) return;const next = { ...templateSettings, defaultTemplateId: template.id };saveGeneratorTemplateSettings(next);setTemplateSettings(next);+ updateJob(selection.jobId, { ...updates, generatorTemplateId: template.id });};useEffect(() => {@@ -164,7 +167,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCoconst updateJob = (id: string, updates: Partial<GenerationJob>) => {const current = configRef.current;// Typing in one scene's fields (or dragging its length) is one undo step.- onChange({ ...current, generationJobs: current.generationJobs.map((job) => job.id === id ? { ...job, ...updates } : job) }, `scene:${id}`);+ onChange(saveSceneDrafts({ ...current, generationJobs: current.generationJobs.map((job) => job.id === id ? { ...job, ...updates } : job) }, current), `scene:${id}`);};// Keep saved bindings in sync with all shots, including chip replacement,@@ -187,14 +190,14 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCoupdateJob(job.id, mergeSceneUpdates(job, updates));const changeSceneSettings = (job: GenerationJob, updates: Partial<GenerationJob>) => {- updateScene(job, updates);if (updates.sceneType && templateSceneBlocker(updates.sceneType, selectedTemplate)) {const candidates = templateSettings.templates.filter((template) => (templateSupportsVideo(template) && templateUsable(template))&& !templateSceneBlocker(updates.sceneType!, template));const compatible = (updates.sceneType === "character-replace" || updates.sceneType === "pose" || isVideoTransition(updates)? candidates.find((template) => /ref2v/i.test(template.paths.transformer)) : undefined) ?? candidates[0];- if (compatible) chooseGeneratorTemplate(compatible.id);+ if (compatible) { chooseGeneratorTemplate(compatible.id, mergeSceneUpdates(job, updates)); return; }}+ updateScene(job, updates);};const addFrame = async (job: GenerationJob, edge: "start" | "end") => {@@ -325,7 +328,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo};const requestFor = (job: GenerationJob): SlopfabGenerationRequest =>- sceneGenerationRequest(job, configRef.current, folderPath, defaultGenerationSteps, selectedTemplate);+ sceneGenerationRequest(job, configRef.current, folderPath, templateFor(job).defaultSteps, templateFor(job));const snapshotFor = (job: GenerationJob, request = requestFor(job)): string =>sceneGenerationSnapshot(job, request);@@ -339,7 +342,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCoif (!runtimeReady) return;const submissions = scenes.map((job) => {const request = requestFor(job);- return { job, request, snapshot: snapshotFor(job, request) };+ return { job, request, snapshot: snapshotFor(job, request), template: templateFor(job) };});try { onGenerate?.(submissions); }catch (reason) { setRuntimeError(reason instanceof Error ? reason.message : String(reason)); }@@ -406,7 +409,8 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCoconst visited = new Set<string>();const visiting = new Set<string>();const visitForBatch = (job: GenerationJob): boolean => {- if (continuationBlocker(job, jobs) || longShotBlocker(job, config, false) || templateSceneBlocker(sceneTypeFor(job), selectedTemplate) || sendBlocker(job, config.references)) return false;+ if (job.generatorTemplateId && !templateSettings.templates.some(t => t.id === job.generatorTemplateId) || !templateUsable(templateFor(job))) return false;+ if (continuationBlocker(job, jobs) || longShotBlocker(job, config, false) || templateSceneBlocker(sceneTypeFor(job), templateFor(job)) || sendBlocker(job, config.references)) return false;if (visited.has(job.id)) return true;if (visiting.has(job.id)) return false;if (["queued", "generating", "ready"].includes(job.status)) { visited.add(job.id); return true; }@@ -431,13 +435,15 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCoconst generateAll = () => submit(batchScenesReady);const generationBlocker = (job: GenerationJob): string | null => {+ if (job.generatorTemplateId && !templateSettings.templates.some(t => t.id === job.generatorTemplateId)) return "The saved generator is no longer available. Choose another generator.";+ if (!templateUsable(templateFor(job))) return "Prepare this scene's generator weights before generating.";if (!runtimeReady) return runtimeError ?? generatorRuntime?.detail ?? "The video generator is not ready.";if (job.status === "ready") return "Saving this scene.";const source = jobs.find((candidate) => candidate.id === continuationSceneId(job, jobs));return continuationBlocker(job, jobs)?? longShotBlocker(job, config)?? (source && (!source.latentRelativePath || source.status !== "completed") ? "Generate the selected source scene first, or use Generate all." : null)- ?? templateSceneBlocker(sceneTypeFor(job), selectedTemplate) ?? sendBlocker(job, config.references);+ ?? templateSceneBlocker(sceneTypeFor(job), templateFor(job)) ?? sendBlocker(job, config.references);};const changedJobIds = new Set(jobs@@ -446,7 +452,7 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCo&& (job.generationSnapshot !== snapshotFor(job)|| jobs.some((source) => (source.id === continuationSceneId(job, jobs) || longShotDependencies(job, jobs).includes(source)) && ["queued", "generating", "ready"].includes(source.status)))).map((job) => job.id));- const selectedIndicator = selected && changedJobIds.has(selected.id) ? "changed" : selected?.status;+ const selectedIndicator = selected && changedJobIds.has(selected.id) && !selected.generationHistory?.selectedId ? "changed" : selected?.status;const selectedCancellable = selected?.status === "queued" || selected?.status === "generating";const selectedCancelling = Boolean(selected && cancellingJobIds.has(selected.id));const selectedBlocker = selected && !selectedCancellable ? generationBlocker(selected) : null;@@ -555,6 +561,18 @@ export function GeneratorView({ config, folderPath, runtime = null, generationCoonMoveScene={moveScene}onMoveShot={moveShot}onRename={rename}+ onHistorySelect={(job, versionId) => {+ onChange(selectSceneGeneration(configRef.current, job.id, versionId));+ setSelection({ jobId: job.id, shotId: null });+ }}+ onMakePrimary={(job, versionId) => {+ onChange(makeSceneGenerationPrimary(configRef.current, job.id, versionId));+ void purgeSceneThumbnails(job);+ }}+ onDuplicate={(job) => {+ const duplicated = duplicateScene(configRef.current, job.id);+ if (duplicated) { onChange(duplicated.config); setSelection({ jobId: duplicated.id, shotId: null }); }+ }}onRemoveScene={(job) => void confirmRemoveScene(job)}onRemoveShot={(job, shotId) => void confirmRemoveShot(job, shotId)}/>diff --git a/src/components/workspace/SceneBoard.tsx b/src/components/workspace/SceneBoard.tsxindex e550849..51c250a 100644--- a/src/components/workspace/SceneBoard.tsx+++ b/src/components/workspace/SceneBoard.tsx@@ -1,4 +1,6 @@-import { Add16, ArrowDown16, ArrowUp16, ChevronDown12, ChevronRight12, Delete16, Grip16, MoveTo16, OpenExternal16, Rename16, Stop14, Stop16, Wand16 } from "../ui/icons";+import { SceneHistoryBar } from "./SceneHistoryBar";+import { scenePreviewJob, scenePreviewAsset } from "../../lib/sceneHistory";+import { Copy16, Add16, ArrowDown16, ArrowUp16, ChevronDown12, ChevronRight12, Delete16, Grip16, MoveTo16, OpenExternal16, Rename16, Stop14, Stop16, Wand16 } from "../ui/icons";import { useState, type DragEvent, type KeyboardEvent, type ReactNode } from "react";import {SCENE_MAX_SECONDS,@@ -17,7 +19,7 @@ import { statusIcon, STATUS_BADGE } from "./sceneStatus";import { ShotThumbnail } from "./ShotThumbnail";import { sceneMediaStartSeconds } from "../../lib/continuationMedia";import { longShotPlaybackSource } from "../../lib/longShot";-import { generationAssetId, type ProjectAsset } from "../../lib/project";+import { type ProjectAsset } from "../../lib/project";export interface GeneratorSelection {jobId: string;@@ -82,7 +84,7 @@ export function SceneBoard({onMoveShot,onRename,onRemoveScene,- onRemoveShot,+ onRemoveShot, onHistorySelect, onMakePrimary, onDuplicate,}: {jobs: GenerationJob[];assets?: ProjectAsset[];@@ -104,6 +106,9 @@ export function SceneBoard({onRename?: (selection: GeneratorSelection) => void;onRemoveScene?: (job: GenerationJob) => void;onRemoveShot?: (job: GenerationJob, shotId: string) => void;+ onHistorySelect?: (job: GenerationJob, id: string | null) => void;+ onMakePrimary?: (job: GenerationJob, id: string) => void;+ onDuplicate?: (job: GenerationJob) => void;}) {const [collapsed, setCollapsed] = useState<ReadonlySet<string>>(new Set());const [dragging, setDragging] = useState<Dragging | null>(null);@@ -141,6 +146,7 @@ export function SceneBoard({? { id: "cancel", label: "Cancel generation", icon: <Stop16 />, onSelect: () => onGenerate(job) }: { id: "generate", label: "Generate", icon: <Wand16 />, disabled: Boolean(blocker), onSelect: () => onGenerate(job) },{ id: "rename", label: "Rename", icon: <Rename16 />, shortcut: "F2", disabled: !onRename, onSelect: () => onRename?.({ jobId: job.id, shotId: null }) },+ { id: "duplicate", label: "Duplicate", icon: <Copy16 />, disabled: !onDuplicate, onSelect: () => onDuplicate?.(job) },{ id: "add-shot", label: "Add shot", icon: <Add16 />, onSelect: () => onAddShot(job) },{ separator: true },{ id: "up", label: "Move up", icon: <ArrowUp16 />, disabled: jobIndex === 0, onSelect: () => onMoveScene(job.id, jobs[jobIndex - 1]?.id ?? null) },@@ -214,11 +220,14 @@ export function SceneBoard({{jobs.map((job, jobIndex) => {const shots = sceneShots(job);const duration = sceneDurationSeconds(job);+ const preview = scenePreviewJob(job, assets);+ const previewAsset = scenePreviewAsset(job, assets);+ const joined = job.generationHistory?.selectedId ? null : longShotPlaybackSource(job, { assets, generationJobs: jobs });const order = referenceOrder(job, shots, references);const sceneOpen = selection.jobId === job.id && selection.shotId === null;const cancellable = job.status === "queued" || job.status === "generating";const blocker = generationBlocker(job);- const indicator = changedJobIds.has(job.id) ? "changed" : job.status;+ const indicator = changedJobIds.has(job.id) && !job.generationHistory?.selectedId ? "changed" : job.status;const isCollapsed = collapsed.has(job.id);const rovingShot = shots.find((shot) => selection.jobId === job.id && shot.id === selection.shotId)?.id ?? shots[0]?.id;const sceneDrop = dropTarget?.kind === "scene" ? dropTarget.beforeJobId : undefined;@@ -392,7 +401,7 @@ export function SceneBoard({>{cancellable ? <Stop14 /> : <Wand16 />}</HeaderButton></header>- {!isCollapsed && <ol+ {!isCollapsed && <div className="scene-section__content"><olclassName={`shot-grid${shotDrop?.beforeShotId === null ? " shot-grid--drop-end" : ""}`}aria-label={`Shots in ${job.title}`}onKeyDown={(event) => gridKeys(event, job)}@@ -400,7 +409,6 @@ export function SceneBoard({onDrop={(event) => dropShot(event, null)}>{shots.map((shot, index) => {- const joined = longShotPlaybackSource(job, { assets, generationJobs: jobs });const isSource = dragging?.kind === "shot" && dragging.shotId === shot.id;return <likey={shot.id}@@ -425,8 +433,8 @@ export function SceneBoard({}}><ShotCard- sourceOffsetSeconds={joined ? joined.segment.startFrame / 24 : sceneMediaStartSeconds(assets.find((asset) => asset.id === generationAssetId(job.id)))}- job={joined ? { ...job, outputRelativePath: joined.source.relativePath } : job}+ sourceOffsetSeconds={joined ? joined.segment.startFrame / 24 : sceneMediaStartSeconds(previewAsset)}+ job={joined ? { ...job, outputRelativePath: joined.source.relativePath } : preview}shot={shot}index={index}endsAt={index + 1 < shots.length ? shots[index + 1].startSeconds : duration}@@ -458,7 +466,9 @@ export function SceneBoard({/></li>;})}- </ol>}+ </ol>+ <SceneHistoryBar job={job} assets={assets} folderPath={folderPath} onSelect={onHistorySelect} onMakePrimary={onMakePrimary} />+ </div>}</section>;})}{menu.element}diff --git a/src/components/workspace/SceneHistoryBar.tsx b/src/components/workspace/SceneHistoryBar.tsxnew file mode 100644index 0000000..174175a--- /dev/null+++ b/src/components/workspace/SceneHistoryBar.tsx@@ -0,0 +1,46 @@+import { useEffect, useState } from "react";+import { Film16, Edit16 } from "../ui/icons";+import { useContextMenu } from "../ui";+import { sceneHistory } from "../../lib/sceneHistory";+import { sceneMediaStartSeconds } from "../../lib/continuationMedia";+import type { GenerationJob, ProjectAsset } from "../../lib/project";+import { shotPoster } from "./ShotThumbnail";++function TakePoster({ folderPath, media }: { folderPath: string; media: ProjectAsset }) {+ const [url, setUrl] = useState<string | null>(null);+ useEffect(() => {+ let live = true; setUrl(null);+ if (media.relativePath) void shotPoster(folderPath, media.relativePath, sceneMediaStartSeconds(media)).then(result => { if (live) setUrl(result.poster); }, () => {});+ return () => { live = false; };+ }, [folderPath, media.relativePath]);+ return url ? <img src={url} alt="" draggable={false} /> : <Film16 aria-hidden="true" />;+}++export function SceneHistoryBar({ job, assets, folderPath, onSelect, onMakePrimary }: {+ job: GenerationJob; assets: ProjectAsset[]; folderPath: string;+ onSelect?: (job: GenerationJob, id: string | null) => void;+ onMakePrimary?: (job: GenerationJob, id: string) => void;+}) {+ const history = sceneHistory(job, assets);+ const busy = ["queued", "generating", "ready"].includes(job.status);+ const menu = useContextMenu();+ return <aside className="scene-history" aria-label={`Generation history for ${job.title}`}>+ {history.versions.map((version, index) => {+ const primary = version.id === history.primaryId;+ const open = (source: Parameters<typeof menu.open>[0]) => menu.open(source, [{ id: "primary", label: "Make Primary", disabled: busy || primary || !onMakePrimary,+ onSelect: () => onMakePrimary?.(job, version.id) }], { "aria-label": `Generation ${index + 1} actions` });+ return <button key={version.id} type="button" className="scene-history__take" disabled={busy || !onSelect}+ aria-label={`Generation ${index + 1}${primary ? " (Primary)" : ""} of ${job.title}`} aria-pressed={history.selectedId === version.id}+ data-tooltip={`Generation ${index + 1}${primary ? " - Primary" : ""} - ${new Date(version.createdAt).toLocaleString()}`}+ onClick={() => onSelect?.(job, version.id)} onContextMenu={open} onKeyDown={event => { if (event.key === "ContextMenu" || event.key === "F10" && event.shiftKey) { event.preventDefault(); open(event); } }}>+ <span className="scene-history__picture"><TakePoster folderPath={folderPath} media={version.media} /></span>+ <span>{primary ? "Primary" : `Take ${index + 1}`}</span>+ </button>;+ })}+ {(history.draft || !history.versions.length) && <button type="button" className="scene-history__take scene-history__draft" disabled={busy || !onSelect}+ aria-label={`Draft of ${job.title}`} aria-pressed={!history.selectedId} onClick={() => onSelect?.(job, null)}>+ <span className="scene-history__picture"><Edit16 aria-hidden="true" /></span><span>Draft</span>+ </button>}+ {menu.element}+ </aside>;+}diff --git a/src/lib/projectSession.ts b/src/lib/projectSession.tsindex f7ec11d..c004592 100644--- a/src/lib/projectSession.ts+++ b/src/lib/projectSession.ts@@ -70,7 +70,7 @@ export class ProjectSession {private backgroundSeq = 0;constructor(readonly record: ProjectRecord, private writer: ProjectWriter) {this.savedConfig = record.config;- const config = saveSceneDrafts(saveImageDraft(record.config));+ const config = saveImageDraft(record.config);const stamped = Date.parse(record.config.updatedAt);this.state = { config, dirty: config !== record.config, saving: false, saveError: null, canUndo: false, canRedo: false, savedAt: Number.isFinite(stamped) ? stamped : null };this.history.subscribe(() => {diff --git a/src/lib/sceneHistory.test.ts b/src/lib/sceneHistory.test.tsindex 3ca74a9..05f5570 100644--- a/src/lib/sceneHistory.test.ts+++ b/src/lib/sceneHistory.test.ts@@ -26,6 +26,13 @@ describe("scene generation history", () => {expect(config.generationJobs[0]).toMatchObject({ music: "Pending", steps: 8, seed: 20 });expect(config.generationJobs[0].generationHistory!.versions[0].scene.music).toBe("First");});+ it("removes a draft when its edits are reverted to a saved take", () => {+ let config = finish(edit(initial(), "First"), "one");+ config = edit(config, "Pending");+ expect(config.generationJobs[0].generationHistory!.draft).toBeTruthy();+ config = edit(config, "First");+ expect(config.generationJobs[0].generationHistory).toMatchObject({ selectedId: "one", draft: null });+ });it("removes optional settings when restoring a take that never had them", () => {let config = finish(initial(), "one");config = { ...config, generationJobs: config.generationJobs.map(j => ({ ...j, audioSteps: 8, latentUpscale: true, backdropColor: "green" as const })) };diff --git a/src/lib/sceneHistory.ts b/src/lib/sceneHistory.tsindex d96da3e..1cd76ce 100644--- a/src/lib/sceneHistory.ts+++ b/src/lib/sceneHistory.ts@@ -22,7 +22,7 @@ export function sceneHistory(job: GenerationJob, assets: readonly ProjectAsset[]if (!job.outputRelativePath) return { versions: [], primaryId: null, selectedId: null, draft: sceneInput(job) };const media = assets.find(a => a.id === generationAssetId(job.id) || a.kind === "generated" && a.relativePath === job.outputRelativePath);const version: SceneGenerationVersion = { id: `legacy-${job.id}`, createdAt: job.updatedAt, scene: sceneInput(job),- media: { ...media, id: generationAssetId(job.id), name: job.title, kind: "generated", mimeType: "video/mp4", relativePath: job.outputRelativePath, createdAt: media?.createdAt ?? job.createdAt },+ media: { ...media, id: generationAssetId(job.id), name: job.title, kind: "generated", mimeType: "video/mp4", sourcePath: null, relativePath: job.outputRelativePath, createdAt: media?.createdAt ?? job.createdAt },generationSnapshot: job.generationSnapshot, latentRelativePath: job.latentRelativePath };return { versions: [version], primaryId: version.id, selectedId: version.id, draft: null };}@@ -40,7 +40,11 @@ export function saveSceneDrafts(config: ProjectConfig, previous?: ProjectConfig)const selectedId = history.selectedId;const selected = history.versions.find(v => v.id === selectedId);if (selected && !sameSceneInput(input, selected.scene)) history = { ...history, selectedId: null, draft: input };- else if (!selected && (!history.draft || !sameSceneInput(input, history.draft))) history = { ...history, selectedId: null, draft: input };+ else if (!selected) {+ const matching = history.versions.find(v => sameSceneInput(input, v.scene));+ if (matching) history = { ...history, selectedId: matching.id, draft: null };+ else if (!history.draft || !sameSceneInput(input, history.draft)) history = { ...history, selectedId: null, draft: input };+ }if (history === job.generationHistory) return job;changed = true; return { ...job, generationHistory: history };});diff --git a/src/lib/workQueue.ts b/src/lib/workQueue.tsindex de53444..43b9ac5 100644--- a/src/lib/workQueue.ts+++ b/src/lib/workQueue.ts@@ -224,6 +224,7 @@ export class WorkQueue {for (const submission of submissions) {if (this.items.some((item) => item.projectKey === projectKey && item.sceneId === submission.job.id && isWorkActive(item))) continue;const chosen = template ?? submission.template ?? loadGeneratorTemplateSettings().templates.find(t => t.id === submission.job.generatorTemplateId) ?? defaultGeneratorTemplate(undefined, "video");+ if (!templateSupportsVideo(chosen)) throw new Error("Choose a generator that supports video generation.");const config = structuredClone({ ...current, providerSettings: { ...current.providerSettings,slopfab: engineProviderSetting(chosen.paths, current.providerSettings.slopfab, chosen.attention, chosen.loras ?? [], chosen.mode ?? "prompt", chosen.additionalSafetensors ?? [], chosen.motionCache ?? false, chosen.sources ?? {}, chosen),} });diff --git a/src/styles/generator.css b/src/styles/generator.cssindex 28c8cff..0c17a01 100644--- a/src/styles/generator.css+++ b/src/styles/generator.css@@ -947,3 +947,17 @@.scene-rule__caption,.scene-rule__badge { display: none; }}+++/* Scene histories use a normal column, never a nested scrolling surface. The+ retention policy is in sceneHistory.ts; the layout accepts more takes. */+.scene-section__content { display: grid; grid-template-columns: minmax(0, 1fr) 88px; align-items: start; gap: var(--space-2); }+.scene-section__content > .shot-grid { min-width: 0; grid-template-columns: repeat(auto-fill, minmax(0, min(var(--shot-tile-width), 100%))); }+.scene-board--list .scene-section__content > .shot-grid { grid-template-columns: minmax(0, 1fr); }+.scene-history { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) var(--space-2) var(--space-3) 0; }+.scene-history__take { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-1); min-width: 0; padding: 3px; border: 1px solid var(--stroke-divider); border-radius: var(--radius-sm); color: var(--text-secondary); background: var(--surface-pane); font-size: var(--text-xs); }+.scene-history__take:hover:not(:disabled) { background: var(--fill-subtle-hover); }+.scene-history__take[aria-pressed="true"] { border-color: var(--accent); color: var(--text-primary); background: var(--accent-soft); }+.scene-history__picture { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9; background: var(--stage-bg); border-radius: var(--radius-sm); overflow: hidden; }+.scene-history__picture img { width: 100%; height: 100%; object-fit: contain; }+.scene-history__draft .scene-history__picture { background: var(--fill-subtle-hover); }