A local-first private AI assistant for everyday use. Runs on-device models with encrypted P2P sync, and supports sharing chats publicly on ATProto.
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: refactored health command + using env for db password in dev

madclaws 2cb58ad5 13e81956

+50 -28
+1 -1
Cargo.lock
··· 6550 6550 6551 6551 [[package]] 6552 6552 name = "tiles" 6553 - version = "0.4.6" 6553 + version = "0.4.5" 6554 6554 dependencies = [ 6555 6555 "anyhow", 6556 6556 "async-std",
+1 -1
tiles/Cargo.toml
··· 1 1 [package] 2 2 name = "tiles" 3 - version = "0.4.6" 3 + version = "0.4.5" 4 4 edition = "2024" 5 5 6 6 [dependencies]
+2 -2
tiles/src/commands/mod.rs
··· 268 268 } 269 269 } 270 270 } 271 - pub async fn check_health() { 272 - health::check_health().await; 271 + pub async fn check_health() -> Result<()> { 272 + health::check_health().await 273 273 } 274 274 275 275 pub async fn start_server(runtime: &Runtime) {
+27 -22
tiles/src/core/health.rs
··· 1 1 // Contains functions for health checking various dependencies 2 2 3 - use std::{env, process::Command}; 3 + use std::env; 4 + 5 + use anyhow::Result; 4 6 5 - use crate::runtime::mlx::ping; 7 + use crate::{ 8 + daemon::ping, 9 + utils::installer::{UpdateInfo, get_update_info}, 10 + }; 6 11 7 - pub async fn check_health() { 12 + pub async fn check_health() -> Result<()> { 8 13 let os = env::consts::OS; 9 - println!("Running diagnosis..."); 10 - check_python3(); 11 - if os == "macos" { 12 - check_server_status().await 13 - } 14 - } 14 + println!("Running diagnosis...\n"); 15 15 16 - fn check_python3() { 17 - let output = Command::new("python3") 18 - .arg("--version") 19 - .output() 20 - .ok() 21 - .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string()); 22 - 23 - if let Some(version) = output { 24 - println!("Python3: ✅ {}", version) 16 + println!("Checking for newer version...\n"); 17 + let update_info: UpdateInfo = get_update_info().await?; 18 + if update_info.can_update { 19 + println!("⚠️ Outdated version, try `tiles update`"); 20 + let update_str = format!( 21 + "\tcurrent version - {}\n\tlatest version - {}", 22 + update_info.current_version, update_info.latest_version 23 + ); 24 + println!("{}", update_str); 25 25 } else { 26 - println!("Python3: ❌ hint: Install Python3 for your OS") 26 + println!("✅ Running latest version\n"); 27 27 } 28 + if os == "macos" && !cfg!(debug_assertions) { 29 + check_server_status().await; 30 + } 31 + Ok(()) 28 32 } 33 + 29 34 async fn check_server_status() { 30 - if ping().await.is_ok() { 31 - println!("Model server is UP: ✅") 35 + if ping(None).await.is_ok() { 36 + println!("✅ Daemon is UP") 32 37 } else { 33 - println!("Model server is DOWN: ❌, try `tiles server start`") 38 + println!("❌ Daemon is DOWN, try `tiles daemon start`") 34 39 } 35 40 }
+18 -1
tiles/src/core/storage/db.rs
··· 3 3 //! Uses sqlite as the underlying database 4 4 //! 5 5 6 - use std::path::PathBuf; 6 + use std::{env, path::PathBuf}; 7 7 8 8 use anyhow::{Result, anyhow}; 9 9 use log::info; ··· 117 117 118 118 fn fetch_passkey() -> Result<String> { 119 119 let app_name = get_app_name(); 120 + // handling db passwords in dev mode separately 121 + // This is to suppress keychain popups during development 122 + 123 + if cfg!(debug_assertions) { 124 + if let Ok(passwd) = env::var("TILES_DEV_DB_PASSWORD") { 125 + return Ok(passwd); 126 + } else { 127 + info!("DB passkey not found in development, creating one.."); 128 + let passwd = create_and_save_passkey(&app_name, "db_passkey")?; 129 + info!( 130 + "Save this password {} as an environment variable with name `TILES_DEV_DB_PASSWORD`", 131 + passwd 132 + ); 133 + return Ok(passwd); 134 + } 135 + } 136 + 120 137 if let Ok(passkey) = get_passkey(&app_name, "db_passkey") { 121 138 Ok(passkey) 122 139 } else {
+1 -1
tiles/src/main.rs
··· 233 233 .inspect_err(|e| eprintln!("Tiles failed to run due to {:?}", e))?; 234 234 } 235 235 Some(Commands::Health) => { 236 - commands::check_health().await; 236 + commands::check_health().await?; 237 237 } 238 238 Some(Commands::Server(server)) => match server.command { 239 239 Some(ServerCommands::Start) => commands::start_server(&runtime).await,