diff --git a/crates/agent_ui/src/acp/mode_selector.rs b/crates/agent_ui/src/acp/mode_selector.rs index aed151de728ce2e802154a73d4add9681a410933..83ab9c299976848b973af28192462fda4eb69409 100644 --- a/crates/agent_ui/src/acp/mode_selector.rs +++ b/crates/agent_ui/src/acp/mode_selector.rs @@ -56,6 +56,10 @@ impl ModeSelector { self.set_mode(all_modes[next_index].id.clone(), cx); } + pub fn mode(&self) -> acp::SessionModeId { + self.connection.current_mode() + } + pub fn set_mode(&mut self, mode: acp::SessionModeId, cx: &mut Context) { let task = self.connection.set_mode(mode, cx); self.setting_mode = true; diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs index 82237d86ba9f66b5d68321e03092660dea29d65d..312ca136a2bf6f8b134a0dae0ab01bb71497a3b2 100644 --- a/crates/agent_ui/src/acp/thread_view.rs +++ b/crates/agent_ui/src/acp/thread_view.rs @@ -1135,6 +1135,7 @@ impl AcpThreadView { self.is_loading_contents = true; let model_id = self.current_model_id(cx); + let mode_id = self.current_mode_id(cx); let guard = cx.new(|_| ()); cx.observe_release(&guard, |this, _guard, cx| { this.is_loading_contents = false; @@ -1169,7 +1170,8 @@ impl AcpThreadView { "Agent Message Sent", agent = agent_telemetry_id, session = session_id, - model = model_id + model = model_id, + mode = mode_id ); thread.send(contents, cx) @@ -1182,6 +1184,7 @@ impl AcpThreadView { agent = agent_telemetry_id, session = session_id, model = model_id, + mode = mode_id, status, turn_time_ms, ); @@ -5405,6 +5408,16 @@ impl AcpThreadView { ) } + fn current_mode_id(&self, cx: &App) -> Option> { + if let Some(thread) = self.as_native_thread(cx) { + Some(thread.read(cx).profile().0.clone()) + } else if let Some(mode_selector) = self.mode_selector() { + Some(mode_selector.read(cx).mode().0) + } else { + None + } + } + fn current_model_id(&self, cx: &App) -> Option { self.model_selector .as_ref()