From 0973b83d3a4f1eaed818bbe5a77124452e46f1a0 Mon Sep 17 00:00:00 2001 From: Dhanji Prasanna Date: Wed, 8 Oct 2025 14:06:25 +1100 Subject: [PATCH] fix build warnings --- crates/g3-cli/src/retro_tui.rs | 53 ++-------------------------- crates/g3-cli/src/theme.rs | 44 ----------------------- crates/g3-core/src/error_handling.rs | 8 ++--- 3 files changed, 4 insertions(+), 101 deletions(-) diff --git a/crates/g3-cli/src/retro_tui.rs b/crates/g3-cli/src/retro_tui.rs index 64b6132..b5d0bbf 100644 --- a/crates/g3-cli/src/retro_tui.rs +++ b/crates/g3-cli/src/retro_tui.rs @@ -106,7 +106,7 @@ struct TerminalState { /// SSE rate tracking for wave animation sse_wave_history: VecDeque, // Wave animation values for SSEs /// Start time for token tracking - session_start: Instant, + _session_start: Instant, // Prefixed with _ to indicate it's intentionally unused for now /// SSE counter (including pings) sse_count: u32, /// Last token count for rate calculation @@ -147,7 +147,7 @@ impl TerminalState { last_tool_header_index: None, token_wave_history: VecDeque::with_capacity(40), // Keep 40 points for wave animation sse_wave_history: VecDeque::with_capacity(40), // Keep 40 points for wave animation - session_start: Instant::now(), + _session_start: Instant::now(), last_token_count: 0, sse_count: 0, } @@ -459,18 +459,6 @@ impl TerminalState { } } } - - /// Add padding lines to ensure content can be scrolled fully into view - fn add_padding(&mut self) { - // Add enough blank lines to ensure the last content can be scrolled into view - // This is a workaround for the scrolling calculation issues - let padding_lines = 5; // Add 5 blank lines for padding - for _ in 0..padding_lines { - self.output_history.push(String::new()); - } - // Reset scroll to show the actual content (not the padding) - // This keeps the view focused on the last real content - } } /// Public interface for the retro terminal @@ -1571,43 +1559,6 @@ impl RetroTui { state.manual_scroll = false; } } - - /// Scroll tool activity up - pub fn tool_scroll_up(&self) { - if let Ok(mut state) = self.state.lock() { - if state.tool_activity_scroll > 0 { - state.tool_activity_auto_scroll = false; - state.tool_activity_scroll -= 1; - } - } - } - - /// Scroll tool activity down - pub fn tool_scroll_down(&self) { - if let Ok(mut state) = self.state.lock() { - let total_lines = state.tool_activity.len(); - let visible_height = 6; // Tool detail area height minus borders - - if total_lines > visible_height { - let max_scroll = total_lines.saturating_sub(visible_height); - if state.tool_activity_scroll < max_scroll { - state.tool_activity_auto_scroll = false; - state.tool_activity_scroll = (state.tool_activity_scroll + 1).min(max_scroll); - } - } - } - } - - /// Reset tool activity scroll to auto-scroll mode - pub fn tool_scroll_auto(&self) { - if let Ok(mut state) = self.state.lock() { - state.tool_activity_auto_scroll = true; - let visible_height = 6; - if state.tool_activity.len() > visible_height { - state.tool_activity_scroll = state.tool_activity.len().saturating_sub(visible_height); - } - } - } } impl Drop for RetroTui { diff --git a/crates/g3-cli/src/theme.rs b/crates/g3-cli/src/theme.rs index c08d349..6c059f7 100644 --- a/crates/g3-cli/src/theme.rs +++ b/crates/g3-cli/src/theme.rs @@ -87,13 +87,6 @@ impl ColorTheme { Ok(theme) } - /// Save a theme to a JSON file - pub fn to_file>(&self, path: P) -> Result<()> { - let content = serde_json::to_string_pretty(self)?; - fs::write(path, content)?; - Ok(()) - } - /// Get the default retro sci-fi theme (inspired by Alien terminals) pub fn default() -> Self { ColorTheme { @@ -151,41 +144,4 @@ impl ColorTheme { } } } -} - -/// Create example theme files in the user's config directory -pub fn create_example_themes() -> Result<()> { - let home = dirs::home_dir().ok_or_else(|| anyhow::anyhow!("Could not find home directory"))?; - let themes_dir = home.join(".config").join("g3").join("themes"); - - // Create directory if it doesn't exist - fs::create_dir_all(&themes_dir)?; - - // Save default theme - let default_theme = ColorTheme::default(); - default_theme.to_file(themes_dir.join("retro.json"))?; - - // Save Dracula theme - let dracula_theme = ColorTheme::dracula(); - dracula_theme.to_file(themes_dir.join("dracula.json"))?; - - // Create a custom example theme (Matrix-inspired) - let matrix_theme = ColorTheme { - name: "Matrix".to_string(), - terminal_green: ColorValue::Rgb { r: 0, g: 255, b: 0 }, - terminal_amber: ColorValue::Rgb { r: 0, g: 200, b: 0 }, - terminal_dim_green: ColorValue::Rgb { r: 0, g: 100, b: 0 }, - terminal_bg: ColorValue::Rgb { r: 0, g: 0, b: 0 }, - terminal_cyan: ColorValue::Rgb { r: 0, g: 255, b: 128 }, - terminal_red: ColorValue::Rgb { r: 255, g: 0, b: 0 }, - terminal_pale_blue: ColorValue::Rgb { r: 0, g: 255, b: 200 }, - terminal_dark_amber: ColorValue::Rgb { r: 0, g: 150, b: 0 }, - terminal_white: ColorValue::Rgb { r: 200, g: 255, b: 200 }, - terminal_success: ColorValue::Rgb { r: 0, g: 255, b: 0 }, // Bright green for Matrix theme - }; - matrix_theme.to_file(themes_dir.join("matrix.json"))?; - - println!("Example theme files created in: {}", themes_dir.display()); - - Ok(()) } \ No newline at end of file diff --git a/crates/g3-core/src/error_handling.rs b/crates/g3-core/src/error_handling.rs index a2b780e..3194dfe 100644 --- a/crates/g3-core/src/error_handling.rs +++ b/crates/g3-core/src/error_handling.rs @@ -6,7 +6,7 @@ //! - Detailed error logging with context information //! - Request/response capture for debugging -use anyhow::{anyhow, Result}; +use anyhow::Result; use serde::{Deserialize, Serialize}; use std::time::Duration; use tracing::{error, info, warn}; @@ -27,11 +27,7 @@ const DEFAULT_MAX_RETRY_DELAY_MS: u64 = 10000; /// Spread over 10 minutes (600 seconds) with 6 retries const AUTONOMOUS_MAX_RETRY_DELAY_MS: u64 = 120000; // 2 minutes max per retry -/// Total time budget for autonomous mode retries (10 minutes) -const AUTONOMOUS_RETRY_BUDGET_MS: u64 = 600000; - -/// Jitter factor (0.0 to 1.0) to randomize retry delays (default) -const DEFAULT_JITTER_FACTOR: f64 = 0.3; +// Removed unused constants AUTONOMOUS_RETRY_BUDGET_MS and DEFAULT_JITTER_FACTOR /// Jitter factor for autonomous mode (higher for better distribution) const JITTER_FACTOR: f64 = 0.3;