import { CausalChainIndex } from './causal-chain.js';
import { MemoryCategory } from './types.js';
import './causal-trajectory.js';
import './objective-state.js';
import './index-1qIcnbG1.js';

/**
 * preference-consolidator.ts — IRC Preference Consolidation for Engram
 *
 * Post-extraction pass that synthesizes preference and correction memories
 * into explicit preference statements. These statements are formatted to
 * match the expected answer patterns in memory benchmarks (e.g., LongMemEval)
 * and provide clear behavioral context during recall.
 *
 * The key insight: Engram extracts preferences as factual statements like
 * "The user uses Adobe Premiere Pro for video editing." But benchmarks
 * expect preference statements like "The user would prefer resources
 * specifically tailored to Adobe Premiere Pro." This module bridges that gap.
 */

interface ConsolidatedPreference {
    /** Synthesized preference statement */
    statement: string;
    /** Source memory IDs */
    sourceIds: string[];
    /** Category of the source memories */
    category: MemoryCategory;
    /** Confidence (max of sources) */
    confidence: number;
    /** Keywords for matching during recall */
    keywords: string[];
}

/**
 * causal-behavior.ts — CMC Phase 4: Implicit Behavioral Preference Learning
 *
 * Extracts behavioral signals from causal chain analysis. Unlike explicit
 * preference extraction (which reads text), this derives preferences from
 * patterns of action: what goals recur, what actions succeed repeatedly,
 * what outcomes are consistently pursued.
 *
 * Key insight: "Preferences are recurring causal pathways."
 */

type CausalBehaviorSignalType = "topic_revisitation" | "action_pattern" | "outcome_preference" | "phrasing_style";
interface CausalBehaviorSignal {
    signalType: CausalBehaviorSignalType;
    pattern: string;
    frequency: number;
    sessionCount: number;
    confidence: number;
    trajectoryIds: string[];
}
interface BehaviorConfig {
    minFrequency: number;
    minSessions: number;
    confidenceThreshold: number;
}
/**
 * Convert behavioral signals into ConsolidatedPreference entries
 * that can be merged with existing IRC preference output.
 */
declare function synthesizeCausalPreferences(signals: CausalBehaviorSignal[], confidenceThreshold: number): ConsolidatedPreference[];
/**
 * Compute the causal impact score for a memory based on its
 * presence in causal chains. Used in lifecycle heat/decay.
 *
 * Formula: 0.1 * incomingEdges + 0.15 * outgoingEdges, clamped to [0, 0.3]
 */
declare function computeCausalImpactScore(memoryId: string, chainIndex: CausalChainIndex): number;
/**
 * Extract all behavioral signals from causal trajectories and chain analysis.
 */
declare function extractCausalBehaviorSignals(options: {
    memoryDir: string;
    causalTrajectoryStoreDir?: string;
    config: BehaviorConfig;
}): Promise<CausalBehaviorSignal[]>;

export { type BehaviorConfig, type CausalBehaviorSignal, type CausalBehaviorSignalType, computeCausalImpactScore, extractCausalBehaviorSignals, synthesizeCausalPreferences };
