1pub mod component;
7pub mod crdt;
8pub mod ffi;
9pub mod frontmatter;
10pub mod merge;
11pub mod template;
12
13pub const BOUNDARY_ID_LEN: usize = 8;
15
16pub fn new_boundary_id() -> String {
18 let full = uuid::Uuid::new_v4().to_string().replace('-', "");
19 full[..BOUNDARY_ID_LEN.min(full.len())].to_string()
20}
21
22pub fn new_boundary_id_with_summary(summary: Option<&str>) -> String {
27 let id = new_boundary_id();
28 match summary {
29 Some(s) if !s.is_empty() => {
30 let slug: String = s.to_lowercase()
31 .chars()
32 .map(|c| if c.is_alphanumeric() { c } else { '-' })
33 .collect::<String>()
34 .split('-')
35 .filter(|s| !s.is_empty())
36 .take(3) .collect::<Vec<&str>>()
38 .join("-");
39 let slug = &slug[..slug.len().min(20)];
40 format!("{}:{}", id, slug)
41 }
42 _ => id,
43 }
44}
45
46pub fn format_boundary_marker(id: &str) -> String {
48 format!("<!-- agent:boundary:{} -->", id)
49}