apollo-agent 0.3.0

Local-first Rust AI agent runtime β€” Telegram-first, trait-driven, SurrealDB + RocksDB state layer.
Documentation
//! Small text utilities shared across tools and providers.

pub fn truncate_chars(text: &str, max_chars: usize) -> String {
    text.chars().take(max_chars).collect()
}

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

    #[test]
    fn test_truncate_chars() {
        assert_eq!(truncate_chars("hello world", 5), "hello");
        assert_eq!(truncate_chars("hello", 5), "hello");
        assert_eq!(truncate_chars("hi", 5), "hi");
        assert_eq!(truncate_chars("hello", 0), "");
        assert_eq!(truncate_chars("", 5), "");
        assert_eq!(truncate_chars("πŸ‘‹πŸŒŽ", 1), "πŸ‘‹");
        assert_eq!(truncate_chars("πŸ‘‹πŸŒŽ", 2), "πŸ‘‹πŸŒŽ");
        assert_eq!(truncate_chars("こんにけは", 2), "こん");
        assert_eq!(truncate_chars("μ•ˆλ…•ν•˜μ„Έμš”", 3), "μ•ˆλ…•ν•˜");
        assert_eq!(truncate_chars("δ½ ε₯½δΈ–η•Œ", 1), "δ½ ");
    }
}