Move fixed_filter_json from g3-core to g3-cli

Properly separates UI display concern from core library:
- fixed_filter_json module now lives in g3-cli (UI layer)
- UiWriter trait gains filter_json_tool_calls() and reset_json_filter() methods
- g3-core delegates filtering to UI layer via trait methods
- Different UiWriter implementations can choose their own filtering behavior
- ConsoleUiWriter filters JSON tool calls for clean terminal display
- MachineUiWriter/NullUiWriter use default pass-through

Benefits:
- Proper separation of concerns
- Core stays clean without display-specific logic
- Testability - filter can be tested independently in g3-cli
This commit is contained in:
Dhanji R. Prasanna
2025-12-22 10:32:21 +11:00
parent fbf31e5f68
commit 01a5284d6d
14 changed files with 297 additions and 183 deletions

View File

@@ -69,6 +69,18 @@ pub trait UiWriter: Send + Sync {
/// Print the final output summary with markdown formatting
/// Shows a spinner while formatting, then renders the markdown
fn print_final_output(&self, summary: &str);
/// Filter JSON tool calls from streaming content for display.
/// This is a UI concern - the raw content should be preserved for logging.
/// Default implementation passes through unchanged.
fn filter_json_tool_calls(&self, content: &str) -> String {
content.to_string()
}
/// Reset the JSON tool call filter state.
/// Called at the start of a new response to clear any partial state.
/// Default implementation does nothing.
fn reset_json_filter(&self) {}
}
/// A no-op implementation for when UI output is not needed