import type { LanguageModel } from "ai";
import type { MiddlewareContext, MiddlewareConfig, MiddlewareFactoryOptions, MiddlewareChainStats, MiddlewarePreset, NeuroLinkMiddleware, MiddlewareRegistrationOptions } from "../types/middlewareTypes.js";
import { MiddlewareRegistry } from "./registry.js";
/**
 * Middleware factory for creating and applying middleware chains.
 * Each factory instance manages its own registry and configuration.
 */
export declare class MiddlewareFactory {
    registry: MiddlewareRegistry;
    presets: Map<string, MiddlewarePreset>;
    private options;
    constructor(options?: MiddlewareFactoryOptions);
    /**
     * Initialize the factory with built-in middleware and presets
     */
    private initialize;
    /**
     * Register a custom preset
     */
    registerPreset(preset: MiddlewarePreset, replace?: boolean): void;
    /**
     * Register a custom middleware
     */
    register(middleware: NeuroLinkMiddleware, options?: MiddlewareRegistrationOptions): void;
    /**
     * Apply middleware to a language model
     */
    applyMiddleware(model: LanguageModel, context: MiddlewareContext, options?: MiddlewareFactoryOptions): LanguageModel;
    private getCreator;
    /**
     * Build middleware configuration from factory options
     */
    private buildMiddlewareConfig;
    /**
     * Get preset configuration
     */
    private getPresetConfig;
    /**
     * Create middleware context from provider and options
     */
    createContext(provider: string, model: string, options?: Record<string, unknown>, session?: {
        sessionId?: string;
        userId?: string;
    }): MiddlewareContext;
    /**
     * Validate middleware configuration
     */
    validateConfig(config: Record<string, MiddlewareConfig>): {
        isValid: boolean;
        errors: string[];
        warnings: string[];
    };
    /**
     * Get available presets
     */
    getAvailablePresets(): Array<{
        name: string;
        description: string;
        middleware: string[];
    }>;
    /**
     * Get middleware chain statistics
     */
    getChainStats(context: MiddlewareContext, config: Record<string, MiddlewareConfig>): MiddlewareChainStats;
    /**
     * Create a middleware-enabled model factory function
     */
    createModelFactory(baseModelFactory: () => Promise<LanguageModel>, defaultOptions?: MiddlewareFactoryOptions): (context: MiddlewareContext, options?: MiddlewareFactoryOptions) => Promise<LanguageModel>;
}
