import { Body, Controller, Get, Post } from '@nestjs/common'; import { ApiBody, ApiCreatedResponse, ApiOkResponse, ApiTags, } from '@nestjs/swagger'; import { ZodValidationPipe } from '../common/pipes/zod-validation.pipe'; import { AgentInvocation } from './agent.types'; import { AgentService } from './agent.service'; import { CreateAgentInvocationDto, CreateAgentInvocationInput, createAgentInvocationSchema, } from './create-agent-invocation.dto'; @ApiTags('agent') @Controller('agent/invocations') export class AgentController { constructor(private readonly agentService: AgentService) {} @Get() @ApiOkResponse({ description: 'Agent invocation audit list.' }) listInvocations(): AgentInvocation[] { return this.agentService.listInvocations(); } @Post() @ApiBody({ type: CreateAgentInvocationDto }) @ApiCreatedResponse({ description: 'Create a DevOps-scoped agent invocation.' }) async createInvocation( @Body(new ZodValidationPipe(createAgentInvocationSchema)) body: CreateAgentInvocationInput, ): Promise { return this.agentService.createInvocation(body); } }