AI media harness for planning, generating, and editing locally
TypeScript
Add scene Take upscale actions
Bittiba0970af3301
diff --git a/README.md b/README.mdindex 865cc40..93471f1 100644--- a/README.md+++ b/README.md@@ -25,7 +25,7 @@ Slopus combines an AI assistant, local image, video and music generation, reusab## Features- **Agent.** Plan scenes, generate media, inspect frames and song inputs, and match Motions to music with Claude Code, Codex, OpenRouter or a local OpenAI-compatible model. Toggle the pane with Ctrl+Shift+A.-- **Video.** Organize Videos → Scenes → Shots in folders, preview whole videos, and share prompts and timed music/video references across scenes. Generate with [multiple scene types](docs/scene-types.md), keep four takes plus a Draft, and choose each scene's timeline take with **Make Primary**.+- **Video.** Organize Videos → Scenes → Shots in folders, share prompts and timed references, and generate with [multiple scene types](docs/scene-types.md). Keep four takes plus a Draft, upscale saved Takes 1.5x/2x/4x from Generate's dropdown, and choose the timeline take with **Make Primary**.- **Images.** Generate with MiniMax H3, MOSS Image or Fibo 2.0. Use whole-image, box, lasso and Zoom edits where supported, with drafts and versions in the image bar.- **Music.** Generate with YuE2 or MiniMax Music3, edit lyrics and style, organize songs in folders, browse grid/list views, and play songs in sequence or reuse them as references and timeline audio.- **References.** Reuse descriptions, images, trimmed video clips and [H3 RefMods](docs/refmods.md) across scenes.diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 8d05bcb..9e44033 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -4,6 +4,8 @@ Changes since 0.3.2.## What's new+- **Scene upscaling.** Generate's dropdown offers 1.5x, 2x and 4x latent upscaling as new Takes. Upscaled Takes can be enlarged again; scene references always use original latents.+- **Video library.** Organize Videos → Scenes → Shots in folders, play scenes sequentially on cards or in a popout, and apply shared prompts and timed music/video references. Split a complete song into scenes; timeline clips remain individual scenes.- **Music export.** Preview and export WAV, MP3, lossless FLAC, AAC/M4A or Opus/WebM/Ogg, with bitrate controls and background export. MP3/FLAC use bundled Mediabunny encoders.- **Single Shot.** Generate a short ending first, then anchor a continuous shot to it. Supports references in both prompts and optional continuation from any generated scene.diff --git a/docs/scene-types.md b/docs/scene-types.mdindex 24b42cf..bc36c24 100644--- a/docs/scene-types.md+++ b/docs/scene-types.md@@ -10,8 +10,10 @@ For a music video, select a complete song on an empty Video and choose **CreateThe Scene panel saves a type on each scene. Long Shot is retired; use Bridge to connect videos. Saved Long Shot scenes retain their generation and playback behavior, while new or duplicated scenes use the available types.+Select a generated Take and open Generate's arrow to upscale its saved latents 1.5x, 2x or 4x into a new Take. Escape or clicking outside closes the menu. Upscaled Takes can be enlarged again; continuations and bridges always use their original latents.+- **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.+- **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 original latent resolutions, at least two seconds, and updated workers. Generate all handles dependency order.- **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.diff --git a/docs/slopfab-compatibility.md b/docs/slopfab-compatibility.mdindex 7285cef..bf6f2a6 100644--- a/docs/slopfab-compatibility.md+++ b/docs/slopfab-compatibility.md@@ -1,11 +1,11 @@# Slopfab compatibility-## Bundled runtime (API 1.41.0)+## Bundled runtime (API 1.43.0)-Windows and Linux runtimes use SlopFab commit `bcc1d26d92433475434447f34017550f9f823fe2`+Windows and Linux runtimes use SlopFab commit `bf952e73efd66901ebe0558a6c8535ce3a2b0a3e`from `D:\Projects\slopfab`, with CUDA and Vulkan enabled and FFmpeg disabled.-This update adds source-initialized continuation and music progress fixes.-Single Shot uses latent boundary anchors and fresh middle noise. LAN protocol is 21. Restart Slopus and+This update adds standalone saved-latent upscaling with in-process video/audio decoding.+Single Shot uses latent boundary anchors and fresh middle noise. LAN protocol is 22. Restart Slopus andupdate workers to load the new runtime.The Linux runtime passes C API and embedded-tokenizer checks. Slopus core and desktop@@ -37,8 +37,8 @@ final duration; Single Shot requires at least two seconds.Only the final joined output and latents enter scene history. Timeline rangesidentify each scene's own portion, retaining the shared decode at joins.Temporary endings are removed on success, failure and cancellation. Starting-scenes must use compatible resolution and latent-upscale settings. Protocol 21-prevents older workers from restoring their source-initialization default.+scenes must use compatible original latent resolutions. Protocol 22 also requires+workers to support saved-latent upscale requests.Single Shot disables `slopfab_request_set_continuation_source_init` in bothpasses: repeating the final source latent slice across the new interval can@@ -232,7 +232,7 @@ into a bridge on its next generation.The two margin controls replace the previous anchor's ending and the followinganchor's beginning in multiples of 17 frames (default 17, zero allowed).Each anchor must also provide 22 preserved context frames. Use the same canvas,-VAE models and latent upscale setting throughout the run. Cite original subject+VAE models and original latent resolution throughout the run. Cite original subjectreferences in every scene that needs them.Slopus calls `slopfab_request_set_latent_bridge_files`. The requested gap rounds@@ -270,28 +270,26 @@ order, request and callback lifetimes, repeated runs, failures, cancellationand the older-runtime fallback. A separate test checks that the bundledruntime exports the new entry point; these tests do not run model inference.-## API 1.24: scene latent upscaling--Scene Generation settings offer an optional **Latent upscale** toggle. Slopus-passes a half-size diffusion canvas (rounded up to complete 32-pixel patches)-and calls `slopfab_request_set_latent_upscaler` with scale 2 and temporal chunking.-Slopfab upscales the video latents before VAE decoding on CUDA or Vulkan; audio-and frame counts are unchanged. WebCodecs encodes to the exact selected output-size when patch alignment makes the decoded frames slightly larger. Planning-reports the selected output size while latent dimensions describe diffusion.--The MiniMax H3 3D conv v1 FP16 checkpoint is downloadable under-Settings > Generator > Other weights > Latent upscale, with an optional local-file override. Weights remain machine-local. LAN protocol 8 transfers local-files or has the worker download the standard checkpoint; older workers must-be updated so they cannot silently ignore the toggle. Older runtimes reject-an enabled toggle with an API 1.24 requirement; disabled scenes remain supported.--Saved latents retain the diffusion resolution. Continuations must use a source-archive with matching diffusion dimensions, so use the same upscale setting-and project resolution throughout a continuation chain. The toggle is captured-in generation history and in queued requests. Progress identifies the latent-upscaling stage, and existing cancellation and WebCodecs/MP4 saving apply.+## API 1.43: saved scene latent upscaling++The Scene Generate dropdown offers **Upscale 1.5x**, **Upscale 2x** and+**Upscale 4x** for the selected Take. Escape or clicking outside dismisses it.+Each action queues `slopfab_latent_upscale_decode_file_start`, saves the enlarged+archive with `slopfab_generation_save_latents`, and encodes the decoded video/audio+with WebCodecs into a new Take. No prompt conditioning or diffusion runs. Canvas+dimensions round to the nearest 32 pixels; audio latents and frame counts stay unchanged.++Download the MiniMax H3 latent upscaler under **Settings > Generators > Other+weights**. The action needs that checkpoint and the video/audio VAEs. Protocol 22+transfers those weights and the saved archive to workers, without transformer,+text encoder, tokenizer or LoRAs. Workers need API 1.43 or later.++Each enlarged Take retains its own archive for further upscaling and an+`originalLatentRelativePath` for continuations and bridges. Making it primary+changes the playable video while keeping the scene's reference latents original.+Joined scene ranges and original archives survive history pruning, cancellation+and errors. The former generation-time Latent upscale toggle is removed; legacy+values remain readable but new scene generation ignores them.## API 1.22: export upscalingdiff --git a/src/components/OtherWeightsSettings.tsx b/src/components/OtherWeightsSettings.tsxindex 0e26d39..d826e0d 100644--- a/src/components/OtherWeightsSettings.tsx+++ b/src/components/OtherWeightsSettings.tsx@@ -81,7 +81,7 @@ function OtherWeightEditor({ template, desktop, busy, onDone }: {onChange={(event) => setPaths({ ...paths, [file.url]: event.target.value })} placeholder="Absolute path to a .safetensors file" /><button className="secondary-button" type="button" disabled={!desktop} aria-label={`Browse for ${file.name}`} onClick={() => void browse(file)}>Browse…</button></span></label>)}- {template.id === "latent-upscale" && <p>Used by the Latent upscale toggle in scene Generation settings. Workers receive local files or download the standard weights.</p>}+ {template.id === "latent-upscale" && <p>Upscale saved scene Takes from the Generate menu. Workers receive local files or download the standard weights.</p>}{template.id === "seedvr2" && <p>SeedVR2 runs locally or on the selected worker. Workers receive local files and download any weights without a local path.</p>}{error && <InfoBar severity="error" message={error} />}</fieldset>diff --git a/src/components/workspace/GeneratorView.test.tsx b/src/components/workspace/GeneratorView.test.tsxindex c6a38e4..a33b3de 100644--- a/src/components/workspace/GeneratorView.test.tsx+++ b/src/components/workspace/GeneratorView.test.tsx@@ -33,6 +33,36 @@ beforeEach(() => {});afterEach(cleanup);+it("offers upscale actions above Generate and dismisses them without submitting", () => {+ const state = setup();+ const open = () => fireEvent.click(screen.getByRole("button", { name: "Scene generation actions" }));+ open();+ const dialog = screen.getByRole("dialog", { name: "Scene generation actions" });+ for (const scale of [1.5, 2, 4]) expect(within(dialog).getByRole("button", { name: `Upscale ${scale}x` })).toBeDisabled();+ fireEvent.keyDown(dialog, { key: "Escape" });+ expect(screen.queryByRole("dialog", { name: "Scene generation actions" })).toBeNull();+ open();+ fireEvent.pointerDown(document.body);+ expect(screen.queryByRole("dialog", { name: "Scene generation actions" })).toBeNull();+ expect(state.latest().generationJobs.every(job => job.status === "draft")).toBe(true);+});++it("submits the selected Take to upscale and closes the action popup", () => {+ Object.assign(window, { __TAURI_INTERNALS__: {} });+ try {+ let config = project();+ const job = config.generationJobs[0];+ config = completeSceneGeneration(config, job.id, { id: "take", scene: sceneInput(job), createdAt: config.createdAt, latentRelativePath: "latents/take.safetensors",+ media: { id: `asset-${job.id}`, kind: "generated", mimeType: "video/mp4", name: job.title, relativePath: "media/take.mp4", createdAt: config.createdAt } });+ const generate = vi.fn();+ render(<GeneratorView config={config} folderPath="C:/project" onChange={() => {}} onOpenTimeline={() => {}} onGenerate={generate} />);+ fireEvent.click(screen.getByRole("button", { name: "Scene generation actions" }));+ fireEvent.click(screen.getByRole("button", { name: "Upscale 2x" }));+ expect(generate).toHaveBeenCalledWith([expect.objectContaining({ upscaleSource: expect.objectContaining({ id: "take" }), request: expect.objectContaining({ latentUpscaleSource: { path: "latents/take.safetensors", scale: 2 } }) })]);+ expect(screen.queryByRole("dialog", { name: "Scene generation actions" })).toBeNull();+ } finally { delete (window as unknown as Record<string, unknown>).__TAURI_INTERNALS__; }+});+it("excludes MOSS from the video picker even when it is the saved default", () => {const moss = { ...mossImageTemplate(), sources: {}, paths: { transformer: "moss", textEncoder: "qwen", videoVae: "flux", tokenizer: "tokenizer.json", audioVae: "" } };const video = createGeneratorTemplate("Video model");@@ -805,16 +835,13 @@ describe("Generator scene controls", () => {expect(state.latest().generationJobs.map((job) => job.status)).toEqual(["queued", "queued"]);});- it.each([[false, false], [false, true], [true, false], [true, true]])("saves generation controls with separate audio steps %s and latent upscale %s", async (separateAudio, latentUpscale) => {+ it.each([[false, false], [false, true], [true, false], [true, true]])("saves audio controls %s without applying legacy latent upscale %s", async (separateAudio, latentUpscale) => {const initial = project();initial.settings = { ...initial.settings, resolution: "416p", frameRate: 60 };+ initial.generationJobs[0].latentUpscale = latentUpscale;const state = setup(initial);const generation = screen.getByRole("region", { name: "Generation" });- const upscale = within(generation).getByRole("switch", { name: "Latent upscale" });- expect(upscale).not.toBeChecked();- fireEvent.click(upscale);- if (!latentUpscale) fireEvent.click(upscale);- expect(parseProjectConfig(JSON.parse(JSON.stringify(state.latest()))).generationJobs[0].latentUpscale).toBe(latentUpscale);+ expect(within(generation).queryByRole("switch", { name: "Latent upscale" })).toBeNull();expect(within(generation).getByRole("spinbutton", { name: "Generation step count" })).toHaveValue(20);expect(within(generation).getByRole("spinbutton", { name: "Generation seed" })).toHaveValue(-1);@@ -840,7 +867,7 @@ describe("Generator scene controls", () => {fireEvent.click(within(screen.getByRole("region", { name: "First scene" })).getByRole("button", { name: "Generate" }));await waitFor(() => expect(state.latest().generationJobs[0].generationSnapshot).toEqual(expect.any(String)));expect(JSON.parse(state.latest().generationJobs[0].generationSnapshot!).audioSteps).toBe(separateAudio ? 17 : undefined);- expect(JSON.parse(state.latest().generationJobs[0].generationSnapshot!).latentUpscale).toBe(latentUpscale ? true : undefined);+ expect(JSON.parse(state.latest().generationJobs[0].generationSnapshot!).latentUpscale).toBeUndefined();expect(JSON.parse(state.latest().generationJobs[0].generationSnapshot!)).toEqual(expect.objectContaining({steps: 28,videoSigmaShift: 8.5,diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsxindex d64112e..3c7191b 100644--- a/src/components/workspace/GeneratorView.tsx+++ b/src/components/workspace/GeneratorView.tsx@@ -1,4 +1,7 @@import { generatorOptions } from "../generatorOptions";+import { sceneUpscaleSubmission, selectedUpscaleTake } from "../../lib/sceneUpscale";+import { Flyout } from "../ui";+import { ChevronDown14 } from "../ui/icons";import { duplicateScene, makeSceneGenerationPrimary, removeSceneGeneration, saveSceneDrafts, selectSceneGeneration } from "../../lib/sceneHistory";import { sceneGenerationRequest, sendBlocker, templateSceneBlocker } from "../../lib/sceneGeneration";import { longShotBlocker, longShotDependencies, longShotPosition } from "../../lib/longShot";@@ -93,6 +96,9 @@ export function GeneratorView({ config, sceneIds, toolbarStart, folderPath, runtconst root = useRef<HTMLDivElement>(null);const titleInput = useRef<HTMLInputElement>(null);const [showDebugPrompt, setShowDebugPrompt] = useState(false);+ const [generationActionsOpen, setGenerationActionsOpen] = useState(false);+ const generationActionsButton = useRef<HTMLButtonElement>(null);+ useEffect(() => setGenerationActionsOpen(false), [selection.jobId, selection.shotId]);const debugEnabled = useSyncExternalStore(subscribeDebugOptions, loadDebugOptionsEnabled);const [startFrameError, setStartFrameError] = useState<string | null>(null);@@ -465,6 +471,11 @@ export function GeneratorView({ config, sceneIds, toolbarStart, folderPath, runtconst selectedCancellable = selected?.status === "queued" || selected?.status === "generating";const selectedCancelling = Boolean(selected && cancellingJobIds.has(selected.id));const selectedBlocker = selected && !selectedCancellable ? generationBlocker(selected) : null;+ const upscaleTake = selected && selectedUpscaleTake(selected, config);+ const upscaleBlocker = !upscaleTake?.latentRelativePath ? "Select a generated Take with saved latents."+ : selected && sceneGenerationPending(selected) ? "Wait for this scene to finish."+ : selectedTemplate.modelType && selectedTemplate.modelType !== "minimax-h3" ? "Saved latent upscaling requires MiniMax H3."+ : !isTauri() ? "Upscaling requires the desktop app." : null;/* --- Keyboard ------------------------------------------------------------Scoped to the Generator, so the same keys can mean something else on the@@ -711,9 +722,10 @@ export function GeneratorView({ config, sceneIds, toolbarStart, folderPath, runtaria-haspopup="dialog"onClick={() => setShowDebugPrompt(true)}>Debug prompt</button>}+ <div className={`scene-generation-controls${!openShot && !selectedCancellable ? " scene-generation-controls--split" : ""}`}><buttontype="button"- className="primary-button"+ className="primary-button scene-generate-button"data-tooltip={selectedCancellable ? `Cancel ${selected.title}` : selectedBlocker ?? `Generate ${selected.title}`}disabled={selectedCancellable ? selectedCancelling : Boolean(selectedBlocker)}onClick={() => generateScene(selected)}@@ -721,6 +733,19 @@ export function GeneratorView({ config, sceneIds, toolbarStart, folderPath, runt{selectedCancellable ? <Stop14 aria-hidden="true" /> : <Sparkle16 aria-hidden="true" />}{selectedCancellable ? selectedCancelling ? "Cancelling…" : "Cancel" : "Generate"}</button>+ {!openShot && !selectedCancellable && <button ref={generationActionsButton} type="button" className="primary-button scene-generation-options"+ aria-label="Scene generation actions" aria-haspopup="dialog" aria-expanded={generationActionsOpen}+ onClick={() => setGenerationActionsOpen(!generationActionsOpen)}><ChevronDown14 aria-hidden="true" /></button>}+ </div>+ <Flyout open={generationActionsOpen && !openShot && !selectedCancellable} anchor={generationActionsButton} onClose={() => setGenerationActionsOpen(false)}+ placement="top-end" width={240} aria-label="Scene generation actions" className="scene-generation-actions">+ {[1.5, 2, 4].map(scale => <button key={scale} type="button" className="primary-button" disabled={Boolean(upscaleBlocker)} data-tooltip={upscaleBlocker ?? "Create a new Take from the selected Take's saved latents"}+ onClick={() => {+ setGenerationActionsOpen(false);+ try { onGenerate?.([sceneUpscaleSubmission(selected, config, scale, selectedTemplate)]); }+ catch (reason) { setRuntimeError(reason instanceof Error ? reason.message : String(reason)); }+ }}>Upscale {scale}x</button>)}+ </Flyout></div></aside>}diff --git a/src/components/workspace/SceneEditor.tsx b/src/components/workspace/SceneEditor.tsxindex dd3433a..1f65271 100644--- a/src/components/workspace/SceneEditor.tsx+++ b/src/components/workspace/SceneEditor.tsx@@ -569,10 +569,6 @@ export function SceneInspector({ job, shots, references, folderPath = "", scenesonCommit={(value) => onChange({ seed: value })}/></PropRow>- <PropRow label="Latent upscale" htmlFor={`${id}-latent-upscale`} tooltip="Generate at half resolution, then upscale to the selected resolution. Requires Latent upscale weights in Settings → Generator → Other weights.">- <ToggleSwitch id={`${id}-latent-upscale`} aria-label="Latent upscale" checked={job.latentUpscale ?? false} disabled={disabled}- onChange={(checked) => onChange({ latentUpscale: checked })} />- </PropRow><PropRow label="Advanced options" htmlFor={`${id}-advanced-options`} tooltip="Show sigma shifts and a separate audio step count."><ToggleSwitch id={`${id}-advanced-options`} aria-label="Advanced options" checked={job.audioSteps != null} disabled={disabled}onChange={(checked) => onChange({ audioSteps: checked ? Math.min(sceneGenerationSteps(job, defaultSteps), MAX_AUDIO_GENERATION_STEPS) : undefined })} />diff --git a/src/components/workspace/SceneHistoryBar.tsx b/src/components/workspace/SceneHistoryBar.tsxindex d56449d..e3dcd6f 100644--- a/src/components/workspace/SceneHistoryBar.tsx+++ b/src/components/workspace/SceneHistoryBar.tsx@@ -34,10 +34,11 @@ export function SceneHistoryBar({ job, assets, folderPath, onSelect, onMakePrimaonSelect: () => onRemove?.(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()}`}+ data-tooltip={`Generation ${index + 1}${primary ? " - Primary" : ""}${version.upscaleFactor ? ` - Upscaled ${version.upscaleFactor}x (${version.media.width} × ${version.media.height})` : ""} - ${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>+ {version.upscaleFactor && <span>{version.upscaleFactor}x upscale</span>}</button>;})}{(history.draft || !history.versions.length) && <button type="button" className="scene-history__take scene-history__draft" disabled={busy || !onSelect}diff --git a/src/lib/continuationMedia.test.ts b/src/lib/continuationMedia.test.tsindex d314daf..5e7b6eb 100644--- a/src/lib/continuationMedia.test.ts+++ b/src/lib/continuationMedia.test.ts@@ -53,6 +53,15 @@ it("keeps standalone scenes and trims in scene coordinates", () => {expect(resolved).toMatchObject({ assetId: "asset-b", sourceStartMs: 124 * 1000 / 24 + 500, durationMs: b.durationMs });});+it("plays an upscaled primary at its own resolution even when a later clip shares original latents", () => {+ const config = project();+ for (const asset of config.assets) { asset.width = 736; asset.height = 416; }+ config.assets[0].width = 1472; config.assets[0].height = 832;+ expect(continuationPlaybackTracks(config)[0].clips.map(clip => clip.assetId)).toEqual(["asset-a", "asset-c", "asset-c"]);+ config.assets[2].width = 2944; config.assets[2].height = 1664;+ expect(continuationPlaybackTracks(config)[0].clips.map(clip => clip.assetId)).toEqual(["asset-c", "asset-c", "asset-c"]);+});+it("shares joined sources across a cut between different tracks", () => {const config = project();const b = config.timeline.tracks[0].clips.splice(1, 1)[0];diff --git a/src/lib/continuationMedia.ts b/src/lib/continuationMedia.tsindex fe7bf21..d3a8b06 100644--- a/src/lib/continuationMedia.ts+++ b/src/lib/continuationMedia.ts@@ -1,5 +1,5 @@import { clipPlaybackRate } from "./clipTiming";-import { currentLongShotArchives } from "./longShot";+import { canReuseJoinedVideo, currentLongShotArchives } from "./longShot";import { GENERATION_FRAME_RATE, generationAssetId, sceneOutputFrames, type GenerationJob, type ProjectAsset, type ProjectConfig, type SceneMediaSegment, type TimelineClip } from "./project";const milliseconds = (frames: number) => frames * 1000 / GENERATION_FRAME_RATE;@@ -60,7 +60,7 @@ export function continuationPlaybackTracks(config: ProjectConfig) {const own = asset && assetSceneSegment(asset, config.generationJobs);let source = asset;let segment = own;- const joinedLongShot = own && longShots.find((candidate) => candidate.sceneSegments?.some((part) => part.sceneId === own.sceneId && part.latentRelativePath === own.latentRelativePath));+ const joinedLongShot = own && longShots.find((candidate) => canReuseJoinedVideo(asset, candidate) && candidate.sceneSegments?.some((part) => part.sceneId === own.sceneId && part.latentRelativePath === own.latentRelativePath));if (joinedLongShot) {const part = joinedLongShot.sceneSegments!.find((part) => part.sceneId === own!.sceneId)!;resolved.set(clip.id, { ...clip, assetId: joinedLongShot.id, sourceStartMs: clip.sourceStartMs + milliseconds(part.startFrame) });@@ -72,6 +72,7 @@ export function continuationPlaybackTracks(config: ProjectConfig) {for (const next of following) {const nextClip = resolved.get(next.id);const joined = nextClip && assets.get(nextClip.assetId);+ if (joined && !canReuseJoinedVideo(asset, joined)) continue;// Long Shot archives are selected above only after validating all// dependencies. Never revive a stale archive through legacy adjacency.const joinedOwnIndex = joined?.sceneSegments?.findIndex((part) => generationAssetId(part.sceneId) === joined.id) ?? -1;diff --git a/src/lib/longShot.test.ts b/src/lib/longShot.test.tsindex 5fd16e4..99ec5ba 100644--- a/src/lib/longShot.test.ts+++ b/src/lib/longShot.test.ts@@ -43,7 +43,7 @@ it("allows queued Long Shot anchors while retaining readiness and compatibilitysource.status = "failed";expect(longShotBlocker(bridge, config, true, true)).toContain("Generate");source.status = "generating"; source.latentUpscale = true;- expect(longShotBlocker(bridge, config, true, true)).toContain("Latent upscale");+ expect(longShotBlocker(bridge, config, true, true)).toBeNull();});it("continues the last scene from the joined archive and invalidates it when a following anchor is added", () => {diff --git a/src/lib/longShot.ts b/src/lib/longShot.tsindex da5809b..e693697 100644--- a/src/lib/longShot.ts+++ b/src/lib/longShot.ts@@ -1,6 +1,11 @@import { sceneGenerationPending, sceneSiblings, generationAssetId, sceneDurationSeconds, sceneOutputFrames, type GenerationJob, type ProjectAsset, type ProjectConfig, type SceneGenerationInput, type SceneMediaSegment } from "./project";export const LONG_SHOT_CONTEXT = 22;+/** Joined decodes may share original latent identity with an enlarged Take. */+export function canReuseJoinedVideo(source: ProjectAsset | undefined, candidate: ProjectAsset) {+ return (!source?.width || (candidate.width ?? 0) >= source.width)+ && (!source?.height || (candidate.height ?? 0) >= source.height);+}export const bridgeGapFrames = (frames: number) => Math.max(12, Math.ceil((frames - 12) / 17) * 17 + 12);/** Alternation restarts at the beginning of each consecutive Long Shot run. */@@ -37,7 +42,6 @@ export function longShotBlocker(job: GenerationJob, config: ProjectConfig, requiconst plannedFrames = Math.max(22, Math.ceil((sceneDurationSeconds(source) * 24 - 5) / 17) * 17 + 5);const frames = needsOutput ? sceneOutputFrames(source, config) : requireCompleted ? plannedFrames : Math.max(sceneOutputFrames(source, config) ?? 0, plannedFrames);if (frames != null && frames < margin + LONG_SHOT_CONTEXT) return `“${source.title}” needs at least ${margin + LONG_SHOT_CONTEXT} frames for this bridge. Reduce its editable margin or lengthen the source.`;- if (!!source.latentUpscale !== !!job.latentUpscale) return "Use the same Latent upscale setting for the bridge and both neighboring clips.";}return null;}@@ -82,7 +86,8 @@ export function currentLongShotArchives(config: Pick<ProjectConfig, "assets" | "}export function longShotPlaybackSource(job: GenerationJob, config: Pick<ProjectConfig, "assets" | "generationJobs" | "videos">) {- const source = currentLongShotArchives(config).find((asset) => asset.sceneSegments?.some((part) => part.sceneId === job.id && part.latentRelativePath === job.latentRelativePath));+ const primary = config.assets.find(asset => asset.id === generationAssetId(job.id));+ const source = currentLongShotArchives(config).find((asset) => canReuseJoinedVideo(primary, asset) && asset.sceneSegments?.some((part) => part.sceneId === job.id && part.latentRelativePath === job.latentRelativePath));const segment = source?.sceneSegments?.find((part) => part.sceneId === job.id);return source && segment ? { source, segment } : null;}diff --git a/src/lib/project.singleShot.test.ts b/src/lib/project.singleShot.test.tsindex 4ee6cf2..828284b 100644--- a/src/lib/project.singleShot.test.ts+++ b/src/lib/project.singleShot.test.ts@@ -79,5 +79,5 @@ it("uses the starting video's ending latents and rejects cycles, missing sourcesexpect(continuationBlocker(next, [next, { ...source, sceneType: "prompt" }])).toBeNull();expect(continuationBlocker(next, [next, { ...source, continuationSceneId: next.id }])).toMatch(/cycle/);expect(continuationBlocker({ ...source, continuationSceneId: source.id }, [source])).toMatch(/cycle/);- expect(continuationBlocker(next, [next, { ...source, latentUpscale: true }])).toMatch(/Latent upscale/);+ expect(continuationBlocker(next, [next, { ...source, latentUpscale: true }])).toBeNull();});diff --git a/src/lib/project.ts b/src/lib/project.tsindex 7106b2e..20f8fbd 100644--- a/src/lib/project.ts+++ b/src/lib/project.ts@@ -643,6 +643,8 @@ export type SceneInput = z.infer<typeof sceneInputSchema>;export const sceneGenerationVersionSchema = z.object({id: idSchema, createdAt: isoDateSchema, scene: sceneInputSchema, media: projectAssetSchema,generationSnapshot: z.string().nullish(), latentRelativePath: projectRelativePathSchema.nullish(),+ originalLatentRelativePath: projectRelativePathSchema.nullish(),+ upscaleFactor: z.number().refine(value => [1.5, 2, 4].includes(value)).optional(),});export type SceneGenerationVersion = z.infer<typeof sceneGenerationVersionSchema>;const sceneGenerationHistorySchema = z.object({@@ -1091,7 +1093,6 @@ export function continuationBlocker(job: GenerationJob, jobs: readonly Generatioseen.add(id);const source = jobs.find((candidate) => candidate.id === id);if (!source) return "The selected source scene no longer exists.";- if (current.sceneType === "single-shot" && !!source.latentUpscale !== !!current.latentUpscale) return "Use the same Latent upscale setting for the Single Shot and its starting video.";if (source.sceneType !== "continue" && !continuationSceneId(source, jobs)) return null;current = source;}diff --git a/src/lib/runtime.ts b/src/lib/runtime.tsindex 067da3e..2f3f962 100644--- a/src/lib/runtime.ts+++ b/src/lib/runtime.ts@@ -118,6 +118,7 @@ export interface SlopfabGenerationRequest {videoSigmaShift?: number;audioSigmaShift?: number;latentUpscale?: boolean;+ latentUpscaleSource?: { path: string; scale: number };seed: number;canvasWidth: number;canvasHeight: number;diff --git a/src/lib/sceneGeneration.ts b/src/lib/sceneGeneration.tsindex 08f79f4..612bfd0 100644--- a/src/lib/sceneGeneration.ts+++ b/src/lib/sceneGeneration.ts@@ -47,7 +47,6 @@ export function sceneGenerationRequest(job: GenerationJob, config: ProjectConfig...generationSigmaShifts(job, template),generationEffects: activeGenerationEffects(job.generationEffects),...(job.audioSteps != null ? { audioSteps: job.audioSteps } : {}),- ...(job.latentUpscale ? { latentUpscale: true } : {}),seed: sceneGenerationSeed(job),canvasWidth: canvas.width,canvasHeight: canvas.height,diff --git a/src/lib/sceneHistory.test.ts b/src/lib/sceneHistory.test.tsindex a911557..6d8fdeb 100644--- a/src/lib/sceneHistory.test.ts+++ b/src/lib/sceneHistory.test.ts@@ -4,6 +4,21 @@ import { completeSceneGeneration, duplicateScene, makeSceneGenerationPrimary, reimport { ProjectSession } from "./projectSession";const initial = () => createProjectConfig({ name: "History", prompt: "A quiet scene", aspectRatio: "16:9", resolution: "416p", targetDurationSeconds: 5 });++it("keeps original reference latents across upscaled primaries, history pruning and reloads", () => {+ let config = finish(initial(), "original");+ const id = config.generationJobs[0].id;+ for (let i = 0; i < 6; i++) {+ config = completeSceneGeneration(config, id, { ...take(config, `upscale-${i}`), originalLatentRelativePath: "latents/original.safetensors", upscaleFactor: 2 });+ config = parseProjectConfig(JSON.parse(JSON.stringify(config)));+ expect(config.generationJobs[0].latentRelativePath).toBe("latents/original.safetensors");+ }+ const history = config.generationJobs[0].generationHistory!;+ expect(history.versions).toHaveLength(SCENE_GENERATION_HISTORY_LIMIT);+ expect(history.versions.at(-1)?.latentRelativePath).toBe("latents/upscale-5.safetensors");+ config = makeSceneGenerationPrimary(config, id, history.versions[0].id);+ expect(config.generationJobs[0].latentRelativePath).toBe("latents/original.safetensors");+});function take(config: ProjectConfig, id: string): SceneGenerationVersion {const job = config.generationJobs[0];return { id, createdAt: new Date(0).toISOString(), scene: sceneInput(job), generationSnapshot: id, latentRelativePath: `latents/${id}.safetensors`,diff --git a/src/lib/sceneHistory.ts b/src/lib/sceneHistory.tsindex a24b744..09bdabe 100644--- a/src/lib/sceneHistory.ts+++ b/src/lib/sceneHistory.ts@@ -85,7 +85,7 @@ export function makeSceneGenerationPrimary(config: ProjectConfig, sceneId: strinconst media = { ...structuredClone(version.media), id: assetId };return { ...config,generationJobs: config.generationJobs.map(j => j.id !== sceneId ? j : { ...j, generationHistory: { ...history, primaryId: versionId },- outputRelativePath: media.relativePath, latentRelativePath: version.latentRelativePath, generationSnapshot: version.generationSnapshot, status: "completed", stage: "completed", progress: 1, error: null }),+ outputRelativePath: media.relativePath, latentRelativePath: version.originalLatentRelativePath ?? version.latentRelativePath, generationSnapshot: version.generationSnapshot, status: "completed", stage: "completed", progress: 1, error: null }),assets: [...config.assets.map(a => a.id === assetId || a.kind === "generated" && a.relativePath === job.outputRelativePath? { ...media, id: a.id, name: a.name } : a), ...(config.assets.some(a => a.id === assetId) ? [] : [media])],};diff --git a/src/lib/sceneUpscale.ts b/src/lib/sceneUpscale.tsnew file mode 100644index 0000000..bd30b02--- /dev/null+++ b/src/lib/sceneUpscale.ts@@ -0,0 +1,20 @@+import { sceneHistory } from "./sceneHistory";+import type { GenerationJob, ProjectConfig } from "./project";+import type { GeneratorTemplate } from "./settings";+import type { GenerationSubmission } from "./workQueue";++export function selectedUpscaleTake(job: GenerationJob, config: ProjectConfig) {+ const history = sceneHistory(job, config.assets);+ return history.versions.find(take => take.id === history.selectedId);+}++export function sceneUpscaleSubmission(job: GenerationJob, config: ProjectConfig, scale: number, template: GeneratorTemplate): GenerationSubmission {+ const source = selectedUpscaleTake(job, config);+ if (!source?.latentRelativePath) throw new Error("Select a generated Take with saved latents to upscale.");+ if (![1.5, 2, 4].includes(scale)) throw new Error("Choose an upscale factor of 1.5, 2 or 4.");+ if (["queued", "generating", "ready"].includes(job.status)) throw new Error("Wait for this scene to finish before upscaling.");+ return { job, template, upscaleSource: source, snapshot: source.generationSnapshot ?? "",+ request: { jobId: job.id, prompt: "", steps: source.scene.steps ?? 8, seed: source.scene.seed ?? -1,+ frames: Math.round((source.media.durationMs ?? 0) * 24 / 1000), canvasWidth: source.media.width ?? 0, canvasHeight: source.media.height ?? 0,+ referencePaths: [], latentUpscaleSource: { path: source.latentRelativePath, scale } } };+}diff --git a/src/lib/workQueue.test.ts b/src/lib/workQueue.test.tsindex f61873f..fed72b2 100644--- a/src/lib/workQueue.test.ts+++ b/src/lib/workQueue.test.ts@@ -20,6 +20,8 @@ import { compileImagePrompt } from "./imagePrompt";import { addImageNode, createImageEditScene } from "./imageScene";import { createEmptyImage, imageGenerationSnapshot, makeImagePrimary, restoreGeneratedImage } from "./imageHistory";import { sceneGenerationRequest } from "./sceneGeneration";+import { sceneUpscaleSubmission } from "./sceneUpscale";+import { completeSceneGeneration, sceneInput } from "./sceneHistory";import { newSong } from "./music";import { musicTemplates } from "./settings";import { bridgeGapFrames, currentLongShotArchives } from "./longShot";@@ -65,6 +67,53 @@ const finish = async (queue: WorkQueue, id: string) => {await waitFor(() => expect(queue.getSnapshot().find((item) => item.id === id)?.status).toBe("completed"));};+it("upscales selected Takes repeatedly without diffusion, preserving source lineage and joined scene ranges", async () => {+ const { queue, first } = setup();+ const job = first.getSnapshot().config.generationJobs[0];+ const original = "latents/original.safetensors";+ const segments = [{ sceneId: job.id, startFrame: 0, frameCount: 124, latentRelativePath: original }];+ first.update(config => completeSceneGeneration(config, job.id, { id: "original", createdAt: config.createdAt, scene: sceneInput(job), generationSnapshot: "original settings", latentRelativePath: original,+ media: { id: `asset-${job.id}`, kind: "generated", mimeType: "video/mp4", name: job.title, relativePath: "media/original.mp4", width: 736, height: 416, durationMs: 124 / 24 * 1000, sceneSegments: segments, createdAt: config.createdAt } }));+ const template = loadGeneratorTemplateSettings().templates[0];+ let expectedSource = original;+ for (const scale of [1.5, 2, 4]) {+ const config = first.getSnapshot().config;+ const item = sceneUpscaleSubmission(config.generationJobs[0], config, scale, template);+ const [id] = queue.enqueue(first, [item]);+ item.request.latentUpscaleSource!.path = "edited-after-queue";+ await waitFor(() => expect(queue.getSnapshot().find(work => work.id === id)?.status).toBe("generating"));+ const sent = vi.mocked(enqueueSlopfabGeneration).mock.calls.at(-1)![0];+ expect(sent.latentUpscaleSource).toEqual({ path: expectedSource, scale });+ expect(sent.prompt).toBe(""); expect(sent.referencePaths).toEqual([]);+ expect(sent.singleShot).toBeUndefined(); expect(sent.previousSceneId).toBeUndefined();+ await finish(queue, id);+ const result = first.getSnapshot().config.generationJobs[0];+ const take = result.generationHistory!.versions.at(-1)!;+ expect(result.latentRelativePath).toBe(original);+ expect(result.generationSnapshot).toBe("original settings");+ expect(take.originalLatentRelativePath).toBe(original);+ expect(take.media.sceneSegments).toEqual(segments);+ expect(take.upscaleFactor).toBe(scale);+ expectedSource = take.latentRelativePath!;+ }+ expect(vi.mocked(saveGeneratedScene).mock.calls.every(([options]) => !options.outputSize)).toBe(true);+});++it.each(["failed", "cancelled"])("keeps the original Take usable when upscaling is %s", async state => {+ const { queue, first } = setup();+ const job = first.getSnapshot().config.generationJobs[0];+ first.update(config => completeSceneGeneration(config, job.id, { id: "original", createdAt: config.createdAt, scene: sceneInput(job), latentRelativePath: "latents/original.safetensors",+ media: { id: `asset-${job.id}`, kind: "generated", mimeType: "video/mp4", name: job.title, relativePath: "media/original.mp4", createdAt: config.createdAt } }));+ const config = first.getSnapshot().config;+ const [id] = queue.enqueue(first, [sceneUpscaleSubmission(config.generationJobs[0], config, 2, loadGeneratorTemplateSettings().templates[0])]);+ await waitFor(() => expect(enqueueSlopfabGeneration).toHaveBeenCalledOnce());+ if (state === "cancelled") await queue.cancel(id);+ emit("slopfab-job", { jobId: id, state, detail: state });+ await waitFor(() => expect(queue.getSnapshot()[0].status).toBe(state));+ expect(first.getSnapshot().config.generationJobs[0]).toMatchObject({ status: "completed", outputRelativePath: "media/original.mp4", latentRelativePath: "latents/original.safetensors" });+ expect(first.getSnapshot().config.generationJobs[0].generationHistory!.versions).toHaveLength(1);+});+it("queues an immutable music request and saves its audio into timeline media", async () => {const { queue, first, saved } = setup();const song = { ...newSong(), title: "Evening", style: "Soft jazz", seed: 42 };diff --git a/src/lib/workQueue.ts b/src/lib/workQueue.tsindex 9500ad3..d2e8084 100644--- a/src/lib/workQueue.ts+++ b/src/lib/workQueue.ts@@ -35,7 +35,7 @@ import type { SceneMediaSegment } from "./project";import { exportReferenceRefmod, refmodExportBlocker, refmodExportRequest, type RefmodExportTarget } from "./refmodExport";export type WorkStatus = "queued" | "preparing" | "generating" | "encoding" | "completed" | "failed" | "cancelled";-export interface GenerationSubmission { job: GenerationJob; request: SlopfabGenerationRequest; snapshot: string; template?: GeneratorTemplate }+export interface GenerationSubmission { job: GenerationJob; request: SlopfabGenerationRequest; snapshot: string; template?: GeneratorTemplate; upscaleSource?: import("./project").SceneGenerationVersion }export const MAX_IMAGE_BATCH_COUNT = 100;function imageGenerationSeed(seed: number): number {@@ -68,6 +68,7 @@ export interface WorkItem {settings: { frames: number; steps: number; audioSteps?: number; videoSigmaShift?: number; audioSigmaShift?: number; latentUpscale?: boolean; seed: number; canvasWidth: number; canvasHeight: number };}interface PendingWork {+ upscaleSource?: import("./project").SceneGenerationVersion;music?: MusicSong;sceneInput?: SceneInput;extend?: { sourceId: string; name: string; options: ExtendOptions };@@ -234,29 +235,31 @@ export class WorkQueue {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),} });- const captured = { ...submission.job, generatorTemplateId: chosen.id || undefined, steps: submission.request.steps, seed: submission.request.seed };+ const captured = submission.upscaleSource ? submission.job : { ...submission.job, generatorTemplateId: chosen.id || undefined, steps: submission.request.steps, seed: submission.request.seed };config.generationJobs = config.generationJobs.map(j => j.id === captured.id ? structuredClone(captured) : j);const id = `work-${crypto.randomUUID()}`;ids.push(id);let finish!: () => void;const done = new Promise<void>((resolve) => { finish = resolve; });- const request = structuredClone({ ...submission.request, jobId: id, steps: generationStepsWithLoras(submission.request.steps, config),- ...generationSigmaShiftsWithLoras(submission.request, config) });- this.work.set(id, { id, session, sceneId: submission.job.id, sceneInput: sceneInput(captured), request, config, snapshot: submission.snapshot, cancelled: false, submitted: false, done, finish });+ const request = structuredClone({ ...submission.request, jobId: id, ...(!submission.upscaleSource ? { steps: generationStepsWithLoras(submission.request.steps, config),+ ...generationSigmaShiftsWithLoras(submission.request, config) } : {}) });+ this.work.set(id, { id, session, sceneId: submission.job.id, sceneInput: structuredClone(submission.upscaleSource?.scene ?? sceneInput(captured)), upscaleSource: submission.upscaleSource && structuredClone(submission.upscaleSource), request, config, snapshot: submission.snapshot, cancelled: false, submitted: false, done, finish });this.items = [...this.items, {id, generationGroupId: id, projectKey, folderPath: session.record.folderPath, projectName: config.name,sceneId: submission.job.id, title: submission.job.title, submittedAt: new Date().toISOString(),- status: "queued", progress: 0, detail: "Waiting to generate", error: null, completionAt: null,+ status: "queued", progress: 0, detail: submission.upscaleSource ? "Waiting to upscale" : "Waiting to generate", error: null, completionAt: null,cancelling: false, needsSave: false,settings: { frames: request.frames, steps: request.steps, audioSteps: request.audioSteps, videoSigmaShift: request.videoSigmaShift, audioSigmaShift: request.audioSigmaShift, latentUpscale: request.latentUpscale, seed: request.seed, canvasWidth: request.canvasWidth, canvasHeight: request.canvasHeight },}];- this.updateScene(this.work.get(id)!, { status: "queued", stage: "queued", progress: 0, error: null, generationSnapshot: submission.snapshot, generatorTemplateId: captured.generatorTemplateId, steps: captured.steps, seed: captured.seed });+ this.updateScene(this.work.get(id)!, { status: "queued", stage: "queued", progress: 0, error: null,+ ...(!submission.upscaleSource ? { generationSnapshot: submission.snapshot, generatorTemplateId: captured.generatorTemplateId, steps: captured.steps, seed: captured.seed } : {}) });}// Link after the whole batch is present, including sources submitted in// earlier calls. Group IDs survive completed-work cleanup and draft edits.for (const id of ids) {const work = this.work.get(id)!;const job = work.config.generationJobs.find((job) => job.id === work.sceneId)!;+ if (work.upscaleSource) continue;const sources = new Set([work.request.previousSceneId, work.request.latentBridge?.leftSceneId,work.request.latentBridge?.rightSceneId, longShotPosition(job, sceneSiblings(job, work.config))?.previousBridge?.id]);const group = this.items.find((item) => item.id === id)!.generationGroupId!;@@ -523,7 +526,7 @@ export class WorkQueue {continue;}const work = this.work.get(next.id)!;- this.patch(work.id, { status: "preparing", detail: work.refmod ? "Preparing refmod" : "Preparing generation" });+ this.patch(work.id, { status: "preparing", detail: work.refmod ? "Preparing refmod" : work.upscaleSource ? "Preparing upscale" : "Preparing generation" });try {await this.ready;if (work.cancelled) continue;@@ -563,8 +566,9 @@ export class WorkQueue {const blocker = continuationBlocker(captured, live.generationJobs);if (blocker) throw new Error(blocker);const sourceInput = JSON.parse(previous.generationSnapshot ?? "null");- if (sourceInput && (sourceInput.canvasWidth !== work.request.canvasWidth || sourceInput.canvasHeight !== work.request.canvasHeight || !!sourceInput.latentUpscale !== !!work.request.latentUpscale))- throw new Error("Use the starting video's resolution and Latent upscale setting.");+ const divisor = sourceInput?.latentUpscale ? 2 : 1;+ if (sourceInput && (Math.ceil(sourceInput.canvasWidth / divisor / 32) * 32 !== work.request.canvasWidth || Math.ceil(sourceInput.canvasHeight / divisor / 32) * 32 !== work.request.canvasHeight))+ throw new Error("Use the resolution of the starting video's original latents.");}if (captured.sceneType === "long-shot") {const current = live.generationJobs.find((job) => job.id === work.sceneId);@@ -590,7 +594,8 @@ export class WorkQueue {const plan = await resolveSlopfabPlan(work.request, work.config, next.folderPath);if (work.cancelled) continue;work.outputFrames = plan.alignedFrames;- this.patch(work.id, { status: "generating", detail: work.music ? "Generating music" : `Generating ${work.image ? "image" : `${plan.alignedFrames} frames`} at ${plan.canvasWidth} × ${plan.canvasHeight}` });+ this.patch(work.id, { status: "generating", detail: work.upscaleSource ? `Upscaling to ${plan.canvasWidth} × ${plan.canvasHeight}` : work.music ? "Generating music" : `Generating ${work.image ? "image" : `${plan.alignedFrames} frames`} at ${plan.canvasWidth} × ${plan.canvasHeight}`,+ ...(work.upscaleSource ? { settings: { ...next.settings, frames: plan.alignedFrames, canvasWidth: plan.canvasWidth, canvasHeight: plan.canvasHeight } } : {}) });this.updateScene(work, { status: "generating", stage: "preparing" }, false);await enqueueSlopfabGeneration(work.request, work.config, next.folderPath);work.submitted = true;@@ -672,7 +677,7 @@ export class WorkQueue {private cancelled(work: PendingWork, detail = "Generation cancelled before it started.") {this.timing.clear(work.id);this.patch(work.id, { status: "cancelled", detail, cancelling: false, completionAt: null });- this.updateScene(work, { status: "cancelled", stage: "failed", error: detail });+ this.updateScene(work, work.upscaleSource ? { status: "completed", stage: "completed", progress: 1, error: detail } : { status: "cancelled", stage: "failed", error: detail });void work.session.save().catch(() => undefined);work.finish();}@@ -685,7 +690,7 @@ export class WorkQueue {const detail = describeDiagnosticError(reason);this.timing.clear(work.id);this.patch(work.id, { status: "failed", detail: work.refmod ? "Refmod export failed" : "Generation failed", error: detail, completionAt: null, cancelling: false });- this.updateScene(work, { status: "failed", stage: "failed", error: detail });+ this.updateScene(work, work.upscaleSource ? { status: "completed", stage: "completed", progress: 1, error: detail } : { status: "failed", stage: "failed", error: detail });writeDiagnostic("error", "work-queue", "generation.failed", detail, { workId: work.id, sceneId: work.sceneId, folderPath: work.session.record.folderPath });void work.session.save().catch(() => undefined);work.finish();@@ -817,7 +822,7 @@ export class WorkQueue {if (work.cancelled) { this.cancelled(work); return; }const assetId = generationAssetId(work.sceneId);const totalFrames = saved.durationMs ? Math.round(saved.durationMs * GENERATION_FRAME_RATE / 1000) : work.outputFrames ?? work.request.frames;- const sceneSegments = work.request.latentBridge+ const sceneSegments = work.upscaleSource ? work.upscaleSource.media.sceneSegments : work.request.latentBridge? bridgedSceneSegments(work.sceneId, generationLatentPath(work.id), totalFrames, work.request.frames, work.request.latentBridge, work.bridgeSegments): joinedSceneSegments(work.sceneId, generationLatentPath(work.id), totalFrames,Math.ceil(work.request.frames / 17) * 17, work.request.previousSceneId ? {@@ -828,7 +833,9 @@ export class WorkQueue {const media = { kind: "generated" as const, relativePath: saved.relativePath, sourcePath: null, mimeType: "video/mp4", hasAudio: saved.hasAudio ?? null, width: saved.width ?? work.request.canvasWidth, height: saved.height ?? work.request.canvasHeight, durationMs: saved.durationMs ?? Math.round(totalFrames / GENERATION_FRAME_RATE * 1000), sceneSegments };const version = { id: work.id, createdAt: new Date().toISOString(), scene: work.sceneInput!,media: { ...media, id: assetId, name: work.sceneInput!.title, createdAt: new Date().toISOString() },- generationSnapshot: work.snapshot, latentRelativePath: generationLatentPath(work.id) };+ generationSnapshot: work.snapshot, latentRelativePath: generationLatentPath(work.id),+ ...(work.upscaleSource ? { originalLatentRelativePath: work.upscaleSource.originalLatentRelativePath ?? work.upscaleSource.latentRelativePath,+ upscaleFactor: work.request.latentUpscaleSource!.scale } : {}) };work.session.update(sceneResultUpdate(work.sceneId, version, saved.note));try {await work.session.save();diff --git a/src/styles/generator.css b/src/styles/generator.cssindex 08a8717..91578fe 100644--- a/src/styles/generator.css+++ b/src/styles/generator.css@@ -1044,3 +1044,14 @@.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); }++.scene-generation-controls { display: flex; min-width: 0; }+.scene-generation-controls > .scene-generate-button { flex: 1; }+.scene-generation-controls--split { border: 1px solid var(--button-primary-stroke); border-bottom-color: var(--button-primary-stroke-bottom); border-radius: var(--radius-sm); background: var(--button-primary-bg); }+.scene-generation-controls--split > .primary-button { min-height: calc(var(--control-md) - 2px); border: 0; background: transparent; }+.scene-generation-controls--split > .scene-generate-button { border-radius: calc(var(--radius-sm) - 1px) 0 0 calc(var(--radius-sm) - 1px); }+.scene-generation-controls--split > .scene-generation-options { position: relative; flex: 0 0 var(--control-md); padding: 0; border-radius: 0 calc(var(--radius-sm) - 1px) calc(var(--radius-sm) - 1px) 0; }+.scene-generation-options::before { content: ""; position: absolute; left: 0; top: 25%; bottom: 25%; width: 1px; background: currentColor; opacity: .22; }+.scene-generation-controls--split > .primary-button:hover:not(:disabled), .scene-generation-controls--split > .primary-button[aria-expanded="true"] { background: var(--button-primary-hover); }+.scene-generation-controls--split > .primary-button:active:not(:disabled) { background: var(--button-primary-active); }+.scene-generation-actions { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); }