@using AIStudio.Agents.AssistantAudit @inherits MSGComponentBase @if (this.plugin is null) { @T("The assistant plugin could not be resolved for auditing.") } else { @T("This security check uses a sample prompt preview. Empty or placeholder values in the preview are expected.") @this.plugin.Name @this.plugin.Description @T("Audit provider"): @this.ProviderLabel @T("Minimum required safety level"): @this.MinimumLevelLabel
@T("System Prompt")
@T("User Prompt Preview")
@{ var promptBuilder = this.plugin.HasCustomPromptBuilder; var sortDirection = promptBuilder ? SortDirection.Ascending : SortDirection.Descending; var badgeColor = promptBuilder ? Color.Success : Color.Error; var fallbackBadgeColor = !promptBuilder ? Color.Success : Color.Error; var fallbackText = promptBuilder ? T("Fallback Prompt") : T("User Prompt"); }
@T("Components")
@if (item.Value is AssistantAuditTreeItem treeItem) {
@treeItem.Text @if (!string.IsNullOrWhiteSpace(treeItem.Caption)) { if (treeItem.IsComponent) { @treeItem.Caption } else { @treeItem.Caption } }
}
@T("Plugin Structure")
@if (item.Value is AssistantAuditTreeItem treeItem) {
@treeItem.Text @if (!string.IsNullOrWhiteSpace(treeItem.Caption)) { @treeItem.Caption }
}
@T("Lua Manifest")
@foreach (var file in this.luaFiles) { var fileInfo = new FileInfo(Path.Combine(this.plugin.PluginPath, file.Key));
@file.Key @T("Size"): @this.FormatFileSize(fileInfo.Length) @T("Created"): @this.FormatFileTimestamp(fileInfo.CreationTime) @T("Last accessed"): @this.FormatFileTimestamp(fileInfo.LastAccessTime) @T("Last modified"): @this.FormatFileTimestamp(fileInfo.LastWriteTime) @file.Key
}
@if (this.audit is not null) { @T("Audit Result") @if (this.audit.Findings.Count == 0 && this.audit.Level is not AssistantAuditLevel.UNKNOWN) { @T("Safe"): @T("No security issues were found during this check.") } else { @this.audit.Level.GetName(): @this.audit.Summary @if (this.IsActivationBlockedBySettings) { @T("This plugin cannot be activated because its audit result is below the required safety level and your settings block activation in this case.") } else if (this.RequiresActivationConfirmation) { @T("This plugin is below the required safety level. Your settings still allow activation, but enabling it requires an extra confirmation because it may be unsafe.") } @T("Findings") @foreach (var finding in this.audit.Findings) { var severityUi = finding.Severity switch { AssistantAuditLevel.UNKNOWN => ( AlertStyling: "color: rgb(12,128,223); background-color: rgba(33,150,243,0.06);", AlertIcon: Icons.Material.Filled.QuestionMark, ChipColor: Color.Info ), AssistantAuditLevel.DANGEROUS => ( AlertStyling: "color: rgb(242,28,13); background-color: rgba(244,67,54,0.06);", AlertIcon: Icons.Material.Filled.Dangerous, ChipColor: Color.Error ), AssistantAuditLevel.CAUTION => ( AlertStyling: "color: rgb(214,129,0); background-color: rgba(255,152,0,0.06);", AlertIcon: Icons.Material.Filled.Warning, ChipColor: Color.Warning ), AssistantAuditLevel.SAFE => ( AlertStyling: "color: rgb(0,163,68); background-color: rgba(0,200,83,0.06);", AlertIcon: Icons.Material.Filled.Verified, ChipColor: Color.Success ), _ => ( AlertStyling: "color: rgb(12,128,223); background-color: rgba(33,150,243,0.06);", AlertIcon: Icons.Material.Filled.QuestionMark, ChipColor: Color.Info ) }; @finding.Category @finding.Severity.GetName() @finding.Location @finding.Description } } }
} @if (this.isAuditing) { }
@(this.audit is null ? T("Cancel") : T("Close")) @T("Start Security Check") @if (this.CanEnablePlugin) { @T("Enable Assistant Plugin") }