Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-sovereign-core/blob/main/crates/spark-supervisor/src/main.rs # aien-sovereign-core Autonomous sovereign intelligence engine and runtime core for NVIDIA DGX Spark Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core / crates / spark-supervisor / src / main.rs` 63 lines ยท 2044 bytes Raw Blame History 1 use clap::{Parser, Subcommand}; 2 use std::path::PathBuf; 3 use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; 4 5 mod config; 6 mod proc_telemetry; 7 mod supervisor; 8 9 use config::SupervisorConfig; 10 use supervisor::Supervisor; 11 12 #[derive(Parser, Debug)] 13 #[command(name = "spark-supervisor", about = "Sovereign Native Process Supervisor for SparkOS")] 14 struct Cli { 15 #[arg(long, default_value = "/home/drakestapleton/.config/aien/supervisor.toml")] 16 config: PathBuf, 17 18 #[command(subcommand)] 19 command: Option, 20 } 21 22 #[derive(Subcommand, Debug)] 23 enum Commands { 24 Run, 25 Status, 26 Check, 27 } 28 29 #[tokio::main] 30 async fn main() -> Result<(), Box> { 31 let cli = Cli::parse(); 32 33 tracing_subscriber::registry() 34 .with(tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into())) 35 .with(tracing_subscriber::fmt::layer()) 36 .init(); 37 38 if !cli.config.exists() { 39 eprintln!("Config file not found at {:?}. Generating default supervisor.toml...", cli.config); 40 if let Some(p) = cli.config.parent() { 41 let _ = std::fs::create_dir_all(p); 42 } 43 let default_toml = "[services.cortex]\ncommand = \"/home/drakestapleton/.local/bin/cortex-rs\"\nargs = [\"--port\", \"18080\"]\nrestart = \"always\"\nhealth_url = \"http://127.0.0.1:18080/health\"\n\n[services.cockpit]\ncommand = \"/home/drakestapleton/.local/bin/spark-cockpit-rs\"\nrestart = \"always\"\nhealth_url = \"http://127.0.0.1:18095/health\"\n"; 44 std::fs::write(&cli.config, default_toml)?; 45 } 46 47 let config = SupervisorConfig::load_from_file(&cli.config)?; 48 let supervisor = Supervisor::new(config); 49 50 match cli.command.unwrap_or(Commands::Run) { 51 Commands::Run => { 52 supervisor.run_daemon().await?; 53 } 54 Commands::Status => { 55 supervisor.print_status().await; 56 } 57 Commands::Check => { 58 println!("Configuration {:?} is valid.", cli.config); 59 } 60 } 61 62 Ok(()) 63 }