Skip to main content

zag_agent/
lib.rs

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