- Add @Inject() to all gateway constructor params (required without emitDecoratorMetadata) - AgentService: ProviderService, CoordService - RoutingService: ProviderService - ProvidersController: ProviderService, RoutingService - SessionsController: AgentService - Fix coord controller ALLOWED_ROOTS to walk up to monorepo root (pnpm-workspace.yaml) - Gateway now boots and serves all routes correctly Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
41 lines
1007 B
TypeScript
41 lines
1007 B
TypeScript
import {
|
|
Controller,
|
|
Delete,
|
|
Get,
|
|
HttpCode,
|
|
HttpStatus,
|
|
Inject,
|
|
NotFoundException,
|
|
Param,
|
|
UseGuards,
|
|
} from '@nestjs/common';
|
|
import { AuthGuard } from '../auth/auth.guard.js';
|
|
import { AgentService } from './agent.service.js';
|
|
|
|
@Controller('api/sessions')
|
|
@UseGuards(AuthGuard)
|
|
export class SessionsController {
|
|
constructor(@Inject(AgentService) private readonly agentService: AgentService) {}
|
|
|
|
@Get()
|
|
list() {
|
|
const sessions = this.agentService.listSessions();
|
|
return { sessions, total: sessions.length };
|
|
}
|
|
|
|
@Get(':id')
|
|
findOne(@Param('id') id: string) {
|
|
const info = this.agentService.getSessionInfo(id);
|
|
if (!info) throw new NotFoundException('Session not found');
|
|
return info;
|
|
}
|
|
|
|
@Delete(':id')
|
|
@HttpCode(HttpStatus.NO_CONTENT)
|
|
async destroy(@Param('id') id: string) {
|
|
const info = this.agentService.getSessionInfo(id);
|
|
if (!info) throw new NotFoundException('Session not found');
|
|
await this.agentService.destroySession(id);
|
|
}
|
|
}
|