csharpdeeb25a2 | 1 | using CascadeIDE.Features.IdeMcp.Application; |
| 2 | |
| 3 | namespace CascadeIDE.ViewModels; |
| 4 | |
| 5 | /// <summary>Жизненный цикл IDE MCP-хоста: <c>ide_ping</c>, перезапуск внешних MCP и stdio-сессии Cursor ACP.</summary> |
| 6 | public partial class MainWindowViewModel |
| 7 | { |
| 8 | /// <inheritdoc cref="IdeMcpHostOrchestrator.PingJson"/> |
| 9 | public static string PingIdeMcpHostJson() => IdeMcpHostOrchestrator.PingJson(); |
| 10 | |
| 11 | /// <summary>Пересоздать клиентов внешних MCP и сбросить stdio-сессию Cursor ACP.</summary> |
| 12 | public async Task<string> RestartMcpClientsForAgentAsync(CancellationToken cancellationToken = default) |
| 13 | { |
| 14 | Autonomous.CancelForHostReconfiguration(); |
| 15 | await _mcpClientService.DisposeAsync().ConfigureAwait(false); |
| 16 | cancellationToken.ThrowIfCancellationRequested(); |
| 17 | _mcpClientService = new Services.McpClientService(Services.McpExternalServersJsonResolver.ResolveEffectiveJson(_settings)); |
| 18 | _autonomousAgentService = CreateAutonomousAgentService(_mcpClientService); |
| 19 | Autonomous.ReplaceAgentService(_autonomousAgentService); |
| 20 | ChatPanel.DisposeCursorAcpSession(); |
| 21 | return IdeMcpHostOrchestrator.RestartClientsOkJson(); |
| 22 | } |
| 23 | } |
| 24 | |
View only · write via MCP/CIDE