//! Spectra's own marks, in the style of `oxy`'s (`ui.rs` stays exactly //! `oxy`'s, so the two tools look the same): presence and agent health. use super::ui::{dim, glyph, ok, warn}; use console::style; /// An agent's presence (spec §8.1) as a coloured glyph and word. #[allow(dead_code)] // Used by agent list once presence lands (#5). pub fn presence(state: &str) -> String { let (g, a) = match state { "online" => ("●", "*"), "busy" => ("◆", "+"), "idle" => ("◌", "o"), "blocked" => ("‼", "!"), "paused" => ("⏸", "="), _ => ("○", "-"), }; let text = format!("{} {state:<7}", glyph(g, a)); match state { "online" => ok(text), "busy" => style(text).cyan().to_string(), "blocked" | "paused" => warn(text), _ => dim(text), } } /// Whether an agent may act: a tick, or a warning with the reason. pub fn health(state: &str) -> String { if state == "ok" { ok(glyph("✔", "ok")) } else { warn(glyph("⚠", "!")) } }