#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AppMode {
Agent,
Yolo,
Plan,
}
impl AppMode {
#[must_use]
pub fn from_setting(value: &str) -> Self {
match value.trim().to_ascii_lowercase().as_str() {
"plan" => Self::Plan,
"yolo" => Self::Yolo,
_ => Self::Agent,
}
}
#[must_use]
pub fn as_setting(self) -> &'static str {
match self {
Self::Agent => "agent",
Self::Yolo => "yolo",
Self::Plan => "plan",
}
}
#[must_use]
pub fn label(self) -> &'static str {
match self {
Self::Agent => "AGENT",
Self::Yolo => "YOLO",
Self::Plan => "PLAN",
}
}
#[allow(dead_code)]
#[must_use]
pub fn description(self) -> &'static str {
match self {
Self::Agent => "Agent mode - autonomous task execution with tools",
Self::Yolo => "YOLO mode - full tool access without approvals",
Self::Plan => "Plan mode - design before implementing",
}
}
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum ReasoningEffort {
Off,
Low,
Medium,
High,
Auto,
#[default]
Max,
}
impl ReasoningEffort {
#[must_use]
pub fn from_setting(value: &str) -> Self {
match value.trim().to_ascii_lowercase().as_str() {
"off" | "disabled" | "none" | "false" => Self::Off,
"low" | "minimal" => Self::Low,
"medium" | "mid" => Self::Medium,
"high" => Self::High,
"auto" | "automatic" => Self::Auto,
"max" | "maximum" | "xhigh" => Self::Max,
_ => Self::default(),
}
}
#[must_use]
pub fn as_setting(self) -> &'static str {
match self {
Self::Off => "off",
Self::Low => "low",
Self::Medium => "medium",
Self::High => "high",
Self::Auto => "auto",
Self::Max => "max",
}
}
#[must_use]
pub fn short_label(self) -> &'static str {
match self {
Self::Off => "off",
Self::Low => "low",
Self::Medium => "med",
Self::High => "high",
Self::Auto => "auto",
Self::Max => "max",
}
}
#[must_use]
pub fn api_value(self) -> Option<&'static str> {
Some(self.as_setting())
}
#[must_use]
pub fn cycle_next(self) -> Self {
match self {
Self::Off => Self::High,
Self::Auto => Self::Off,
Self::Low | Self::Medium | Self::High => Self::Max,
Self::Max => Self::Off,
}
}
}