/**
 * Adaptive Pattern Engine for UAP
 *
 * Tracks pattern outcomes per task category and returns patterns sorted
 * by historical success rate. Enables the system to learn which patterns
 * work best for different types of tasks over time.
 *
 * Now with SQLite persistence — outcomes survive across process restarts.
 */
export interface PatternOutcome {
    uses: number;
    successes: number;
}
export interface AdaptedPattern {
    id: string;
    content: string;
    successRate: number;
}
export interface PatternStats {
    uses: number;
    successes: number;
    rate: number;
}
/**
 * AdaptivePatternEngine learns which patterns work best for different
 * task categories by tracking success/failure outcomes.
 *
 * Supports optional SQLite persistence via `attachDb()`.
 */
export declare class AdaptivePatternEngine {
    /**
     * Map<patternId, Map<taskCategory, PatternOutcome>>
     * Tracks per-pattern, per-category success rates.
     */
    private outcomes;
    /**
     * Optional content store: Map<patternId, content>
     * Populated when outcomes are recorded so getAdaptedPatterns can return content.
     */
    private patternContent;
    /**
     * Optional SQLite database for persistence.
     */
    private db;
    private flushStmt;
    private flushAgentStmt;
    /**
     * Attach a SQLite database for persistent outcome storage.
     * Loads existing outcomes from the database into memory.
     */
    attachDb(dbPath: string): void;
    /**
     * Load all persisted outcomes into the in-memory maps.
     */
    private loadFromDb;
    /**
     * Flush a single outcome to the database.
     */
    private flushOutcome;
    /**
     * Record the outcome of applying a pattern to a task.
     *
     * @param patternId - Identifier of the pattern (e.g. "P12")
     * @param success - Whether the task completed successfully
     * @param taskCategory - Category of the task (e.g. "security", "refactor")
     * @param agentId - Optional agent identifier for per-agent tracking
     */
    recordPatternOutcome(patternId: string, success: boolean, taskCategory: string, agentId?: string): void;
    /**
     * Set content for a pattern (optional, for richer results).
     */
    setPatternContent(patternId: string, content: string): void;
    /**
     * Get patterns sorted by success rate for a given task category.
     *
     * @param taskCategory - Category to filter by
     * @param limit - Maximum number of patterns to return (default: 10)
     * @returns Patterns sorted by success rate descending
     */
    getAdaptedPatterns(taskCategory: string, limit?: number): AdaptedPattern[];
    /**
     * Get aggregated stats for all tracked patterns across all categories.
     *
     * @returns Map of patternId to aggregate stats
     */
    getPatternStats(): Record<string, PatternStats>;
    /**
     * Close the database connection if attached.
     */
    close(): void;
}
export declare function getAdaptivePatternEngine(dbPath?: string): AdaptivePatternEngine;
/**
 * Reset the singleton (for testing).
 */
export declare function resetAdaptivePatternEngine(): void;
//# sourceMappingURL=adaptive-patterns.d.ts.map