feat: 初始化DevOps平台后端

This commit is contained in:
湛兮
2026-06-11 20:49:59 +08:00
commit caec5a618d
88 changed files with 11893 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { z } from 'zod';
import { AgentPurpose } from './agent.types';
const agentPurposeSchema = z.enum([
'release-risk',
'failure-diagnosis',
'runbook-qa',
'release-note',
'incident-review',
]);
const optionalTrimmedString = (maxLength: number) =>
z
.string()
.trim()
.max(maxLength)
.optional()
.or(z.literal('').transform(() => undefined));
/**
* Agent 入口只接受 DevOps 场景参数,防止演变成通用聊天代理。
*/
export const createAgentInvocationSchema = z.object({
type: agentPurposeSchema,
runId: optionalTrimmedString(120),
projectKey: optionalTrimmedString(80),
promptSummary: z.string().trim().min(1).max(2000),
});
export type CreateAgentInvocationInput = z.infer<
typeof createAgentInvocationSchema
>;
export class CreateAgentInvocationDto {
@ApiProperty({
enum: [
'release-risk',
'failure-diagnosis',
'runbook-qa',
'release-note',
'incident-review',
],
example: 'failure-diagnosis',
})
type!: AgentPurpose;
@ApiPropertyOptional({ example: 'run-1052' })
runId?: string;
@ApiPropertyOptional({ example: 'access-manage' })
projectKey?: string;
@ApiProperty({
example: 'Analyze latest failed Jenkins log excerpt for access-manage test.',
})
promptSummary!: string;
}