/** * Frontier Model Integration Interface * * Defines the contract for integrating frontier AI models * (Mythos, GPT-5.5-Cyber, etc.) into the certification pipeline. * * These models excel at: * - Deep semantic reasoning about code * - Discovering novel vulnerability patterns * - Understanding complex exploit chains * - Finding logic flaws that evade pattern-based detection * * @module frontier/types */ import type { Severity } from "../certification/types.js"; /** * Capabilities that a frontier model may provide */ export type FrontierCapability = "vulnerability-discovery" | "exploit-chain-analysis" | "logic-flaw-detection" | "memory-safety-analysis" | "authentication-bypass-detection" | "race-condition-detection" | "cryptographic-weakness-analysis" | "data-flow-tracing" | "code-comprehension" | "fix-generation"; /** * Model provider types */ export type FrontierProvider = "anthropic-mythos" | "openai-gpt55-cyber" | "google-gemini-security" | "custom" | "stub"; /** * Analysis depth levels */ export type AnalysisDepth = "shallow" | "standard" | "deep" | "exhaustive"; /** * A file with context for analysis */ export interface FileContext { /** Relative file path */ path: string; /** File content */ content: string; /** Detected language */ language: string; /** Direct dependencies (imported modules) */ dependencies?: string[]; /** Function call graph if available */ callGraph?: CallGraphNode[]; /** Lines of code */ loc: number; /** File hash for caching */ hash?: string; } /** * Call graph node for inter-procedural analysis */ export interface CallGraphNode { /** Function/method name */ name: string; /** File containing the function */ file: string; /** Line number */ line: number; /** Functions this one calls */ calls: string[]; /** Functions that call this one */ calledBy: string[]; /** Whether this function has side effects */ hasSideEffects?: boolean; /** Whether this function accesses external resources */ accessesExternal?: boolean; } /** * Request for frontier model analysis */ export interface FrontierAnalysisRequest { /** Project root path */ projectPath: string; /** Files to analyze */ files: FileContext[]; /** Specific focus areas (e.g., "authentication", "sql handling") */ focusAreas?: string[]; /** Analysis depth */ depth: AnalysisDepth; /** Maximum cost in USD (optional budget cap) */ maxCost?: number; /** Timeout in milliseconds */ timeout?: number; /** Prior findings to build upon */ priorFindings?: Finding[]; /** Specific vulnerability types to focus on */ vulnerabilityTypes?: string[]; /** Custom analysis prompt/instructions */ customPrompt?: string; } /** * A security finding from frontier analysis */ export interface Finding { /** Unique finding ID */ id: string; /** Vulnerability title */ title: string; /** Detailed description */ description: string; /** Severity level */ severity: Severity; /** Confidence (0-100) */ confidence: number; /** Affected file */ file: string; /** Start line */ startLine: number; /** End line */ endLine: number; /** Code snippet */ codeSnippet?: string; /** Vulnerability category */ category: string; /** CWE ID if applicable */ cweId?: string; /** MITRE technique if applicable */ mitreTechnique?: string; /** Suggested fix */ suggestedFix?: string; /** Fix code snippet */ fixCode?: string; /** Explanation of the vulnerability */ explanation: string; /** Attack scenario narrative */ attackNarrative?: string; /** References */ references?: string[]; } /** * An exploit chain discovered by the model */ export interface ExploitChain { /** Unique chain ID */ id: string; /** Chain title */ title: string; /** Steps in the exploit chain */ steps: ExploitStep[]; /** Overall severity */ severity: Severity; /** Overall confidence */ confidence: number; /** MITRE ATT&CK technique if applicable */ mitreTechnique?: string; /** Narrative description of the attack */ attackNarrative: string; /** Prerequisites for exploitation */ prerequisites?: string[]; /** Impact if exploited */ impact: string; /** Remediation steps */ remediation: string[]; } /** * A step in an exploit chain */ export interface ExploitStep { /** Step number */ step: number; /** Step description */ description: string; /** File involved */ file: string; /** Line number */ line: number; /** Function/method involved */ function?: string; /** What the attacker does */ attackerAction: string; /** What the system does */ systemBehavior: string; /** Data that flows to next step */ dataFlow?: string; } /** * Cost report for an analysis */ export interface CostReport { /** Input tokens consumed */ inputTokens: number; /** Output tokens generated */ outputTokens: number; /** Total cost in USD */ totalCost: number; /** Model used */ model: string; /** Breakdown by phase if multi-phase */ breakdown?: { phase: string; inputTokens: number; outputTokens: number; cost: number; }[]; } /** * Cost estimate before running */ export interface CostEstimate { /** Minimum expected cost */ min: number; /** Maximum expected cost */ max: number; /** Best estimate */ estimated: number; /** Currency (always USD) */ currency: "USD"; /** Factors affecting the estimate */ factors?: string[]; } /** * Result of frontier model analysis */ export interface FrontierAnalysisResult { /** Security findings */ findings: Finding[]; /** Exploit chains discovered */ exploitChains: ExploitChain[]; /** Confidence in the analysis (0-100) */ confidence: number; /** Model(s) used */ modelUsed: string; /** Cost report */ cost: CostReport; /** Reasoning steps (if available) */ reasoning?: string[]; /** Analysis duration in milliseconds */ duration: number; /** Files analyzed */ filesAnalyzed: number; /** Lines of code analyzed */ linesAnalyzed: number; /** Warnings or limitations */ warnings?: string[]; } /** * Interface for a frontier model provider */ export interface FrontierModelProvider { /** Provider name */ readonly name: FrontierProvider; /** Human-readable display name */ readonly displayName: string; /** Capabilities this provider supports */ readonly capabilities: FrontierCapability[]; /** * Run security analysis */ analyze(request: FrontierAnalysisRequest): Promise; /** * Check if the provider is available */ isAvailable(): Promise; /** * Estimate cost for a request */ estimateCost(request: FrontierAnalysisRequest): Promise; /** * Get provider status/health */ getStatus(): Promise<{ available: boolean; latencyMs?: number; error?: string; }>; } /** * Result of running multiple models and comparing */ export interface ConsensusResult { /** Findings agreed upon by majority */ consensusFindings: Finding[]; /** Findings with disagreement */ disputedFindings: { finding: Finding; modelAgreement: string[]; modelDisagreement: string[]; }[]; /** Exploit chains with consensus */ consensusChains: ExploitChain[]; /** Overall consensus confidence */ consensusConfidence: number; /** Per-model results */ modelResults: { model: string; findings: Finding[]; chains: ExploitChain[]; confidence: number; }[]; /** Combined cost */ totalCost: CostReport; } /** * Configuration for frontier model integration */ export interface FrontierConfig { /** Enabled providers */ providers: FrontierProvider[]; /** Default analysis depth */ defaultDepth: AnalysisDepth; /** Budget per analysis (USD) */ budgetPerAnalysis: number; /** Whether to require consensus */ requireConsensus: boolean; /** Minimum consensus threshold (0-1) */ consensusThreshold: number; /** Cache results for identical files */ enableCaching: boolean; /** Cache TTL in seconds */ cacheTtlSeconds: number; /** API keys (stored securely) */ apiKeys?: Record; /** Custom endpoints */ endpoints?: Record; } /** * Default frontier configuration */ export declare const DEFAULT_FRONTIER_CONFIG: FrontierConfig; //# sourceMappingURL=types.d.ts.map