use std::collections::{HashMap, HashSet, VecDeque};
use std::sync::Arc;
use crate::tui::bus_log::BusLogState;
use crate::tui::help::HelpScrollState;
use crate::tui::models::{InputMode, ViewMode};
use crate::tui::ralph_view::RalphViewState;
use crate::tui::swarm_view::SwarmViewState;
use crate::tui::symbol_search::SymbolSearchState;
impl Default for super::AppState {
fn default() -> Self {
Self {
view_mode: ViewMode::Chat,
input_mode: InputMode::Normal,
messages: vec![],
input: String::new(),
input_cursor: 0,
input_scroll: 0,
chat_scroll: 0,
chat_last_max_scroll: 0,
tool_preview_scroll: 0,
tool_preview_last_max_scroll: 0,
status: "Ready — type a message and press Enter. Ctrl+C/Ctrl+Q quits.".to_string(),
processing: false,
session_id: None,
sessions: vec![],
selected_session: 0,
session_filter: String::new(),
cwd_display: String::new(),
bus_log: BusLogState::new(),
swarm: SwarmViewState::new(),
ralph: RalphViewState::new(),
symbol_search: SymbolSearchState::new(),
slash_suggestions: vec![],
selected_slash_suggestion: 0,
command_history: Vec::new(),
history_index: None,
worker_id: None,
worker_name: None,
a2a_connected: false,
recent_tasks: Vec::new(),
worker_bridge_registered_agents: HashSet::new(),
worker_bridge_processing_state: None,
worker_task_queue: VecDeque::new(),
help_scroll: HelpScrollState::default(),
show_help: false,
available_models: Vec::new(),
selected_model_index: 0,
model_picker_active: false,
model_filter: String::new(),
streaming_text: String::new(),
processing_started_at: None,
current_request_first_token_ms: None,
current_request_last_token_ms: None,
last_request_first_token_ms: None,
last_request_last_token_ms: None,
last_completion_model: None,
last_completion_latency_ms: None,
last_completion_prompt_tokens: None,
last_completion_output_tokens: None,
last_tool_name: None,
last_tool_latency_ms: None,
last_tool_success: None,
pending_images: Vec::new(),
queued_steering: Vec::new(),
current_turn_cancel: None,
auto_apply_edits: false,
allow_network: false,
slash_autocomplete: true,
use_worktree: true,
selected_settings_index: 0,
mcp_registry: Arc::new(crate::tui::app::mcp::TuiMcpRegistry::new()),
spawned_agents: HashMap::new(),
active_spawned_agent: None,
streaming_agent_texts: HashMap::new(),
cached_message_lines: Vec::new(),
cached_messages_len: 0,
cached_max_width: 0,
cached_streaming_snapshot: None,
cached_processing: false,
cached_frozen_len: 0,
watchdog_notification: None,
main_watchdog_root_prompt: None,
main_last_event_at: None,
main_watchdog_restart_count: 0,
main_inflight_prompt: None,
okr_repository: None,
pending_okr_approval: None,
pending_smart_switch_retry: None,
smart_switch_retry_count: 0,
smart_switch_attempted_models: Vec::new(),
chat_sync_rx: None,
chat_sync_status: None,
chat_sync_last_success: None,
chat_sync_last_error: None,
chat_sync_uploaded_bytes: 0,
chat_sync_uploaded_batches: 0,
autochat: super::super::autochat::state::AutochatState::default(),
file_picker_dir: std::path::PathBuf::new(),
file_picker_entries: Vec::new(),
file_picker_selected: 0,
file_picker_filter: String::new(),
file_picker_active: false,
workspace: crate::tui::models::WorkspaceSnapshot::default(),
chat_layout_mode: crate::tui::ui::webview::layout_mode::ChatLayoutMode::default(),
last_key_at: None,
}
}
}