AI media harness for planning, generating, and editing locally
TypeScript
Support H3 Image runtime
Bitti0935f7ed3b83
diff --git a/docs/slopfab-compatibility.md b/docs/slopfab-compatibility.mdindex 51555f1..b9af551 100644--- a/docs/slopfab-compatibility.md+++ b/docs/slopfab-compatibility.md@@ -1,5 +1,29 @@# Slopfab compatibility+## MiniMax H3 Image (API 1.52.0)++The bundled Windows and Linux runtimes use SlopFab commit+`9ba04d8` with CUDA and Vulkan enabled and FFmpeg disabled.+The **MiniMax H3 Image** template selects `h3_image`, Flash attention and the+fixed six-update Euler grid. Vulkan uses portable arithmetic. Its download+catalog uses [Comfy-Org/MiniMax-H3-Image](https://huggingface.co/Comfy-Org/MiniMax-H3-Image):+BF16, INT8 ConvRot and W4A8 transformers, Qwen3-VL-32B INT8 or NVFP4 text+encoders, and the FP16 image VAE. The repository's optional Qwen3.5 prompt+enhancer is not an inference text encoder and is not offered by this template.++Plain image prompts support up to 16 ordered pictures, including the implicit+source for edits and Zoom. Masked editing uses strength 1; outpainting disables+Langevin refinement and uses a nine-pixel blend overlap. Video/audio, LoRAs,+refmods, generation effects, CFG, negative prompts, H3 previews and saved latent+features are disabled for this family. Existing installations receive the+template once; removing it is respected.++The new runtime counts H3 video steps as updates rather than grid points.+Slopus translates its existing H3 video and audio counts before submission,+preserving saved schedules, LoRA recipes and Single Shot anchoring. Image-only+families retain their update counts. LAN protocol 33 requires updated workers+for the image family and the runtime compatibility adjustment.+## Bundled runtime (API 1.48.0)Windows and Linux runtimes use SlopFab commit `54362786a76e7530f7216dfeca130835a8f298f3`diff --git a/lib/slopfab/libslopfab.so b/lib/slopfab/libslopfab.soindex f3bbc87..1a4286a 100644--- a/lib/slopfab/libslopfab.so+++ b/lib/slopfab/libslopfab.so@@ -1,3 +1,3 @@version https://git-lfs.github.com/spec/v1-oid sha256:728450c234478a92648319e2dfebeae9f4540a92745cae7f216e5ddfc2947a36-size 23692176+oid sha256:1847ab2170849be772fd61a28dc710097aa66e073481864a020bec01086cbcd0+size 24794208diff --git a/lib/slopfab/slopfab.dll b/lib/slopfab/slopfab.dllindex f4513f2..0a94ee1 100644--- a/lib/slopfab/slopfab.dll+++ b/lib/slopfab/slopfab.dll@@ -1,3 +1,3 @@version https://git-lfs.github.com/spec/v1-oid sha256:bbea018ab44dfa15db947cb5688a580671a2d74fd1a5d7006ec8ac006857586d-size 20469248+oid sha256:72b1c4849691a8fa8686fa2601a06f3e82849b62a38b3381551b53b020dcd74b+size 20917248diff --git a/src-tauri/core/src/slopfab/config.rs b/src-tauri/core/src/slopfab/config.rsindex 2d2a8ec..f13b147 100644--- a/src-tauri/core/src/slopfab/config.rs+++ b/src-tauri/core/src/slopfab/config.rs@@ -253,6 +253,30 @@ impl Configuration {return Err("Krea 2 requires Flash attention and text-to-image generation without audio or H3 conditioning.".into());}}+ if self.model_type == "h3_image" {+ if self.generation_steps(request.steps)? != 6 {+ return Err("MiniMax H3 Image requires its fixed six-step sampling schedule.".into());+ }+ if self.animate || request.latent_upscale || request.latent_bridge.is_some()+ || request.continuation_path.is_some() || request.continuation_relative_path.is_some()+ || request.save_latents_path.is_some() || request.keystone_path.is_some()+ || request.video_transition.is_some() || !request.reference_video_ids.is_empty()+ || !request.reference_audio_ids.is_empty() || self.preview_vae.is_some()+ || self.prompt_embedding.is_some() || self.attention != "flash2" {+ return Err("MiniMax H3 Image requires Flash attention without video, audio, previews or H3 latent features.".into());+ }+ if let Some(edit) = &request.image_edit {+ for step in &edit.edits {+ if step.strength.is_some_and(|strength| strength != 1.0)+ || step.outpaint_langevin_steps.is_some_and(|steps| steps != 0) {+ return Err("MiniMax H3 Image edits require strength 1 and zero Langevin steps.".into());+ }+ if step.reference_paths.as_ref().unwrap_or(&request.reference_paths).len() + 1 > 16 {+ return Err("MiniMax H3 Image supports at most 16 pictures including the edit source.".into());+ }+ }+ }+ }if let Some(mode) = request.video_transition.as_deref() {let expected = match mode {"extend" => 1,diff --git a/src-tauri/core/src/slopfab/continuation.rs b/src-tauri/core/src/slopfab/continuation.rsindex 96c8005..9a4f2d6 100644--- a/src-tauri/core/src/slopfab/continuation.rs+++ b/src-tauri/core/src/slopfab/continuation.rs@@ -347,7 +347,8 @@ pub(super) mod tests {let experiment = RequestHandle::new(&api).unwrap();api.set_prompt(&experiment, &request.prompt).unwrap();api.set_frames(&experiment, 68).unwrap();- api.set_steps(&experiment, 25).unwrap();+ // The current C API counts updates; the original used 25 grid points.+ api.set_steps(&experiment, 24).unwrap();api.set_seed(&experiment, request.seed as u64).unwrap();api.set_resolution(&experiment, 64, 32).unwrap();api.set_attention(&experiment, "flash2").unwrap();diff --git a/src-tauri/core/src/slopfab/h3.rs b/src-tauri/core/src/slopfab/h3.rsindex 7abbcc0..a4923c2 100644--- a/src-tauri/core/src/slopfab/h3.rs+++ b/src-tauri/core/src/slopfab/h3.rs@@ -31,8 +31,8 @@ pub(super) fn configure_request(}api.set_model_family(handle, &configuration.model_type)?;}- if configuration.model_type == "krea2" {- api.set_model_family(handle, "krea2")?;+ if matches!(configuration.model_type.as_str(), "krea2" | "h3_image") {+ api.set_model_family(handle, &configuration.model_type)?;if platform == ComputePlatform::Vulkan { api.set_vulkan_portable(handle)?; }}if configuration.attention == "sol" && platform == ComputePlatform::Vulkan {@@ -71,11 +71,14 @@ pub(super) fn configure_request(// Ending-anchor APIs count new lead-in/gap frames, while Slopus scene// duration includes the short ending. Planning uses equivalent full geometry.api.set_frames(handle, if request.single_shot.as_ref().is_some_and(|single| single.ending_path.is_some()) { frames - 22 } else { frames })?;- if request.still_image && !matches!(configuration.model_type.as_str(), "moss" | "fibo2" | "krea2") {+ if request.still_image && !matches!(configuration.model_type.as_str(), "moss" | "fibo2" | "krea2" | "h3_image") {api.set_still_image(handle)?;}let video_steps = configuration.generation_steps(request.steps)?;- api.set_steps(handle, video_steps)?;+ // Saved H3 settings count grid points, including terminal zero. The updated+ // runtime counts denoising updates. Image-only families already use updates.+ let legacy_h3 = configuration.model_type == "minimax-h3";+ api.set_steps(handle, if legacy_h3 { video_steps - 1 } else { video_steps })?;let preset = configuration.sampling_preset.as_ref().map_err(Clone::clone)?;if let Some(preset) = preset {match preset {@@ -95,7 +98,7 @@ pub(super) fn configure_request(shifts.audio_override.or(request.audio_sigma_shift).or(shifts.audio), sampling.sampler.as_deref(), sampling.scheduler.as_deref())?;}// Sampling presets replace overrides, so apply the audio setting afterward.- api.set_audio_steps(handle, request.audio_steps.unwrap_or(0))?;+ api.set_audio_steps(handle, request.audio_steps.map(|steps| if legacy_h3 { steps - 1 } else { steps }).unwrap_or(0))?;if let Some(cfg) = &crate::models::generator_features(&configuration.model_type).cfg {let negative = request.negative_prompt.as_deref().unwrap_or("");if configuration.model_type == "krea2" {@@ -136,7 +139,7 @@ pub(super) fn configure_request(if let Some(overlap) = step.outpaint_blend_overlap {api.set_outpaint_blend_overlap(handle, overlap)?;}- if let Some(steps) = step.outpaint_langevin_steps {+ if let Some(steps) = step.outpaint_langevin_steps.or((configuration.model_type == "h3_image").then_some(0)) {api.set_outpaint_langevin_steps(handle, steps)?;}}diff --git a/src-tauri/core/src/slopfab/tests.rs b/src-tauri/core/src/slopfab/tests.rsindex 9c37020..196df2c 100644--- a/src-tauri/core/src/slopfab/tests.rs+++ b/src-tauri/core/src/slopfab/tests.rs@@ -1948,3 +1948,66 @@ fn template_editing_flag_is_enforced_without_blocking_text_generation() {settings.get_mut("slopfab").unwrap().options.remove("editingModel");Configuration::from_settings(&settings).validate_inputs(&request).unwrap();}++#[test]+fn h3_image_plans_six_steps_on_cuda_and_vulkan_with_masked_edits_and_outpainting() {+ let mut configuration = Configuration::from_settings(&BTreeMap::new());+ configuration.model_type = "h3_image".into();+ configuration.attention = "flash2";+ let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../lib/slopfab").join(super::DLL_FILE_NAME);+ let api = ffi::Api::load(&path).unwrap();+ let request = GenerationRequest { still_image: true, frames: 1, steps: 6, prompt: "A blue teapot".into(),+ canvas_width: 128, canvas_height: 128, ..Default::default() };+ for platform in [ComputePlatform::Cuda13, ComputePlatform::Vulkan] {+ for purpose in [RequestPurpose::Plan, RequestPurpose::Generate] {+ for mode in ["generate", "mask", "outpaint"] {+ let mut request = request.clone();+ if mode != "generate" {+ request.image_edit = Some(serde_json::from_value(serde_json::json!({"sourceRelativePath":"source.png", "edits":[{+ "prompt":"Edit <Picture 1>. Make it blue", "x":32, "y":32, "width":64, "height":64,+ "invertMask": mode == "outpaint", "feather": 0+ }]})).unwrap());+ request.image_edit_pixels = Some(vec![128; 128 * 128 * 3].into());+ }+ let handle = RequestHandle::new(&api).unwrap();+ configure_request(&api, &handle, &request, &configuration, platform, purpose, &ReferenceVideos::default()).unwrap();+ let plan = api.resolve(&handle).unwrap();+ assert_eq!((plan.canvas_width, plan.canvas_height, plan.aligned_frames, plan.num_model_evaluations), (128, 128, 1, 6));+ }+ }+ }+}++#[test]+fn h3_image_rejects_incompatible_controls_and_counts_the_edit_source() {+ let mut configuration = Configuration::from_settings(&BTreeMap::new());+ configuration.model_type = "h3_image".into();+ configuration.attention = "flash2";+ let request = GenerationRequest { still_image: true, frames: 1, steps: 6, prompt: "A blue teapot".into(),+ canvas_width: 128, canvas_height: 128, reference_paths: vec!["picture.png".into(); 16], ..Default::default() };+ configuration.validate_inputs(&request).unwrap();+ for (name, value, message) in [+ ("steps", serde_json::json!(20), "six-step"),+ ("guidanceScale", serde_json::json!(3), "CFG"),+ ("negativePrompt", serde_json::json!("blurry"), "negative prompts"),+ ("stillImage", serde_json::json!(false), "video generation"),+ ("videoSigmaShift", serde_json::json!(3), "sampling schedule"),+ ("latentUpscale", serde_json::json!(true), "latent features"),+ ] {+ let mut json = serde_json::to_value(&request).unwrap();+ json[name] = value;+ assert!(configuration.validate_inputs(&serde_json::from_value(json).unwrap()).unwrap_err().contains(message), "{name}");+ }+ let mut request = request;+ request.image_edit = Some(serde_json::from_value(serde_json::json!({"sourceRelativePath":"source.png", "edits":[{+ "prompt":"Edit <Picture 1>", "x":0, "y":0, "width":128, "height":128+ }]})).unwrap());+ assert!(configuration.validate_inputs(&request).unwrap_err().contains("including the edit source"));+ request.reference_paths.pop();+ configuration.validate_inputs(&request).unwrap();+ request.image_edit.as_mut().unwrap().edits[0].strength = Some(0.65);+ assert!(configuration.validate_inputs(&request).unwrap_err().contains("strength 1"));+ request.image_edit.as_mut().unwrap().edits[0].strength = None;+ request.image_edit.as_mut().unwrap().edits[0].outpaint_langevin_steps = Some(5);+ assert!(configuration.validate_inputs(&request).unwrap_err().contains("zero Langevin"));+}diff --git a/src-tauri/core/src/worker/protocol.rs b/src-tauri/core/src/worker/protocol.rsindex 1626e41..6fe5b0e 100644--- a/src-tauri/core/src/worker/protocol.rs+++ b/src-tauri/core/src/worker/protocol.rs@@ -36,7 +36,8 @@ pub const SERVICE_TYPE: &str = "_slopus-worker._tcp.local.";// v30 carries portable learned-drift calibration and LCS highlight controls.// v31 matches the two-minute anchored recipe: lock 22 frames without replacing the source tail.// v32 sizes local image inference from selection bounds, padded to the 32-pixel grid.-pub const PROTOCOL_VERSION: u32 = 32;+// v33 routes MiniMax H3 Image with its fixed schedule and image-specific editing.+pub const PROTOCOL_VERSION: u32 = 33;/// Streaming SeedVR2 restoration; model paths are resolved on the worker.#[derive(Debug, Clone, Serialize, Deserialize)]@@ -391,7 +392,7 @@ mod tests {let single = restored.single_shot.unwrap();assert_eq!(single.ending_prompt, "The subject waves goodbye");assert!(single.ending_path.is_none());- assert_eq!(PROTOCOL_VERSION, 32);+ assert_eq!(PROTOCOL_VERSION, 33);}#[test]diff --git a/src/lib/generatorModels.json b/src/lib/generatorModels.jsonindex bf23c1f..874a490 100644--- a/src/lib/generatorModels.json+++ b/src/lib/generatorModels.json@@ -180,5 +180,33 @@"schedulers": ["beta"]+ },+ "h3_image": {+ "label": "MiniMax H3 Image",+ "description": "Image generation and editing on CUDA or Vulkan",+ "imageGeneration": true,+ "videoGeneration": false,+ "imageEditing": true,+ "imageReferences": true,+ "loras": false,+ "motionCache": false,+ "generationEffects": false,+ "cfg": null,+ "imageOutpainting": true,+ "characterSheets": false,+ "requiresImageInput": false,+ "editImageReferences": true,+ "maxImageReferences": 16,+ "refmods": false,+ "sigmaShifts": false,+ "cudaOnly": false,+ "imageCompositionCreation": true,+ "negativePrompt": false,+ "negativePromptDisabledReason": null,+ "musicGeneration": false,+ "samplers": [+ "euler"+ ],+ "schedulers": []}}