From d8276cd6614c4ccbd9e51dae4f1e670c4a98d17d Mon Sep 17 00:00:00 2001 From: Anthony Date: Fri, 22 Aug 2025 01:39:00 -0400 Subject: [PATCH 1/2] WIP dismiss agent panel onboarding panel when typing --- crates/agent_ui/src/agent_panel.rs | 12 ++++++++++++ crates/agent_ui/src/message_editor.rs | 3 +++ 2 files changed, 15 insertions(+) diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs index d2ff6aa4f3..3f7941dae2 100644 --- a/crates/agent_ui/src/agent_panel.rs +++ b/crates/agent_ui/src/agent_panel.rs @@ -300,6 +300,7 @@ impl ActiveView { MessageEditorEvent::Changed | MessageEditorEvent::EstimatedTokenCount => { cx.notify(); } + MessageEditorEvent::DismissOnboarding => {} MessageEditorEvent::ScrollThreadToBottom => match &this.active_view { ActiveView::Thread { thread, .. } => { thread.update(cx, |thread, cx| { @@ -670,6 +671,17 @@ impl AgentPanel { ) }); + cx.subscribe(&message_editor, |_, _, event, cx| match event { + // todo!: I don't like how this is writing to the db everything time the user types + //this also doens't work for text threads and newly openned threads?? + MessageEditorEvent::DismissOnboarding => { + OnboardingUpsell::set_dismissed(true, cx); + cx.notify(); + } + _ => {} + }) + .detach(); + let acp_history_store = cx.new(|cx| agent2::HistoryStore::new(context_store.clone(), cx)); let acp_history = cx.new(|cx| AcpThreadHistory::new(acp_history_store.clone(), window, cx)); cx.subscribe_in( diff --git a/crates/agent_ui/src/message_editor.rs b/crates/agent_ui/src/message_editor.rs index bed10e90a7..db8d158c15 100644 --- a/crates/agent_ui/src/message_editor.rs +++ b/crates/agent_ui/src/message_editor.rs @@ -217,6 +217,7 @@ impl MessageEditor { cx.subscribe_in(&context_strip, window, Self::handle_context_strip_event), cx.subscribe(&editor, |this, _, event: &EditorEvent, cx| { if event == &EditorEvent::BufferEdited { + cx.emit(MessageEditorEvent::DismissOnboarding); this.handle_message_changed(cx) } }), @@ -1416,6 +1417,7 @@ impl MessageEditor { } fn message_or_context_changed(&mut self, debounce: bool, cx: &mut Context) { + // todo! Might want to use this instead of dismiss onboarding event cx.emit(MessageEditorEvent::Changed); self.update_token_count_task.take(); @@ -1639,6 +1641,7 @@ pub enum MessageEditorEvent { EstimatedTokenCount, Changed, ScrollThreadToBottom, + DismissOnboarding, } impl Focusable for MessageEditor { From a4a1be576c2a777526cea22abb889e81cf106228 Mon Sep 17 00:00:00 2001 From: Anthony Date: Mon, 25 Aug 2025 21:29:22 -0400 Subject: [PATCH 2/2] Dismiss Agent Onboarding banner when creating a new thread/text thread --- crates/agent_ui/src/agent_panel.rs | 52 ++++++++++++++---------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs index 3f7941dae2..dd19dcb44c 100644 --- a/crates/agent_ui/src/agent_panel.rs +++ b/crates/agent_ui/src/agent_panel.rs @@ -300,7 +300,10 @@ impl ActiveView { MessageEditorEvent::Changed | MessageEditorEvent::EstimatedTokenCount => { cx.notify(); } - MessageEditorEvent::DismissOnboarding => {} + MessageEditorEvent::DismissOnboarding => { + OnboardingUpsell::set_dismissed(true, cx); + cx.notify(); + } MessageEditorEvent::ScrollThreadToBottom => match &this.active_view { ActiveView::Thread { thread, .. } => { thread.update(cx, |thread, cx| { @@ -656,32 +659,6 @@ impl AgentPanel { ) }); - let message_editor = cx.new(|cx| { - MessageEditor::new( - fs.clone(), - workspace.clone(), - message_editor_context_store.clone(), - prompt_store.clone(), - thread_store.downgrade(), - context_store.downgrade(), - Some(history_store.downgrade()), - thread.clone(), - window, - cx, - ) - }); - - cx.subscribe(&message_editor, |_, _, event, cx| match event { - // todo!: I don't like how this is writing to the db everything time the user types - //this also doens't work for text threads and newly openned threads?? - MessageEditorEvent::DismissOnboarding => { - OnboardingUpsell::set_dismissed(true, cx); - cx.notify(); - } - _ => {} - }) - .detach(); - let acp_history_store = cx.new(|cx| agent2::HistoryStore::new(context_store.clone(), cx)); let acp_history = cx.new(|cx| AcpThreadHistory::new(acp_history_store.clone(), window, cx)); cx.subscribe_in( @@ -722,7 +699,24 @@ impl AgentPanel { let panel_type = AgentSettings::get_global(cx).default_view; let active_view = match panel_type { - DefaultView::Thread => ActiveView::thread(active_thread, message_editor, window, cx), + DefaultView::Thread => { + let message_editor = cx.new(|cx| { + MessageEditor::new( + fs.clone(), + workspace.clone(), + message_editor_context_store.clone(), + prompt_store.clone(), + thread_store.downgrade(), + context_store.downgrade(), + Some(history_store.downgrade()), + thread.clone(), + window, + cx, + ) + }); + + ActiveView::thread(active_thread, message_editor, window, cx) + } DefaultView::TextThread => { let context = context_store.update(cx, |context_store, cx| context_store.create(cx)); @@ -1869,6 +1863,8 @@ impl AgentPanel { window: &mut Window, cx: &mut Context, ) { + OnboardingUpsell::set_dismissed(true, cx); + match agent { AgentType::Zed => { window.dispatch_action(