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-mv/blob/main/crates/aien-switchboard/src/bin/switchboard.rs # aien-sovereign-core-mv AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination. 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-mv / crates / aien-switchboard / src / bin / switchboard.rs` 70 lines ยท 2136 bytes Raw Blame History 1 //! `switchboard`: list, open and check isolated Claude Code profiles 2 //! (ADR 0030 phase 1, issue #592). The only place in the crate that starts a 3 //! process. 4 5 use aien_switchboard::cli; 6 use aien_switchboard::launch::{LaunchError, LaunchPlan, Spawner}; 7 use aien_switchboard::{Env, VersionProbe}; 8 use std::os::unix::process::CommandExt; 9 use std::path::Path; 10 use std::process::{Command, Stdio}; 11 12 /// Replaces this process with `claude`, so `claude` owns the terminal and its 13 /// signals directly. Only returns if the operating system refused. 14 struct ExecSpawner; 15 16 impl Spawner for ExecSpawner { 17 fn spawn(&mut self, plan: &LaunchPlan) -> Result { 18 let e = Command::new(&plan.program) 19 .env_clear() 20 .envs(&plan.env) 21 .exec(); 22 Err(LaunchError::Spawn { 23 program: plan.program.clone(), 24 message: e.kind().to_string(), 25 }) 26 } 27 } 28 29 /// Runs ` --version` with exactly the given environment and no 30 /// input. 31 struct CommandProbe; 32 33 impl VersionProbe for CommandProbe { 34 fn version(&mut self, program: &Path, env: &Env) -> Result { 35 let out = Command::new(program) 36 .arg("--version") 37 .env_clear() 38 .envs(env) 39 .stdin(Stdio::null()) 40 .output() 41 .map_err(|e| e.kind().to_string())?; 42 if out.status.success() { 43 Ok(String::from_utf8_lossy(&out.stdout).into_owned()) 44 } else { 45 Err(format!("exit status {}", out.status)) 46 } 47 } 48 } 49 50 fn main() { 51 let args: Vec = std::env::args().skip(1).collect(); 52 let env: Env = std::env::vars_os().collect(); 53 let cwd = match std::env::current_dir() { 54 Ok(d) => d, 55 Err(e) => { 56 eprintln!("switchboard: cannot read the working folder: {}", e.kind()); 57 std::process::exit(1); 58 } 59 }; 60 let code = cli::run( 61 &args, 62 &env, 63 &cwd, 64 &mut ExecSpawner, 65 &mut CommandProbe, 66 &mut std::io::stdout(), 67 &mut std::io::stderr(), 68 ); 69 std::process::exit(code); 70 }