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>
27 lines
1.1 KiB
C#
27 lines
1.1 KiB
C#
using RoslynBridge.WebApi.Models;
|
|
|
|
namespace RoslynBridge.WebApi.Services;
|
|
|
|
/// <summary>
|
|
/// Interface for communicating with the Roslyn Bridge Visual Studio plugin
|
|
/// </summary>
|
|
public interface IRoslynBridgeClient
|
|
{
|
|
/// <summary>
|
|
/// Execute a query against the Roslyn Bridge server
|
|
/// </summary>
|
|
/// <param name="request">The query request</param>
|
|
/// <param name="instancePort">Optional port of specific VS instance to target</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>The query response</returns>
|
|
Task<RoslynQueryResponse> ExecuteQueryAsync(RoslynQueryRequest request, int? instancePort = null, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Check if the Roslyn Bridge server is healthy
|
|
/// </summary>
|
|
/// <param name="instancePort">Optional port of specific VS instance to check</param>
|
|
/// <param name="cancellationToken">Cancellation token</param>
|
|
/// <returns>True if healthy, false otherwise</returns>
|
|
Task<bool> IsHealthyAsync(int? instancePort = null, CancellationToken cancellationToken = default);
|
|
}
|