diff --git a/crates/tinytools-agent/src/stream/mod.rs b/crates/tinytools-agent/src/stream/mod.rs index 5ae526e..d5a86e9 100644 --- a/crates/tinytools-agent/src/stream/mod.rs +++ b/crates/tinytools-agent/src/stream/mod.rs @@ -151,8 +151,30 @@ fn hold_from(tail: &str) -> usize { } } } + if let Some(idx) = trailing_bare_angle_bracket(tail) { + best = best.min(idx); + } best } +/// Byte index of a trailing `<` or ` Option { + let trimmed = tail.trim_end_matches(char::is_whitespace); + if let Some(stripped) = trimmed.strip_suffix("{\"path\":\"a\"}"); + assert_eq!(second.calls.len(), 1); + assert_eq!(second.calls[0].name, "read"); +} + #[test] fn plural_tool_calls_prose_is_not_held() { assert_eq!(