From ccee5124a78dbdd365826a981ab656e35c3cdfc3 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Tue, 2 Sep 2025 12:49:31 -0700 Subject: [PATCH] Intercept /login and /logout commands for now --- crates/agent_ui/src/acp/thread_view.rs | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs index a9421723d125d27f3eb13c43fb17936f9078dae8..cd15c9599982d6eff01385bd4cdc9948adf9c3c3 100644 --- a/crates/agent_ui/src/acp/thread_view.rs +++ b/crates/agent_ui/src/acp/thread_view.rs @@ -907,6 +907,39 @@ impl AcpThreadView { return; } + let text = self.message_editor.read(cx).text(cx); + if text == "/login" || text == "/logout" { + let ThreadState::Ready { thread, .. } = &self.thread_state else { + return; + }; + + let connection = thread.read(cx).connection().clone(); + if !connection + .auth_methods() + .iter() + .any(|method| method.id.0.as_ref() == "claude-login") + { + return; + }; + let this = cx.weak_entity(); + let agent = self.agent.clone(); + window.defer(cx, |window, cx| { + Self::handle_auth_required( + this, + AuthRequired { + description: None, + provider_id: Some(language_model::ANTHROPIC_PROVIDER_ID), + }, + agent, + connection, + window, + cx, + ); + }); + cx.notify(); + return; + } + let contents = self .message_editor .update(cx, |message_editor, cx| message_editor.contents(cx));