From 1f23256032fe8c1d9f6898f20085deddb5c77df5 Mon Sep 17 00:00:00 2001 From: Jonas Pacheco Date: Mon, 6 Apr 2026 17:12:55 -0300 Subject: [PATCH] =?UTF-8?q?feat(kernel):=20exp=C3=B5e=20rotas=20do=20Regis?= =?UTF-8?q?try=20no=20Dashboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Adiciona ServiceRegistry no DashboardServer - Cria rotas /api/registry/services, /stats, /:id - Permite acessar serviços descobertos via API - Integração completa Registry -> Dashboard --- server/kernel/dashboard/DashboardServer.ts | 23 ++++++++++++++++++++++ server/kernel/index.ts | 1 + 2 files changed, 24 insertions(+) diff --git a/server/kernel/dashboard/DashboardServer.ts b/server/kernel/dashboard/DashboardServer.ts index e7e8c6b..0c7655c 100644 --- a/server/kernel/dashboard/DashboardServer.ts +++ b/server/kernel/dashboard/DashboardServer.ts @@ -13,6 +13,7 @@ import { HealthMonitor } from '../core/HealthMonitor'; import { LogAggregator } from '../core/LogAggregator'; import { KernelWebSocket } from '../websocket/KernelWebSocket'; import { createKernelRoutes } from '../api/routes'; +import { ServiceRegistry } from '../registry/ServiceRegistry'; export interface DashboardServerOptions { port?: number; @@ -29,6 +30,7 @@ export class DashboardServer { private processManager: ProcessManager, private healthMonitor: HealthMonitor, private logAggregator: LogAggregator, + private serviceRegistry?: ServiceRegistry, options: DashboardServerOptions = {} ) { this.options = { @@ -104,6 +106,27 @@ export class DashboardServer { ); this.app.use('/api/kernel', kernelRoutes); + // Rotas do Registry (se disponível) + if (this.serviceRegistry) { + this.app.get('/api/registry/services', (req: Request, res: Response) => { + const services = this.serviceRegistry!.getServices(); + res.json({ success: true, data: services, timestamp: new Date() }); + }); + + this.app.get('/api/registry/stats', (req: Request, res: Response) => { + const stats = this.serviceRegistry!.getStats(); + res.json({ success: true, data: stats, timestamp: new Date() }); + }); + + this.app.get('/api/registry/services/:id', (req: Request, res: Response) => { + const service = this.serviceRegistry!.getService(req.params.id); + if (!service) { + return res.status(404).json({ success: false, error: 'Serviço não encontrado' }); + } + res.json({ success: true, data: service, timestamp: new Date() }); + }); + } + // Serve dashboard HTML // Suporte a ESM e CommonJS (build do Docker) const __dirname = (() => { diff --git a/server/kernel/index.ts b/server/kernel/index.ts index a1c0d90..8c09df4 100644 --- a/server/kernel/index.ts +++ b/server/kernel/index.ts @@ -151,6 +151,7 @@ export class ArcadiaKernel { this.processManager, this.healthMonitor, this.logAggregator, + this.serviceRegistry, // Passa o Registry pro Dashboard { port: this.options.dashboard.port, host: this.options.dashboard.host,