feat(ui): add Restore default agents button to Settings modal
This commit is contained in:
@@ -161,6 +161,32 @@ public sealed partial class SettingsModalViewModel : ViewModelBase
|
|||||||
finally { IsBusy = false; }
|
finally { IsBusy = false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task RestoreDefaultAgents()
|
||||||
|
{
|
||||||
|
IsBusy = true;
|
||||||
|
StatusMessage = "";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _worker.RestoreDefaultAgentsAsync();
|
||||||
|
if (result is null)
|
||||||
|
StatusMessage = "Worker offline.";
|
||||||
|
else if (result.Copied == 0 && result.Skipped == 0)
|
||||||
|
StatusMessage = "No default agents bundled.";
|
||||||
|
else if (result.Copied == 0)
|
||||||
|
StatusMessage = "All default agents already present.";
|
||||||
|
else
|
||||||
|
StatusMessage = $"Restored {result.Copied} default agent(s).";
|
||||||
|
|
||||||
|
await _worker.RefreshAgentsAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
StatusMessage = $"Restore failed: {ex.Message}";
|
||||||
|
}
|
||||||
|
finally { IsBusy = false; }
|
||||||
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void OpenPath(string? path)
|
private void OpenPath(string? path)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -184,6 +184,23 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- AGENTS -->
|
||||||
|
<StackPanel Spacing="0">
|
||||||
|
<TextBlock Classes="section-label" Text="AGENTS"/>
|
||||||
|
<Border Classes="section">
|
||||||
|
<StackPanel Spacing="8">
|
||||||
|
<TextBlock Text="Restore bundled default agents (code-reviewer, test-writer, debugger, security-reviewer, explorer, researcher). Existing files are not overwritten."
|
||||||
|
FontSize="11"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
Foreground="{DynamicResource TextDimBrush}"/>
|
||||||
|
<Button Content="Restore default agents"
|
||||||
|
Command="{Binding RestoreDefaultAgentsCommand}"
|
||||||
|
IsEnabled="{Binding !IsBusy}"
|
||||||
|
HorizontalAlignment="Left"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<!-- ABOUT -->
|
<!-- ABOUT -->
|
||||||
<StackPanel Spacing="0">
|
<StackPanel Spacing="0">
|
||||||
<TextBlock Classes="section-label" Text="ABOUT"/>
|
<TextBlock Classes="section-label" Text="ABOUT"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user