export interface AssaySDKConfig { anthropicApiKey?: string; model?: string; maxIterations?: number; onProgress?: (event: ProgressEvent) => void; } export interface ProgressEvent { phase: 'spec' | 'constraints' | 'generate' | 'extract' | 'verify' | 'formal' | 'regenerate'; message: string; iteration: number; totalIterations: number; } export interface GenerateOptions { task: string; language: string; context?: string; maxIterations?: number; } export interface VerifyOptions { code: string; language: string; context?: string; } /** Options for forward-verify pipeline. */ export interface ForwardVerifyOptions { /** Build output from tsc or equivalent. When passed and failed, skips LLM entirely. */ buildOutput?: { passed: boolean; errors?: string; }; } export interface CodeClaim { id: string; category: 'correctness' | 'security' | 'error-handling' | 'edge-case' | 'type-safety' | 'performance'; severity: 'critical' | 'high' | 'medium' | 'low'; description: string; assertion: string; } export type ClaimVerdict = 'PASS' | 'PARTIAL' | 'FAIL' | 'N/A' | 'UNVERIFIABLE'; export interface ClaimVerification { claimId: string; verdict: ClaimVerdict; reasoning: string; method: 'formal' | 'llm'; formalOverride?: { originalLlmVerdict: ClaimVerdict; formalVerdict: 'PASS' | 'FAIL'; reason: string; }; } export interface FormalStats { formallyVerified: number; llmVerified: number; disagreements: number; formalOverrides: number; /** Findings from auto-generated learned rules (Phase 1 self-expanding). */ learnedRuleFindings?: number; /** Noise filter stats from the ScanSession, if one was provided. */ noiseFilter?: { filesScanned: number; suppressedRules: string[]; fireCounts: Record; }; /** Stats from the contract verification layer (deterministic, zero LLM). */ contractStats?: { typeContractsExtracted: number; typeContractsVerified: number; schemaContractsExtracted: number; schemaContractsVerified: number; migrationContractsExtracted: number; migrationContractsVerified: number; smtProofsAttempted: number; smtProofsSucceeded: number; contractFailures: number; }; } /** Tracks the LLM/formal verification ratio — the key metric for the 10x roadmap. */ export interface FormalCoverage { /** Claims verified by formal verifier or learned rules (deterministic). */ formalClaimsVerified: number; /** Claims verified only by LLM (non-deterministic). */ llmClaimsVerified: number; /** Total claims processed. */ totalClaims: number; /** Percentage of claims verified formally: (formalClaimsVerified / totalClaims) * 100. */ formalPercent: number; } export interface VerificationResult { claims: CodeClaim[]; verifications: ClaimVerification[]; formalStats: FormalStats; /** LLM/formal ratio tracking — measures progress toward 15/85 target. */ formalCoverage: FormalCoverage; passed: number; failed: number; partial: number; total: number; allPassed: boolean; } export interface VerifiedCode { code: string; language: string; verified: boolean; verification: VerificationResult; iterations: number; specs: number; constraints: number; usage: { inputTokens: number; outputTokens: number; durationMs: number; }; }