The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
feat(comfyui): plug-and-play Python auto-install via winget (P14)
purplee083fa8efeb9
diff --git a/src-tauri/src/commands/agent.rs b/src-tauri/src/commands/agent.rsindex e9183037..a7e0eaaf 100644--- a/src-tauri/src/commands/agent.rs+++ b/src-tauri/src/commands/agent.rs@@ -279,7 +279,15 @@ pub fn execute_code(let workspace = agent_workspace(chatId.as_deref(), Some(&*state));let _ = fs::create_dir_all(&workspace);- let mut cmd = Command::new(&state.python_bin);+ let python_bin = state.python_bin.lock().unwrap().clone();+ if python_bin.is_empty() {+ return Err(+ "Python is not installed — agent code execution requires Python. \+ Install it from Settings → ComfyUI → Install Python first."+ .to_string(),+ );+ }+ let mut cmd = Command::new(&python_bin);cmd.arg(&script_path).current_dir(&workspace).stdin(Stdio::null())diff --git a/src-tauri/src/commands/install.rs b/src-tauri/src/commands/install.rsindex 2d813e4f..072007d5 100644--- a/src-tauri/src/commands/install.rs+++ b/src-tauri/src/commands/install.rs@@ -231,7 +231,32 @@ pub fn install_comfyui(.map(PathBuf::from).unwrap_or_else(|| dirs::home_dir().unwrap_or_default().join("ComfyUI"));- let python_bin = state.python_bin.clone();+ // Pre-flight: refuse to start ComfyUI install without a real Python.+ // The frontend is expected to call `install_python` first when this+ // returns the "no python" error — that flow shows a Python-install+ // progress card before re-firing `install_comfyui`. The ComfyUI carcass+ // bug (P14) was caused by skipping this check: pip got fed the Microsoft+ // Store stub `python.exe`, which exit-1'd, leaving a half-cloned+ // ComfyUI dir on disk that LU then mistakenly detected as "installed".+ let python_bin = state.python_bin.lock().unwrap().clone();+ if python_bin.is_empty() || !crate::python::is_real_python(&python_bin) {+ // Reset install state so the frontend's polling sees the error+ // immediately — without this the spawned thread below never runs and+ // the UI sits on "installing" forever.+ let mut install = state.install_status.lock().unwrap();+ install.status = "error".to_string();+ install.logs.push(+ "Python is not installed on this machine. \+ Install Python first (Settings → ComfyUI → Install Python, \+ or click 'Install Python' in the onboarding ComfyUI step), \+ then retry the ComfyUI install."+ .to_string(),+ );+ return Err(+ "no_python: Python must be installed before ComfyUI. Call install_python first."+ .to_string(),+ );+ }let install_status = state.install_status.clone();std::thread::spawn(move || {@@ -824,6 +849,244 @@ pub fn lmstudio_server_status() -> Result<serde_json::Value, String> {}))}+// ── Python Auto-Install (P14: Plug-and-Play, blocking pre-req for ComfyUI) ──+//+// On a fresh Windows box `python.exe` is the Microsoft Store stub at+// `%LOCALAPPDATA%\Microsoft\WindowsApps\python.exe` — it prints "Python was+// not found, run without arguments to install from the Microsoft Store" and+// exits 1. That kills `pip install torch ...` 200 ms in, leaves a half-cloned+// ComfyUI dir on disk, and the user sees "ComfyUI not responding". The+// only Plug-and-Play fix for newbies is to install Python ourselves; this is+// what `install_python` does. Same shape as `install_ollama` /+// `install_lmstudio`: kick off a background thread, surface status via a+// shared `InstallState`, and re-resolve `python_bin` once it finishes so+// subsequent `install_comfyui` calls find it without an app restart.++#[tauri::command]+pub fn install_python(state: State<'_, AppState>) -> Result<serde_json::Value, String> {+ // If Python is already there, short-circuit so the UI can skip the+ // install card and go straight to ComfyUI. is_real_python rejects+ // the empty sentinel and WindowsApps stub paths.+ {+ let current = state.python_bin.lock().unwrap().clone();+ if crate::python::is_real_python(¤t) {+ return Ok(serde_json::json!({"status": "already_installed", "path": current}));+ }+ }++ let mut install = state.python_install.lock().unwrap();+ if install.status == "downloading"+ || install.status == "installing"+ || install.status == "starting"+ {+ return Ok(serde_json::json!({"status": "already_installing"}));+ }++ install.status = "installing".to_string();+ install.logs.clear();+ install.download_progress = 0;+ install.download_total = 0;+ install.download_speed = 0.0;+ install+ .logs+ .push("Installing Python 3.12 via winget (~30 MB)…".to_string());+ drop(install);++ let py_state = state.python_install.clone();+ let py_bin_slot = state.python_bin.clone();++ std::thread::spawn(move || {+ let update = |status: &str, msg: &str| {+ if let Ok(mut s) = py_state.lock() {+ s.status = status.to_string();+ s.logs.push(msg.to_string());+ }+ };++ // Stream-friendly winget invocation. `--silent --accept-*-agreements`+ // drops the EULA prompts; without them winget will sit and wait for+ // user input forever inside our background thread. Python.Python.3.12+ // is the canonical winget id for the python.org installer (matches+ // `winget search python` top result).+ update("installing", "Running: winget install Python.Python.3.12 --silent --accept-package-agreements --accept-source-agreements");++ let mut cmd = Command::new("winget");+ cmd.args([+ "install",+ "Python.Python.3.12",+ "--silent",+ "--accept-package-agreements",+ "--accept-source-agreements",+ "--scope",+ "user",+ ])+ .stdout(Stdio::piped())+ .stderr(Stdio::piped());+ #[cfg(target_os = "windows")]+ cmd.creation_flags(CREATE_NO_WINDOW);++ let child = match cmd.spawn() {+ Ok(c) => c,+ Err(e) => {+ update(+ "error",+ &format!(+ "Could not run winget: {}. winget ships with Windows 10/11 — \+ if it's missing, run 'Get App Installer' from the Microsoft \+ Store (free) and retry.",+ e+ ),+ );+ return;+ }+ };++ // Stream stdout + stderr line-by-line so the UI's log card animates+ // as winget extracts and installs (otherwise it freezes for 1–2 min).+ let mut child = child;+ let stdout = child.stdout.take();+ let stderr = child.stderr.take();+ let stdout_state = py_state.clone();+ let stdout_handle = std::thread::spawn(move || {+ if let Some(out) = stdout {+ let reader = BufReader::new(out);+ for line in reader.lines().map_while(Result::ok) {+ let trimmed = line.trim();+ if !trimmed.is_empty() {+ if let Ok(mut s) = stdout_state.lock() {+ s.logs.push(trimmed.to_string());+ }+ }+ }+ }+ });+ let stderr_state = py_state.clone();+ let stderr_handle = std::thread::spawn(move || {+ if let Some(err) = stderr {+ let reader = BufReader::new(err);+ for line in reader.lines().map_while(Result::ok) {+ let trimmed = line.trim();+ if !trimmed.is_empty() {+ if let Ok(mut s) = stderr_state.lock() {+ s.logs.push(trimmed.to_string());+ }+ }+ }+ }+ });++ let exit_status = match child.wait() {+ Ok(s) => s,+ Err(e) => {+ update("error", &format!("winget wait failed: {}", e));+ return;+ }+ };+ let _ = stdout_handle.join();+ let _ = stderr_handle.join();++ if !exit_status.success() {+ // winget exit codes are HRESULT-shaped; -1978335189 (0x8A150011)+ // means "no upgrade applicable" which is fine if Python is+ // already present. Anything else is a real failure.+ let code = exit_status.code().unwrap_or(-1);+ // Re-resolve regardless: Python may already be on the box from+ // a previous install attempt that the original where-scan+ // missed (e.g. Add-to-PATH was unchecked).+ let resolved = crate::python::get_python_bin();+ if crate::python::is_real_python(&resolved) {+ if let Ok(mut slot) = py_bin_slot.lock() {+ *slot = resolved.clone();+ }+ update(+ "complete",+ &format!("Python ready (winget exit {} ignored, Python detected at {})", code, resolved),+ );+ return;+ }+ update(+ "error",+ &format!(+ "winget exited with code {}. Python was not detected after \+ install. Try installing manually from python.org with the \+ 'Add Python to PATH' checkbox on, then return here and \+ click Re-Scan.",+ code+ ),+ );+ return;+ }++ update("starting", "winget finished. Re-resolving Python…");++ // Give the freshly installed Python a moment to settle (winget can+ // signal completion before the file is fully linked into PATH on+ // some boxes), then re-resolve and persist.+ for attempt in 0..15 {+ std::thread::sleep(std::time::Duration::from_secs(1));+ let resolved = crate::python::get_python_bin();+ if crate::python::is_real_python(&resolved) {+ if let Ok(mut slot) = py_bin_slot.lock() {+ *slot = resolved.clone();+ }+ update(+ "complete",+ &format!("Python ready at {}", resolved),+ );+ return;+ }+ println!("[Python] post-install resolve attempt {}/15 — not yet on PATH", attempt + 1);+ }++ update(+ "error",+ "winget reported success but Python is still not on PATH. \+ Restart Locally Uncensored — sometimes Windows needs the new PATH \+ to take effect. If it still doesn't show up, install manually \+ from python.org with 'Add Python to PATH' on.",+ );+ });++ Ok(serde_json::json!({"status": "installing"}))+}++#[tauri::command]+pub fn install_python_status(state: State<'_, AppState>) -> Result<serde_json::Value, String> {+ let install = state.python_install.lock().unwrap();+ Ok(serde_json::json!({+ "status": install.status,+ "logs": install.logs,+ "download_progress": install.download_progress,+ "download_total": install.download_total,+ "download_speed": install.download_speed,+ }))+}++/// Cheap synchronous probe: is there a real Python on the box? The frontend+/// calls this before kicking off `install_comfyui` so it can decide whether+/// to show the Python install step first. Returns the resolved path on+/// success so the UI can display it ("Found Python at C:\\…").+#[tauri::command]+pub fn python_check(state: State<'_, AppState>) -> Result<serde_json::Value, String> {+ let current = state.python_bin.lock().unwrap().clone();+ if crate::python::is_real_python(¤t) {+ return Ok(serde_json::json!({"available": true, "path": current}));+ }++ // The slot may have been empty at startup (fresh box) and Python may+ // have been installed since (e.g. via this same install_python flow on+ // another launch). Re-resolve as a refresh.+ let resolved = crate::python::get_python_bin();+ if crate::python::is_real_python(&resolved) {+ if let Ok(mut slot) = state.python_bin.lock() {+ *slot = resolved.clone();+ }+ Ok(serde_json::json!({"available": true, "path": resolved}))+ } else {+ Ok(serde_json::json!({"available": false, "path": null}))+ }+}+// ──────────────────────────────────────────────────────────────────────────────#[allow(non_snake_case)]@@ -892,7 +1155,7 @@ pub fn install_custom_node(// Install requirements.txt if it existslet reqs = target_dir.join("requirements.txt");if reqs.exists() {- let python_bin = state.python_bin.clone();+ let python_bin = state.python_bin.lock().unwrap().clone();println!("[Install] Installing requirements for {}...", node_name);let mut pip = Command::new(&python_bin);pip.args(["-m", "pip", "install", "-r"]).arg(&reqs)diff --git a/src-tauri/src/commands/process.rs b/src-tauri/src/commands/process.rsindex 33c17964..88460474 100644--- a/src-tauri/src/commands/process.rs+++ b/src-tauri/src/commands/process.rs@@ -100,6 +100,134 @@ fn scan_for_comfyui(dir: &Path, depth: u32) -> Option<PathBuf> {None}+/// Heuristic: does this ComfyUI directory look like a *complete* install,+/// i.e. one that will actually start when we run `python main.py`?+///+/// "Complete" here means: torch is reachable. Two paths qualify:+///+/// 1. Portable variants ship a `python_embeded/` directory with the+/// matching torch wheel pre-baked. We just check that+/// `python_embeded/Lib/site-packages/torch/` exists — fast and avoids+/// spawning a Python process for every dir we scan.+/// 2. From-source installs depend on the system Python having torch.+/// `python_embeded/` won't exist; we sniff the system Python's+/// `Lib/site-packages/torch/` instead. (Best-effort: we only check the+/// canonical "next to python.exe" layout — virtualenvs aren't covered,+/// but those users wouldn't be using LU's auto-install path anyway.)+///+/// Returning `false` for a `main.py`-only carcass is the whole point of+/// P14: a half-cloned ComfyUI dir from a previous abort (Python missing,+/// pip 403, network drop) used to be detected as "installed", which left+/// the user staring at "ComfyUI not responding" forever. Reporting it as+/// incomplete instead lets the install flow retry cleanly.+fn is_comfyui_install_complete(comfy_path: &Path) -> bool {+ if !comfy_path.join("main.py").exists() {+ return false;+ }++ // Path 1: portable layouts (next-to or inside the ComfyUI dir).+ let portable_candidates = [+ comfy_path+ .parent()+ .map(|p| p.join("python_embeded").join("Lib").join("site-packages").join("torch")),+ Some(comfy_path.join("python_embeded").join("Lib").join("site-packages").join("torch")),+ ];+ for c in portable_candidates.into_iter().flatten() {+ if c.exists() {+ return true;+ }+ }++ // Path 2: system Python — derive its prefix from the resolved path+ // and look for torch in the standard sysconfig location. This catches+ // the from-source case where pip dropped torch into the system+ // Python's site-packages.+ let candidate_pythons = collect_candidate_pythons();+ for py in candidate_pythons {+ if let Some(prefix) = Path::new(&py).parent() {+ // Windows layout: <prefix>/Lib/site-packages+ let win_torch = prefix.join("Lib").join("site-packages").join("torch");+ if win_torch.exists() {+ return true;+ }+ // Unix layout: <prefix>/../lib/python3.X/site-packages — be+ // permissive, just look for any torch under <prefix>/../lib.+ if let Some(parent) = prefix.parent() {+ let lib = parent.join("lib");+ if lib.exists() {+ if let Ok(entries) = std::fs::read_dir(&lib) {+ for e in entries.flatten() {+ if e.path().join("site-packages").join("torch").exists() {+ return true;+ }+ }+ }+ }+ }+ }+ }++ false+}++/// Collect the system Python paths we might want to probe. Mirrors the+/// search order in `python::get_python_bin` but returns *all* hits, not+/// just the first — so the carcass check works even when the user has+/// torch installed in a non-default Python.+fn collect_candidate_pythons() -> Vec<String> {+ let mut out: Vec<String> = Vec::new();++ if !cfg!(target_os = "windows") {+ for bin in &["python3", "python"] {+ out.push(bin.to_string());+ }+ return out;+ }++ // `where python` candidates (excluding WindowsApps stub).+ let mut where_cmd = Command::new("where");+ where_cmd.arg("python");+ #[cfg(target_os = "windows")]+ where_cmd.creation_flags(CREATE_NO_WINDOW);+ if let Ok(output) = where_cmd.output() {+ if output.status.success() {+ let stdout = String::from_utf8_lossy(&output.stdout);+ for line in stdout.lines() {+ let path = line.trim();+ if !path.is_empty() && !path.contains("WindowsApps") {+ out.push(path.to_string());+ }+ }+ }+ }++ for p in [+ "C:\\Python313\\python.exe",+ "C:\\Python312\\python.exe",+ "C:\\Python311\\python.exe",+ "C:\\Python310\\python.exe",+ "C:\\Python39\\python.exe",+ ] {+ if Path::new(p).exists() {+ out.push(p.to_string());+ }+ }++ if let Ok(localappdata) = std::env::var("LOCALAPPDATA") {+ let programs = Path::new(&localappdata).join("Programs").join("Python");+ if let Ok(entries) = std::fs::read_dir(&programs) {+ for e in entries.flatten() {+ let py = e.path().join("python.exe");+ if py.exists() {+ out.push(py.to_string_lossy().to_string());+ }+ }+ }+ }++ out+}+pub fn find_comfyui_path() -> Option<String> {// 1. Check environment variableif let Ok(env_path) = std::env::var("COMFYUI_PATH") {@@ -289,8 +417,16 @@ pub fn start_comfyui(state: State<'_, AppState>) -> Result<serde_json::Value, Stlet candidate = std::path::Path::new(&comfy_path).join("python_embeded").join("python.exe");if candidate.exists() { Some(candidate.to_string_lossy().to_string()) } else { None }});- let python = bundled_python.as_deref().unwrap_or(&state.python_bin);+ let system_python = state.python_bin.lock().unwrap().clone();+ let python = bundled_python.clone().unwrap_or(system_python.clone());let port_str = port.to_string();+ if python.is_empty() {+ return Err(+ "No Python available — install Python first (Settings → ComfyUI → Install Python). \+ ComfyUI from-source needs a system Python; install one and retry."+ .to_string(),+ );+ }if bundled_python.is_some() {println!("[ComfyUI] Using bundled portable Python: {}", python);} else {@@ -298,7 +434,7 @@ pub fn start_comfyui(state: State<'_, AppState>) -> Result<serde_json::Value, St}println!("[ComfyUI] Starting from: {} on port {}", comfy_path, port);- let mut cmd = Command::new(python);+ let mut cmd = Command::new(&python);cmd.args(["main.py", "--listen", "127.0.0.1", "--port", &port_str, "--enable-cors-header", "*"]).current_dir(&comfy_path).env("TQDM_DISABLE", "1")@@ -403,16 +539,35 @@ pub async fn comfyui_status(state: State<'_, AppState>) -> Result<serde_json::Va};// For remote hosts we don't care whether a local install path exists.+ let resolved_path: Option<String> = if is_local {+ path.clone().or_else(find_comfyui_path)+ } else {+ None+ };+let found = if is_local {- path.is_some() || find_comfyui_path().is_some()+ resolved_path.is_some()} else {true // the remote side handles its own install};+ // Carcass detection: a local install is only "complete" if torch is+ // actually reachable. Remote hosts are reported complete by definition+ // — the remote side owns its own install state.+ let complete = if is_local {+ match &resolved_path {+ Some(p) => is_comfyui_install_complete(Path::new(p)),+ None => false,+ }+ } else {+ true+ };+Ok(serde_json::json!({"running": running,"starting": process_alive && !running,"found": found,+ "complete": complete,"path": path,"port": port,"host": host,@@ -431,8 +586,23 @@ pub fn is_local_host(host: &str) -> bool {#[tauri::command]pub fn find_comfyui() -> Result<serde_json::Value, String> {match find_comfyui_path() {- Some(path) => Ok(serde_json::json!({"found": true, "path": path})),- None => Ok(serde_json::json!({"found": false, "path": null})),+ Some(path) => {+ // Surface install completeness so the UI can distinguish a+ // working ComfyUI from a half-cloned carcass and offer the+ // right action (Continue vs. Re-install). See+ // is_comfyui_install_complete for the definition of "complete".+ let complete = is_comfyui_install_complete(Path::new(&path));+ Ok(serde_json::json!({+ "found": true,+ "path": path,+ "complete": complete,+ }))+ }+ None => Ok(serde_json::json!({+ "found": false,+ "path": null,+ "complete": false,+ })),}}@@ -696,12 +866,17 @@ pub fn auto_start_comfyui(state: &AppState) {let c = std::path::Path::new(&path).join("python_embeded").join("python.exe");if c.exists() { Some(c.to_string_lossy().to_string()) } else { None }});- let python = portable_python.as_deref().unwrap_or(state.python_bin.as_str());+ let system_python = state.python_bin.lock().unwrap().clone();+ let python = portable_python.clone().unwrap_or_else(|| system_python.clone());+ if python.is_empty() {+ println!("[ComfyUI] Auto-start skipped: no Python available (install via P14 flow)");+ return;+ }if portable_python.is_some() {println!("[ComfyUI] Auto-start using bundled portable Python: {}", python);}- let mut cmd = Command::new(python);+ let mut cmd = Command::new(&python);cmd.args(["main.py", "--listen", "127.0.0.1", "--port", &port_str, "--enable-cors-header", "*"]).current_dir(&path).env("TQDM_DISABLE", "1")diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rsindex d3d14ffb..d0908dff 100644--- a/src-tauri/src/main.rs+++ b/src-tauri/src/main.rs@@ -49,6 +49,9 @@ fn main() {commands::install::install_lmstudio_status,commands::install::start_lmstudio_server,commands::install::lmstudio_server_status,+ commands::install::install_python,+ commands::install::install_python_status,+ commands::install::python_check,commands::install::install_custom_node,// Whisper STTcommands::whisper::whisper_status,@@ -193,10 +196,19 @@ fn main() {commands::process::auto_start_comfyui(&state);let handle = app.handle().clone();- let python_bin = state.python_bin.clone();+ let python_bin = state.python_bin.lock().unwrap().clone();let whisper = state.whisper.clone();std::thread::spawn(move || {- commands::whisper::auto_start_whisper_sync(&handle, &python_bin, &whisper);+ // Whisper auto-start is best-effort and pip-installs faster-whisper+ // on first launch — silently skip when no Python is on the box, so+ // a fresh install doesn't fail the whole startup. The user can+ // install Python later via the ComfyUI flow; whisper picks up on+ // next launch.+ if !python_bin.is_empty() {+ commands::whisper::auto_start_whisper_sync(&handle, &python_bin, &whisper);+ } else {+ println!("[Whisper] Skipping auto-start: no Python yet (install via ComfyUI step)");+ }});Ok(())diff --git a/src-tauri/src/python.rs b/src-tauri/src/python.rsindex 93632109..493e7985 100644--- a/src-tauri/src/python.rs+++ b/src-tauri/src/python.rs@@ -7,7 +7,14 @@ use std::os::windows::process::CommandExt;#[cfg(target_os = "windows")]const CREATE_NO_WINDOW: u32 = 0x08000000;-/// Resolve the real Python binary path, filtering out Windows Store alias.+/// Resolve the real Python binary path, filtering out the Microsoft Store stub+/// alias (`%LOCALAPPDATA%\Microsoft\WindowsApps\python.exe`) which prints+/// "Python was not found, run without arguments to install from the Microsoft+/// Store" and exits 1 — useless for `pip install`. Returns the empty string+/// when no real Python is available; callers must treat `""` as+/// "Python not installed". Falling back to the bare `"python"` string the way+/// older versions did re-introduces the Store-stub trap on a fresh Windows+/// box, which is exactly the bug P14 fixes.pub fn get_python_bin() -> String {if cfg!(not(target_os = "windows")) {// On Linux/macOS, try python3 first, then python@@ -18,7 +25,8 @@ pub fn get_python_bin() -> String {}}}- return "python3".to_string();+ // Nothing usable — empty string sentinel.+ return String::new();}// Windows: use `where python` and filter out WindowsApps alias@@ -106,6 +114,18 @@ pub fn get_python_bin() -> String {}}- println!("[Python] WARNING: No reliable Python found, falling back to 'python'");- "python".to_string()+ println!("[Python] No real Python found on PATH or known locations — returning empty sentinel");+ String::new()+}++/// True iff `bin` looks like a real, runnable Python binary (not the empty+/// sentinel from `get_python_bin` and not a Microsoft Store stub).+pub fn is_real_python(bin: &str) -> bool {+ if bin.is_empty() {+ return false;+ }+ if bin.contains("WindowsApps") {+ return false;+ }+ true}diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rsindex 82397895..ee0b5467 100644--- a/src-tauri/src/state.rs+++ b/src-tauri/src/state.rs@@ -139,9 +139,17 @@ pub struct AppState {pub install_status: Arc<Mutex<InstallState>>,pub ollama_install: Arc<Mutex<InstallState>>,pub lmstudio_install: Arc<Mutex<InstallState>>,+ pub python_install: Arc<Mutex<InstallState>>,pub searxng_install: Mutex<InstallState>,pub searxng_available: AtomicBool,- pub python_bin: String,+ /// Resolved Python binary path. Empty string means "no real Python on+ /// this box" — callers must treat `""` as the missing-Python sentinel+ /// and surface the install_python flow rather than spawning `"python"`+ /// (which on Windows hits the Microsoft Store stub). Wrapped in a+ /// `Mutex` so `install_python` can update it at runtime once Python+ /// finishes installing — without that, the user would have to restart+ /// LU to pick up the freshly installed Python.+ pub python_bin: Arc<Mutex<String>>,// Claude Codepub claude_code_process: Mutex<Option<Child>>,pub claude_code_install: Arc<Mutex<InstallState>>,@@ -158,7 +166,11 @@ pub struct AppState {impl AppState {pub fn new() -> Self {let python_bin = get_python_bin();- println!("[Python] Resolved: {}", python_bin);+ if python_bin.is_empty() {+ println!("[Python] Resolved: <none — install_python required for ComfyUI / agent code-exec>");+ } else {+ println!("[Python] Resolved: {}", python_bin);+ }// Load persisted ComfyUI port+host from config.json if available.// Fixes a pre-existing bug where `set_comfyui_port` wrote to disk but@@ -193,9 +205,10 @@ impl AppState {install_status: Arc::new(Mutex::new(InstallState::default())),ollama_install: Arc::new(Mutex::new(InstallState::default())),lmstudio_install: Arc::new(Mutex::new(InstallState::default())),+ python_install: Arc::new(Mutex::new(InstallState::default())),searxng_install: Mutex::new(InstallState::default()),searxng_available: AtomicBool::new(false),- python_bin,+ python_bin: Arc::new(Mutex::new(python_bin)),// Claude Codeclaude_code_process: Mutex::new(None),claude_code_install: Arc::new(Mutex::new(InstallState::default())),