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

@ -3,7 +3,7 @@ use std::path::PathBuf;
use std::sync::Arc;
use anyhow::{Result, anyhow};
use assistant_settings::{AgentProfile, AssistantSettings};
use assistant_settings::{AgentProfile, AgentProfileId, AssistantSettings};
use assistant_tool::{ToolId, ToolSource, ToolWorkingSet};
use chrono::{DateTime, Utc};
use collections::HashMap;
@ -202,7 +202,7 @@ impl ThreadStore {
self.load_profile_by_id(&assistant_settings.default_profile, cx);
}
pub fn load_profile_by_id(&self, profile_id: &Arc<str>, cx: &Context<Self>) {
pub fn load_profile_by_id(&self, profile_id: &AgentProfileId, cx: &Context<Self>) {
let assistant_settings = AssistantSettings::get_global(cx);
if let Some(profile) = assistant_settings.profiles.get(profile_id) {