Add Hub Console with agent management and message routing
Implement Hub that auto-connects to Gateway, manages agents via REST API, and routes WebSocket messages to agents by payload.agentId with echo responses sent back to the original sender. - Add Hub with GatewayClient auto-connect, agent CRUD, and message routing - Add Console (NestJS) with REST API and static pages (management + demo client) - Switch Gateway registration from explicit event to query-based on connect - Remove deprecated types (RegisterPayload, metadata, SendMessagePayload) - Add @nestjs/serve-static for serving console UI Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4b3592b5e4
commit
dcca9333ab
18 changed files with 773 additions and 79 deletions
48
src/console/app.module.ts
Normal file
48
src/console/app.module.ts
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import { Module } from "@nestjs/common";
|
||||
import { ServeStaticModule } from "@nestjs/serve-static";
|
||||
import { LoggerModule } from "nestjs-pino";
|
||||
import { join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { AppController } from "./app.controller.js";
|
||||
import { Hub } from "../hub/hub.js";
|
||||
|
||||
const __dirname = fileURLToPath(new URL(".", import.meta.url));
|
||||
const isDev = process.env["NODE_ENV"] !== "production";
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ServeStaticModule.forRoot({
|
||||
rootPath: join(__dirname, "public"),
|
||||
serveRoot: "/",
|
||||
exclude: ["/api/(.*)"],
|
||||
}),
|
||||
LoggerModule.forRoot({
|
||||
pinoHttp: isDev
|
||||
? {
|
||||
transport: {
|
||||
target: "pino-pretty",
|
||||
options: {
|
||||
colorize: true,
|
||||
singleLine: true,
|
||||
},
|
||||
},
|
||||
level: process.env["LOG_LEVEL"] ?? "debug",
|
||||
}
|
||||
: {
|
||||
level: process.env["LOG_LEVEL"] ?? "info",
|
||||
},
|
||||
}),
|
||||
],
|
||||
controllers: [AppController],
|
||||
providers: [
|
||||
{
|
||||
provide: "HUB",
|
||||
useFactory: () => {
|
||||
const gatewayUrl =
|
||||
process.env["GATEWAY_URL"] ?? "http://localhost:3000";
|
||||
return new Hub(gatewayUrl);
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
export class AppModule {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue