codetether_agent/tui/app/state/
default_impl.rs1use std::collections::{HashMap, HashSet, VecDeque};
4use std::sync::Arc;
5
6use crate::tui::audit_view::AuditViewState;
7use crate::tui::bus_log::BusLogState;
8use crate::tui::help::HelpScrollState;
9use crate::tui::models::{InputMode, ViewMode};
10use crate::tui::ralph_view::RalphViewState;
11use crate::tui::swarm_view::SwarmViewState;
12use crate::tui::symbol_search::SymbolSearchState;
13
14impl Default for super::AppState {
15 fn default() -> Self {
16 Self {
17 view_mode: ViewMode::Chat,
18 input_mode: InputMode::Normal,
19 messages: vec![],
20 input: String::new(),
21 input_cursor: 0,
22 input_scroll: 0,
23 chat_scroll: 0,
24 chat_last_max_scroll: 0,
25 tool_preview_scroll: 0,
26 tool_preview_last_max_scroll: 0,
27 protocol_selected: 0,
28 protocol_scroll: 0,
29 status: "Ready — type a message and press Enter. Ctrl+C/Ctrl+Q quits.".to_string(),
30 processing: false,
31 session_id: None,
32 sessions: vec![],
33 selected_session: 0,
34 session_filter: String::new(),
35 cwd_display: String::new(),
36 bus_log: BusLogState::new(),
37 swarm: SwarmViewState::new(),
38 audit: AuditViewState::default(),
39 ralph: RalphViewState::new(),
40 symbol_search: SymbolSearchState::new(),
41 slash_suggestions: vec![],
42 selected_slash_suggestion: 0,
43 command_history: Vec::new(),
44 history_index: None,
45 worker_id: None,
46 worker_name: None,
47 a2a_connected: false,
48 recent_tasks: Vec::new(),
49 worker_bridge_registered_agents: HashSet::new(),
50 worker_bridge_processing_state: None,
51 worker_task_queue: VecDeque::new(),
52 help_scroll: HelpScrollState::default(),
53 show_help: false,
54 available_models: Vec::new(),
55 selected_model_index: 0,
56 model_picker_active: false,
57 model_filter: String::new(),
58 streaming_text: String::new(),
59 processing_started_at: None,
60 current_request_first_token_ms: None,
61 current_request_last_token_ms: None,
62 last_request_first_token_ms: None,
63 last_request_last_token_ms: None,
64 last_completion_model: None,
65 last_completion_latency_ms: None,
66 last_completion_prompt_tokens: None,
67 last_completion_output_tokens: None,
68 last_tool_name: None,
69 last_tool_latency_ms: None,
70 last_tool_success: None,
71 pending_images: Vec::new(),
72 current_turn_cancel: None,
73 auto_apply_edits: false,
74 allow_network: false,
75 slash_autocomplete: true,
76 use_worktree: true,
77 selected_settings_index: 0,
78 mcp_registry: Arc::new(crate::tui::app::mcp::TuiMcpRegistry::new()),
79 spawned_agents: HashMap::new(),
80 active_spawned_agent: None,
81 streaming_agent_texts: HashMap::new(),
82 cached_message_lines: Vec::new(),
83 cached_messages_len: 0,
84 cached_max_width: 0,
85 cached_streaming_snapshot: None,
86 cached_processing: false,
87 cached_frozen_len: 0,
88 watchdog_notification: None,
89 main_watchdog_root_prompt: None,
90 main_last_event_at: None,
91 main_watchdog_restart_count: 0,
92 main_inflight_prompt: None,
93 okr_repository: None,
94 pending_okr_approval: None,
95 pending_smart_switch_retry: None,
96 smart_switch_retry_count: 0,
97 smart_switch_attempted_models: Vec::new(),
98 chat_sync_rx: None,
99 chat_sync_status: None,
100 chat_sync_last_success: None,
101 chat_sync_last_error: None,
102 chat_sync_uploaded_bytes: 0,
103 chat_sync_uploaded_batches: 0,
104 autochat: super::super::autochat::state::AutochatState::default(),
105 file_picker_dir: std::path::PathBuf::new(),
106 file_picker_entries: Vec::new(),
107 file_picker_selected: 0,
108 file_picker_filter: String::new(),
109 file_picker_active: false,
110 workspace: crate::tui::models::WorkspaceSnapshot::default(),
111 chat_layout_mode: crate::tui::ui::webview::layout_mode::ChatLayoutMode::default(),
112 last_key_at: None,
113 }
114 }
115}