Skip to main content

zag_agent/
lib.rs

1pub mod agent;
2pub mod attachment;
3pub mod auto_selector;
4pub mod builder;
5pub mod capability;
6pub mod config;
7pub mod factory;
8pub mod file_util;
9pub mod json_validation;
10pub mod listen;
11pub mod manpages;
12pub mod mcp;
13pub mod output;
14pub mod plan;
15pub mod preflight;
16pub mod process;
17pub mod process_store;
18pub mod progress;
19pub mod providers;
20pub mod review;
21pub mod sandbox;
22pub mod search;
23pub mod session;
24pub mod session_log;
25pub mod skills;
26pub mod streaming;
27pub mod worktree;
28
29/// Truncate a string to at most `max_bytes` bytes, rounding down to a valid
30/// UTF-8 char boundary. Equivalent to `str::floor_char_boundary` (Rust 1.91+).
31pub(crate) fn truncate_str(s: &str, max_bytes: usize) -> &str {
32    if max_bytes >= s.len() {
33        return s;
34    }
35    let mut end = max_bytes;
36    while end > 0 && !s.is_char_boundary(end) {
37        end -= 1;
38    }
39    &s[..end]
40}
41
42#[cfg(test)]
43#[path = "mock_integration_tests.rs"]
44mod mock_integration_tests;