- Move core agent engine to packages/core/ - Add packages/types/ for shared TypeScript types - Add packages/utils/ for utility functions - Add apps/cli/ for command-line interface - Add apps/gateway/ for NestJS WebSocket gateway - Add apps/server/ for REST API server - Restructure desktop app (electron/ → src/main/, src/preload/) - Update pnpm workspace configuration - Remove legacy src/ directory Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
33 lines
850 B
TypeScript
33 lines
850 B
TypeScript
import { Controller, Get, Post, Body, Inject } from "@nestjs/common";
|
|
import { EventsGateway } from "./events.gateway.js";
|
|
|
|
@Controller()
|
|
export class AppController {
|
|
constructor(
|
|
@Inject(EventsGateway) private readonly eventsGateway: EventsGateway
|
|
) {}
|
|
|
|
@Get()
|
|
getHello(): { message: string; timestamp: string } {
|
|
return {
|
|
message: "Hello from Gateway!",
|
|
timestamp: new Date().toISOString(),
|
|
};
|
|
}
|
|
|
|
@Get("ping")
|
|
ping(): { ping: string } {
|
|
return { ping: "pong" };
|
|
}
|
|
|
|
@Post("broadcast")
|
|
broadcast(@Body() body: { text: string }): { success: boolean } {
|
|
// Broadcast messages to all WebSocket clients via HTTP interface
|
|
this.eventsGateway.server.emit("message", {
|
|
from: "server",
|
|
text: body.text,
|
|
timestamp: new Date().toISOString(),
|
|
});
|
|
return { success: true };
|
|
}
|
|
}
|