Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
acp: Add agent license if available from the registry (#64178)
Ben Brandt7cda6f0523f0
diff --git a/crates/agent_servers/src/custom.rs b/crates/agent_servers/src/custom.rsindex c79ebdc45c0..9d682fdcbc9 100644--- a/crates/agent_servers/src/custom.rs+++ b/crates/agent_servers/src/custom.rs@@ -361,6 +361,7 @@ mod tests {version: SharedString::from("1.0.0"),repository: None,website: None,+ license_url: None,icon_path: None,},package: id,diff --git a/crates/agent_ui/src/agent_registry_ui.rs b/crates/agent_ui/src/agent_registry_ui.rsindex 72fb3463919..5cdf6c7e37d 100644--- a/crates/agent_ui/src/agent_registry_ui.rs+++ b/crates/agent_ui/src/agent_registry_ui.rs@@ -444,6 +444,27 @@ impl AgentRegistryPage {})});+ let license_button = agent.license_url().map(|license_url| {+ let license_url = license_url.clone();+ let license_url_for_click = license_url.clone();+ IconButton::new(+ SharedString::from(format!("agent-license-{}", agent.id())),+ IconName::FileTextOutlined,+ )+ .icon_size(IconSize::Small)+ .tooltip(move |_, cx| {+ Tooltip::with_meta(+ "View Agent License or Terms of Service",+ None,+ license_url.clone(),+ cx,+ )+ })+ .on_click(move |_, _, cx| {+ cx.open_url(&license_url_for_click);+ })+ });+AgentRegistryCard::new().child(h_flex()@@ -483,7 +504,8 @@ impl AgentRegistryPage {.truncate(),).when_some(repository_button, |this, button| this.child(button))- .when_some(website_button, |this, button| this.child(button)),+ .when_some(website_button, |this, button| this.child(button))+ .when_some(license_button, |this, button| this.child(button)),),)}diff --git a/crates/project/src/agent_registry_store.rs b/crates/project/src/agent_registry_store.rsindex 67550e8108b..7ab885daba1 100644--- a/crates/project/src/agent_registry_store.rs+++ b/crates/project/src/agent_registry_store.rs@@ -32,6 +32,7 @@ pub struct RegistryAgentMetadata {pub version: SharedString,pub repository: Option<SharedString>,pub website: Option<SharedString>,+ pub license_url: Option<SharedString>,pub icon_path: Option<SharedString>,}@@ -88,6 +89,10 @@ impl RegistryAgent {self.metadata().website.as_ref()}+ pub fn license_url(&self) -> Option<&SharedString> {+ self.metadata().license_url.as_ref()+ }+pub fn icon_path(&self) -> Option<&SharedString> {self.metadata().icon_path.as_ref()}@@ -396,6 +401,7 @@ async fn build_registry_agents(version: entry.version.into(),repository: entry.repository.map(Into::into),website: entry.website.map(Into::into),+ license_url: entry.license_url.map(Into::into),icon_path,};@@ -643,6 +649,8 @@ struct RegistryEntry {#[serde(default)]website: Option<String>,#[serde(default)]+ license_url: Option<String>,+ #[serde(default)]icon: Option<String>,distribution: RegistryDistribution,}diff --git a/crates/project/src/agent_server_store.rs b/crates/project/src/agent_server_store.rsindex 6756319e109..8b10f8bb54a 100644--- a/crates/project/src/agent_server_store.rs+++ b/crates/project/src/agent_server_store.rs@@ -1765,6 +1765,7 @@ mod tests {version: SharedString::from(version.to_string()),repository: None,website: None,+ license_url: None,icon_path: None,},package: id,