/** * AI Code Verification Types * * Types for detecting AI-generated code, hallucination checking, * and confidence scoring. * * @module scanners/ai-code/types */ import { z } from "zod"; /** * AI code detection confidence levels */ export type ConfidenceLevel = "high" | "medium" | "low" | "uncertain"; /** * AI code indicator types */ export type AIIndicatorType = "pattern" | "comment" | "structure" | "naming" | "metadata" | "hallucination"; /** * Hallucination types */ export type HallucinationType = "nonexistent_import" | "nonexistent_api" | "incorrect_signature" | "fabricated_package" | "deprecated_api" | "wrong_version" | "mixed_frameworks"; /** * AI code indicator */ export interface AIIndicator { type: AIIndicatorType; location: { file: string; line: number; column?: number; }; description: string; confidence: ConfidenceLevel; evidence: string; } /** * Hallucination finding */ export interface HallucinationFinding { type: HallucinationType; location: { file: string; line: number; column?: number; }; severity: "critical" | "high" | "medium" | "low"; description: string; expected?: string; actual: string; suggestion?: string; } /** * Code change with confidence score */ export interface ScoredChange { file: string; startLine: number; endLine: number; changeType: "added" | "modified" | "deleted"; aiLikelihood: number; confidence: ConfidenceLevel; indicators: AIIndicator[]; hallucinations: HallucinationFinding[]; requiresReview: boolean; reviewReason?: string; } /** * AI verification config */ export declare const AIVerifyConfigSchema: z.ZodObject<{ detection: z.ZodOptional; checkComments: z.ZodDefault; checkImports: z.ZodDefault; checkMetadata: z.ZodDefault; }, "strip", z.ZodTypeAny, { checkPatterns: boolean; checkComments: boolean; checkImports: boolean; checkMetadata: boolean; }, { checkPatterns?: boolean | undefined; checkComments?: boolean | undefined; checkImports?: boolean | undefined; checkMetadata?: boolean | undefined; }>>; hallucination: z.ZodOptional; checkApis: z.ZodDefault; checkVersions: z.ZodDefault; packageRegistry: z.ZodDefault>; }, "strip", z.ZodTypeAny, { checkImports: boolean; checkApis: boolean; checkVersions: boolean; packageRegistry: "npm" | "pypi" | "crates"; }, { checkImports?: boolean | undefined; checkApis?: boolean | undefined; checkVersions?: boolean | undefined; packageRegistry?: "npm" | "pypi" | "crates" | undefined; }>>; review: z.ZodOptional>; requireForHallucinations: z.ZodDefault; autoApproveBelow: z.ZodDefault; }, "strip", z.ZodTypeAny, { requireForConfidence: "high" | "medium" | "low"; requireForHallucinations: boolean; autoApproveBelow: number; }, { requireForConfidence?: "high" | "medium" | "low" | undefined; requireForHallucinations?: boolean | undefined; autoApproveBelow?: number | undefined; }>>; exclude: z.ZodOptional>; }, "strip", z.ZodTypeAny, { detection?: { checkPatterns: boolean; checkComments: boolean; checkImports: boolean; checkMetadata: boolean; } | undefined; exclude?: string[] | undefined; review?: { requireForConfidence: "high" | "medium" | "low"; requireForHallucinations: boolean; autoApproveBelow: number; } | undefined; hallucination?: { checkImports: boolean; checkApis: boolean; checkVersions: boolean; packageRegistry: "npm" | "pypi" | "crates"; } | undefined; }, { detection?: { checkPatterns?: boolean | undefined; checkComments?: boolean | undefined; checkImports?: boolean | undefined; checkMetadata?: boolean | undefined; } | undefined; exclude?: string[] | undefined; review?: { requireForConfidence?: "high" | "medium" | "low" | undefined; requireForHallucinations?: boolean | undefined; autoApproveBelow?: number | undefined; } | undefined; hallucination?: { checkImports?: boolean | undefined; checkApis?: boolean | undefined; checkVersions?: boolean | undefined; packageRegistry?: "npm" | "pypi" | "crates" | undefined; } | undefined; }>; export type AIVerifyConfig = z.infer; /** * Diagnostics for when no files are found */ export interface FileDiagnostics { reason: string; suggestions: string[]; searchedDirectories: string[]; extensionsUsed: string[]; excludePatterns: string[]; filesFoundBeforeExclude?: number; } /** * Full AI verification result */ export interface AIVerificationResult { success: boolean; filesAnalyzed: number; changesScored: ScoredChange[]; hallucinations: HallucinationFinding[]; indicators: AIIndicator[]; summary: { totalChanges: number; aiLikelyChanges: number; requiresReview: number; hallucinationsFound: number; averageConfidence: number; }; score: { detectionScore: number; hallucinationScore: number; reviewScore: number; overallScore: number; }; duration: number; error?: string; diagnostics?: FileDiagnostics; } /** * Pattern match result */ export interface PatternMatch { pattern: string; file: string; line: number; match: string; confidence: ConfidenceLevel; } //# sourceMappingURL=types.d.ts.map