Add support for Claude Code auth (#37103)

Co-authored-by: Antonio Scandurra <me@as-cii.com>

Closes #ISSUE

Release Notes:

- N/A

Co-authored-by: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Conrad Irwin
2025-08-28 12:59:31 -06:00
committed by GitHub
co-authored by Antonio Scandurra
parent 909d7215c0
commit 69933d5b81
3 changed files with 136 additions and 6 deletions
+14 -1
View File
@@ -2,6 +2,7 @@ use crate::{AgentServerCommand, AgentServerSettings};
use acp_thread::AgentConnection;
use anyhow::Result;
use gpui::{App, Entity, SharedString, Task};
use language_models::provider::anthropic::AnthropicLanguageModelProvider;
use project::Project;
use std::{path::Path, rc::Rc};
use ui::IconName;
@@ -49,10 +50,22 @@ impl crate::AgentServer for CustomAgentServer {
cx: &mut App,
) -> Task<Result<Rc<dyn AgentConnection>>> {
let server_name = self.name();
let command = self.command.clone();
let mut command = self.command.clone();
let root_dir = root_dir.to_path_buf();
// TODO: Remove this once we have Claude properly
cx.spawn(async move |mut cx| {
if let Some(api_key) = cx
.update(AnthropicLanguageModelProvider::api_key)?
.await
.ok()
{
command
.env
.get_or_insert_default()
.insert("ANTHROPIC_API_KEY".to_owned(), api_key.key);
}
crate::acp::connect(server_name, command, &root_dir, &mut cx).await
})
}