diff --git a/crates/colibri-daemon/src/main.rs b/crates/colibri-daemon/src/main.rs index 58e8868..d1fb603 100644 --- a/crates/colibri-daemon/src/main.rs +++ b/crates/colibri-daemon/src/main.rs @@ -76,8 +76,8 @@ async fn main() -> Result<(), Box> { // Auto-spawn one Pi agent if configured (live "Operator Image" OOTB flow). // Runs after the socket server is up so the spawn registers on the board; - // no-op unless COLIBRI_AUTOSPAWN_PI is set and a DeepSeek key is present. - socket::autospawn_pi_if_configured(&state).await; + // no-op unless COLIBRI_AUTOSPAWN is set and a DeepSeek key is present. + socket::autospawn_agent_if_configured(&state).await; // Start the daemon background loop (heartbeat, session rotation, scheduler) let loop_state = state.clone(); diff --git a/crates/colibri-daemon/src/socket.rs b/crates/colibri-daemon/src/socket.rs index a62210d..de13b7d 100644 --- a/crates/colibri-daemon/src/socket.rs +++ b/crates/colibri-daemon/src/socket.rs @@ -400,47 +400,45 @@ async fn cmd_list_sessions(state: &SharedState) -> ColibriResponse { })) } -/// Auto-spawn a single Pi agent at daemon startup when configured. +/// Auto-spawn a single agent at daemon startup when configured. /// -/// Enabled with `COLIBRI_AUTOSPAWN_PI` (`YES`/`1`/`true`/`on`). Requires a +/// Enabled with `COLIBRI_AUTOSPAWN` (`YES`/`1`/`true`/`on`). Requires a /// `DEEPSEEK_API_KEY` in the daemon environment (sourced from `provider.env`) — -/// the host-spawned Pi inherits it. Idempotent: skips when a Pi subprocess is -/// already running, so a daemon restart (e.g. after the operator enters creds -/// and `service colibri_daemon restart` runs) does not stack duplicates. +/// the host-spawned agent inherits it. Idempotent: skips when an agent subprocess +/// is already running, so a daemon restart does not stack duplicates. /// -/// The live "Operator Image" is single-agent, so the Pi runs on the host (no -/// jail). Binary and argv are env-tunable so the exact Pi invocation can be -/// adjusted on the image without a rebuild: -/// - `COLIBRI_PI_BINARY` (default `pi`) -/// - `COLIBRI_AUTOSPAWN_PI_ARGS` (default `--mode json`) -pub async fn autospawn_pi_if_configured(state: &SharedState) { - if !env_truthy("COLIBRI_AUTOSPAWN_PI") { +/// The live "Operator Image" is single-agent, so the agent runs on the host (no +/// jail). Binary and argv are env-tunable without a rebuild: +/// - `COLIBRI_AUTOSPAWN_BINARY` (default `zot`) +/// - `COLIBRI_AUTOSPAWN_ARGS` (default `--mode json`) +pub async fn autospawn_agent_if_configured(state: &SharedState) { + if !env_truthy("COLIBRI_AUTOSPAWN") { return; } if state.config.deepseek_api_key.is_none() { info!( - "autospawn-pi: DEEPSEEK_API_KEY not set; skipping (operator can add it via Join Hive)" + "autospawn: DEEPSEEK_API_KEY not set; skipping (operator can add it via Join Hive)" ); return; } - let pi_binary = std::env::var("COLIBRI_PI_BINARY") + let agent_binary = std::env::var("COLIBRI_AUTOSPAWN_BINARY") .ok() .filter(|s| !s.trim().is_empty()) - .unwrap_or_else(|| "pi".to_string()); + .unwrap_or_else(|| "zot".to_string()); - // One Pi is enough. Match by binary basename so a restart does not duplicate. - let pi_name = basename(&pi_binary); + // One agent is enough. Match by binary basename so a restart does not duplicate. + let agent_name = basename(&agent_binary); let already = state .agents .iter() - .any(|e| basename(&e.value().config.binary) == pi_name); + .any(|e| basename(&e.value().config.binary) == agent_name); if already { - info!(pi = %pi_name, "autospawn-pi: a Pi agent is already running; skipping"); + info!(agent = %agent_name, "autospawn: an agent is already running; skipping"); return; } - let args: Vec = std::env::var("COLIBRI_AUTOSPAWN_PI_ARGS") + let args: Vec = std::env::var("COLIBRI_AUTOSPAWN_ARGS") .ok() .filter(|s| !s.trim().is_empty()) .unwrap_or_else(|| "--mode json".to_string())