/**
 * Perfetto SQL Skill
 *
 * Main service for Perfetto trace analysis using official SQL patterns.
 * Provides specialized analysis functions for common Android performance scenarios.
 *
 * All SQL patterns are based on official Perfetto metrics and stdlib modules.
 */
import { TraceProcessorService } from './traceProcessorService';
import { SqlKnowledgeBase } from './sqlKnowledgeBase';
import { PerfettoSkillType, type PerfettoSqlRequest, type PerfettoSqlResponse } from '../types/perfettoSql';
export declare class PerfettoSqlSkill {
    private traceProcessor;
    private knowledgeBase;
    private enhancedEngine;
    private enhancedEngineInitializing;
    constructor(traceProcessor: TraceProcessorService, knowledgeBase?: SqlKnowledgeBase);
    /**
     * Get the enhanced SQL template engine (lazy initialization)
     * Provides access to 527 official Perfetto SQL templates
     */
    private getEnhancedEngine;
    /**
     * Get AI context enriched with official Perfetto SQL patterns
     * This provides the AI with relevant official templates for generating SQL
     */
    getEnrichedAIContext(question: string): Promise<string>;
    /**
     * Get recommended SQL queries for a given category
     */
    getRecommendedSQLForCategory(category: string): Promise<Array<{
        name: string;
        description: string;
        sql: string;
    }>>;
    /**
     * Get matching official templates for a user query
     */
    findOfficialTemplates(query: string): Promise<{
        builtinTemplate: any | null;
        officialTemplates: any[];
        recommendedSQL: Array<{
            name: string;
            description: string;
            sql: string;
        }>;
    }>;
    /**
     * Analyze a trace based on a natural language question
     */
    analyze(request: PerfettoSqlRequest): Promise<PerfettoSqlResponse>;
    /**
     * Detect the appropriate analysis skill from the question
     */
    private detectIntent;
    /**
     * Extract parameters from the question
     */
    private extractParams;
    /**
     * Generate SQL-only response for WASM traces (where trace is in browser)
     * The UI will execute this SQL locally
     */
    private generateSqlOnlyResponse;
    private getStartupSql;
    private getScrollingSql;
    private getNavigationSql;
    private getClickResponseSql;
    private getMemorySql;
    private getCpuSql;
    private getSurfaceFlingerSql;
    private getInputSql;
    private getBinderSql;
    private getBufferFlowSql;
    private getSystemServerSql;
    private getSlowFunctionsSql;
    private getNetworkSql;
    private getDatabaseSql;
    private getFileIOSql;
    /**
     * Analyze app startup performance
     * Based on: perfetto_sql/stdlib/android/startup/startups_minsdk33.sql
     */
    analyzeStartup(traceId: string, packageName?: string): Promise<PerfettoSqlResponse>;
    /**
     * 从 slice 表直接分析启动事件
     * 查询完整的 Activity 生命周期和启动相关事件
     */
    private analyzeStartupFromSlices;
    /**
     * Analyze app startup with detailed breakdown
     * Includes: slice durations, CPU core distribution, frequency, thread blocking
     */
    analyzeStartupDetailed(traceId: string, packageName?: string): Promise<PerfettoSqlResponse>;
    /**
     * Analyze a single startup event with all detailed metrics
     */
    private analyzeOneStartup;
    /**
     * Format summary for a single startup event
     */
    private formatSingleStartupSummary;
    /**
     * Format summary for multiple startup events
     */
    private formatMultiStartupSummary;
    /**
     * 格式化 android_startup_processes 查询结果
     */
    private formatStartupProcessesSummary;
    /**
     * 格式化启动事件摘要（从 slice 表查询的数据）
     */
    private formatStartupEventsSummary;
    private analyzeStartupLegacy;
    /**
     * Fallback startup analysis when android_startups is not available
     * Uses slice table to find activity lifecycle events
     */
    private analyzeStartupFallback;
    /**
     * Analyze scrolling performance with multi-dimensional jank detection
     *
     * For Android 12+: Uses FrameTimeline tables (expected_frame_timeline_slice, actual_frame_timeline_slice)
     * For Android < 12: Falls back to combining Choreographer, RenderThread, SF, and Vsync analysis
     *
     * Based on:
     * - https://perfetto.dev/docs/data-sources/frametimeline
     * - android_performance.com systrace analysis series
     */
    analyzeScrolling(traceId: string, packageName?: string): Promise<PerfettoSqlResponse>;
    /**
     * Modern jank detection using FrameTimeline (Android 12+)
     * Uses actual_frame_timeline_slice and expected_frame_timeline_slice tables
     */
    private analyzeScrollingWithFrameTimeline;
    /**
     * Analyze janky sessions (consecutive janky frames) and frozen frames
     * Helps identify patterns of continuous jank that are more noticeable to users
     */
    private analyzeJankySessions;
    /**
     * Analyze frame rate stability and calculate smoothness metrics
     * Returns statistical analysis of frame timing consistency
     */
    private analyzeFrameStability;
    /**
     * Analyze root cause for each janky frame
     * Identifies whether jank is caused by main thread, GPU, or system issues
     */
    private analyzeJankRootCauses;
    /**
     * Get human-readable description for root cause
     */
    private getRootCauseDescription;
    /**
     * Legacy jank detection for Android < 12
     * Combines multiple data sources to detect real jank
     */
    private analyzeScrollingLegacy;
    /**
     * Analyze memory usage
     * Based on: linux/memory/*.sql patterns
     */
    analyzeMemory(traceId: string, packageName?: string): Promise<PerfettoSqlResponse>;
    /**
     * Analyze CPU utilization
     * Based on: linux/cpu/utilization/*.sql patterns
     */
    analyzeCpu(traceId: string, packageName?: string): Promise<PerfettoSqlResponse>;
    /**
     * Analyze SurfaceFlinger performance
     * Based on: android/surfaceflinger.sql, android_surfaceflinger.sql
     */
    analyzeSurfaceFlinger(traceId: string): Promise<PerfettoSqlResponse>;
    /**
     * Analyze Binder transactions
     * Based on: android/android_binder.sql
     */
    analyzeBinder(traceId: string, packageName?: string): Promise<PerfettoSqlResponse>;
    /**
     * Generic analysis with template-based SQL generation
     */
    private analyzeGeneric;
    /**
     * Analyze navigation/activity switching performance
     * Based on activity transition slice patterns
     */
    analyzeNavigation(traceId: string, packageName?: string): Promise<PerfettoSqlResponse>;
    /**
     * Analyze click/tap response performance
     * Based on input event latency patterns
     */
    analyzeClickResponse(traceId: string, packageName?: string): Promise<PerfettoSqlResponse>;
    /**
     * Analyze input events and latency
     * Based on input system tracking
     */
    analyzeInput(traceId: string, packageName?: string): Promise<PerfettoSqlResponse>;
    /**
     * Analyze buffer flow and queue
     * Based on GPU fence and buffer queue patterns
     */
    analyzeBufferFlow(traceId: string): Promise<PerfettoSqlResponse>;
    /**
     * Analyze SystemServer performance
     * Based on system_server process patterns
     */
    analyzeSystemServer(traceId: string): Promise<PerfettoSqlResponse>;
    /**
     * Analyze slow functions (>16ms)
     * Detects functions that exceed the 16.6ms frame budget
     */
    analyzeSlowFunctions(traceId: string, packageName?: string): Promise<PerfettoSqlResponse>;
    /**
     * Analyze network request performance
     * Uses network_traffic_slice table to track HTTP requests
     */
    analyzeNetwork(traceId: string, packageName?: string): Promise<PerfettoSqlResponse>;
    /**
     * Analyze database query performance
     * Uses slice table to find SQLite/Room operations
     */
    analyzeDatabase(traceId: string, packageName?: string): Promise<PerfettoSqlResponse>;
    /**
     * Analyze file I/O performance
     * Uses slice table to find read/write operations
     */
    analyzeFileIO(traceId: string, packageName?: string): Promise<PerfettoSqlResponse>;
    private formatStartupSummary;
    private formatScrollingSummary;
    /**
     * Format summary for FrameTimeline-based scrolling analysis (Android 12+)
     */
    private formatFrameTimelineScrollingSummary;
    /**
     * Format summary for legacy scrolling analysis (Android < 12)
     */
    private formatLegacyScrollingSummary;
    private formatMemorySummary;
    private formatCpuSummary;
    private formatSurfaceFlingerSummary;
    private formatBinderSummary;
    private formatNavigationSummary;
    private formatClickResponseSummary;
    private formatInputSummary;
    private formatBufferFlowSummary;
    private formatSystemServerSummary;
    private formatSlowFunctionsSummary;
    private formatNetworkSummary;
    private formatDatabaseSummary;
    private formatFileIOSummary;
    /**
     * Get available analysis types
     */
    getAvailableSkills(): PerfettoSkillType[];
    /**
     * Get knowledge base reference
     */
    getKnowledgeBase(): SqlKnowledgeBase;
}
export default PerfettoSqlSkill;
//# sourceMappingURL=perfettoSqlSkill.d.ts.map