feat: внедрение RazorConsole TUI с runtime-управлением MCP-инструментами
- Добавлен RazorConsole.Core для интерактивного TUI-дашборда - ToolRegistryService: живое включение/отключение модулей и отдельных методов - InMemoryLogSink: кольцевой буфер логов с фильтрацией по модулю - TUI: 3 таба (Overview, Logs, Settings) - IToolModule: generic-интерфейс для легкого добавления новых MCP-модулей - Guard-проверка TryCheckEnabled() во всех существующих инструментах
This commit is contained in:
42
LazyBear.MCP/TUI/Components/SettingsTab.razor
Normal file
42
LazyBear.MCP/TUI/Components/SettingsTab.razor
Normal file
@@ -0,0 +1,42 @@
|
||||
@using LazyBear.MCP.Services.ToolRegistry
|
||||
@inject ToolRegistryService Registry
|
||||
|
||||
<Rows>
|
||||
<Markup Content=" " />
|
||||
<Markup Content="[bold]Tool Registry — runtime enable/disable[/]" />
|
||||
<Markup Content="[grey]Changes take effect immediately without restart[/]" />
|
||||
<Markup Content=" " />
|
||||
|
||||
@{
|
||||
int focusIdx = 20;
|
||||
}
|
||||
|
||||
@foreach (var module in Registry.GetModules())
|
||||
{
|
||||
var moduleEnabled = Registry.IsModuleEnabled(module.ModuleName);
|
||||
var moduleColor = moduleEnabled ? Spectre.Console.Color.Green : Spectre.Console.Color.Red;
|
||||
var moduleName = module.ModuleName;
|
||||
var capturedFocus = focusIdx++;
|
||||
|
||||
<Panel Title="@module.ModuleName" BorderColor="@moduleColor" Expand="true">
|
||||
<Rows>
|
||||
<Columns>
|
||||
<TextButton Content="@(moduleEnabled ? "[green]■ MODULE ENABLED[/]" : "[red]□ MODULE DISABLED[/]")"
|
||||
OnClick="@(() => Registry.ToggleModule(moduleName))"
|
||||
BackgroundColor="@(moduleEnabled ? Spectre.Console.Color.DarkGreen : Spectre.Console.Color.DarkRed)"
|
||||
FocusedColor="@Spectre.Console.Color.Yellow"
|
||||
FocusOrder="@capturedFocus" />
|
||||
<Markup Content="@($" {module.Description}")" Foreground="@Spectre.Console.Color.Grey" />
|
||||
</Columns>
|
||||
<Markup Content=" " />
|
||||
<ToolButtonList Module="@module" StartFocusIdx="@focusIdx" />
|
||||
</Rows>
|
||||
</Panel>
|
||||
|
||||
focusIdx += module.ToolNames.Count;
|
||||
<Markup Content=" " />
|
||||
}
|
||||
</Rows>
|
||||
|
||||
@code {
|
||||
}
|
||||
Reference in New Issue
Block a user