All files / src/llm-responses/dto submit-llm-response.dto.ts

100% Statements 20/20
100% Branches 2/2
100% Functions 3/3
100% Lines 20/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 11815x                       15x   15x 15x 15x     15x           15x               15x                 2x 15x               2x 15x               15x               15x             15x             15x               15x               15x               15x                 15x    
import {
  IsEnum,
  IsInt,
  IsNotEmpty,
  IsOptional,
  IsString,
  IsUrl,
  IsUUID,
  ValidateIf,
  IsArray,
  IsObject,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
 
export enum SessionType {
  LATEST = 'latest',
  ACTIVE = 'active',
}
 
export class SubmitLlmResponseDto {
  @ApiProperty({
    description: 'Raw LLM response text to be parsed and orchestrated',
  })
  @IsString()
  @IsNotEmpty()
  raw_llm_response: string;
 
  @ApiPropertyOptional({
    description: 'UUID of existing SessionInput to attach response to',
    format: 'uuid',
  })
  @IsOptional()
  @IsUUID()
  inputId?: string;
 
  @ApiPropertyOptional({
    description: 'Execution strategy (required if inputId not provided)',
    enum: ['review_first', 'apply_revert'],
  })
  @IsOptional()
  @IsString()
  @IsNotEmpty()
  @ValidateIf((o) => !o.inputId)
  execution_strategy?: string;
 
  @ApiPropertyOptional({
    description: 'Session target (required if inputId not provided)',
    enum: SessionType,
  })
  @IsOptional()
  @IsEnum(SessionType)
  @ValidateIf((o) => !o.inputId)
  session?: SessionType;
 
  @ApiPropertyOptional({
    description: 'Idempotency key to prevent duplicate submissions',
    format: 'uuid',
  })
  @IsOptional()
  @IsUUID()
  idempotency_key?: string;
 
  @ApiPropertyOptional({
    description: 'External URL (e.g., AI Studio or Claude chat URL)',
    example: 'https://claude.ai/chat/abc123',
  })
  @IsOptional()
  @IsUrl()
  url?: string;
 
  @ApiPropertyOptional({
    description: 'Original user prompt that generated this response',
  })
  @IsOptional()
  @IsString()
  user_prompt?: string;
 
  @ApiPropertyOptional({
    description: 'External turn ID from source conversation',
  })
  @IsOptional()
  @IsString()
  external_turn_id?: string;
 
  @ApiPropertyOptional({
    description: 'Number of input tokens used',
    minimum: 0,
  })
  @IsOptional()
  @IsInt()
  input_token_count?: number;
 
  @ApiPropertyOptional({
    description: 'Number of output tokens generated',
    minimum: 0,
  })
  @IsOptional()
  @IsInt()
  output_token_count?: number;
 
  @ApiPropertyOptional({
    description: 'Number of cached tokens used',
    minimum: 0,
  })
  @IsOptional()
  @IsInt()
  cached_token_count?: number;
 
  @ApiPropertyOptional({
    description:
      'Native tool calls from LLM response (array of tool call objects)',
  })
  @IsOptional()
  @IsArray()
  @IsObject({ each: true })
  tool_calls?: any[];
}