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,7 +69,7 @@ fn test_thin_context_basic() {
// Trigger thinning at 50%
context.used_tokens = 5000;
let (summary, _chars_saved) = context.thin_context();
let (summary, _chars_saved) = context.thin_context(None);
println!("Thinning summary: {}", summary);
@@ -130,7 +130,7 @@ fn test_thin_write_file_tool_calls() {
// Trigger thinning at 50%
context.used_tokens = 5000;
let (summary, _chars_saved) = context.thin_context();
let (summary, _chars_saved) = context.thin_context(None);
println!("Thinning summary: {}", summary);
@@ -190,7 +190,7 @@ fn test_thin_str_replace_tool_calls() {
// Trigger thinning at 50%
context.used_tokens = 5000;
let (summary, _chars_saved) = context.thin_context();
let (summary, _chars_saved) = context.thin_context(None);
println!("Thinning summary: {}", summary);
@@ -224,7 +224,7 @@ fn test_thin_context_no_large_results() {
}
context.used_tokens = 5000;
let (summary, _chars_saved) = context.thin_context();
let (summary, _chars_saved) = context.thin_context(None);
// Should report no large results found
assert!(summary.contains("no large tool results or tool calls found"));
@@ -253,7 +253,7 @@ fn test_thin_context_only_affects_first_third() {
}
context.used_tokens = 5000;
let (summary, _chars_saved) = context.thin_context();
let (summary, _chars_saved) = context.thin_context(None);
// First third is 4 messages (indices 0-3), so only indices 1 and 3 should be thinned
// That's 2 tool results