91 lines
2.9 KiB
TypeScript
91 lines
2.9 KiB
TypeScript
import { Type } from 'class-transformer';
|
|
import {
|
|
IsEnum,
|
|
IsHash,
|
|
IsIn,
|
|
IsInt,
|
|
IsISO8601,
|
|
IsNotEmpty,
|
|
IsOptional,
|
|
IsString,
|
|
Max,
|
|
Min,
|
|
} from 'class-validator';
|
|
import { OperationMode, WorkflowState } from '../orchestration.domain';
|
|
export class CreateOrchestrationTaskDto {
|
|
@IsString() @IsNotEmpty() key!: string;
|
|
@IsString() @IsNotEmpty() title!: string;
|
|
@IsString() @IsNotEmpty() department!: string;
|
|
@IsEnum(OperationMode) operationMode!: OperationMode;
|
|
@Type(() => Number) @IsInt() @Min(0) budgetLimitCents!: number;
|
|
@IsOptional() metadata?: Record<string, unknown>;
|
|
}
|
|
export class TransitionTaskDto {
|
|
@IsEnum(WorkflowState) toState!: WorkflowState;
|
|
@Type(() => Number) @IsInt() @Min(1) expectedVersion!: number;
|
|
@IsString() @IsNotEmpty() idempotencyKey!: string;
|
|
@IsOptional() @IsString() reason?: string;
|
|
}
|
|
export class GateDecisionDto {
|
|
@IsIn(['APPROVED', 'REJECTED']) decision!: 'APPROVED' | 'REJECTED';
|
|
@Type(() => Number) @IsInt() @Min(1) expectedVersion!: number;
|
|
@IsString() @IsNotEmpty() idempotencyKey!: string;
|
|
@IsISO8601() expiresAt!: string;
|
|
@IsOptional() @IsString() notes?: string;
|
|
@IsOptional() @IsString() runId?: string;
|
|
@IsOptional() @IsHash('sha256') artifactHash?: string;
|
|
@IsOptional() @IsString() commitSha?: string;
|
|
@IsOptional() @IsString() environment?: string;
|
|
}
|
|
export class RecordBudgetDto {
|
|
@Type(() => Number) @IsInt() @Min(1) amountCents!: number;
|
|
@IsString() @IsNotEmpty() idempotencyKey!: string;
|
|
@IsString() @IsNotEmpty() kind!: string;
|
|
@IsOptional() metadata?: Record<string, unknown>;
|
|
}
|
|
export class SetKillSwitchDto {
|
|
@IsIn([
|
|
'FREEZE_NEW_WORK',
|
|
'STOP_AGENTS',
|
|
'DISABLE_MUTATIONS',
|
|
'EMERGENCY_HALT',
|
|
])
|
|
level!: string;
|
|
@IsString() @IsNotEmpty() reason!: string;
|
|
}
|
|
|
|
export class ReconcileBudgetDto {
|
|
@IsString() @IsNotEmpty() reservationId!: string;
|
|
@Type(() => Number) @IsInt() @Min(0) actualCents!: number;
|
|
@IsString() @IsNotEmpty() idempotencyKey!: string;
|
|
}
|
|
export class OrchestrationCommandDto {
|
|
@Type(() => Number) @IsInt() @Min(1) expectedVersion!: number;
|
|
@IsString() @IsNotEmpty() idempotencyKey!: string;
|
|
@IsOptional() @IsString() commitSha?: string;
|
|
@IsOptional()
|
|
@IsIn(['development', 'staging', 'production'])
|
|
environment?: string;
|
|
@IsOptional() @IsString() runId?: string;
|
|
@IsOptional() @IsString() approvalId?: string;
|
|
@IsOptional() @IsString() dependsOnTaskId?: string;
|
|
@IsOptional() @IsIn(['SUCCEEDED', 'FAILED']) status?: string;
|
|
@IsOptional()
|
|
@IsIn([
|
|
'TRANSIENT',
|
|
'RATE_LIMITED',
|
|
'DEPENDENCY',
|
|
'VALIDATION',
|
|
'POLICY',
|
|
'PERMANENT',
|
|
])
|
|
retryClass?: string;
|
|
@IsOptional() @IsHash('sha256') sha256?: string;
|
|
@IsOptional() @IsHash('sha256') artifactHash?: string;
|
|
@IsOptional() @IsHash('sha256') subjectHash?: string;
|
|
@IsOptional() @IsString() kind?: string;
|
|
@IsOptional() @IsString() uri?: string;
|
|
@IsOptional() predicate?: Record<string, unknown>;
|
|
@IsOptional() @IsString() signature?: string;
|
|
}
|