Add WebAPI middleware for multi-instance Roslyn Bridge routing
Add RoslynBridge.WebApi - ASP.NET Core 8.0 middleware that: - Provides a centralized REST API for accessing multiple VS instances - Manages instance registry with discovery by port, solution, or PID - Proxies requests to the appropriate VS instance - Tracks request/response history for debugging - Auto-cleanup of stale instances via background service Features: - Health endpoints: /api/health, /api/health/ping - Roslyn endpoints: /api/roslyn/projects, /api/roslyn/diagnostics, etc. - Instance management: /api/instances (register, heartbeat, unregister) - History tracking: /api/history, /api/history/stats - Swagger UI at root (/) for API documentation - CORS enabled for web applications Services: - InstanceRegistryService: Thread-safe registry of VS instances - HistoryService: In-memory request/response history (max 1000 entries) - InstanceCleanupService: Background service to remove stale instances - RoslynBridgeClient: HTTP client for proxying to VS instances Update RoslynBridge.sln to include RoslynBridge.WebApi project. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
46
RoslynBridge.WebApi/Services/IHistoryService.cs
Normal file
46
RoslynBridge.WebApi/Services/IHistoryService.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using RoslynBridge.WebApi.Models;
|
||||
|
||||
namespace RoslynBridge.WebApi.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for managing query history
|
||||
/// </summary>
|
||||
public interface IHistoryService
|
||||
{
|
||||
/// <summary>
|
||||
/// Add a new history entry
|
||||
/// </summary>
|
||||
/// <param name="entry">The history entry to add</param>
|
||||
void Add(QueryHistoryEntry entry);
|
||||
|
||||
/// <summary>
|
||||
/// Get all history entries
|
||||
/// </summary>
|
||||
/// <returns>List of all history entries</returns>
|
||||
IEnumerable<QueryHistoryEntry> GetAll();
|
||||
|
||||
/// <summary>
|
||||
/// Get a specific history entry by ID
|
||||
/// </summary>
|
||||
/// <param name="id">The entry ID</param>
|
||||
/// <returns>The history entry, or null if not found</returns>
|
||||
QueryHistoryEntry? GetById(string id);
|
||||
|
||||
/// <summary>
|
||||
/// Get recent history entries
|
||||
/// </summary>
|
||||
/// <param name="count">Number of entries to return</param>
|
||||
/// <returns>List of recent history entries</returns>
|
||||
IEnumerable<QueryHistoryEntry> GetRecent(int count = 50);
|
||||
|
||||
/// <summary>
|
||||
/// Clear all history entries
|
||||
/// </summary>
|
||||
void Clear();
|
||||
|
||||
/// <summary>
|
||||
/// Get total count of history entries
|
||||
/// </summary>
|
||||
/// <returns>Total number of entries</returns>
|
||||
int GetCount();
|
||||
}
|
||||
Reference in New Issue
Block a user