Files
nexus/backend/Controllers/HealthController.cs
T
devops df94ed3cd4
CI - Build & Test / Backend (.NET) (push) Successful in 1m19s
CI - Build & Test / Frontend (Vue/TS) (push) Successful in 18s
CI - Build & Test / Security Check (push) Successful in 3s
feat: board-first orchestration with Gateway Bridge, live-update, and flow-board
- GatewayBridgeController: MCP-artiger Kommando-Adapter für Agent-zu-Backend
- TaskBridgeService + LiveUpdateService: SSE Live-Sync + Bridge-Kommandos
- FlowBoard.vue: Board-first orchestration dashboard panel
- live-sync.ts store + live.ts service: SSE-basierte Live-Updates
- Nullability-Warnung in HealthController.cs gefixt
- nginx.conf: SSE-Proxy + CORS für Bridge-Endpunkte
- .gitignore: pnpm/corepack local caches ausgeschlossen
- docs: architecture-board-first-orchestration.md hinzugefügt
- README: Backend Bridge API dokumentiert
2026-06-22 19:56:45 +02:00

58 lines
1.8 KiB
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Nexus.Api.Integrations;
namespace Nexus.Api.Controllers;
[ApiController]
public class HealthController(IAgentRuntime runtime, HealthCheckService healthChecks) : ControllerBase
{
[AllowAnonymous]
[HttpGet("/health/live")]
public IResult Live()
{
return Results.Ok(new { status = "Healthy", timestamp = DateTimeOffset.UtcNow });
}
[HttpGet("/health")]
public async Task<IResult> Get(CancellationToken ct)
{
var report = await healthChecks.CheckHealthAsync(ct);
string runtimeStatus;
string? runtimeDetail;
try
{
var status = await runtime.GetStatusAsync(ct);
runtimeStatus = status.Status.ToString();
runtimeDetail = status.Detail;
}
catch (Exception ex)
{
runtimeStatus = "Offline";
runtimeDetail = ex.Message;
}
var entries = report.Entries.ToDictionary(
e => e.Key,
e => new
{
status = e.Value.Status.ToString(),
description = e.Value.Description,
data = (IReadOnlyDictionary<string, object?>)e.Value.Data
});
entries["runtime"] = new
{
status = runtimeStatus,
description = runtimeDetail,
data = (IReadOnlyDictionary<string, object?>)new Dictionary<string, object?>()
};
var isHealthy = report.Status == HealthStatus.Healthy && runtimeStatus == "Online";
return isHealthy ? Results.Ok(new { status = "Healthy", checks = entries, timestamp = DateTimeOffset.UtcNow })
: Results.Ok(new { status = "Degraded", checks = entries, timestamp = DateTimeOffset.UtcNow });
}
}