export interface TableColumn {
    name: string;
    type: string;
    description: string;
    nullable?: boolean;
}
export interface TableSchema {
    name: string;
    description: string;
    columns: TableColumn[];
    joins?: string[];
}
/**
 * Official Perfetto table schemas
 * Source: perfetto_sql/stdlib/prelude/after_eof/views.sql
 */
export declare const TABLE_SCHEMAS: Record<string, TableSchema>;
export interface FunctionSignature {
    name: string;
    returnType: string;
    params: Array<{
        name: string;
        type: string;
        optional?: boolean;
    }>;
    description: string;
    category: string;
}
/**
 * Official Perfetto builtin functions
 * Source: perfetto/docs/analysis/builtin.md
 */
export declare const BUILTIN_FUNCTIONS: Record<string, FunctionSignature>;
export interface GlobPattern {
    pattern: string;
    description: string;
    category: string;
}
/**
 * Common GLOB patterns used in Perfetto metrics
 * Source: perfetto/src/trace_processor/metrics/sql/android/
 */
export declare const GLOB_PATTERNS: Record<string, GlobPattern[]>;
export interface SqlTemplate {
    name: string;
    description: string;
    category: string;
    sql: string;
    params: Array<{
        name: string;
        description: string;
        type: string;
    }>;
}
/**
 * SQL templates for common analysis patterns
 * These are distilled from official Perfetto metrics
 */
export declare const SQL_TEMPLATES: Record<string, SqlTemplate>;
export declare class SqlKnowledgeBase {
    private perfettoPath;
    constructor(perfettoPath: string);
    /**
     * Get table schema by name
     */
    getTableSchema(tableName: string): TableSchema | undefined;
    /**
     * Get all table names
     */
    getTableNames(): string[];
    /**
     * Get function signature by name
     */
    getFunction(functionName: string): FunctionSignature | undefined;
    /**
     * Get all functions
     */
    getFunctions(): FunctionSignature[];
    /**
     * Get functions by category
     */
    getFunctionsByCategory(category: string): FunctionSignature[];
    /**
     * Get GLOB patterns by category
     */
    getGlobPatterns(category: string): GlobPattern[];
    /**
     * Get SQL template by name
     */
    getTemplate(templateName: string): SqlTemplate | undefined;
    /**
     * Get templates by category
     */
    getTemplatesByCategory(category: string): SqlTemplate[];
    /**
     * Validate column exists in table
     */
    validateColumn(tableName: string, columnName: string): boolean;
    /**
     * Suggest joins for a table
     */
    suggestJoins(tableName: string): string[];
    /**
     * Load and parse a Perfetto SQL file from the local project
     */
    parseLocalSqlFile(relativePath: string): Promise<string>;
    /**
     * Get standard library modules list
     */
    listStdlibModules(): string[];
}
export interface PerfettoSqlTemplate {
    id: string;
    name: string;
    category: string;
    subcategory?: string;
    type: 'table' | 'view' | 'function' | 'macro' | 'metric';
    description: string;
    sql?: string;
    filePath?: string;
    dependencies?: string[];
    params?: string[];
    returnType?: string;
    columns?: Array<{
        name: string;
        type: string;
        description: string;
    }>;
}
export interface AnalysisScenario {
    id: string;
    name: string;
    description: string;
    category: string;
    templates: string[];
    order: number;
}
export interface SqlIndex {
    version: string;
    generatedAt: string;
    stats?: {
        totalTemplates: number;
        byCategory: Record<string, {
            count: number;
            types: Record<string, number>;
        }>;
    };
    templates: PerfettoSqlTemplate[];
    scenarios: AnalysisScenario[];
}
export interface SearchResult {
    template: PerfettoSqlTemplate;
    score: number;
    matchedFields: string[];
}
/**
 * Extended Knowledge Base with Official SQL Index Support
 */
export declare class ExtendedSqlKnowledgeBase extends SqlKnowledgeBase {
    private index;
    private fullIndex;
    private templateMap;
    private categoryIndex;
    private nameIndex;
    private initialized;
    private readonly indexPath;
    private readonly fullIndexPath;
    constructor(perfettoPath: string);
    /**
     * Initialize the extended knowledge base
     */
    initialize(): Promise<void>;
    private ensureInitialized;
    /**
     * Get all categories from the index
     */
    getIndexCategories(): string[];
    /**
     * Get templates by category from the index
     */
    getIndexTemplatesByCategory(category: string, includePrivate?: boolean): PerfettoSqlTemplate[];
    /**
     * Get template by ID from the index
     */
    getIndexTemplateById(id: string): PerfettoSqlTemplate | null;
    /**
     * Search templates in the index
     */
    searchIndex(query: string, options?: {
        category?: string;
        type?: string;
        limit?: number;
        includePrivate?: boolean;
    }): SearchResult[];
    /**
     * Smart match - match templates based on user intent
     */
    smartMatch(userQuery: string): SearchResult[];
    /**
     * Get analysis scenarios
     */
    getScenarios(): AnalysisScenario[];
    /**
     * Get scenario by ID
     */
    getScenarioById(id: string): AnalysisScenario | null;
    /**
     * Load full template with SQL content
     */
    loadFullTemplate(id: string): Promise<PerfettoSqlTemplate | null>;
    /**
     * Get stats from the index
     */
    getIndexStats(): SqlIndex['stats'] | null;
    /**
     * Generate context for AI SQL generation
     */
    getContextForAI(query: string, maxTemplates?: number): string;
    /**
     * Generate INCLUDE statement for a template
     */
    generateIncludeStatement(templateId: string): string;
    /**
     * Get recommended queries for a category
     */
    getRecommendedQueries(category: string): Array<{
        name: string;
        description: string;
        sql: string;
    }>;
}
export declare function createKnowledgeBase(perfettoPath?: string): SqlKnowledgeBase;
export declare function createExtendedKnowledgeBase(perfettoPath?: string): ExtendedSqlKnowledgeBase;
export declare function getExtendedKnowledgeBase(): Promise<ExtendedSqlKnowledgeBase>;
export default SqlKnowledgeBase;
//# sourceMappingURL=sqlKnowledgeBase.d.ts.map