agent_servers: Set proxy env for all ACP agents (#38247)

- Use ProxySettings::proxy_url to read from settings or env 
- Export HTTP(S)_PROXY and NO_PROXY for agent CLIs 
- Add read_no_proxy_from_env and move parsing from main

Closes https://github.com/zed-industries/claude-code-acp/issues/46

Release Notes:

- acp: Pass proxy settings through to all ACP agents
This commit is contained in:
Ben Brandt
2025-09-16 10:18:10 +00:00
committed by GitHub
parent f321d02207
commit c0710fa8ca
9 changed files with 62 additions and 35 deletions
+15 -1
View File
@@ -22,7 +22,7 @@ use futures::{
channel::oneshot, future::BoxFuture,
};
use gpui::{App, AsyncApp, Entity, Global, Task, WeakEntity, actions};
use http_client::{HttpClient, HttpClientWithUrl, http};
use http_client::{HttpClient, HttpClientWithUrl, http, read_proxy_from_env};
use parking_lot::RwLock;
use postage::watch;
use proxy::connect_proxy_stream;
@@ -132,6 +132,20 @@ pub struct ProxySettings {
pub proxy: Option<String>,
}
impl ProxySettings {
pub fn proxy_url(&self) -> Option<Url> {
self.proxy
.as_ref()
.and_then(|input| {
input
.parse::<Url>()
.inspect_err(|e| log::error!("Error parsing proxy settings: {}", e))
.ok()
})
.or_else(read_proxy_from_env)
}
}
impl Settings for ProxySettings {
type FileContent = ProxySettingsContent;