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