a-agent 0.2.1

Fast, terminal-native coding agent with progressive context
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
pub fn bound_stdin(input: &[u8], max_bytes: usize) -> String {
    if input.len() <= max_bytes {
        return String::from_utf8_lossy(input).into_owned();
    }
    let mut start = input.len().saturating_sub(max_bytes);
    while start < input.len() && (input[start] & 0b1100_0000) == 0b1000_0000 {
        start += 1;
    }
    format!(
        "[stdin truncated; showing last {max_bytes} bytes]\n{}",
        String::from_utf8_lossy(&input[start..])
    )
}