MCPcopy Create free account
hub / github.com/GCWing/BitFun / apply_agent_selection

Method apply_agent_selection

src/apps/cli/src/modes/chat.rs:2225–2246  ·  view source on GitHub ↗

Apply agent selection: switch agent type

(&mut self, selected: &AgentItem, chat_state: &mut ChatState)

Source from the content-addressed store, hash-verified

2223
2224 /// Apply agent selection: switch agent type
2225 fn apply_agent_selection(&mut self, selected: &AgentItem, chat_state: &mut ChatState) {
2226 if selected.id == self.agent_type {
2227 return;
2228 }
2229 self.agent_type = selected.id.clone();
2230 chat_state.agent_type = selected.id.clone();
2231 tracing::info!("Switched to agent: {}", selected.id);
2232
2233 if selected.id == "HarmonyOSDev" {
2234 let deveco_home = std::env::var("DEVECO_HOME").ok();
2235 let missing = deveco_home
2236 .as_deref()
2237 .map(|s| s.trim().is_empty())
2238 .unwrap_or(true);
2239 if missing {
2240 chat_state.add_system_message(
2241 "HarmonyOSDev tip: HmosCompilation requires DEVECO_HOME (DevEco Studio install path). If compilation fails, set DEVECO_HOME and restart the terminal."
2242 .to_string(),
2243 );
2244 }
2245 }
2246 }
2247
2248 // ============ MCP management ============
2249

Callers 1

handle_key_eventMethod · 0.45

Calls 5

trimMethod · 0.80
add_system_messageMethod · 0.80
cloneMethod · 0.45
okMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected