import { GatewayConfig, PluginConfig, MemoryFile } from './types.js';
import { R as RolloutSummaryInput, M as MaterializeResult } from './codex-materialize-CQlLTzke.js';

/**
 * causal-consolidation.ts — CMC Phase 2: LLM-Assisted Causal Consolidation
 *
 * Uses an LLM to analyze causal trajectory patterns across sessions.
 * The LLM receives the causal chain graph as context — connected trajectories
 * from different sessions — and identifies recurring behavioral patterns,
 * preference signals, and actionable rules.
 *
 * This is the core CMC innovation: the LLM gets cross-session causal context
 * that no other memory system provides. It can see that a user investigated
 * a bug in session 1, attempted a fix in session 2, and succeeded in session 3 —
 * and synthesize a rule or preference from that chain.
 */

interface CausalPatternCandidate {
    id: string;
    sourceType: "causal-pattern";
    subject: string;
    category: "principle" | "rule";
    content: string;
    score: number;
    rationale: string;
    outcome: null;
    provenance: string[];
    agent: string | null;
    workflow: string | null;
}
interface ConsolidationConfig {
    minRecurrence: number;
    minSessions: number;
    successThreshold: number;
}
interface LlmConsolidationResult {
    rules: Array<{
        content: string;
        category: "rule" | "principle" | "preference";
        confidence: number;
        evidence: string[];
    }>;
    preferences: Array<{
        statement: string;
        confidence: number;
        evidence: string[];
    }>;
}
/**
 * Run LLM-assisted consolidation: read trajectories, format causal context,
 * ask LLM to identify patterns and preferences.
 */
declare function deriveCausalPromotionCandidates(options: {
    memoryDir: string;
    causalTrajectoryStoreDir?: string;
    config: ConsolidationConfig;
    gatewayConfig?: GatewayConfig;
    gatewayAgentId?: string;
    pluginConfig?: PluginConfig;
}): Promise<CausalPatternCandidate[]>;
/**
 * Get LLM-synthesized preferences from causal trajectory analysis.
 * Returns formatted preference statements for recall injection.
 */
declare function synthesizeCausalPreferencesViaLlm(options: {
    memoryDir: string;
    causalTrajectoryStoreDir?: string;
    gatewayConfig?: GatewayConfig;
    gatewayAgentId?: string;
    minTrajectories?: number;
}): Promise<string | null>;
/**
 * Optional post-consolidation hook — materializes Codex-native memory artifacts
 * after a causal consolidation run. Guarded by `codexMaterializeMemories` and
 * `codexMaterializeOnConsolidation`. Returns `null` when disabled or when the
 * sentinel is missing (honors user hand-edits).
 *
 * Split from the orchestrator-owned flow so #378 avoids touching
 * orchestrator.ts while Wave 1 edits are in flight.
 */
declare function materializeAfterCausalConsolidation(options: {
    config: PluginConfig;
    namespace?: string;
    memories?: MemoryFile[];
    memoryDir?: string;
    codexHome?: string;
    rolloutSummaries?: RolloutSummaryInput[];
    now?: Date;
}): Promise<MaterializeResult | null>;

export { type CausalPatternCandidate, type ConsolidationConfig, type LlmConsolidationResult, deriveCausalPromotionCandidates, materializeAfterCausalConsolidation, synthesizeCausalPreferencesViaLlm };
