(&mut self)
| 2640 | } |
| 2641 | |
| 2642 | fn refresh_status_dialog(&mut self) { |
| 2643 | let formatters = self |
| 2644 | .context |
| 2645 | .get_api_client() |
| 2646 | .and_then(|client| client.get_formatters().ok()) |
| 2647 | .unwrap_or_default(); |
| 2648 | let route_label = match self.context.current_route() { |
| 2649 | Route::Home => "home".to_string(), |
| 2650 | Route::Session { session_id } => format!("session ({})", session_id), |
| 2651 | Route::Settings => "settings".to_string(), |
| 2652 | Route::Help => "help".to_string(), |
| 2653 | }; |
| 2654 | let session_ctx = self.context.session.read(); |
| 2655 | let mcp_servers = self.context.mcp_servers.read(); |
| 2656 | let lsp_status = self.context.lsp_status.read(); |
| 2657 | let connected_mcp = mcp_servers |
| 2658 | .iter() |
| 2659 | .filter(|s| matches!(s.status, McpConnectionStatus::Connected)) |
| 2660 | .count(); |
| 2661 | let mut lines = vec![ |
| 2662 | StatusLine::title("Runtime"), |
| 2663 | StatusLine::normal(format!("Route: {}", route_label)), |
| 2664 | StatusLine::normal(format!( |
| 2665 | "Directory: {}", |
| 2666 | self.context.directory.read().as_str() |
| 2667 | )), |
| 2668 | StatusLine::normal(format!( |
| 2669 | "Agent: {}", |
| 2670 | self.context.current_agent.read().as_str() |
| 2671 | )), |
| 2672 | StatusLine::normal(format!("Model: {}", self.current_model_label())), |
| 2673 | StatusLine::normal(format!( |
| 2674 | "Theme: {}", |
| 2675 | format_theme_option_label(&self.context.current_theme_name()) |
| 2676 | )), |
| 2677 | StatusLine::normal(format!("Loaded sessions: {}", session_ctx.sessions.len())), |
| 2678 | StatusLine::muted(""), |
| 2679 | StatusLine::title(format!( |
| 2680 | "MCP Servers ({}, connected: {})", |
| 2681 | mcp_servers.len(), |
| 2682 | connected_mcp |
| 2683 | )), |
| 2684 | ]; |
| 2685 | if mcp_servers.is_empty() { |
| 2686 | lines.push(StatusLine::muted("- No MCP servers")); |
| 2687 | } else { |
| 2688 | for server in mcp_servers.iter() { |
| 2689 | let status_text = match server.status { |
| 2690 | McpConnectionStatus::Connected => "connected", |
| 2691 | McpConnectionStatus::Disconnected => "disconnected", |
| 2692 | McpConnectionStatus::Failed => "failed", |
| 2693 | McpConnectionStatus::NeedsAuth => "needs authentication", |
| 2694 | McpConnectionStatus::NeedsClientRegistration => "needs client ID", |
| 2695 | McpConnectionStatus::Disabled => "disabled", |
| 2696 | }; |
| 2697 | let base = format!("- {}: {}", server.name, status_text); |
| 2698 | match server.status { |
| 2699 | McpConnectionStatus::Connected => lines.push(StatusLine::success(base)), |
no test coverage detected