| 1 | using CascadeIDE.ViewModels; |
| 2 | using CascadeIDE.Features.IdeMcp.Application; |
| 3 | using CascadeIDE.Models; |
| 4 | using CascadeIDE.Services; |
| 5 | |
| 6 | namespace CascadeIDE.Features.IdeMcp.Application; |
| 7 | |
| 8 | internal sealed partial class MainWindowIdeMcpHost |
| 9 | { |
| 10 | |
| 11 | public Task<string> WriteAgentNotesAsync(string content, CancellationToken cancellationToken) => |
| 12 | Task.FromResult(IdeMcpAgentNotesOrchestrator.WriteAgentNotes(_host.McpAgentNotes, _host.Workspace.SolutionPath, content)); |
| 13 | |
| 14 | public Task<string> ReadAgentNotesAsync(CancellationToken cancellationToken) => |
| 15 | Task.FromResult(IdeMcpAgentNotesOrchestrator.ReadAgentNotes(_host.McpAgentNotes, _host.Workspace.SolutionPath)); |
| 16 | |
| 17 | public Task<string> AppendAgentNotesAsync(string content, CancellationToken cancellationToken) => |
| 18 | Task.FromResult(IdeMcpAgentNotesOrchestrator.AppendAgentNotes(_host.McpAgentNotes, _host.Workspace.SolutionPath, content)); |
| 19 | |
| 20 | public Task<string> ListAgentNotesRevisionsAsync(int? limit, CancellationToken cancellationToken) => |
| 21 | Task.FromResult(IdeMcpAgentNotesOrchestrator.ListAgentNotesRevisions(_host.McpAgentNotes, _host.Workspace.SolutionPath, limit)); |
| 22 | |
| 23 | public Task<string> RollbackAgentNotesAsync(string? revisionFile, CancellationToken cancellationToken) => |
| 24 | Task.FromResult(IdeMcpAgentNotesOrchestrator.RollbackAgentNotes(_host.McpAgentNotes, _host.Workspace.SolutionPath, revisionFile)); |
| 25 | |
| 26 | public Task<string> ReadHotContextAsync(string? activeScope, CancellationToken cancellationToken) => |
| 27 | Task.FromResult(IdeMcpAgentNotesOrchestrator.ReadHotContext(_host.McpAgentNotes, _host.Workspace.SolutionPath, activeScope)); |
| 28 | |
| 29 | public Task<string> RouteContextAsync(string query, string? activeScope, int? maxSections, int? maxChars, CancellationToken cancellationToken) => |
| 30 | Task.FromResult(IdeMcpAgentNotesOrchestrator.RouteContext(_host.McpAgentNotes, _host.Workspace.SolutionPath, query, activeScope, maxSections, maxChars)); |
| 31 | |
| 32 | public Task<string> MemoryHealthAsync(string? activeScope, CancellationToken cancellationToken) => |
| 33 | Task.FromResult(IdeMcpAgentNotesOrchestrator.MemoryHealth(_host.McpAgentNotes, _host.Workspace.SolutionPath, activeScope)); |
| 34 | |
| 35 | public Task<string> CompactHotContextAsync(bool apply, CancellationToken cancellationToken) => |
| 36 | Task.FromResult(IdeMcpAgentNotesOrchestrator.CompactHotContext(_host.McpAgentNotes, _host.Workspace.SolutionPath, apply)); |
| 37 | |
| 38 | public Task<string> ExtractFromArchiveAsync(string query, string? revisionFile, int? headLimit, int? contextLines, CancellationToken cancellationToken) => |
| 39 | Task.FromResult(IdeMcpAgentNotesOrchestrator.ExtractFromArchive(_host.McpAgentNotes, _host.Workspace.SolutionPath, query, revisionFile, headLimit, contextLines)); |
| 40 | |
| 41 | public Task<string> UpsertAgentNotesSectionAsync(string sectionId, string content, CancellationToken cancellationToken) => |
| 42 | Task.FromResult(IdeMcpAgentNotesOrchestrator.UpsertAgentNotesSection(_host.McpAgentNotes, _host.Workspace.SolutionPath, sectionId, content)); |
| 43 | |
| 44 | public Task<string> SearchAgentNotesAsync(string query, int? headLimit, CancellationToken cancellationToken) => |
| 45 | Task.FromResult(IdeMcpAgentNotesOrchestrator.SearchAgentNotes(_host.McpAgentNotes, _host.Workspace.SolutionPath, query, headLimit)); |
| 46 | |
| 47 | public Task<string> ReadKnowledgeFileAsync(string filePath, int? offset, int? limit, string? knowledgeRootId, CancellationToken cancellationToken) => |
| 48 | Task.FromResult(_host.McpAgentNotes.ReadKnowledgeFile(filePath, offset, limit, knowledgeRootId)); |
| 49 | |
| 50 | public Task<string> ListKnowledgeFilesAsync(string? subdir, string? knowledgeRootId, CancellationToken cancellationToken) => |
| 51 | Task.FromResult(_host.McpAgentNotes.ListKnowledgeFiles(subdir, knowledgeRootId)); |
| 52 | |
| 53 | public Task<string> WriteKnowledgeFileAsync(string filePath, string content, string? knowledgePath, bool saveRevision, string? knowledgeRootId, CancellationToken cancellationToken) => |
| 54 | Task.FromResult(_host.McpAgentNotes.WriteKnowledgeFile(filePath, content, knowledgePath, saveRevision, knowledgeRootId)); |
| 55 | |
| 56 | public Task<string> AppendKnowledgeFileAsync(string filePath, string content, string? knowledgePath, bool saveRevision, string? knowledgeRootId, CancellationToken cancellationToken) => |
| 57 | Task.FromResult(_host.McpAgentNotes.AppendKnowledgeFile(filePath, content, knowledgePath, saveRevision, knowledgeRootId)); |
| 58 | |
| 59 | public Task<string> UpsertKnowledgeSectionAsync(string filePath, string sectionId, string content, string? knowledgePath, bool saveRevision, string? knowledgeRootId, CancellationToken cancellationToken) => |
| 60 | Task.FromResult(_host.McpAgentNotes.UpsertKnowledgeSection(filePath, sectionId, content, knowledgePath, saveRevision, knowledgeRootId)); |
| 61 | |
| 62 | public Task<string> DeleteKnowledgeFileAsync(string filePath, string? knowledgePath, string? knowledgeRootId, CancellationToken cancellationToken) => |
| 63 | Task.FromResult(_host.McpAgentNotes.DeleteKnowledgeFile(filePath, knowledgePath, knowledgeRootId)); |
| 64 | |
| 65 | public Task<string> DeleteKnowledgeSectionAsync(string filePath, string sectionId, string? knowledgePath, string? knowledgeRootId, CancellationToken cancellationToken) => |
| 66 | Task.FromResult(_host.McpAgentNotes.DeleteKnowledgeSection(filePath, sectionId, knowledgePath, knowledgeRootId)); |
| 67 | |
| 68 | } |
| 69 | |