Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

merge f-split into f-split-s6

Niko1221326e39118811
diff --cc apps/desktop/src-tauri/Cargo.toml
index 5c695511f,6285977b3..ebd2f4769
--- a/apps/desktop/src-tauri/Cargo.toml
+++ b/apps/desktop/src-tauri/Cargo.toml
@@@ -12,7 -12,7 +12,8 @@@ tauri-build = { version = "2", feature
[dependencies]
tauri = { version = "2", features = [] }
tauri-plugin-shell = "2"
+tauri-plugin-updater = "2"
+ tauri-plugin-single-instance = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
diff --cc apps/desktop/src-tauri/src/main.rs
index 4d4b04801,51cd861c9..116137fbd
--- a/apps/desktop/src-tauri/src/main.rs
+++ b/apps/desktop/src-tauri/src/main.rs
@@@ -24,8 -36,149 +36,151 @@@ use std::time::{Duration, Instant}
use tauri::{Manager, WebviewUrl, WebviewWindowBuilder};
+mod updater;
+
+ /// The kill-on-close Job Object that holds everything this app starts (Windows). Its only handle is this process's,
+ /// which the system closes however the process ends; closing the last handle ends every process in the job.
+ #[cfg(windows)]
+ mod job {
+ use std::ffi::c_void;
+
+ type Handle = *mut c_void;
+ const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE: u32 = 0x2000;
+ const JOB_OBJECT_EXTENDED_LIMIT_INFORMATION: i32 = 9;
+
+ #[repr(C)]
+ #[derive(Default)]
+ struct BasicLimits {
+ per_process_user_time_limit: i64,
+ per_job_user_time_limit: i64,
+ limit_flags: u32,
+ minimum_working_set_size: usize,
+ maximum_working_set_size: usize,
+ active_process_limit: u32,
+ affinity: usize,
+ priority_class: u32,
+ scheduling_class: u32,
+ }
+
+ #[repr(C)]
+ #[derive(Default)]
+ struct IoCounters {
+ counts: [u64; 6],
+ }
+
+ #[repr(C)]
+ #[derive(Default)]
+ struct ExtendedLimits {
+ basic: BasicLimits,
+ io: IoCounters,
+ process_memory_limit: usize,
+ job_memory_limit: usize,
+ peak_process_memory_used: usize,
+ peak_job_memory_used: usize,
+ }
+
+ #[link(name = "kernel32")]
+ extern "system" {
+ fn CreateJobObjectW(attributes: *mut c_void, name: *const u16) -> Handle;
+ fn SetInformationJobObject(job: Handle, class: i32, info: *mut c_void, len: u32) -> i32;
+ fn AssignProcessToJobObject(job: Handle, process: Handle) -> i32;
+ fn GetCurrentProcess() -> Handle;
+ fn CloseHandle(handle: Handle) -> i32;
+ fn IsProcessInJob(process: Handle, job: Handle, result: *mut i32) -> i32;
+ }
+
+ /// Is this process inside any job object? (The self-test asks, so an installed build proves it is contained.)
+ pub fn current_process_in_a_job() -> bool {
+ let mut result = 0i32;
+ unsafe { IsProcessInJob(GetCurrentProcess(), std::ptr::null_mut(), &mut result) != 0 && result != 0 }
+ }
+
+ pub struct Job(Handle);
+
+ // The handle is a plain kernel object handle, usable from any thread.
+ unsafe impl Send for Job {}
+ unsafe impl Sync for Job {}
+
+ impl Job {
+ /// A new job that ends all of its processes when its last handle closes. None if the system refuses.
+ pub fn kill_on_close() -> Option<Job> {
+ unsafe {
+ let handle = CreateJobObjectW(std::ptr::null_mut(), std::ptr::null());
+ if handle.is_null() {
+ return None;
+ }
+ let mut info = ExtendedLimits::default();
+ info.basic.limit_flags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
+ let ok = SetInformationJobObject(
+ handle,
+ JOB_OBJECT_EXTENDED_LIMIT_INFORMATION,
+ &mut info as *mut ExtendedLimits as *mut c_void,
+ std::mem::size_of::<ExtendedLimits>() as u32,
+ );
+ if ok == 0 {
+ CloseHandle(handle);
+ return None;
+ }
+ Some(Job(handle))
+ }
+ }
+
+ /// Put a process (by handle) in the job; everything it starts later joins too.
+ pub fn assign_raw(&self, process: *mut c_void) -> bool {
+ unsafe { AssignProcessToJobObject(self.0, process) != 0 }
+ }
+
+ /// Put this very process in the job, so the host and everything below it are contained.
+ pub fn assign_current(&self) -> bool {
+ self.assign_raw(unsafe { GetCurrentProcess() })
+ }
+ }
+
+ impl Drop for Job {
+ fn drop(&mut self) {
+ unsafe {
+ CloseHandle(self.0);
+ }
+ }
+ }
+ }
+
+ /// Held for the life of the process. The handle is deliberately never closed by us: the system closes it when the
+ /// process ends, by any route, and that is the moment the job ends what is left in it.
+ #[cfg(windows)]
+ static APP_JOB: std::sync::OnceLock<job::Job> = std::sync::OnceLock::new();
+
+ /// Is the app inside a job object right now? Always false off Windows.
+ fn app_is_contained() -> bool {
+ #[cfg(windows)]
+ {
+ job::current_process_in_a_job()
+ }
+ #[cfg(not(windows))]
+ {
+ false
+ }
+ }
+
+ /// Put this process (and so everything it starts) in a kill-on-close job. True if it is contained now.
+ fn contain_app() -> bool {
+ #[cfg(windows)]
+ {
+ if let Some(job) = job::Job::kill_on_close() {
+ if job.assign_current() {
+ let _ = APP_JOB.set(job);
+ return true;
+ }
+ }
+ eprintln!("[strata] could not put the app in a job object; engines are stopped by the host and their owners instead");
+ false
+ }
+ #[cfg(not(windows))]
+ {
+ false
+ }
+ }
+
/// The running App Host, kept so it can be stopped on exit.
struct HostProcess(Mutex<Option<Child>>);
@@@ -595,8 -757,15 +762,16 @@@ fn main()
}
tauri::Builder::default()
+ // First, as the plugin requires: a second launch ends here after telling the running app to show itself.
+ .plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
+ if let Some(window) = app.get_webview_window("main") {
+ let _ = window.unminimize();
+ let _ = window.show();
+ let _ = window.set_focus();
+ }
+ }))
.plugin(tauri_plugin_shell::init())
+ .plugin(tauri_plugin_updater::Builder::new().build())
.manage(HostProcess(Mutex::new(None)))
.manage(HostPort(Mutex::new(None)))
.manage(ShutdownToken(Mutex::new(None)))
diff --cc strata_cli/cli.py
index bbd6b74a6,001ae1250..5fbb87e4d
--- a/strata_cli/cli.py
+++ b/strata_cli/cli.py
@@@ -450,8 -461,8 +463,8 @@@ def parser() -> argparse.ArgumentParser
for one_shot in (profile_create, profile_list, profile_show, profile_validate, profile_set,
profile_source, profile_edit, profile_history, profile_rollback, doctor,
components_verify, models_list, models_inspect, models_import, calibrate,
- runtime_start, runtime_status, runtime_verify, runtime_stop, runtime_restart,
+ runtime_start, runtime_status, runtime_verify, runtime_stop, runtime_cleanup, runtime_restart,
- *ops_items, bench_run, bench_report, bench_compare, code_sessions):
+ *ops_items, bench_run, bench_report, bench_compare, code_sessions, *update_parsers):
one_shot.add_argument("--json", action="store_true", help="alias for --output json")
one_shot.add_argument("--quiet", action="store_true", default=argparse.SUPPRESS,
help="suppress human informational output")