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:
21
LazyBear.MCP/TUI/Components/ToolButtonList.razor
Normal file
21
LazyBear.MCP/TUI/Components/ToolButtonList.razor
Normal file
@@ -0,0 +1,21 @@
|
||||
@using LazyBear.MCP.Services.ToolRegistry
|
||||
@inject ToolRegistryService Registry
|
||||
|
||||
@foreach (var (tool, idx) in Module.ToolNames.Select((t, i) => (t, i)))
|
||||
{
|
||||
var toolEnabled = Registry.IsToolEnabled(Module.ModuleName, tool);
|
||||
var toolName = tool;
|
||||
var moduleName = Module.ModuleName;
|
||||
var fo = StartFocusIdx + idx;
|
||||
|
||||
<TextButton Content="@(toolEnabled ? $"[green]✓[/] {toolName}" : $"[grey]✗[/] {toolName}")"
|
||||
OnClick="@(() => Registry.ToggleTool(moduleName, toolName))"
|
||||
BackgroundColor="@(toolEnabled ? Spectre.Console.Color.Grey19 : Spectre.Console.Color.Grey7)"
|
||||
FocusedColor="@Spectre.Console.Color.Yellow"
|
||||
FocusOrder="@fo" />
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter, EditorRequired] public IToolModule Module { get; set; } = null!;
|
||||
[Parameter] public int StartFocusIdx { get; set; } = 100;
|
||||
}
|
||||
Reference in New Issue
Block a user