/**
 * Narrative Engine — Rainmaker Content Middleware
 *
 * Sits between raw forecast output and final content rendering.
 * Pipeline: classify → enrich → assemble → guardrail → render.
 *
 * Every forecast narrative passes through this engine to ensure:
 * - Situational variance alignment
 * - Confidence-tier tone matching
 * - Market-direction awareness
 * - Editorial guardrails (banned language, Rain Man naming, safe closes)
 * - Modular language assembly
 */
export type SpreadScenario = 'HEAVY_FAVORITE' | 'CLEAR_FAVORITE' | 'COIN_FLIP' | 'HEAVY_UNDERDOG';
export type VarianceLevel = 'LOW' | 'MODERATE' | 'HIGH' | 'CONTRADICTORY';
export type ConfidenceTier = 'A_PLUS' | 'A' | 'B_PLUS' | 'B' | 'B_MINUS' | 'BELOW_B';
export type MarketDirection = 'WITH_FORECAST' | 'AGAINST_FORECAST' | 'STABLE';
export type ContentType = 'SPREAD' | 'TOTAL' | 'HCW' | 'DVP' | 'SUMMARY' | 'SIGNAL' | 'BLOG';
export interface NarrativeContext {
    homeTeam: string;
    awayTeam: string;
    league: string;
    marketSpread: number | null;
    projectedMargin: number | null;
    marketTotal: number | null;
    projectedTotal: number | null;
    confidence: number;
    valueRating: number;
    stormCategory: number;
    forecastSide: string;
    spreadEdge: number;
    totalDirection: 'OVER' | 'UNDER' | 'NONE';
    totalEdge: number;
    injuryUncertainty?: boolean;
    recentFormInstability?: boolean;
    rosterChanges?: boolean;
    sharpMovesDetected?: boolean;
    marketMovedSinceOpen?: boolean;
    marketMoveDirection?: 'TOWARD_FORECAST' | 'AWAY_FROM_FORECAST' | null;
}
export interface NarrativeClassification {
    spreadScenario: SpreadScenario;
    varianceLevel: VarianceLevel;
    confidenceTier: ConfidenceTier;
    marketDirection: MarketDirection;
    totalsAuditFlag: boolean;
}
export interface NarrativeMetadata extends NarrativeClassification {
    suggestedTone: string;
    suggestedClose: string;
    spreadLanguageSample: string;
    varianceLanguageSample: string;
    marketLanguageSample: string;
}
/**
 * Classify the spread scenario based on the market spread magnitude.
 * Sport-aware thresholds.
 */
export declare function classifySpreadScenario(marketSpread: number | null, league: string): SpreadScenario;
/**
 * Classify the variance level based on multiple situational factors.
 */
export declare function classifyVariance(ctx: NarrativeContext): VarianceLevel;
/**
 * Classify confidence tier from composite confidence (0-1).
 */
export declare function classifyConfidenceTier(confidence: number): ConfidenceTier;
/**
 * Classify market direction relative to the forecast.
 */
export declare function classifyMarketDirection(ctx: NarrativeContext): MarketDirection;
/**
 * Detect if totals output appears muted relative to context.
 */
export declare function shouldAuditTotals(ctx: NarrativeContext): boolean;
/**
 * Run all classifiers and return a complete classification.
 */
export declare function classifyNarrative(ctx: NarrativeContext): NarrativeClassification;
/**
 * Get contextual closing language based on classification.
 */
export declare function getClosingLanguage(classification: NarrativeClassification): string;
/**
 * Remove banned hard-claim language, replacing with safer alternatives.
 */
export declare function removeBannedClaims(text: string): string;
/**
 * Replace overt wagering language with market language.
 */
export declare function replaceWageringLanguage(text: string): string;
/**
 * Enforce single "Rain Man" mention per paragraph/block.
 * After the first occurrence, replace subsequent uses with rotating substitutes.
 */
export declare function enforceSingleRainManReference(text: string): string;
/**
 * Soften absolute language (will → may, always → often, never → rarely).
 */
export declare function softenAbsoluteLanguage(text: string): string;
/**
 * Ensure text ends with a suggestive/observational close rather than a forceful instruction.
 * Only modifies the last sentence if it contains forceful phrasing.
 */
export declare function ensureSuggestiveClose(text: string): string;
/**
 * Master editorial guardrail pass — runs all guardrails in sequence.
 */
export declare function editorialGuardrails(text: string): string;
/**
 * Check if text has overly aggressive conviction language that conflicts
 * with the confidence tier or variance level.
 */
export declare function alignToneToConfidence(text: string, tier: ConfidenceTier): string;
/**
 * Override aggressive language when variance is high.
 */
export declare function alignToneToVariance(text: string, variance: VarianceLevel): string;
/**
 * Inject market-direction awareness into text.
 */
export declare function alignToneToMarketDirection(text: string, direction: MarketDirection, tier: ConfidenceTier): string;
/**
 * Build the full narrative metadata for a forecast.
 * This metadata is stored alongside the forecast for frontend rendering.
 */
export declare function buildNarrativeMetadata(ctx: NarrativeContext): NarrativeMetadata;
/**
 * Process all narrative text fields through the full pipeline.
 * This is the main post-processing entry point.
 */
export declare function processNarrativeFields(fields: {
    summary: string;
    spread_analysis: string;
    total_analysis: string;
    key_factors: string[];
    sharp_money_indicator: string;
    line_movement_analysis: string;
    weather_impact?: string;
    injury_notes?: string;
    historical_trend: string;
}, ctx: NarrativeContext): typeof fields;
/**
 * Generate the Narrative Engine system prompt addendum.
 * Inject this into the LLM system prompt for forecast generation.
 */
export declare function getNarrativeSystemPromptAddendum(ctx: NarrativeContext): string;
/**
 * Generate enrichment instructions for HCW (Home Crowd + Weather) prompts.
 */
export declare function getHcwEnrichmentPrompt(): string;
/**
 * Generate enrichment instructions for DVP (Defense vs Position) prompts.
 */
export declare function getDvpEnrichmentPrompt(): string;
/**
 * Generate enrichment instructions for totals analysis.
 */
export declare function getTotalsEnrichmentPrompt(): string;
/**
 * Build the complete prompt addendum for blog/Rain Wire generation.
 */
export declare function getBlogNarrativePrompt(classification: NarrativeClassification): string;
/**
 * Full narrative engine pipeline entry point.
 * Call this after forecast generation to process all narrative fields
 * and generate metadata for the frontend.
 */
export declare function runNarrativeEngine(forecastData: any, ctx: NarrativeContext): {
    processedFields: any;
    metadata: NarrativeMetadata;
};
//# sourceMappingURL=narrative-engine.d.ts.map