diff --git a/crates/mind-body/src/self_run.rs b/crates/mind-body/src/self_run.rs index e4bc9a4..64d5596 100644 --- a/crates/mind-body/src/self_run.rs +++ b/crates/mind-body/src/self_run.rs @@ -133,8 +133,19 @@ fn task_section(mind: &dyn MindPort, claims: &[PipelineRef]) -> String { } cut_at(task, TASK_LIMIT) } -/// `text` cut at a character boundary to `limit` bytes, marked when cut.fn cut_at(mut text: String, limit: usize) -> String { if text.len() > limit { let mut end = limit; while !text.is_char_boundary(end) { end -= 1; } text.truncate(end); text.push_str(" -[task truncated]"); } text} + +/// `text` cut at a character boundary to `limit` bytes, marked when cut. +fn cut_at(mut text: String, limit: usize) -> String { + if text.len() > limit { + let mut end = limit; + while !text.is_char_boundary(end) { + end -= 1; + } + text.truncate(end); + text.push_str("\n[task truncated]"); + } + text +} /// What the child is told once, at the context ceiling. pub const FLUSH_MESSAGE: &str = "The context ceiling is reached. Admit to the mind what it lacks, close your run, and end.";