Add tokens consumed and context percentage to per-tool timing footer
The per-tool timing line now shows:
- Tokens delta (tokens added to context by this tool call)
- Context window usage percentage
Example: └─ ⚡️ 1ms 523tk | 49% ctx
Changes:
- Updated UiWriter trait print_tool_timing signature
- Track tokens before/after adding tool messages to calculate delta
- Updated ConsoleUiWriter, MachineUiWriter, PlannerUiWriter, and test mocks
This commit is contained in:
@@ -64,8 +64,10 @@ impl UiWriter for MachineUiWriter {
|
||||
println!("TOOL_OUTPUT_LINES: {}", count);
|
||||
}
|
||||
|
||||
fn print_tool_timing(&self, duration_str: &str) {
|
||||
fn print_tool_timing(&self, duration_str: &str, tokens_delta: u32, context_percentage: f32) {
|
||||
println!("TOOL_DURATION: {}", duration_str);
|
||||
println!("TOKENS_DELTA: {}", tokens_delta);
|
||||
println!("CONTEXT_PERCENTAGE: {:.0}", context_percentage);
|
||||
println!("END_TOOL_OUTPUT");
|
||||
println!();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user