feat(agent): implement agent execution engine and turn handling with background processing

This commit is contained in:
asepharyana
2026-07-20 16:29:39 +07:00
parent 2e8a4f2443
commit efcd191f96
15 changed files with 452 additions and 247 deletions
+7 -1
View File
@@ -97,7 +97,13 @@ fn draw_usage_widget(frame: &mut Frame, area: Rect, state: &crate::state::AppSta
let now_ms = chrono::Utc::now().timestamp_millis();
let summary = compute_usage_summary(&rt.usage, rt.session_start, now_ms);
let max_tokens = crate::state::resolve_context_window(&state.app_config, &state.settings);
let current_tokens = state.cached_token_count;
let current_tokens = if rt.usage.last_tokens_in > 0 {
// Actual context window used by the LLM (includes system prompt + tree)
rt.usage.last_tokens_in as usize
} else {
// Fallback for brand new sessions before the first API call
state.cached_token_count
};
let mut items = vec![
Line::from(Span::styled(