using System.Linq.Expressions; namespace AIStudio.Settings.DataModel; public sealed class DataTools(Expression>? configSelection = null) { public DataTools() : this(null) { } /// /// The settings the user entered per tool: tool ID, then field name. /// public Dictionary> Settings { get; set; } = []; public Dictionary> DefaultToolIdsByComponent { get; set; } = []; public HashSet VisibleToolSelectionComponents { get; set; } = []; public bool EnableTools { get; set; } = ManagedConfiguration.Register( configSelection, x => x.EnableTools, true); public HashSet DisabledToolIds { get; set; } = ManagedConfiguration.Register( configSelection, x => x.DisabledToolIds, []); public Dictionary MinimumProviderConfidenceByToolId { get; set; } = ManagedConfiguration.Register( configSelection, x => x.MinimumProviderConfidenceByToolId, new Dictionary(StringComparer.Ordinal)); /// /// Tool settings an organization fixed, which the user cannot change. Keys are /// "toolId.fieldName". /// /// /// Keyed by tool and field rather than held in a property per setting, because a property per /// setting only works for the tools AI Studio ships. Tools defined by plugin authors are not /// known at compile time, yet an organization has to be able to configure them the same way. ///

/// A secret field travels here too, but only encrypted with the enterprise secret, in the /// same "ENC:v1:" form the providers use for their API keys. What is stored is therefore /// ciphertext, worthless without a secret that lives outside every deployed file. A plaintext /// secret is refused rather than used, and a secret is never accepted as a pre-filled default /// — see the tool settings service for both rules. ///
public Dictionary LockedToolSettings { get; set; } = ManagedConfiguration.Register( configSelection, x => x.LockedToolSettings, new Dictionary(StringComparer.Ordinal)); /// /// Tool settings an organization pre-filled but left changeable. Keys are "toolId.fieldName". /// /// /// Applies until the user saves a value of their own, which then wins. That is the difference /// to the locked settings above, and the reason both exist: an organization can fix the search /// instance while leaving the timeouts to the user. /// public Dictionary DefaultToolSettings { get; set; } = ManagedConfiguration.Register( configSelection, x => x.DefaultToolSettings, new Dictionary(StringComparer.Ordinal)); }