Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

Official stable-diffusion.cpp engine with updates from engine.json; 0.9.2

Gabriele Lozuponedebc96405882
diff --git a/Cargo.lock b/Cargo.lock
index 55d3970..4b4a930 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2321,7 +2321,7 @@ dependencies = [
[[package]]
name = "kokon"
-version = "0.9.1"
+version = "0.9.2"
dependencies = [
"dirs",
"image",
@@ -3310,7 +3310,7 @@ checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea"
[[package]]
name = "qls-core"
-version = "0.9.1"
+version = "0.9.2"
dependencies = [
"anyhow",
"base64 0.23.1",
@@ -3338,7 +3338,7 @@ dependencies = [
[[package]]
name = "qls-service"
-version = "0.9.1"
+version = "0.9.2"
dependencies = [
"axum",
"futures-util",
diff --git a/Cargo.toml b/Cargo.toml
index 5006f3c..de38973 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@ resolver = "3"
members = ["crates/qls-core", "crates/qls-service", "src-tauri"]
[workspace.package]
-version = "0.9.1"
+version = "0.9.2"
edition = "2024"
license = "AGPL-3.0-only"
diff --git a/NOTICE b/NOTICE
index 222eae1..2088f97 100644
--- a/NOTICE
+++ b/NOTICE
@@ -39,9 +39,10 @@ Downloaded by the setup screen (not part of this product)
Every file is pinned by URL, size and SHA-256 in crates/qls-core/src/catalog.rs.
- stable-diffusion.cpp by leejet (https://github.com/leejet/stable-diffusion.cpp), MIT:
- CUDA 12, Vulkan or Metal build of commit 3f8527a with MoSR upscaler support added, from the
- fork release https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/tag/kokon-mosr-1
- (proposed upstream as https://github.com/leejet/stable-diffusion.cpp/pull/2128).
+ official CUDA 12, Vulkan or Metal build of release master-964-1d0a58a
+ (https://github.com/leejet/stable-diffusion.cpp/releases/tag/master-964-1d0a58a), which
+ includes the MoSR upscaler support contributed by Kokon (pull request #2128). A newer
+ official release listed in engine.json of this repository may replace it.
- ggml by the ggml authors (https://github.com/ggml-org/ggml), MIT, included in the
stable-diffusion.cpp builds.
- NVIDIA CUDA 12 runtime and cuBLAS DLLs (NVIDIA cards only), redistributed in the
diff --git a/README.md b/README.md
index 02f9a4c..f194eff 100644
--- a/README.md
+++ b/README.md
@@ -513,9 +513,9 @@ upscale):
- **Superscale-SP** (default): sharp and natural on most images; on JPEG photos and dark areas it
can draw a faint grid.
- **MoSR** (experimental, 17 MB, comes with the app): the fastest, good for 4× upscales, but on
- clean images enlarged less than about 3× it draws a fine grid. It needs Kokon's build of
- [stable-diffusion.cpp](https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/tag/kokon-mosr-1)
- ([pull request](https://github.com/leejet/stable-diffusion.cpp/pull/2128) to the original project).
+ clean images enlarged less than about 3× it draws a fine grid. Kokon contributed it to
+ [stable-diffusion.cpp](https://github.com/leejet/stable-diffusion.cpp)
+ ([pull request #2128](https://github.com/leejet/stable-diffusion.cpp/pull/2128), merged 2026-10-12).
- **UltraSharp** (optional download): very clean, but smooths skin into an artificial look and can
invent lines. Non-commercial license.
- **Lanczos**: a plain resize, never invents anything.
diff --git a/crates/qls-core/src/catalog.rs b/crates/qls-core/src/catalog.rs
index 53530e7..d8fcf4c 100644
--- a/crates/qls-core/src/catalog.rs
+++ b/crates/qls-core/src/catalog.rs
@@ -26,8 +26,9 @@ pub enum FileKind {
}
/// Release of the engine builds below. Written into [`ENGINE_MARKER`] after extraction, so an
-/// engine of another release (files present, marker missing or different) is updated.
-pub const ENGINE_TAG: &str = "kokon-mosr-1";
+/// engine of another release (files present, marker missing or different) is updated. A newer
+/// release published in the engine manifest replaces these at runtime ([`engine_tag`]).
+pub const ENGINE_TAG: &str = "master-964-1d0a58a";
/// File in an engine's folder naming the release it was extracted from.
pub const ENGINE_MARKER: &str = "kokon-engine.txt";
@@ -97,23 +98,24 @@ impl Download {
}
}
-/// Upstream release the CUDA runtime comes from (the fork's build links the same one).
+/// Upstream release the CUDA runtime comes from (byte-identical in every release since).
const SDCPP_UPSTREAM_RELEASE: &str = "https://github.com/leejet/stable-diffusion.cpp/releases/tag/master-929-3f8527a";
-const SDCPP_RELEASE: &str = "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/tag/kokon-mosr-1";
+const SDCPP_RELEASE: &str = "https://github.com/leejet/stable-diffusion.cpp/releases/tag/master-964-1d0a58a";
-/// stable-diffusion.cpp commit 3f8527a (2026-09-27, the build every backend fact in the
-/// README was verified on) plus the MoSR upscaler (fork commit 2e3312d, upstream PR #2128).
-/// Qwen output is bit-identical to 3f8527a. CUDA 12 build; it runs on RTX 20xx to RTX 50xx.
+/// Official stable-diffusion.cpp release master-964-1d0a58a (2026-10-13): the first with the
+/// MoSR upscaler merged (PR #2128, commit 792bcd3), plus automatic flash-attention and
+/// direct/implicit-GEMM convolution selection. CUDA 12 build; it runs on RTX 20xx to RTX 50xx.
+/// Sizes and SHA-256 from GitHub's asset digests.
pub const ENGINE_CUDA: Download = Download {
id: "engine_cuda",
label: "stable-diffusion.cpp (CUDA 12)",
kind: FileKind::Engine,
- url: "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-mosr-1/sd-mosr-upscaler-2e3312d-bin-win-cuda12-x64.zip",
+ url: "https://github.com/leejet/stable-diffusion.cpp/releases/download/master-964-1d0a58a/sd-master-1d0a58a-bin-win-cuda12-x64.zip",
fallback_urls: &[],
page: SDCPP_RELEASE,
- size: 337_895_587,
- sha256: "1922fcb034c8f246dbe2c3e4fe5dae6407c0c27df3629558cc8af9dac5adead1",
- dest: "sd-mosr-upscaler-2e3312d-bin-win-cuda12-x64.zip",
+ size: 338_016_915,
+ sha256: "2f08572e143f0b15a764197ea937d219dd70f0cc7eefb30eb84c9dae6a7cba6d",
+ dest: "sd-master-1d0a58a-bin-win-cuda12-x64.zip",
provides: &["sd-server.exe", "stable-diffusion.dll", "ggml-cuda.dll"],
engine_tag: Some(ENGINE_TAG),
};
@@ -135,17 +137,17 @@ pub const CUDA_RUNTIME: Download = Download {
/// Same commit, Vulkan build: AMD, Intel and NVIDIA cards through the GPU driver's Vulkan
/// runtime (nothing else to install). Kept in its own folder so it can sit next to the
-/// CUDA build. SHA-256 from GitHub's asset digest, checked against a download 2026-10-12.
+/// CUDA build.
pub const ENGINE_VULKAN: Download = Download {
id: "engine_vulkan",
label: "stable-diffusion.cpp (Vulkan)",
kind: FileKind::Engine,
- url: "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-mosr-1/sd-mosr-upscaler-2e3312d-bin-win-vulkan-x64.zip",
+ url: "https://github.com/leejet/stable-diffusion.cpp/releases/download/master-964-1d0a58a/sd-master-1d0a58a-bin-win-vulkan-x64.zip",
fallback_urls: &[],
page: SDCPP_RELEASE,
- size: 30_081_934,
- sha256: "fe6ac9f9b93f3ab081c0d4f7031e4c8dfb6f9d413c748345c6aa8c02c2e3f74b",
- dest: "engine-vulkan/sd-mosr-upscaler-2e3312d-bin-win-vulkan-x64.zip",
+ size: 30_155_040,
+ sha256: "74211cb5c382aec2aeb086b64f2fdf525efec5faec4200a2d3257bc2328954ab",
+ dest: "engine-vulkan/sd-master-1d0a58a-bin-win-vulkan-x64.zip",
provides: &["engine-vulkan/sd-server.exe", "engine-vulkan/stable-diffusion.dll", "engine-vulkan/ggml-vulkan.dll"],
engine_tag: Some(ENGINE_TAG),
};
@@ -156,25 +158,109 @@ pub const ENGINE_METAL: Download = Download {
id: "engine_metal",
label: "stable-diffusion.cpp (Metal)",
kind: FileKind::Engine,
- url: "https://github.com/GabrieleLozupone/stable-diffusion.cpp/releases/download/kokon-mosr-1/sd-mosr-upscaler-2e3312d-bin-Darwin-macOS-26.6.2-arm64.zip",
+ url: "https://github.com/leejet/stable-diffusion.cpp/releases/download/master-964-1d0a58a/sd-master-1d0a58a-bin-Darwin-macOS-26.6.2-arm64.zip",
fallback_urls: &[],
page: SDCPP_RELEASE,
- size: 35_071_182,
- sha256: "6a89473230e0f3623c2dcd7815d9578e87b2a0d1871567bd941240fe3662c25e",
- dest: "engine-metal/sd-mosr-upscaler-2e3312d-bin-Darwin-macOS-26.6.2-arm64.zip",
+ size: 35_213_648,
+ sha256: "45001839e925f98ecd18ef5251725f74cff874eeac4599f1136acba65b26911e",
+ dest: "engine-metal/sd-master-1d0a58a-bin-Darwin-macOS-26.6.2-arm64.zip",
provides: &["engine-metal/sd-server", "engine-metal/libstable-diffusion.dylib"],
engine_tag: Some(ENGINE_TAG),
};
-/// The engine files of a backend, in download order.
+/// The engine files of a backend, in download order: the engine manifest's release when one
+/// newer than the built-in pins was applied ([`apply_engine_release`]), else the pins.
pub fn engine_downloads(backend: GpuBackend) -> Vec<Download> {
+ let o = *ENGINE_OVERRIDE.read().unwrap();
+ let (cuda, vulkan, metal) = o.map(|r| (r.cuda, r.vulkan, r.metal)).unwrap_or((ENGINE_CUDA, ENGINE_VULKAN, ENGINE_METAL));
match backend {
- GpuBackend::Cuda => vec![ENGINE_CUDA, CUDA_RUNTIME],
- GpuBackend::Vulkan => vec![ENGINE_VULKAN],
- GpuBackend::Metal => vec![ENGINE_METAL],
+ GpuBackend::Cuda => vec![cuda, CUDA_RUNTIME],
+ GpuBackend::Vulkan => vec![vulkan],
+ GpuBackend::Metal => vec![metal],
}
}
+/// The engine release the app wants installed: the manifest's, or [`ENGINE_TAG`].
+pub fn engine_tag() -> &'static str {
+ ENGINE_OVERRIDE.read().unwrap().map(|r| r.tag).unwrap_or(ENGINE_TAG)
+}
+
+#[derive(Debug, Clone, Copy)]
+struct EngineRelease {
+ tag: &'static str,
+ cuda: Download,
+ vulkan: Download,
+ metal: Download,
+}
+
+static ENGINE_OVERRIDE: std::sync::RwLock<Option<EngineRelease>> = std::sync::RwLock::new(None);
+
+/// Tests that change or depend on the engine override take this lock.
+#[cfg(test)]
+pub(crate) static ENGINE_TEST_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
+
+/// One engine build in the manifest.
+#[derive(Debug, Clone, PartialEq, serde::Deserialize, Serialize)]
+pub struct ManifestAsset {
+ pub url: String,
+ pub size: u64,
+ pub sha256: String,
+}
+
+/// `engine.json` in the Kokon repository: the newest stable-diffusion.cpp release tested
+/// with Kokon. Lets a tested engine reach users without an app release.
+#[derive(Debug, Clone, PartialEq, serde::Deserialize, Serialize)]
+pub struct EngineManifest {
+ /// An upstream release tag, `master-<n>-<commit>`.
+ pub tag: String,
+ /// Oldest app version the release works with (older apps ignore it).
+ pub min_app: String,
+ pub cuda: ManifestAsset,
+ pub vulkan: ManifestAsset,
+ pub metal: ManifestAsset,
+}
+
+/// Build number of an upstream release tag (`master-964-1d0a58a` -> 964).
+pub fn release_number(tag: &str) -> Option<u32> {
+ tag.strip_prefix("master-")?.split('-').next()?.parse().ok()
+}
+
+fn version_tuple(v: &str) -> Option<(u32, u32, u32)> {
+ let mut it = v.trim().trim_start_matches('v').split(['.', '-']).map(|p| p.parse::<u32>().ok());
+ Some((it.next()??, it.next()??, it.next().flatten().unwrap_or(0)))
+}
+
+/// Uses `m` as the engine release when it is valid, meant for `app_version`, and newer than
+/// the built-in pins (an app update that pins a newer engine is never downgraded by an old
+/// manifest). Returns whether it is now in use.
+pub fn apply_engine_release(m: &EngineManifest, app_version: &str) -> Result<bool, String> {
+ let (Some(n), Some(builtin)) = (release_number(&m.tag), release_number(ENGINE_TAG)) else {
+ return Err(format!("not an upstream release tag: {}", m.tag));
+ };
+ if version_tuple(app_version) < version_tuple(&m.min_app) || version_tuple(&m.min_app).is_none() {
+ return Ok(false);
+ }
+ if n <= builtin {
+ *ENGINE_OVERRIDE.write().unwrap() = None;
+ return Ok(false);
+ }
+ let page = format!("https://github.com/leejet/stable-diffusion.cpp/releases/tag/{}", m.tag);
+ let prefix = format!("https://github.com/leejet/stable-diffusion.cpp/releases/download/{}/", m.tag);
+ let leak = |s: String| -> &'static str { Box::leak(s.into_boxed_str()) };
+ let tag = leak(m.tag.clone());
+ let page = leak(page);
+ let build = |a: &ManifestAsset, base: Download, folder: &str| -> Result<Download, String> {
+ let file = a.url.strip_prefix(&prefix).filter(|f| !f.is_empty() && !f.contains(['/', '\\'])).ok_or_else(|| format!("unexpected engine URL: {}", a.url))?;
+ if a.sha256.len() != 64 || !a.sha256.chars().all(|c| c.is_ascii_hexdigit() && !c.is_ascii_uppercase()) || a.size == 0 {
+ return Err(format!("bad size or SHA-256 for {}", a.url));
+ }
+ Ok(Download { url: leak(a.url.clone()), page, size: a.size, sha256: leak(a.sha256.clone()), dest: leak(format!("{folder}{file}")), engine_tag: Some(tag), ..base })
+ };
+ let r = EngineRelease { tag, cuda: build(&m.cuda, ENGINE_CUDA, "")?, vulkan: build(&m.vulkan, ENGINE_VULKAN, "engine-vulkan/")?, metal: build(&m.metal, ENGINE_METAL, "engine-metal/")? };
+ *ENGINE_OVERRIDE.write().unwrap() = Some(r);
+ Ok(true)
+}
+
const QWEN_TE: &str = "https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct-GGUF/tree/main";
const TURBO_GGUF: &str = "https://huggingface.co/DogukanUrker/Qwen-Image-2.1-Turbo-GGUF";
@@ -497,6 +583,45 @@ mod tests {
}
}
+ fn manifest(n: u32) -> EngineManifest {
+ let asset = |f: &str| ManifestAsset {
+ url: format!("https://github.com/leejet/stable-diffusion.cpp/releases/download/master-{n}-abcdef0/sd-master-abcdef0-bin-{f}.zip"),
+ size: 1,
+ sha256: "0".repeat(64),
+ };
+ EngineManifest { tag: format!("master-{n}-abcdef0"), min_app: "0.9.2".into(), cuda: asset("win-cuda12-x64"), vulkan: asset("win-vulkan-x64"), metal: asset("Darwin-macOS-26.6.2-arm64") }
+ }
+
+ #[test]
+ fn engine_manifest_overrides_only_newer_releases() {
+ let _guard = ENGINE_TEST_LOCK.lock().unwrap_or_else(|e| e.into_inner());
+ assert_eq!(release_number(ENGINE_TAG), Some(964));
+ assert_eq!(apply_engine_release(&manifest(964), "0.9.2"), Ok(false), "same as built in");
+ assert_eq!(engine_tag(), ENGINE_TAG);
+ assert_eq!(apply_engine_release(&manifest(970), "0.9.1"), Ok(false), "too old an app");
+ assert_eq!(apply_engine_release(&manifest(970), "0.9.2"), Ok(true));
+ assert_eq!(engine_tag(), "master-970-abcdef0");
+ let cuda = &engine_downloads(GpuBackend::Cuda);
+ assert_eq!(cuda[0].engine_tag, Some("master-970-abcdef0"));
+ assert_eq!(cuda[0].dest, "sd-master-abcdef0-bin-win-cuda12-x64.zip");
+ assert_eq!(cuda[0].provides, ENGINE_CUDA.provides);
+ assert_eq!(cuda[1].id, "cuda_runtime");
+ assert_eq!(engine_downloads(GpuBackend::Vulkan)[0].dest, "engine-vulkan/sd-master-abcdef0-bin-win-vulkan-x64.zip");
+ assert_eq!(engine_downloads(GpuBackend::Metal)[0].dest, "engine-metal/sd-master-abcdef0-bin-Darwin-macOS-26.6.2-arm64.zip");
+ // Only official release downloads of that tag, with a real hash.
+ let mut bad = manifest(971);
+ bad.cuda.url = "https://example.com/sd.zip".into();
+ assert!(apply_engine_release(&bad, "0.9.2").is_err());
+ let mut bad = manifest(971);
+ bad.metal.sha256 = "xyz".into();
+ assert!(apply_engine_release(&bad, "0.9.2").is_err());
+ assert!(apply_engine_release(&EngineManifest { tag: "kokon-x".into(), ..manifest(971) }, "0.9.2").is_err());
+ assert_eq!(engine_tag(), "master-970-abcdef0", "a bad manifest keeps the last good release");
+ // An app that pins a newer engine drops an older manifest release.
+ assert_eq!(apply_engine_release(&manifest(960), "0.9.2"), Ok(false));
+ assert_eq!(engine_tag(), ENGINE_TAG);
+ }
+
#[test]
fn engines_of_another_release_need_updating() {
let dir = tempfile::tempdir().unwrap();
diff --git a/crates/qls-core/src/diagnostics.rs b/crates/qls-core/src/diagnostics.rs
index 16c8348..32ba30d 100644
--- a/crates/qls-core/src/diagnostics.rs
+++ b/crates/qls-core/src/diagnostics.rs
@@ -252,15 +252,16 @@ pub fn upscaler_check(cfg: &AppConfig) -> Check {
pub fn engine_release_check(cfg: &AppConfig) -> Check {
let engines: Vec<_> = crate::catalog::engine_downloads(cfg.gpu_backend).into_iter().filter(|d| d.engine_tag.is_some()).collect();
let tags: Vec<Option<String>> = engines.iter().map(|d| d.installed_tag(&cfg.sdcpp_dir)).collect();
- let ok = tags.iter().all(|t| t.as_deref() == Some(crate::catalog::ENGINE_TAG));
+ let want = crate::catalog::engine_tag();
+ let ok = tags.iter().all(|t| t.as_deref() == Some(want));
Check {
id: "engine_release",
label: "Engine release".into(),
ok,
detail: if ok {
- crate::catalog::ENGINE_TAG.into()
+ want.into()
} else {
- format!("An older engine is installed; Setup updates it to {} (needed for the upscaler).", crate::catalog::ENGINE_TAG)
+ format!("An older engine is installed; Setup updates it to {want}.")
},
}
}
@@ -321,6 +322,7 @@ mod tests {
std::fs::File::create(up.path(dir.path())).unwrap().set_len(up.size).unwrap();
let c = upscaler_check(&cfg);
assert!(c.ok && c.detail.contains("4xNomos2_hq_mosr.pth"));
+ let _guard = crate::catalog::ENGINE_TEST_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let e = engine_release_check(&cfg);
assert!(!e.ok && e.detail.contains(crate::catalog::ENGINE_TAG));
crate::catalog::ENGINE_CUDA.write_tag(dir.path()).unwrap();
diff --git a/crates/qls-core/src/engine.rs b/crates/qls-core/src/engine.rs
index 2fdcdc8..fbeb034 100644
--- a/crates/qls-core/src/engine.rs
+++ b/crates/qls-core/src/engine.rs
@@ -206,13 +206,17 @@ impl Engine {
}
}
- /// The installed engine is from an older release than the catalog's and the running
- /// server (if any) cannot run the upscaler: Setup offers the update.
+ /// The installed engine is from another release than the catalog's (or the engine
+ /// manifest's): Setup offers the update. An engine without a release marker (built by hand,
+ /// an external server) only needs it when it cannot run the upscaler.
pub fn engine_update_needed(&self) -> bool {
let cfg = self.config();
- let current = crate::catalog::engine_downloads(cfg.gpu_backend).iter().all(|d| d.is_present(&cfg.sdcpp_dir));
- // An engine built by hand or an external server may lack the marker yet run MoSR.
- !current && !self.server.capabilities().is_some_and(|c| c.has_upscaler(crate::catalog::UPSCALER_NAME, true))
+ let engines = crate::catalog::engine_downloads(cfg.gpu_backend);
+ if engines.iter().all(|d| d.is_present(&cfg.sdcpp_dir)) {
+ return false;
+ }
+ let managed = engines.iter().any(|d| d.engine_tag.is_some() && d.installed_tag(&cfg.sdcpp_dir).is_some());
+ managed || !self.server.capabilities().is_some_and(|c| c.has_upscaler(crate::catalog::UPSCALER_NAME, true))
}
/// The store holding generation `id`: the gallery, or the private-mode store.
diff --git a/crates/qls-core/src/engine_manifest.rs b/crates/qls-core/src/engine_manifest.rs
new file mode 100644
index 0000000..0c474f1
--- /dev/null
+++ b/crates/qls-core/src/engine_manifest.rs
@@ -0,0 +1,86 @@
+//! Engine updates without an app release: `engine.json` in the Kokon repository names the
+//! newest stable-diffusion.cpp release tested with Kokon. The service reads its cached copy at
+//! start and fetches a fresh one every [`CHECK_EVERY`]; a newer, valid release replaces the
+//! catalog's engine pins ([`catalog::apply_engine_release`]), so the engine check reports an
+//! update and the app offers the download (What's new / Setup), checked by SHA-256 as always.
+
+use std::path::PathBuf;
+use std::time::{Duration, SystemTime, UNIX_EPOCH};
+
+use serde::{Deserialize, Serialize};
+
+use crate::catalog::{self, EngineManifest};
+
+/// Published from the repository's default branch.
+pub const MANIFEST_URL: &str = "https://raw.githubusercontent.com/GabrieleLozupone/kokon/master/engine.json";
+/// How old the cached manifest may get before it is fetched again (2.5 days).
+pub const CHECK_EVERY: Duration = Duration::from_secs(60 * 3600);
+/// How often the service looks at the cache's age.
+const WAKE_EVERY: Duration = Duration::from_secs(6 * 3600);
+
+#[derive(Debug, Serialize, Deserialize)]
+struct Cached {
+ /// Seconds since the Unix epoch of the last successful fetch.
+ checked_at: u64,
+ manifest: EngineManifest,
+}
+
+fn cache_path() -> PathBuf {
+ crate::config::config_dir().join("engine-manifest.json")
+}
+
+fn now() -> u64 {
+ SystemTime::now().duration_since(UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0)
+}
+
+fn read_cache() -> Option<Cached> {
+ serde_json::from_slice(&std::fs::read(cache_path()).ok()?).ok()
+}
+
+fn apply(m: &EngineManifest, app_version: &str) {
+ match catalog::apply_engine_release(m, app_version) {
+ Ok(true) => tracing::info!("engine manifest: release {} available", m.tag),
+ Ok(false) => {}
+ Err(e) => tracing::warn!("engine manifest ignored: {e}"),
+ }
+}
+
+async fn fetch() -> Result<EngineManifest, String> {
+ let client = reqwest::Client::builder().timeout(Duration::from_secs(20)).user_agent("kokon-service").build().map_err(|e| e.to_string())?;
+ let r = client.get(MANIFEST_URL).send().await.map_err(|e| e.to_string())?;
+ if !r.status().is_success() {
+ return Err(format!("HTTP {}", r.status()));
+ }
+ r.json::<EngineManifest>().await.map_err(|e| e.to_string())
+}
+
+/// Fetches the manifest when the cached one is older than [`CHECK_EVERY`] (or `force`), caches
+/// it and applies it. Failures keep the last good release.
+pub async fn check(app_version: &str, force: bool) {
+ let cached = read_cache();
+ if !force && cached.as_ref().is_some_and(|c| now().saturating_sub(c.checked_at) < CHECK_EVERY.as_secs()) {
+ return;
+ }
+ match fetch().await {
+ Ok(m) => {
+ apply(&m, app_version);
+ let c = Cached { checked_at: now(), manifest: m };
+ if let Err(e) = std::fs::write(cache_path(), serde_json::to_vec_pretty(&c).unwrap_or_default()) {
+ tracing::warn!("engine manifest: could not save the cache: {e}");
+ }
+ }
+ Err(e) => tracing::info!("engine manifest: check failed ({e}); trying again later"),
+ }
+}
+
+/// Applies the cached manifest right away, then checks for a newer one for as long as the
+/// service runs.
+pub async fn run(app_version: &'static str) {
+ if let Some(c) = read_cache() {
+ apply(&c.manifest, app_version);
+ }
+ loop {
+ check(app_version, false).await;
+ tokio::time::sleep(WAKE_EVERY).await;
+ }
+}
diff --git a/crates/qls-core/src/lib.rs b/crates/qls-core/src/lib.rs
index 4c39f35..9e2840d 100644
--- a/crates/qls-core/src/lib.rs
+++ b/crates/qls-core/src/lib.rs
@@ -2,6 +2,7 @@ pub mod catalog;
pub mod config;
pub mod diagnostics;
pub mod engine;
+pub mod engine_manifest;
pub mod error;
pub mod examples;
pub mod geometry;
diff --git a/crates/qls-service/Cargo.toml b/crates/qls-service/Cargo.toml
index f5a8f9b..f70068d 100644
--- a/crates/qls-service/Cargo.toml
+++ b/crates/qls-service/Cargo.toml
@@ -12,7 +12,7 @@ path = "src/main.rs"
[dependencies]
axum = "0.8.9"
futures-util = "0.3.34"
-qls-core = { version = "0.9.1", path = "../qls-core" }
+qls-core = { version = "0.9.2", path = "../qls-core" }
serde = { version = "1.0.229", features = ["derive"] }
serde_json = "1.0.151"
sysinfo = "0.39.6"
diff --git a/crates/qls-service/src/api.rs b/crates/qls-service/src/api.rs
index 45d7c3e..1ba218e 100644
--- a/crates/qls-service/src/api.rs
+++ b/crates/qls-service/src/api.rs
@@ -197,7 +197,7 @@ async fn status(State(s): St) -> Json<Value> {
"upscale": srv.capabilities.as_ref().map(|c| c.upscale),
},
"upscaler": { "model": cfg.upscaler().map(|u| u.0).unwrap_or_else(|| cfg.upscaler_model.clone()), "available": cfg.upscaler_file().is_some() },
- "engine": { "release": catalog::ENGINE_TAG, "update_needed": engine_update },
+ "engine": { "release": catalog::engine_tag(), "update_needed": engine_update },
"profile": { "id": cfg.profile().id, "display_name": cfg.profile().display_name },
"gpu": gpu,
"active_job": s.engine.active_job(),
@@ -449,7 +449,7 @@ async fn diagnostics_json(State(s): St) -> ApiResult<Json<Value>> {
.filter(|d| d.engine_tag.is_some())
.map(|d| d.installed_tag(&cfg.sdcpp_dir).unwrap_or_else(|| "none".into()))
.collect();
- let _ = writeln!(text, "Engine release: {} (expected {})", tags.join(", "), catalog::ENGINE_TAG);
+ let _ = writeln!(text, "Engine release: {} (expected {})", tags.join(", "), catalog::engine_tag());
let _ = writeln!(text, "State: {:?}, owned: {}, pid: {:?}, port: {}", srv.state, srv.owned, srv.pid, cfg.server_port);
if let Some(e) = &srv.error {
let _ = writeln!(text, "Last error: {} {}", e.message, e.detail.clone().unwrap_or_default());
diff --git a/crates/qls-service/src/main.rs b/crates/qls-service/src/main.rs
index a93965c..58f592b 100644
--- a/crates/qls-service/src/main.rs
+++ b/crates/qls-service/src/main.rs
@@ -154,6 +154,7 @@ async fn main() {
tokio::spawn(engine.clone().run_worker());
tokio::spawn(lifecycle(state.clone()));
tokio::spawn(server_watch(state.clone()));
+ tokio::spawn(qls_core::engine_manifest::run(APP_VERSION));
let app = api::router(state.clone());
let st = state.clone();
diff --git a/docs/engineering-notes.md b/docs/engineering-notes.md
index 8f09fc4..0774015 100644
--- a/docs/engineering-notes.md
+++ b/docs/engineering-notes.md
@@ -132,9 +132,24 @@ workspace); the in-app comparison uses crops from it (`src/assets/upscalers`).
#### MoSR in sd.cpp
-MoSR by Philip Hofmann (CC BY 4.0), 17 MB. Upstream sd.cpp has no MoSR, so the
-engine is the fork release `kokon-mosr-1` (3f8527a + `src/model/upscaler/mosr.hpp`, upstream
-PR #2128; Qwen output bit-identical to 3f8527a). Port vs PyTorch: mean error 0.04–0.16/255.
+MoSR by Philip Hofmann (CC BY 4.0), 17 MB. Ported by Kokon (`src/model/upscaler/mosr.hpp`),
+merged upstream as PR #2128 on 2026-10-12; since 0.9.2 the engine is the official release
+`master-964-1d0a58a` (0.9.1 used the fork release `kokon-mosr-1`). Port vs PyTorch: mean error
+0.04–0.16/255.
+
+#### Engine updates (`engine.json`)
+
+`engine.json` at the repository root names the newest official release tested with Kokon
+(tag, `min_app`, URL + size + SHA-256 of the CUDA, Vulkan and Metal zips). The service reads its
+cached copy at start and fetches it again when older than 2.5 days (`engine_manifest.rs`). A
+valid release newer than the built-in pin (`catalog::ENGINE_TAG`) replaces the engine
+downloads, so the status reports `engine.update_needed` and What's new offers the download.
+Only `https://github.com/leejet/stable-diffusion.cpp/releases/download/<tag>/` URLs are
+accepted. To ship an engine: test the release on Windows (CUDA + Vulkan) and a Mac, then edit
+`engine.json` on master (digests: `gh api repos/leejet/stable-diffusion.cpp/releases/tags/<tag>`).
+Since master-964 `--fa` and `--diffusion-conv-direct` are deprecated aliases (still accepted, so
+older engines keep working); convolutions default to `auto`, which turns implicit-GEMM direct
+convolutions on for CUDA (RTX 20xx+) and Vulkan, VAE included.
- Launch: `--diffusion-conv-direct` on CUDA and Vulkan only (in sd.cpp it affects UNet/ControlNet
and this upscaler, never Qwen). On Metal it is ~4× slower. `--vae-conv-direct` makes Qwen's
diff --git a/engine.json b/engine.json
new file mode 100644
index 0000000..1aaf258
--- /dev/null
+++ b/engine.json
@@ -0,0 +1,19 @@
+{
+ "tag": "master-964-1d0a58a",
+ "min_app": "0.9.2",
+ "cuda": {
+ "url": "https://github.com/leejet/stable-diffusion.cpp/releases/download/master-964-1d0a58a/sd-master-1d0a58a-bin-win-cuda12-x64.zip",
+ "size": 338016915,
+ "sha256": "2f08572e143f0b15a764197ea937d219dd70f0cc7eefb30eb84c9dae6a7cba6d"
+ },
+ "vulkan": {
+ "url": "https://github.com/leejet/stable-diffusion.cpp/releases/download/master-964-1d0a58a/sd-master-1d0a58a-bin-win-vulkan-x64.zip",
+ "size": 30155040,
+ "sha256": "74211cb5c382aec2aeb086b64f2fdf525efec5faec4200a2d3257bc2328954ab"
+ },
+ "metal": {
+ "url": "https://github.com/leejet/stable-diffusion.cpp/releases/download/master-964-1d0a58a/sd-master-1d0a58a-bin-Darwin-macOS-26.6.2-arm64.zip",
+ "size": 35213648,
+ "sha256": "45001839e925f98ecd18ef5251725f74cff874eeac4599f1136acba65b26911e"
+ }
+}
diff --git a/marketing/release-notes-0.9.2.md b/marketing/release-notes-0.9.2.md
new file mode 100644
index 0000000..fd72db6
--- /dev/null
+++ b/marketing/release-notes-0.9.2.md
@@ -0,0 +1,17 @@
+## Kokon 0.9.2
+
+**Native 2K edits, faster.** On graphics cards with 16 GB or more, 2K edits are now drawn at full size instead of enlarged afterwards: sharper, and about a third faster (41 s instead of 66 s for a 2752×1536 edit on an RTX 5070 Ti).
+
+- **Reference detail** (Advanced menu): your source images go to the model at 1 MP by default, leaving more room for the result. Choose Full for finer source detail. Every new chat starts at 1 MP.
+- **Faster decoding** on 16 GB+ cards: tiles shaped to the image (7.8 s → 4.75 s at 2752×1536).
+- **Official stable-diffusion.cpp.** The MoSR upscaler Kokon contributed was merged upstream ([#2128](https://github.com/leejet/stable-diffusion.cpp/pull/2128)), so Kokon now runs the official release `master-964-1d0a58a` instead of its own fork. The app checks every few days for a newer engine tested with Kokon and offers it in one click.
+- **Prompt tips**: a hint under the prompt and a Prompt tips panel. Describing the scene, not only the subject, keeps the action you asked for.
+
+Updating from 0.9.1: the app asks to download the new engine (~340 MB on NVIDIA, ~30 MB with Vulkan or on a Mac). Your images, models and settings stay as they are.
+
+### Downloads
+
+| File | SHA-256 |
+|---|---|
+| `Kokon_0.9.2_x64-setup.exe` (Windows) | `TBD` |
+| `Kokon_0.9.2_aarch64.dmg` (Mac) | `TBD` |
diff --git a/package.json b/package.json
index 94e5821..11d1c12 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "kokon",
"private": true,
- "version": "0.9.1",
+ "version": "0.9.2",
"license": "AGPL-3.0-only",
"type": "module",
"scripts": {
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index ab10818..42708ab 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -2,7 +2,7 @@
"$schema": "https://schema.tauri.app/config/2",
"productName": "Kokon",
"mainBinaryName": "Kokon",
- "version": "0.9.1",
+ "version": "0.9.2",
"identifier": "app.kokon.desktop",
"build": {
"beforeDevCommand": "npm run bundled && cargo build -p qls-service && npm run dev",
diff --git a/src/components/WhatsNew.tsx b/src/components/WhatsNew.tsx
index 15e69a3..34e5916 100644
--- a/src/components/WhatsNew.tsx
+++ b/src/components/WhatsNew.tsx
@@ -1,4 +1,4 @@
-import { CircleAlert, Images, LayoutGrid, Maximize, SlidersHorizontal, Sparkles } from "lucide-react";
+import { CircleAlert, Cpu, Lightbulb, SlidersHorizontal, Zap } from "lucide-react";
import { useEffect, useState } from "react";
import { api } from "../lib/api";
import { formatBytes, installProgress, installStep, installTimeLeft } from "../lib/logic";
@@ -8,34 +8,34 @@ import type { GpuBackend, InstallItem, InstallStatus } from "../lib/types";
import { KokonMark } from "./Welcome";
/** The release these notes describe. Shown once to people updating from an earlier version. */
-export const WHATS_NEW_VERSION = "0.9.1";
+export const WHATS_NEW_VERSION = "0.9.2";
const NEWS = [
isMac
? {
- icon: Sparkles,
- title: "Plain resize by default on a Mac",
- text: "AI upscalers take minutes on a Mac (Superscale-SP: about 6 minutes for a 1 MP image to 2K on an M2 Pro), so results are enlarged with Lanczos in about a second. You can still pick one.",
+ icon: Zap,
+ title: "Larger edits",
+ text: "Your photo is given to the model at 1 MP, which leaves more room for the result: edits render larger in about the same time.",
}
: {
- icon: Sparkles,
- title: "Superscale-SP by default",
- text: "Results are enlarged with a sharper, more natural upscaler. The previous one, UltraSharp, was great on some images but smoothed skin and textures into an artificial look on others. You can still download it.",
+ icon: Zap,
+ title: "Native 2K edits, faster",
+ text: "On graphics cards with 16 GB or more, 2K edits are drawn at full size instead of enlarged afterwards: sharper, and about a third faster (41 s instead of 66 s on an RTX 5070 Ti).",
},
{
icon: SlidersHorizontal,
- title: "Choose your upscaler",
- text: "In the Advanced menu next to the prompt: Superscale-SP, the experimental MoSR (very fast, included), UltraSharp or a plain resize, a strength slider, and a side-by-side comparison.",
+ title: "Reference detail",
+ text: "In the Advanced menu: how large your source images are given to the model. 1 MP (the default in every new chat) leaves more room for the result; Full keeps finer source detail.",
},
{
- icon: LayoutGrid,
- title: "Gallery preview",
- text: "Click an image in the gallery for a large preview and browse with the arrow keys; F or a double-click for full screen. Enter opens it in its project.",
+ icon: Cpu,
+ title: "Official engine, kept up to date",
+ text: "Kokon now runs the official stable-diffusion.cpp release, which includes our MoSR upscaler, and checks every few days for a newer engine tested with Kokon.",
},
{
- icon: Maximize,
- title: "Full screen and renaming",
- text: "Full screen follows the project's timeline: the arrow keys step through versions without leaving it. Renaming now starts from the current name.",
+ icon: Lightbulb,
+ title: "Prompt tips",
+ text: "A hint under the prompt and a Prompt tips panel: describing the scene, not just the subject, keeps the action you asked for.",
},
];
@@ -124,13 +124,9 @@ export function WhatsNew() {
</div>
))}
</div>
- <button className="btn" onClick={() => setState({ compareUpscalers: true })}>
- <Images size={14} /> Compare the upscalers
- </button>
-
{showEngine && !done && (
<p className="welcome-lead">
- This version needs a newer stable-diffusion.cpp, the engine that runs the models on your graphics chip{getsSuperscale ? ", and the Superscale-SP model" : ""}. Your images,
+ A newer stable-diffusion.cpp is ready, the engine that runs the models on your graphics chip{getsSuperscale ? ", plus the Superscale-SP model" : ""}. Your images,
models and settings stay as they are.
</p>
)}
@@ -171,7 +167,7 @@ export function WhatsNew() {
</button>
</div>
<span className="muted welcome-foot">
- {isMac ? "" : "Until you update, enlargements use a plain resize. "}You can update later from Settings → Models → Set up models…
+ You can update later from Settings → Models → Set up models…
</span>
</>
)}