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 mcp;
11pub mod output;
12pub mod preflight;
13pub mod process;
14pub mod process_store;
15pub mod progress;
16pub mod providers;
17pub mod sandbox;
18pub mod search;
19pub mod session;
20pub mod session_log;
21pub mod skills;
22pub mod streaming;
23pub mod worktree;
24
25/// Truncate a string to at most `max_bytes` bytes, rounding down to a valid
26/// UTF-8 char boundary. Equivalent to `str::floor_char_boundary` (Rust 1.91+).
27pub(crate) fn truncate_str(s: &str, max_bytes: usize) -> &str {
28    if max_bytes >= s.len() {
29        return s;
30    }
31    let mut end = max_bytes;
32    while end > 0 && !s.is_char_boundary(end) {
33        end -= 1;
34    }
35    &s[..end]
36}
37
38#[cfg(test)]
39#[path = "mock_integration_tests.rs"]
40mod mock_integration_tests;