/** * Enhanced Delphi MCP Types * * Provides rich semantic analysis including: * - Severity-coded hallucination flags * - Consensus strength indicators * - Keyword extraction * - Dynamic convergence tracking * - Follow-up questions for disputes */ import { ModelTier } from './models.js'; export interface DelphiResponse { modelId: string; modelName: string; provider: string; content: string; round: number; } export type ClaimStrength = 'unanimous' | 'strong' | 'moderate' | 'weak' | 'disputed'; export type FlagSeverity = 'high' | 'medium' | 'low'; export type ClaimCategory = 'agreement' | 'disagreement' | 'uncertain'; export interface ConsensusKeyword { term: string; frequency: number; context: string; } export interface ClaimAnalysis { claim: string; strength: ClaimStrength; supportingPanelists: number; totalPanelists: number; category: ClaimCategory; quote?: string; } export interface HallucinationFlag { claim: string; severity: FlagSeverity; reason: string; affectedPanelists: string; } export interface ConvergenceMetrics { agreementRatio: number; stabilityScore: number; estimatedRoundsToConverge: number; } export interface FollowUpQuestion { question: string; targetedAt: 'all' | 'dissenters'; relatedClaim: string; } export interface EnhancedConsensusSummary { afterRound: number; synthesisEssay: string; consensusKeywords: ConsensusKeyword[]; claims: ClaimAnalysis[]; flags: HallucinationFlag[]; convergence: ConvergenceMetrics; followUpQuestions: FollowUpQuestion[]; } export interface ConvergenceSnapshot { round: number; agreementRatio: number; newAgreements: string[]; resolvedDisputes: string[]; activeDisputes: string[]; } export interface ExtractedClaim { claim: string; category: 'factual' | 'opinion' | 'prediction' | 'definition'; specificity: 'high' | 'medium' | 'low'; sourceText: string; } export interface ClaimComparison { claim: string; category: 'factual' | 'opinion' | 'prediction' | 'definition'; specificity: 'high' | 'medium' | 'low'; supportingPanelists: string[]; supportCount: number; totalPanelists: number; agreementRatio: number; status: 'unanimous' | 'majority' | 'minority' | 'single'; variants: string[]; potentialIssue?: string; } export interface ClaimAnalysisResult { totalClaims: number; unanimousClaims: ClaimComparison[]; majorityClaims: ClaimComparison[]; contestedClaims: ClaimComparison[]; singleSourceClaims: ClaimComparison[]; tokensUsed: number; } export type GroundingStatus = 'verified' | 'contradicted' | 'conflicted' | 'unverified'; export interface GroundingEvidence { url: string; authorityScore: number; authorityLabel: string; stance: 'supports' | 'contradicts' | 'mentions_not_supporting' | 'irrelevant'; quote: string; rationale: string; confidence: number; quoteVerified: boolean; } export interface RiskAssessment { score: number; reasons: string[]; shouldGround: boolean; } export interface GroundingResult { status: GroundingStatus; confidence: number; risk: RiskAssessment; queries: string[]; evidence: GroundingEvidence[]; } export interface GroundedClaimAnalysisResult extends ClaimAnalysisResult { groundingStats: { claimsAssessed: number; claimsGrounded: number; verified: number; contradicted: number; conflicted: number; unverified: number; }; groundedClaims: Array; } export interface EnhancedDelphiResult { question: string; rounds: DelphiResponse[][]; consensusSummaries: EnhancedConsensusSummary[]; finalConsensus: string; topConsensusTerms: string[]; flags: { high: HallucinationFlag[]; medium: HallucinationFlag[]; low: HallucinationFlag[]; }; claimAnalysis?: ClaimAnalysisResult; groundedClaimAnalysis?: GroundedClaimAnalysisResult; controlComparison?: ControlComparison; consensusFormation?: ConsensusFormation; convergenceHistory: ConvergenceSnapshot[]; metadata: { totalModels: number; maxRounds: number; actualRounds: number; converged: boolean; convergenceThreshold: number; totalTokens: number; adminModel: string; costBreakdown: CostBreakdown; reopenCount: number; budgetExhausted?: boolean; budgetExhaustedPhase?: 'main_loop' | 'claim_analysis' | 'reopen' | 'control_comparison'; autoExpertise?: AutoExpertiseAnalysis; }; } export type OutputFormat = 'markdown' | 'json' | 'plain' | 'html' | 'summary'; export type RevisionMode = 'synthesis_essay' | 'claim_ledger' | 'disputes_only'; export type GroundingMode = 'post' | 'mid' | 'final_only'; /** * Auto-generated expert panel composition. * Created by the admin model when autoExpertise is enabled. */ export interface AutoExpertiseAnalysis { rationale: string; domains: string[]; panelComposition: AutoExpertRole[]; } export interface AutoExpertRole { role: string; focus: string; perspective: string; } /** * Predefined expertise domains for panel personas. * Each domain provides a specialized system prompt that frames * panelists as domain experts, leading to deeper, more specific responses. */ export type ExpertiseDomain = 'security' | 'finance' | 'medical' | 'legal' | 'engineering' | 'data-science' | 'economics' | 'architecture' | 'devops' | 'product'; /** * Expert persona configuration. * Maps expertise domains to system prompts that establish panelist credentials. */ export declare const EXPERT_PERSONAS: Record; /** * Diverse persona mode: assigns different complementary expert roles * to each panelist within a domain, creating a more realistic expert panel. */ export declare const DIVERSE_PERSONAS: Record; export interface DelphiOptions { tier?: ModelTier; panelSize?: number; maxRounds?: number; convergenceThreshold?: number; temperature?: number; enableFollowUp?: boolean; enableGrounding?: boolean; groundingMode?: GroundingMode; outputFormat?: OutputFormat; controlModel?: string; enableControl?: boolean; revisionMode?: RevisionMode; reopenOnContradiction?: boolean; maxTotalTokens?: number; maxCost?: number; preset?: DelphiPreset; expertise?: ExpertiseDomain; diversePersonas?: boolean; autoExpertise?: boolean; } export type DelphiPreset = 'quick' | 'balanced' | 'research' | 'factcheck'; /** * Preset configurations for common use cases. * User-specified options override preset values. */ export declare const DELPHI_PRESETS: Record>; export interface ModelCost { modelId: string; modelName: string; inputTokens: number; outputTokens: number; cost: number; } export interface CostBreakdown { byModel: ModelCost[]; adminCost: ModelCost; totalInputTokens: number; totalOutputTokens: number; totalTokens: number; totalCost: number; } export interface ControlDrift { category: 'agreement' | 'minor_drift' | 'major_drift' | 'contradiction'; description: string; } export interface ControlClaimComparison { claim: string; inControl: boolean; inConsensus: boolean; drift: ControlDrift; controlQuote?: string; consensusQuote?: string; } export interface ControlComparison { controlModel: { id: string; name: string; provider: string; }; controlResponse: string; overallDrift: { score: number; category: 'minimal' | 'low' | 'moderate' | 'high' | 'extreme'; interpretation: string; }; claimComparisons: ControlClaimComparison[]; stats: { claimsOnlyInControl: number; claimsOnlyInConsensus: number; claimsAgreed: number; claimsDrifted: number; }; valueAdded: { correctionsMade: string[]; additionalInsights: string[]; potentialOvercorrections: string[]; }; } export type ModelRole = 'driver' | 'conformist' | 'outlier' | 'neutral'; export interface ModelConsensusMetrics { modelId: string; modelName: string; provider: string; initialAlignment: number; finalAlignment: number; convergence: number; claimsInfluenced: number; uniqueClaimsRejected: number; uniqueClaimsAccepted: number; role: ModelRole; roleReason: string; } export interface ConsensusFormation { models: ModelConsensusMetrics[]; stats: { meanInitialAlignment: number; meanFinalAlignment: number; stdDevFinalAlignment: number; meanConvergence: number; }; quality: { score: number; category: 'strong' | 'moderate' | 'weak' | 'contested'; interpretation: string; }; insights: { driver?: string; outlier?: string; mostConvergent?: string; contestedClaims: string[]; }; } export interface AdminSynthesisResponse { synthesisEssay: string; consensusKeywords: ConsensusKeyword[]; claims: ClaimAnalysis[]; flags: HallucinationFlag[]; convergence: ConvergenceMetrics; followUpQuestions: FollowUpQuestion[]; } export declare function createEmptySynthesis(afterRound: number): EnhancedConsensusSummary; export declare function categorizeFlagsBySeverity(flags: HallucinationFlag[]): { high: HallucinationFlag[]; medium: HallucinationFlag[]; low: HallucinationFlag[]; }; export declare function extractTopConsensusTerms(summaries: EnhancedConsensusSummary[], limit?: number): string[]; export declare function strengthBar(ratio: number, width?: number): string; export declare function severityEmoji(severity: FlagSeverity): string; export declare function strengthDescription(strength: ClaimStrength): string; //# sourceMappingURL=types.d.ts.map