ai-agent 0.13.4

Idiomatic agent sdk inspired by the claude code source leak
Documentation
/// Special characters that macOS Option+key produces, mapped to their
/// keybinding equivalents. Used to detect Option+key shortcuts on macOS
/// terminals that don't have "Option as Meta" enabled.
pub const MACOS_OPTION_SPECIAL_CHARS: &[(&str, &str)] = &[
    ("", "alt+t"), // Option+T -> thinking toggle
    ("π", "alt+p"), // Option+P -> model picker
    ("ø", "alt+o"), // Option+O -> fast mode
];

/// Check if a character is a macOS Option special character
pub fn is_macos_option_char(c: char) -> Option<&'static str> {
    let s = c.to_string();
    for (char, binding) in MACOS_OPTION_SPECIAL_CHARS {
        if *char == s {
            return Some(binding);
        }
    }
    None
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_is_macos_option_char() {
        assert_eq!(is_macos_option_char(''), Some("alt+t"));
        assert_eq!(is_macos_option_char('π'), Some("alt+p"));
        assert_eq!(is_macos_option_char('ø'), Some("alt+o"));
        assert_eq!(is_macos_option_char('a'), None);
    }
}