import { LocalLlmClient } from './local-llm.js';
import { ContradictionVerificationResult, SuggestedLinks, MemorySummaryResult } from './schemas.js';
import { PluginConfig, GatewayConfig, BufferTurn, ExtractionResult, MemoryFile, ConsolidationResult, DaySummaryResult } from './types.js';
import { ModelRegistry } from './model-registry.js';
import { ProfilingCollector } from './profiling.js';
import './index-1qIcnbG1.js';
import 'zod';

declare class ExtractionEngine {
    private readonly config;
    private client;
    private localLlm;
    private fallbackLlm;
    private modelRegistry;
    private profiler;
    constructor(config: PluginConfig, profilerArg?: ProfilingCollector, localLlm?: LocalLlmClient, gatewayConfig?: GatewayConfig, modelRegistry?: ModelRegistry);
    /**
     * Whether LLM calls should be routed through the gateway model chain
     * instead of the plugin's own local/OpenAI clients.
     */
    private get useGatewayModelSource();
    /**
     * Whether the local LLM path should be attempted.
     * Disabled when gateway model source is active (gateway chain replaces local).
     */
    private get shouldUseLocalLlm();
    /**
     * Whether the direct OpenAI client should be used.
     * Disabled when gateway model source is active.
     */
    private get shouldUseDirectClient();
    /**
     * Build FallbackLlmOptions with the configured gateway agent ID injected.
     */
    private withGatewayAgent;
    private emit;
    private directClientUsesOpenAiTokenSemantics;
    private sanitizeExtractionResult;
    private hasExtractionOutputs;
    private normalizeExtractionResultPayload;
    private normalizeEntityUpdate;
    private parseJsonObject;
    private normalizeContradictionVerificationResult;
    private normalizeSuggestedLinksResult;
    private normalizeMemorySummaryResult;
    private normalizeDaySummaryResult;
    private sanitizeConsolidationResult;
    private applyProactiveQuestionPass;
    private parseProactiveQuestionsFromText;
    private parseProactiveExtractionResultFromText;
    private generateProactiveQuestions;
    private answerProactiveQuestions;
    private mergeProactiveExtractionPass;
    private parseWithGatewayFallback;
    extract(turns: BufferTurn[], existingEntities?: string[]): Promise<ExtractionResult>;
    /**
     * Extract memories using local LLM with JSON mode.
     * Uses a minimal prompt to fit within local model context limits (typically 4k-8k).
     */
    private extractWithLocalLlm;
    /**
     * Extract memories using direct OpenAI-compatible client (Chat Completions API).
     * Works with Scryr, OpenRouter, and other OpenAI-compatible endpoints.
     */
    private extractWithDirectClient;
    /**
     * Extract partial facts from truncated JSON responses.
     * Local LLMs sometimes hit token limits mid-JSON. This tries to salvage valid facts.
     */
    private extractPartialFacts;
    /**
     * Build extraction instructions shared between local and cloud LLM.
     */
    private buildExtractionInstructions;
    consolidate(newMemories: MemoryFile[], existingMemories: MemoryFile[], currentProfile: string): Promise<ConsolidationResult>;
    /**
     * Consolidate memories using local LLM.
     */
    private consolidateWithLocalLlm;
    /**
     * Consolidate a bloated profile.md into a compact version.
     * The LLM merges duplicates, removes stale info, and preserves section structure.
     * Returns the consolidated markdown or null on failure.
     */
    consolidateProfile(fullProfileContent: string, targetLines?: number): Promise<{
        consolidatedProfile: string;
        removedCount: number;
        summary: string;
    } | null>;
    /**
     * Consolidate profile using local LLM.
     */
    private consolidateProfileWithLocalLlm;
    /**
     * Consolidate IDENTITY.md reflections into a concise "Learned Patterns" section.
     * Returns the new content for the IDENTITY.md file (everything below the static header).
     */
    consolidateIdentity(fullIdentityContent: string, staticHeaderEndMarker: string): Promise<{
        learnedPatterns: string[];
        summary: string;
    } | null>;
    /**
     * Consolidate identity using local LLM.
     */
    private consolidateIdentityWithLocalLlm;
    /**
     * Verify if two memories contradict each other using LLM.
     * Called when QMD finds semantically similar memories (Phase 2B).
     */
    verifyContradiction(newMemory: {
        content: string;
        category: string;
    }, existingMemory: {
        id: string;
        content: string;
        category: string;
        created: string;
    }): Promise<ContradictionVerificationResult | null>;
    /**
     * Suggest links between a new memory and existing memories (Phase 3A).
     * Called during extraction to build the knowledge graph.
     */
    suggestLinks(newMemory: {
        content: string;
        category: string;
    }, candidateMemories: Array<{
        id: string;
        content: string;
        category: string;
    }>): Promise<SuggestedLinks | null>;
    generateDaySummary(memories: string | MemoryFile[]): Promise<DaySummaryResult | null>;
    /**
     * Summarize a batch of old memories into a compact summary (Phase 4A).
     */
    summarizeMemories(memories: Array<{
        id: string;
        content: string;
        category: string;
        created: string;
    }>): Promise<MemorySummaryResult | null>;
}

export { ExtractionEngine };
