feat: agent session management — metrics, channels, dispose (P2-006) (#78)

Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #78.
This commit is contained in:
2026-03-13 03:35:59 +00:00
committed by jason.woltje
parent f3a7eadcea
commit 7f6dc43a2d
6 changed files with 116 additions and 3 deletions

View File

@@ -0,0 +1,39 @@
import {
Controller,
Delete,
Get,
HttpCode,
HttpStatus,
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(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);
}
}