acp: Add agent license if available from the registry (#64178)

The JetBrains team started added links to the relevant license terms for
each agent. Seems worth linking out to if we have it.

Release Notes:

- N/A
This commit is contained in:
Ben Brandt authored and GitHub committed 2026-09-14 14:04:21 +00:00
1 parent 0738b5d46d
commit 1e6e1a93d8
4 files changed
+33 -1

No files matched your search

+1
View File
@@ -361,6 +361,7 @@ mod tests {
version: SharedString::from("1.0.0"),
repository: None,
website: None,
license_url: None,
icon_path: None,
},
package: id,
+23 -1
View File
@@ -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)),
),
)
}
@@ -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,
}
+1
View File
@@ -1765,6 +1765,7 @@ mod tests {
version: SharedString::from(version.to_string()),
repository: None,
website: None,
license_url: None,
icon_path: None,
},
package: id,