mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-03-29 13:51:37 +00:00
WIP: added managed settings for an audit agent
This commit is contained in:
parent
7380250b68
commit
50537907e5
@ -0,0 +1,15 @@
|
|||||||
|
@using AIStudio.Settings
|
||||||
|
@inherits SettingsPanelBase
|
||||||
|
|
||||||
|
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Policy" HeaderText="@T("Agent: Assistant Plugin Audit")">
|
||||||
|
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
||||||
|
<MudText Typo="Typo.body1" Class="mb-3">
|
||||||
|
@T("This Agent audits newly installed or updated external Plugin-Assistant for security risks before they are activated. It shows the simulated prompt preview, reviews the Lua manifest with an LLM, and stores the latest audit card until the plugin manifest changes.")
|
||||||
|
</MudText>
|
||||||
|
<ConfigurationOption OptionDescription="@T("Require a security audit before activating external Assistants?")" LabelOn="@T("External Assistants must be audited before activation")" LabelOff="@T("External Assistant can be activated without an audit")" State="@(() => this.SettingsManager.ConfigurationData.AssistantPluginAudit.RequireAuditBeforeActivation)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AssistantPluginAudit.RequireAuditBeforeActivation = updatedState)" />
|
||||||
|
<ConfigurationProviderSelection Data="@this.AvailableLLMProvidersFunc()" SelectedValue="@(() => this.SettingsManager.ConfigurationData.AssistantPluginAudit.PreselectedAgentProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.AssistantPluginAudit.PreselectedAgentProvider = selectedValue)" HelpText="@(() => T("Optionally choose a dedicated provider for assistant plugin audits. When left empty, AI Studio falls back to the app-wide default provider."))" />
|
||||||
|
<ConfigurationSelect OptionDescription="@T("Minimum required audit level")" SelectedValue="@(() => this.SettingsManager.ConfigurationData.AssistantPluginAudit.MinimumLevel)" Data="@ConfigurationSelectDataFactory.GetAssistantAuditLevelsData()" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.AssistantPluginAudit.MinimumLevel = selectedValue)" OptionHelp="@T("External Assistants below this audit level are treated as insufficiently reviewed.")" />
|
||||||
|
<ConfigurationOption OptionDescription="@T("Block activation below the minimum Audit-Level?")" LabelOn="@T("Activation is blocked below the minimum Audit-Level")" LabelOff="@T("Users may still activate plugins below the minimum Audit-Level")" State="@(() => this.SettingsManager.ConfigurationData.AssistantPluginAudit.BlockActivationBelowMinimum)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AssistantPluginAudit.BlockActivationBelowMinimum = updatedState)" />
|
||||||
|
<ConfigurationOption OptionDescription="@T("Automatically audit new or updated plugins in the background?")" LabelOn="@T("Security audit is automatically done in the background")" LabelOff="@T("Security audit is done manually by the user")" State="@(() => this.SettingsManager.ConfigurationData.AssistantPluginAudit.AutomaticallyAuditAssistants)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AssistantPluginAudit.AutomaticallyAuditAssistants = updatedState)" />
|
||||||
|
</MudPaper>
|
||||||
|
</ExpansionPanel>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
namespace AIStudio.Components.Settings;
|
||||||
|
|
||||||
|
public partial class SettingsPanelAgentAssistantAudit : SettingsPanelBase;
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
using System.Linq.Expressions;
|
||||||
|
using AIStudio.Agents.AssistantAudit;
|
||||||
|
|
||||||
|
namespace AIStudio.Settings.DataModel;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Settings for auditing assistant plugins before activation.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class DataAssistantPluginAudit(Expression<Func<Data, DataAssistantPluginAudit>>? configSelection = null)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The default constructor for the JSON deserializer.
|
||||||
|
/// </summary>
|
||||||
|
public DataAssistantPluginAudit() : this(null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Should assistant plugins be audited before they can be activated?
|
||||||
|
/// </summary>
|
||||||
|
public bool RequireAuditBeforeActivation { get; set; } = ManagedConfiguration.Register(configSelection, n => n.RequireAuditBeforeActivation, true);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Which provider should be used for the assistant plugin audit?
|
||||||
|
/// When empty, the app-wide default provider is used.
|
||||||
|
/// </summary>
|
||||||
|
public string PreselectedAgentProvider { get; set; } = ManagedConfiguration.Register(configSelection, n => n.PreselectedAgentProvider, string.Empty);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The minimum audit level assistant plugins should meet.
|
||||||
|
/// </summary>
|
||||||
|
public AssistantAuditLevel MinimumLevel { get; set; } = ManagedConfiguration.Register(configSelection, n => n.MinimumLevel, AssistantAuditLevel.CAUTION);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Should activation be blocked when the audit result is below the minimum level?
|
||||||
|
/// </summary>
|
||||||
|
public bool BlockActivationBelowMinimum { get; set; } = ManagedConfiguration.Register(configSelection, n => n.BlockActivationBelowMinimum, true);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If true, the security audit will be hidden from the user and done in the background
|
||||||
|
/// </summary>
|
||||||
|
public bool AutomaticallyAuditAssistants { get; set; } = ManagedConfiguration.Register(configSelection, n => n.AutomaticallyAuditAssistants, false);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user