self-run: repair the task cut function
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4981639f29
commit
0e182237fd
1 changed files with 13 additions and 2 deletions
|
|
@ -133,8 +133,19 @@ fn task_section(mind: &dyn MindPort, claims: &[PipelineRef]) -> String {
|
||||||
}
|
}
|
||||||
cut_at(task, TASK_LIMIT)
|
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.
|
/// 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.";
|
pub const FLUSH_MESSAGE: &str = "The context ceiling is reached. Admit to the mind what it lacks, close your run, and end.";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue