agent: Add newtype for profile IDs (#27939)

This PR adds an `AgentProfileId` newtype for profile IDs that we can use
instead of `Arc<str>` everywhere.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-04-02 13:12:52 -04:00 committed by GitHub
parent b2904e5d9f
commit 646f65511c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 59 additions and 27 deletions

View file

@ -1,6 +1,6 @@
use std::sync::Arc;
use assistant_settings::{AgentProfile, AssistantSettings};
use assistant_settings::{AgentProfile, AgentProfileId, AssistantSettings};
use fs::Fs;
use gpui::{Action, Entity, FocusHandle, Subscription, WeakEntity, prelude::*};
use indexmap::IndexMap;
@ -15,7 +15,7 @@ use util::ResultExt as _;
use crate::{ManageProfiles, ThreadStore, ToggleProfileSelector};
pub struct ProfileSelector {
profiles: IndexMap<Arc<str>, AgentProfile>,
profiles: IndexMap<AgentProfileId, AgentProfile>,
fs: Arc<dyn Fs>,
thread_store: WeakEntity<ThreadStore>,
focus_handle: FocusHandle,
@ -133,7 +133,7 @@ impl Render for ProfileSelector {
.active_model()
.map_or(false, |model| model.supports_tools());
let icon = match profile_id.as_ref() {
let icon = match profile_id.as_str() {
"write" => IconName::Pencil,
"ask" => IconName::MessageBubbles,
_ => IconName::UserRoundPen,