/**
 * Nexus Prime — KV Bridge (AdaptiveKVMerge Integration)
 *
 * Bridges the existing MetaLearner + SLERPCompressor + CacheManager engines
 * with real GPU-level KV cache compression via vLLM/Ollama inference engines.
 *
 * Exposes a REST-compatible API that inference backends can call to get
 * merge decisions, and coordinates multi-agent shared caches via Byzantine consensus.
 *
 * Phase: 9C (AdaptiveKVMerge Bridge)
 */
import { MetaLearner, type CompressionFeatures } from './meta-learner.js';
import { CacheManager } from './cache-manager.js';
import { ByzantineConsensus, type ConsensusResult } from './byzantine-consensus.js';
export interface KVBridgeConfig {
    inferenceBackend: 'vllm' | 'ollama' | 'mock';
    endpoint: string;
    modelId: string;
    agents: number;
}
export interface MergeDecision {
    layerPair: [number, number];
    shouldMerge: boolean;
    interpolationT: number;
    retentionGamma: number;
    confidence: number;
}
export interface AdaptationResult {
    taskType: string;
    shots: number;
    adaptationTime: number;
    improvementPct: number;
}
export interface BridgeMetrics {
    totalDecisions: number;
    mergeRate: number;
    avgCompression: number;
    qualityDrop: number;
    syncOverhead: number;
    consensusStats: {
        agents: number;
        conflicts: number;
        avgReliability: number;
    };
}
export declare class KVBridge {
    private config;
    private metaLearner;
    private cacheManager;
    private consensus;
    private fomaml;
    private totalDecisions;
    private mergeCount;
    private compressionRatios;
    private qualityDrops;
    constructor(config: KVBridgeConfig, metaLearner?: MetaLearner, cacheManager?: CacheManager);
    /**
     * Get merge decisions for a set of layer pairs.
     *
     * The MetaLearner predicts whether adjacent layers should be merged,
     * and with what interpolation parameters.
     */
    getMergeDecisions(featuresList: CompressionFeatures[]): MergeDecision[];
    /**
     * 10-shot adaptation to a new task type using FOMAML.
     */
    adaptToTask(taskType: string, samples: CompressionFeatures[]): Promise<AdaptationResult>;
    /**
     * Multi-agent sync: run Byzantine consensus for a cache update.
     */
    consensusSync(agentId: string, layerIndex: number, delta: number[]): ConsensusResult;
    /**
     * Acquire a layer lock for an agent.
     */
    acquireLayerLock(agentId: string, layer: number): boolean;
    /**
     * Release a layer lock.
     */
    releaseLayerLock(_agentId: string, layer: number): void;
    /**
     * Get bridge metrics.
     */
    getMetrics(): BridgeMetrics;
    /**
     * Get the underlying consensus engine for direct access.
     */
    getConsensus(): ByzantineConsensus;
    /**
     * Get the underlying cache manager for direct access.
     */
    getCacheManager(): CacheManager;
    /**
     * Run inference using the configured backend (Ollama, vLLM, or mock).
     * Returns merge decision text from the LLM.
     */
    runInference(prompt: string): Promise<string>;
    /**
     * Ollama completion API.
     */
    private ollamaComplete;
    /**
     * vLLM completion API (OpenAI-compatible).
     */
    private vllmComplete;
    /**
     * Mock completion for testing.
     */
    private mockComplete;
    /**
     * Compute confidence for a merge decision based on feature strength.
     */
    private computeConfidence;
}
export declare function createKVBridge(config?: Partial<KVBridgeConfig>): KVBridge;
