AI media harness for planning, generating, and editing locally
TypeScript
Add scene latent upscale toggle
Bittiabfa2fda44b7
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 1393b5e..9b579f2 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -4,6 +4,8 @@ This alpha update adds LAN generation workers, Linux support, expanded color gra## What's new+- Scene Generation settings now offer Latent upscale: generate at half resolution and upscale to the selected output size, locally or on a LAN worker. Download its model or choose a local file in Other weights settings.+- Character Sheet creates a selectable image-bar entry as soon as generation is queued. Selecting it while generation runs shows the template's existing settings panel with the submitted settings. Finished results open in the normal image editor.- LAN workers: run the Slopus worker package on another Windows or Linux computer and pick it in the new **Settings → Workers** tab to generate there. Slopus finds workers on the local network automatically, or by address. Workers download generator weights from their download links themselves and use CUDA when available, with a Vulkan fallback; local-only files are sent from this computer, and finished videos, images and latents are saved in your project as usual.- Slopus for Linux (x86_64): install the .deb or .rpm package, or run the AppImage, which updates itself. Local generation on Linux needs an NVIDIA GPU with CUDA 13.diff --git a/docs/slopfab-compatibility.md b/docs/slopfab-compatibility.mdindex 65037f9..3749590 100644--- a/docs/slopfab-compatibility.md+++ b/docs/slopfab-compatibility.md@@ -1,5 +1,28 @@# Slopfab compatibility+## 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.22: export upscalingThe bundled Windows and Linux runtimes come from SlopFab commit `d4f423f`,diff --git a/src/components/OtherWeightsSettings.test.tsx b/src/components/OtherWeightsSettings.test.tsxindex ac1ec3a..ca2e642 100644--- a/src/components/OtherWeightsSettings.test.tsx+++ b/src/components/OtherWeightsSettings.test.tsx@@ -4,7 +4,7 @@ import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-liimport { afterEach, expect, it, vi } from "vitest";import { invoke } from "@tauri-apps/api/core";import { OtherWeightsSettings } from "./OtherWeightsSettings";-import { OTHER_WEIGHT_TEMPLATES, localOtherWeightPaths, otherWeightPaths, refreshOtherWeights, upscaleConfig } from "../lib/upscalers";+import { OTHER_WEIGHT_TEMPLATES, localOtherWeightPaths, otherWeightPaths, refreshOtherWeights, upscaleConfig, latentUpscalerPath } from "../lib/upscalers";import { chooseEnginePath } from "../lib/runtime";vi.mock("@tauri-apps/api/core", () => ({ invoke: vi.fn() }));vi.mock("@tauri-apps/api/event", () => ({ listen: vi.fn().mockResolvedValue(() => {}) }));@@ -51,7 +51,8 @@ it.each(OTHER_WEIGHT_TEMPLATES.flatMap((template) => [false, true].map((remote)fireEvent.click(screen.getByRole("button", { name: "Save" }));await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());await refreshOtherWeights();- expect(upscaleConfig(template.id)).toEqual({ method: template.id, modelPath: "D:/custom/model.safetensors",+ if (template.id === "latent-upscale") expect(latentUpscalerPath()).toBe("D:/custom/model.safetensors");+ else expect(upscaleConfig(template.id)).toEqual({ method: template.id, modelPath: "D:/custom/model.safetensors",...(template.id === "seedvr2" ? { vaePath: "D:/custom/vae.safetensors" } : {}) });fireEvent.click(screen.getByRole("button", { name: `Edit ${template.name} weights` }));for (const file of template.files) {@@ -90,3 +91,29 @@ it("rejects relative paths and missing files without saving them", async () => {await waitFor(() => expect(screen.getByText(/Weight file not found/)).toBeInTheDocument());expect(localOtherWeightPaths()).toEqual({});});++it("resolves latent upscaling weights locally or as a worker download", () => {+ const url = OTHER_WEIGHT_TEMPLATES[2].files[0].url;+ expect(latentUpscalerPath()).toBeUndefined();+ localStorage.setItem("slopus.other-weights.v1", JSON.stringify({ [url]: "C:/cache/upscaler.safetensors" }));+ expect(latentUpscalerPath()).toBe("C:/cache/upscaler.safetensors");+ localStorage.setItem("slopus.generation-worker.v1", JSON.stringify({ id: "worker" }));+ expect(latentUpscalerPath()).toBe(url);+});++it("downloads the latent upscale checkpoint into Other weights", async () => {+ const url = "https://huggingface.co/LBH-123-AI/Minimax_h3_latent_Upscaler/resolve/main/minimax_h3_latent_upscaler_3d_conv_v1/minimax_h3_latent_upscaler_3d_conv_v1_fp16.safetensors";+ vi.mocked(invoke).mockImplementation(async (name) => {+ if (name === "find_downloaded_weights") return {} as never;+ if (name === "download_weight") return "C:/weights/latent-upscaler.safetensors" as never;+ return undefined as never;+ });+ render(<OtherWeightsSettings desktop />);+ await waitFor(() => expect(invoke).toHaveBeenCalledWith("find_downloaded_weights", expect.anything()));+ const card = screen.getByText("Latent upscale").closest(".ui-settings-card") as HTMLElement;+ fireEvent.click(within(card).getByRole("button", { name: "Download" }));+ await waitFor(() => expect(within(card).getByRole("button", { name: "Downloaded" })).toBeDisabled());+ expect(invoke).toHaveBeenCalledWith("download_weight", expect.objectContaining({ url }));+ expect(latentUpscalerPath()).toBe("C:/weights/latent-upscaler.safetensors");+ expect(within(card).getByText("Ready for scene generation")).toBeInTheDocument();+});diff --git a/src/components/OtherWeightsSettings.tsx b/src/components/OtherWeightsSettings.tsxindex 4248c3b..0e26d39 100644--- a/src/components/OtherWeightsSettings.tsx+++ b/src/components/OtherWeightsSettings.tsx@@ -26,7 +26,7 @@ export function OtherWeightsSettings({ desktop }: { desktop: boolean }) {const waiting = queued.find((item) => item.otherWeightId === template.id);return <OpenableCard key={template.id} icon={<Image20 />} header={template.name}openLabel={`Edit ${template.name} weights`} onOpen={() => setEditing(template.id)}- description={waiting ? "Queued for download" : active ? `Downloading ${download.currentFile ?? template.name}` : ready ? "Ready for image and video export" : template.files.map((file) => file.name).join(" · ")}+ description={waiting ? "Queued for download" : active ? `Downloading ${download.currentFile ?? template.name}` : ready ? template.id === "latent-upscale" ? "Ready for scene generation" : "Ready for image and video export" : template.files.map((file) => file.name).join(" · ")}actions={<>{waiting ? <button type="button" onClick={() => cancelQueuedWeightDownload(waiting.templateId)}>Cancel</button>: active ? <><ProgressBar value={weightDownloadProgress(download)} aria-label={`Downloading ${template.name} weights`} />@@ -81,6 +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 === "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 92dc7b9..27355af 100644--- a/src/components/workspace/GeneratorView.test.tsx+++ b/src/components/workspace/GeneratorView.test.tsx@@ -585,11 +585,16 @@ describe("Generator scene controls", () => {expect(state.latest().generationJobs.map((job) => job.status)).toEqual(["queued", "queued"]);});- it.each([false, true])("saves generation controls with separate audio steps %s", async (separateAudio) => {+ 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) => {const initial = project();initial.settings = { ...initial.settings, resolution: "416p", frameRate: 60 };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).getByRole("spinbutton", { name: "Generation step count" })).toHaveValue(20);expect(within(generation).getByRole("spinbutton", { name: "Generation seed" })).toHaveValue(-1);@@ -607,6 +612,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!)).toEqual(expect.objectContaining({steps: 28,seed: 9173,diff --git a/src/components/workspace/ImageExportView.test.tsx b/src/components/workspace/ImageExportView.test.tsxindex 94d6d46..6ede36f 100644--- a/src/components/workspace/ImageExportView.test.tsx+++ b/src/components/workspace/ImageExportView.test.tsx@@ -46,7 +46,7 @@ it("refuses to export a draft and says why", () => {expect(screen.getByText("The image is a draft")).toBeInTheDocument();});-it.each(OTHER_WEIGHT_TEMPLATES)("exports with the selected $name model paths", async (template) => {+it.each(OTHER_WEIGHT_TEMPLATES.filter((template) => template.id !== "latent-upscale"))("exports with the selected $name model paths", async (template) => {vi.spyOn(persistence, "isTauri").mockReturnValue(true);vi.spyOn(persistence, "readMediaFileUrl").mockResolvedValue(null);vi.mocked(invoke).mockImplementation(async (command) => command === "choose_image_export_destination" ? "D:/out.jpg" : 123);diff --git a/src/components/workspace/SceneEditor.tsx b/src/components/workspace/SceneEditor.tsxindex 6bca04e..5571a96 100644--- a/src/components/workspace/SceneEditor.tsx+++ b/src/components/workspace/SceneEditor.tsx@@ -488,6 +488,11 @@ export function SceneInspector({ job, shots, references, folderPath = "", scenesonCommit={(value) => onChange({ steps: value })}/></PropRow>+ <PropRow label="Latent upscale" htmlFor={`${id}-latent-upscale`}>+ <ToggleSwitch id={`${id}-latent-upscale`} aria-label="Latent upscale" checked={job.latentUpscale ?? false} disabled={disabled}+ onChange={(checked) => onChange({ latentUpscale: checked })} />+ </PropRow>+ <p className="prop-caption">Generate at half resolution, then upscale to the selected resolution. Requires Latent upscale weights in Settings → Generator → Other weights.</p><PropRow label="Separate audio steps" htmlFor={`${id}-separate-audio-steps`}><ToggleSwitch id={`${id}-separate-audio-steps`} aria-label="Separate audio steps" 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/lib/generatedVideo.test.ts b/src/lib/generatedVideo.test.tsindex 2da7c65..733a034 100644--- a/src/lib/generatedVideo.test.ts+++ b/src/lib/generatedVideo.test.ts@@ -244,3 +244,40 @@ describe("generated audio at the Rust/webview boundary", () => {expect(invoked).toHaveBeenCalledWith("release_generated_frames", { jobId: "job-01" });});});++it("encodes grid-aligned upscaled frames at the selected output size", async () => {+ desktop();+ const frames: VideoFrameBufferInit[] = [];+ const configured: VideoEncoderConfig[] = [];+ class FakeVideoFrame {+ constructor(_pixels: unknown, init: VideoFrameBufferInit) { frames.push(init); }+ close() { /* released */ }+ }+ class FakeVideoEncoder {+ static isConfigSupported = async (config: VideoEncoderConfig) => ({ supported: true, config });+ state = "configured";+ encodeQueueSize = 0;+ constructor(private init: VideoEncoderInit) {}+ configure(config: VideoEncoderConfig) { configured.push(config); }+ encode() { this.init.output({} as EncodedVideoChunk); }+ async flush() { /* complete */ }+ close() { this.state = "closed"; }+ }+ scope.VideoFrame = FakeVideoFrame;+ scope.VideoEncoder = FakeVideoEncoder;+ invoked.mockImplementation(async (command: string) => {+ if (command === "generated_summary") return summary({ width: 768, height: 448, frameCount: 2, audioSamples: 0 });+ if (command === "generated_frame") return new Uint8Array(768 * 448 * 4);+ if (command === "write_generated_video") return { relativePath: "media/generated/job-01.mp4", bytes: 4 };+ return true;+ });+ const saved = await saveGeneratedScene({ folderPath: "C:/Project", jobId: "job-01", outputSize: { width: 736, height: 416 } });+ expect(saved).toMatchObject({ width: 736, height: 416, durationMs: 83 });+ expect(configured[0]).toMatchObject({ width: 736, height: 416 });+ expect(muxed.configs[0].video).toMatchObject({ width: 736, height: 416 });+ expect(frames).toHaveLength(2);+ expect(frames[0]).toMatchObject({ codedWidth: 768, codedHeight: 448, timestamp: 0 });+ expect(frames[1].timestamp).toBe(41667);+ expect(muxed.videoChunks).toBe(2);+ expect(invoked).toHaveBeenCalledWith("release_generated_frames", { jobId: "job-01" });+});diff --git a/src/lib/generatedVideo.ts b/src/lib/generatedVideo.tsindex 1693bf1..bf90878 100644--- a/src/lib/generatedVideo.ts+++ b/src/lib/generatedVideo.ts@@ -331,6 +331,8 @@ export async function saveGeneratedScene(options: {jobId: string;/** Queue runs have unique IDs; timeline caches still belong to the scene. */thumbnailJobId?: string;+ /** Fit grid-aligned latent upscaling to the selected output using WebCodecs. */+ outputSize?: { width: number; height: number };/** Called as frames go into the encoder, for the progress bar. */onProgress?: (encoded: number, total: number) => void;}): Promise<SavedGeneration> {@@ -352,11 +354,15 @@ export async function saveGeneratedScene(options: {});try {+ const { width, height } = options.outputSize ?? summary;+ if (!Number.isSafeInteger(width) || !Number.isSafeInteger(height) || width <= 0 || height <= 0) {+ throw new Error("The selected video output dimensions are invalid.");+ }const fps = summary.fps > 0 ? summary.fps : 24;- const bitrate = bitrateFor(summary.width, summary.height, fps, GENERATED_QUALITY);- const { codec } = await pickCodec(summary.width, summary.height, fps, bitrate);+ const bitrate = bitrateFor(width, height, fps, GENERATED_QUALITY);+ const { codec } = await pickCodec(width, height, fps, bitrate);writeDiagnostic("info", "generated-video", "video_encoder.selected", "WebCodecs accepted a video encoder configuration.", {- jobId, codec, bitrate, fps, width: summary.width, height: summary.height,+ jobId, codec, bitrate, fps, width, height,});const sound = await audioConfig(summary);const audioChunks: Array<{ chunk: EncodedAudioChunk; meta?: EncodedAudioChunkMetadata }> = [];@@ -379,7 +385,7 @@ export async function saveGeneratedScene(options: {const target = new ArrayBufferTarget();const muxer = new Muxer({target,- video: { codec: outputCodec("h264").muxer, width: summary.width, height: summary.height, frameRate: Math.round(fps) },+ video: { codec: outputCodec("h264").muxer, width, height, frameRate: Math.round(fps) },...(withAudio? { audio: { codec: "aac" as const, numberOfChannels: summary.audioChannels, sampleRate: sound!.sampleRate! } }: {}),@@ -393,7 +399,7 @@ export async function saveGeneratedScene(options: {output: (chunk, meta) => muxer.addVideoChunk(chunk, meta),error: (reason) => { failure.reason = reason instanceof Error ? reason : new Error(String(reason)); },});- encoder.configure({ codec, width: summary.width, height: summary.height, bitrate, framerate: fps, avc: { format: "avc" } });+ encoder.configure({ codec, width, height, bitrate, framerate: fps, avc: { format: "avc" } });const makeFrame = frameFactory(summary.width, summary.height);/* Computed from the index every time rather than accumulated, so a rate@@ -433,7 +439,7 @@ export async function saveGeneratedScene(options: {const written = await writeGeneratedVideo(folderPath, jobId, new Uint8Array(target.buffer));await Promise.allSettled(timelineThumbnails.map((thumbnail) =>writeTimelineThumbnail(folderPath, options.thumbnailJobId ?? jobId, thumbnail.timeMs, thumbnail.bytes)));- return { relativePath: written.relativePath, bytes: written.bytes, note, hasAudio: withAudio, width: summary.width, height: summary.height, durationMs: Math.round(summary.frameCount / summary.fps * 1000) };+ return { relativePath: written.relativePath, bytes: written.bytes, note, hasAudio: withAudio, width, height, durationMs: Math.round(summary.frameCount / summary.fps * 1000) };} finally {// Whatever happened, the render stops occupying memory here.await releaseRendered(jobId);diff --git a/src/lib/project.ts b/src/lib/project.tsindex 1b13a62..60c50ad 100644--- a/src/lib/project.ts+++ b/src/lib/project.ts@@ -579,6 +579,7 @@ export const generationJobSchema = z.object({* were exposed; the readers below give those scenes the current defaults* without rewriting the file just because it was opened. */steps: z.number().int().min(2).max(MAX_GENERATION_STEPS).nullish(),+ latentUpscale: z.boolean().nullish(),audioSteps: z.number().int().min(2).max(MAX_AUDIO_GENERATION_STEPS).nullish(),seed: z.number().int().min(RANDOM_GENERATION_SEED).max(Number.MAX_SAFE_INTEGER).nullish(),/** Base guide §4.6 and §4.7. Per-PROMPT fields, not per-shot, so they live on@@ -1145,6 +1146,7 @@ export interface SceneGenerationInput {frames: number;steps: number;audioSteps?: number;+ latentUpscale?: boolean;seed: number;canvasWidth: number;canvasHeight: number;@@ -1176,6 +1178,7 @@ export function sceneGenerationSnapshot(job: GenerationJob, input: SceneGeneratiframes: input.frames,steps: input.steps,...(input.audioSteps !== undefined ? { audioSteps: input.audioSteps } : {}),+ ...(input.latentUpscale ? { latentUpscale: true } : {}),seed: input.seed,canvasWidth: input.canvasWidth,canvasHeight: input.canvasHeight,diff --git a/src/lib/runtime.ts b/src/lib/runtime.tsindex aec61d0..80177ce 100644--- a/src/lib/runtime.ts+++ b/src/lib/runtime.ts@@ -99,6 +99,7 @@ export interface SlopfabGenerationRequest {imageEdit?: { sourceRelativePath: string; edits: import("./imageEditing").ImageEditStep[] };steps: number;audioSteps?: number;+ latentUpscale?: boolean;seed: number;canvasWidth: number;canvasHeight: number;diff --git a/src/lib/sceneGeneration.ts b/src/lib/sceneGeneration.tsindex f872727..81eb9aa 100644--- a/src/lib/sceneGeneration.ts+++ b/src/lib/sceneGeneration.ts@@ -34,6 +34,7 @@ export function sceneGenerationRequest(job: GenerationJob, config: ProjectConfigframes: Math.round(sceneDurationSeconds(job) * GENERATION_FRAME_RATE),steps: sceneGenerationSteps(job, defaultGenerationSteps),...(job.audioSteps != null ? { audioSteps: job.audioSteps } : {}),+ ...(job.latentUpscale ? { latentUpscale: true } : {}),seed: sceneGenerationSeed(job),canvasWidth: canvas.width,canvasHeight: canvas.height,diff --git a/src/lib/settings.ts b/src/lib/settings.tsindex 69e118a..73821e3 100644--- a/src/lib/settings.ts+++ b/src/lib/settings.ts@@ -12,6 +12,7 @@* in src-tauri/core/src/slopfab/config.rs. Renaming one here without renaming it there* silently drops that path.*/+import { latentUpscalerPath } from "./upscalers";import { DEFAULT_GENERATION_STEPS, MAX_GENERATION_STEPS, type ProjectConfig, type ProviderSetting } from "./project";// Type-only: erased at build time, so this does not close a cycle with runtime.ts.import type { ProviderId } from "./runtime";@@ -523,6 +524,9 @@ export function engineProviderSetting(settings: EngineSettings, base?: ProviderSdelete options.promptEmbedding;delete options.motionCache;delete options.workerWeightSources;+ delete options.latentUpscaler;+ const latentUpscaler = latentUpscalerPath();+ if (latentUpscaler) options.latentUpscaler = latentUpscaler;if (remote && sources) {options.workerWeightSources = JSON.stringify(Object.fromEntries(Object.entries(sources).filter(([role, entries]) => entries?.length && !(mode === "animate" && (role === "textEncoder" || role === "tokenizer")))diff --git a/src/lib/upscalers.ts b/src/lib/upscalers.tsindex 6535806..0ff47ca 100644--- a/src/lib/upscalers.ts+++ b/src/lib/upscalers.ts@@ -8,6 +8,7 @@ export const UPSCALERS = [{ value: "realesrgan", label: "Real-ESRGAN" },{ value: "seedvr2", label: "SeedVR2" },] as const;+export const LATENT_UPSCALER_URL = "https://huggingface.co/LBH-123-AI/Minimax_h3_latent_Upscaler/resolve/main/minimax_h3_latent_upscaler_3d_conv_v1/minimax_h3_latent_upscaler_3d_conv_v1_fp16.safetensors";export const OTHER_WEIGHT_TEMPLATES = [{ id: "realesrgan", name: "Real-ESRGAN", files: [{ id: "model", name: "RealESRGAN x4plus", url: "https://huggingface.co/Comfy-Org/Real-ESRGAN_repackaged/resolve/main/RealESRGAN_x4plus.safetensors" },@@ -16,6 +17,9 @@ export const OTHER_WEIGHT_TEMPLATES = [{ id: "model", name: "SeedVR2 3B FP16", url: "https://huggingface.co/Comfy-Org/SeedVR2/resolve/main/diffusion_models/seedvr2_3b_fp16.safetensors" },{ id: "vae", name: "SeedVR2 VAE", url: "https://huggingface.co/Comfy-Org/SeedVR2/resolve/main/vae/seedvr2_ema_vae_fp16.safetensors" },] },+ { id: "latent-upscale", name: "Latent upscale", files: [+ { id: "model", name: "MiniMax H3 latent upscaler", url: LATENT_UPSCALER_URL },+ ] },] as const;const KEY = "slopus.other-weights.v1";const LOCAL_KEY = "slopus.other-weights-local.v1";@@ -61,6 +65,11 @@ export function upscaleConfig(method: Upscaler): UpscaleConfig | undefined {return { method, modelPath: paths[template.files[0].url],...(template.id === "seedvr2" ? { vaePath: paths[template.files[1].url] } : {}) };}+/** Resolve on this machine, or let a worker download the standard checkpoint. */+export function latentUpscalerPath(): string | undefined {+ return selectedWorker() ? localOtherWeightPaths()[LATENT_UPSCALER_URL] ?? LATENT_UPSCALER_URL+ : otherWeightPaths()[LATENT_UPSCALER_URL];+}export async function refreshOtherWeights() {if (!isTauri()) return;const urls = OTHER_WEIGHT_TEMPLATES.flatMap((item) => item.files.map((file) => file.url));diff --git a/src/lib/workQueue.test.ts b/src/lib/workQueue.test.tsindex 5636ac3..8aefd16 100644--- a/src/lib/workQueue.test.ts+++ b/src/lib/workQueue.test.ts@@ -9,6 +9,7 @@ import { ProjectSession } from "./projectSession";import { cancelSlopfabGeneration, enqueueSlopfabGeneration, resolveSlopfabPlan } from "./runtime";import { saveEngineSettings, saveGeneratorTemplateSettings, loadGeneratorTemplateSettings, EMPTY_ENGINE_SETTINGS, type GeneratorTemplate } from "./settings";import { generateAgentScene } from "./agentGeneration";+import { LATENT_UPSCALER_URL, saveLocalOtherWeightPaths } from "./upscalers";import { WorkQueue, type GenerationSubmission } from "./workQueue";import { saveSceneLastFrame } from "./sceneLastFrame";import { prepareReferenceVideos, releaseReferenceVideos } from "./referenceVideo";@@ -830,3 +831,23 @@ describe("project sessions", () => {expect(session.getSnapshot().dirty).toBe(false);});});++it.each([false, true])("freezes latent upscale %s and saves the selected output size", async (latentUpscale) => {+ const { queue, first } = setup();+ const item = submission(first);+ item.request.latentUpscale = latentUpscale;+ saveLocalOtherWeightPaths({ [LATENT_UPSCALER_URL]: "C:/weights/upscaler.safetensors" });+ queue.enqueue(first, [item]);+ item.request.latentUpscale = !latentUpscale;+ saveLocalOtherWeightPaths({ [LATENT_UPSCALER_URL]: "C:/changed.safetensors" });+ await waitFor(() => expect(enqueueSlopfabGeneration).toHaveBeenCalledOnce());+ expect(vi.mocked(resolveSlopfabPlan).mock.calls[0][0]).toMatchObject({ latentUpscale, canvasWidth: 736, canvasHeight: 416 });+ expect(vi.mocked(enqueueSlopfabGeneration).mock.calls[0][0]).toMatchObject({ latentUpscale, canvasWidth: 736, canvasHeight: 416 });+ expect(vi.mocked(enqueueSlopfabGeneration).mock.calls[0][1].providerSettings.slopfab.options.latentUpscaler).toBe("C:/weights/upscaler.safetensors");+ const work = queue.getSnapshot()[0];+ expect(work.settings.latentUpscale).toBe(latentUpscale);+ emit("slopfab-progress", { jobId: work.id, stage: "upscaling", step: 1, totalSteps: 2 });+ expect(queue.getSnapshot()[0].detail).toBe("Upscaling video latents");+ await finish(queue, work.id);+ expect(vi.mocked(saveGeneratedScene).mock.calls[0][0].outputSize).toEqual(latentUpscale ? { width: 736, height: 416 } : undefined);+});diff --git a/src/lib/workQueue.ts b/src/lib/workQueue.tsindex 51b5169..95c397f 100644--- a/src/lib/workQueue.ts+++ b/src/lib/workQueue.ts@@ -56,7 +56,7 @@ export interface WorkItem {completionAt: number | null;cancelling: boolean;needsSave: boolean;- settings: { frames: number; steps: number; audioSteps?: number; seed: number; canvasWidth: number; canvasHeight: number };+ settings: { frames: number; steps: number; audioSteps?: number; latentUpscale?: boolean; seed: number; canvasWidth: number; canvasHeight: number };}interface PendingWork {extend?: { sourceId: string; name: string; options: ExtendOptions };@@ -229,7 +229,7 @@ export class WorkQueue {sceneId: submission.job.id, title: submission.job.title, submittedAt: new Date().toISOString(),status: "queued", progress: 0, detail: "Waiting to generate", error: null, completionAt: null,cancelling: false, needsSave: false,- settings: { frames: request.frames, steps: request.steps, audioSteps: request.audioSteps, seed: request.seed, canvasWidth: request.canvasWidth, canvasHeight: request.canvasHeight },+ settings: { frames: request.frames, steps: request.steps, audioSteps: request.audioSteps, 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 });}@@ -561,7 +561,7 @@ export class WorkQueue {return;}const progress = Math.max(item.progress, event.totalSteps > 0 ? Math.min(0.88, 0.12 + Math.max(0, event.step) / event.totalSteps * 0.76) : event.stage === "delivering" ? 0.88 : 0.08);- this.patch(work.id, { status: "generating", progress, completionAt: this.timing.update(event), detail: item.cancelling ? "Cancelling generation" : work.request.imageEdit ? `Applying image edits (${Math.min(work.request.imageEdit.edits.length, Math.floor(event.step / Math.max(1, event.totalSteps) * work.request.imageEdit.edits.length) + 1)} of ${work.request.imageEdit.edits.length})` : event.stage === "starting" || event.stage === "transformerLoad" ? "Loading MiniMax H3" : work.image ? "Generating image" : "Generating video" });+ this.patch(work.id, { status: "generating", progress, completionAt: this.timing.update(event), detail: item.cancelling ? "Cancelling generation" : event.stage === "upscaling" ? "Upscaling video latents" : work.request.imageEdit ? `Applying image edits (${Math.min(work.request.imageEdit.edits.length, Math.floor(event.step / Math.max(1, event.totalSteps) * work.request.imageEdit.edits.length) + 1)} of ${work.request.imageEdit.edits.length})` : event.stage === "starting" || event.stage === "transformerLoad" ? "Loading MiniMax H3" : work.image ? "Generating image" : "Generating video" });this.updateScene(work, { status: "generating", stage: event.stage === "starting" || event.stage === "transformerLoad" ? "preparing" : "generating", progress }, false);}private event(event: JobEvent) {@@ -650,6 +650,7 @@ export class WorkQueue {try {const saved = await saveGeneratedScene({folderPath: work.session.record.folderPath, jobId: work.id, thumbnailJobId: work.sceneId,+ ...(work.request.latentUpscale ? { outputSize: { width: work.request.canvasWidth, height: work.request.canvasHeight } } : {}),onProgress: (encoded, total) => {if (total <= 0) return;const progress = Math.min(0.99, 0.9 + encoded / total * 0.1);