Add comprehensive stress tests for streaming markdown formatter

Add 10 stress tests covering:
- Nested formatting (bold in italic, italic in bold)
- Empty/minimal content edge cases
- Escape sequences and special characters
- Lists with complex inline formatting
- Links with various content types
- Tables with formatting in cells
- Code blocks (should not format contents)
- Mixed block elements (headers, quotes, rules)
- Nested lists (3+ levels, mixed types)
- Pathological/adversarial inputs (unbalanced delimiters, unicode, long lines)

All 45 tests pass.
This commit is contained in:
Dhanji R. Prasanna
2026-01-08 20:27:28 +11:00
parent fadfaee040
commit 347513b04c
10 changed files with 3022 additions and 6 deletions

View File

@@ -81,6 +81,12 @@ pub trait UiWriter: Send + Sync {
/// Called at the start of a new response to clear any partial state.
/// Default implementation does nothing.
fn reset_json_filter(&self) {}
/// Finish the streaming markdown formatter and flush any remaining content.
/// Called at the end of an agent response to emit any buffered markdown.
/// Also resets the formatter for the next response.
/// Default implementation does nothing.
fn finish_streaming_markdown(&self) {}
/// Set whether the UI is in agent mode.
/// When in agent mode, tool names may be displayed differently (e.g., different color).
@@ -109,6 +115,7 @@ impl UiWriter for NullUiWriter {
fn print_agent_response(&self, _content: &str) {}
fn notify_sse_received(&self) {}
fn flush(&self) {}
fn finish_streaming_markdown(&self) {}
fn wants_full_output(&self) -> bool {
false
}