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