@@ -129,7 +129,7 @@ pub struct Model {
129129 pub textarea : TextArea ,
130130 pub response_events : Vec < ConversationEvent > ,
131131 pub inline_entries : Vec < InlineEntryState > ,
132- pub selected_agent_index : Option < usize > ,
132+ pub selected_agent_index : usize ,
133133 pub session_id : Option < String > ,
134134 pub error_message : Option < String > ,
135135 pub show_agent_router : bool ,
@@ -149,10 +149,10 @@ pub struct Model {
149149impl Default for Model {
150150 fn default ( ) -> Self {
151151 let agents = vec ! [
152- "Claude Code" . to_string( ) ,
153- "Codex ACP" . to_string( ) ,
154152 "Claude Code ACP" . to_string( ) ,
153+ "Codex ACP" . to_string( ) ,
155154 "Mock ACP Agent" . to_string( ) ,
155+ // "Claude Code".to_string(),
156156 ] ;
157157
158158 let backend_availability = vec ! [
@@ -213,7 +213,7 @@ impl Default for Model {
213213 textarea : create_textarea ( ) ,
214214 response_events : Vec :: new ( ) ,
215215 inline_entries : Vec :: new ( ) ,
216- selected_agent_index : None ,
216+ selected_agent_index : 0 ,
217217 session_id : None ,
218218 error_message : None ,
219219 show_agent_router : false ,
@@ -251,7 +251,7 @@ impl Model {
251251
252252 Message :: SelectItem => {
253253 // Select agent and close overlay
254- self . selected_agent_index = self . agent_selection_list . selected_index ( ) ;
254+ self . selected_agent_index = self . agent_selection_list . selected_index ( ) . unwrap_or ( 0 ) ;
255255 self . show_agent_router = false ;
256256 self . error_message = None ;
257257 self . clear_textarea ( ) ;
@@ -553,6 +553,16 @@ impl Model {
553553 entry. rewrap ( width) ;
554554 }
555555 }
556+
557+ pub fn get_backend ( & self ) -> Box < dyn AgentBackend + Send > {
558+ match self . selected_agent_index {
559+ 0 => Box :: new ( backends:: claude_code_acp:: ClaudeCodeAcpBackend :: new ( ) ) ,
560+ 1 => Box :: new ( backends:: codex_acp:: CodexAcpBackend :: new ( ) ) ,
561+ 2 => Box :: new ( backends:: mock:: MockBackend :: new ( ) ) ,
562+ // 3 => Box::new(ClaudeBackend::new()),
563+ _ => Box :: new ( backends:: claude_code_acp:: ClaudeCodeAcpBackend :: new ( ) ) ,
564+ }
565+ }
556566}
557567
558568fn create_textarea ( ) -> TextArea {
0 commit comments