- Backend: - Migration 032: agent_gov_level, status, incidents, permissions tables - Domain types for governance layer - Permission Engine with all governance checks - Governance Service (promote/demote/roles) - Revocation Service (revoke/suspend/reinstate) - Audit Service (events filtering and stats) - Incidents Service (create/assign/escalate/resolve) - REST API routes for governance, audit, incidents - Frontend: - TypeScript types for governance - API clients for governance, audit, incidents - GovernanceLevelBadge component - CityGovernancePanel component - AuditDashboard component - IncidentsList component with detail modal Based on: Agent_Governance_Protocol_v1.md
64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
/**
|
|
* Application Entry Point
|
|
* Sets up HTTP server and registers routes
|
|
*/
|
|
|
|
import express from 'express';
|
|
import { config } from './infra/config/env';
|
|
import { logger } from './infra/logger/logger';
|
|
import { authMiddleware } from './api/middleware/auth.middleware';
|
|
import { contextMiddleware } from './api/middleware/context.middleware';
|
|
import { daoRoutes } from './api/http/dao.routes';
|
|
import { walletRoutes } from './api/http/wallet.routes';
|
|
import { pdpRoutes } from './api/http/pdp.routes';
|
|
import { vendorRoutes } from './api/http/vendor.routes';
|
|
import { platformsRoutes } from './api/http/platforms.routes';
|
|
import { agentsRoutes } from './api/http/agents.routes';
|
|
import { teamsRoutes } from './api/http/teams.routes';
|
|
// Foundation Update routes
|
|
import daisRoutes from './http/dais.routes';
|
|
import assignmentRoutes from './http/assignment.routes';
|
|
// Governance Engine routes
|
|
import governanceRoutes from './http/governance.routes';
|
|
import auditRoutes from './http/audit.routes';
|
|
import incidentsRoutes from './http/incidents.routes';
|
|
|
|
const app = express();
|
|
|
|
// Middleware
|
|
app.use(express.json());
|
|
app.use(authMiddleware);
|
|
app.use(contextMiddleware);
|
|
|
|
// Routes
|
|
app.use('/api/v1/dao', daoRoutes);
|
|
app.use('/api/v1/teams', teamsRoutes);
|
|
app.use('/api/v1/wallet', walletRoutes);
|
|
app.use('/api/v1/pdp', pdpRoutes);
|
|
app.use('/api/v1/platforms', platformsRoutes);
|
|
app.use('/api/v1/platforms', vendorRoutes); // Vendor routes under platforms
|
|
app.use('/api/v1', agentsRoutes);
|
|
|
|
// Foundation Update routes (DAIS & Assignments)
|
|
app.use('/api/v1/dais', daisRoutes);
|
|
app.use('/api/v1/assignments', assignmentRoutes);
|
|
|
|
// Governance Engine routes
|
|
app.use('/api/v1/governance', governanceRoutes);
|
|
app.use('/api/v1/audit', auditRoutes);
|
|
app.use('/api/v1/incidents', incidentsRoutes);
|
|
|
|
// Health check
|
|
app.get('/health', (req, res) => {
|
|
res.json({ status: 'ok' });
|
|
});
|
|
|
|
// Start server
|
|
const port = config.port;
|
|
app.listen(port, () => {
|
|
logger.info(`Server started on port ${port}`);
|
|
});
|
|
|
|
export default app;
|
|
|