/**
 * project-access.js — 项目数据访问工具 (5)
 *
 * 1. search_project_code    搜索项目源码
 * 2. read_project_file      读取项目文件
 * 2b. list_project_structure 列出项目目录结构
 * 2c. get_file_summary       文件结构摘要
 * 2d. semantic_search_code   语义知识搜索
 */
/** 项目文件缓存条目 */
interface ProjectFile {
    relativePath?: string;
    path?: string;
    name?: string;
    content?: string;
}
/** 工具间共享状态（可挂载到 ctx 或 ctx._sharedState） */
interface ToolSharedState {
    _searchCache?: Map<string, SearchCacheEntry>;
    _readCache?: Map<string, ReadCacheEntry>;
    _searchCallCount?: number;
    [key: string]: unknown;
}
/** 工具上下文 */
export interface ToolContext extends ToolSharedState {
    projectRoot?: string;
    fileCache?: ProjectFile[] | null;
    container?: {
        get(name: string): unknown;
    } | null;
    _sharedState?: ToolSharedState;
    source?: string;
}
/** 搜索缓存条目 */
export interface SearchCacheEntry {
    matches: SearchMatch[];
    total: number;
    _cached?: boolean;
}
/** 搜索匹配项 */
export interface SearchMatch {
    file: string;
    line: number;
    code: string;
    context: string;
    score: number;
}
/** 读取缓存条目 */
export interface ReadCacheEntry {
    content?: string;
    totalLines?: number;
    language?: string;
    error?: string;
    _cached?: boolean;
}
/** 文件摘要结果 */
export interface FileSummaryResult {
    filePath: string;
    language: string;
    lineCount: number;
    imports: string[];
    declarations: string[];
    methods: string[];
    properties: string[];
    preview?: string;
}
/** 文件过滤参数 */
interface FileFilterParams {
    fileFilter?: string;
}
/** search_project_code 参数 */
export interface SearchCodeParams extends FileFilterParams {
    pattern?: string;
    patterns?: string[];
    isRegex?: boolean;
    contextLines?: number;
    maxResults?: number;
    query?: string;
    search?: string;
    keyword?: string;
    search_query?: string;
}
/** read_project_file 参数 */
export interface ReadFileParams extends FileFilterParams {
    filePath?: string;
    filePaths?: string[];
    startLine?: number;
    endLine?: number;
    maxLines?: number;
    path?: string;
    file_path?: string;
    filepath?: string;
    file?: string;
    filename?: string;
}
/** list_project_structure 参数 */
export interface ListStructureParams {
    directory?: string;
    depth?: number;
    includeStats?: boolean;
}
/** get_file_summary 参数 */
export interface FileSummaryParams {
    filePath?: string;
    file_path?: string;
    path?: string;
    file?: string;
}
/** semantic_search_code 参数 */
export interface SemanticSearchParams {
    query?: string;
    search?: string;
    keyword?: string;
    topK?: number;
    category?: string;
    language?: string;
}
/** 三方库路径识别 — 从 LanguageProfiles 统一派生 */
export declare const THIRD_PARTY_RE: RegExp;
/** 源码文件扩展名 — 从 LanguageService 统一派生 */
export declare const SOURCE_EXT_RE: RegExp;
export declare const searchProjectCode: {
    name: string;
    description: string;
    parameters: {
        type: string;
        properties: {
            pattern: {
                type: string;
                description: string;
            };
            patterns: {
                type: string;
                items: {
                    type: string;
                };
                description: string;
            };
            isRegex: {
                type: string;
                description: string;
            };
            fileFilter: {
                type: string;
                description: string;
            };
            contextLines: {
                type: string;
                description: string;
            };
            maxResults: {
                type: string;
                description: string;
            };
        };
        required: never[];
    };
    handler: (params: SearchCodeParams, ctx: ToolContext) => Promise<{
        hint: string;
        matches: SearchMatch[];
        total: number;
        searchedFiles: number;
        skippedThirdParty: number;
    } | {
        hint?: undefined;
        matches: SearchMatch[];
        total: number;
        searchedFiles: number;
        skippedThirdParty: number;
    } | {
        _deduped?: number | undefined;
        hint?: string | undefined;
        batchResults: Record<string, SearchCacheEntry>;
        patternsSearched: number;
        searchedFiles: number;
        error?: undefined;
        matches?: undefined;
        total?: undefined;
    } | {
        error: string;
        matches: never[];
        total: number;
    } | {
        _cached: boolean;
        hint: string;
        matches?: SearchMatch[] | undefined;
        total?: number | undefined;
        error?: undefined;
    }>;
};
export declare const readProjectFile: {
    name: string;
    description: string;
    parameters: {
        type: string;
        properties: {
            filePath: {
                type: string;
                description: string;
            };
            filePaths: {
                type: string;
                items: {
                    type: string;
                };
                description: string;
            };
            startLine: {
                type: string;
                description: string;
            };
            endLine: {
                type: string;
                description: string;
            };
            maxLines: {
                type: string;
                description: string;
            };
        };
        required: never[];
    };
    handler: (params: ReadFileParams, ctx: ToolContext) => Promise<{
        filePath: string;
        totalLines: number;
        startLine: number;
        endLine: number;
        content: string;
        language: string;
    } | {
        _deduped?: number | undefined;
        hint?: string | undefined;
        batchResults: Record<string, ReadCacheEntry>;
        filesRead: number;
        error?: undefined;
    } | {
        error: string;
    } | {
        _cached: boolean;
        hint: string;
        content?: string;
        totalLines?: number;
        language?: string;
        error?: string;
    }>;
};
export declare const listProjectStructure: {
    name: string;
    description: string;
    parameters: {
        type: string;
        properties: {
            directory: {
                type: string;
                description: string;
            };
            depth: {
                type: string;
                description: string;
            };
            includeStats: {
                type: string;
                description: string;
            };
        };
    };
    handler: (params: ListStructureParams, ctx: ToolContext) => Promise<{
        error: string;
        directory?: undefined;
        tree?: undefined;
        stats?: undefined;
    } | {
        directory: string;
        tree: string;
        stats: {
            totalFiles: number;
            totalDirs: number;
            byLanguage: Record<string, number>;
            totalLines: number;
        } | undefined;
        error?: undefined;
    }>;
};
export declare const getFileSummary: {
    name: string;
    description: string;
    parameters: {
        type: string;
        properties: {
            filePath: {
                type: string;
                description: string;
            };
        };
        required: string[];
    };
    handler: (params: FileSummaryParams, ctx: ToolContext) => Promise<FileSummaryResult | {
        error: string;
    }>;
};
export declare const semanticSearchCode: {
    name: string;
    description: string;
    parameters: {
        type: string;
        properties: {
            query: {
                type: string;
                description: string;
            };
            topK: {
                type: string;
                description: string;
            };
            category: {
                type: string;
                description: string;
            };
            language: {
                type: string;
                description: string;
            };
        };
        required: string[];
    };
    handler: (params: SemanticSearchParams, ctx: ToolContext) => Promise<{
        error: string;
        fallbackTool?: undefined;
        mode?: undefined;
        query?: undefined;
        message?: undefined;
        results?: undefined;
        degraded?: undefined;
        totalResults?: undefined;
    } | {
        error: string;
        fallbackTool: string;
        mode?: undefined;
        query?: undefined;
        message?: undefined;
        results?: undefined;
        degraded?: undefined;
        totalResults?: undefined;
    } | {
        mode: string;
        query: string;
        message: string;
        results: {
            id: string;
            content: string;
            score: number;
            metadata: Record<string, unknown>;
        }[];
        error?: undefined;
        fallbackTool?: undefined;
        degraded?: undefined;
        totalResults?: undefined;
    } | {
        mode: string;
        query: string;
        results: {
            id: string;
            content: string;
            score: number;
            metadata: Record<string, unknown>;
        }[];
        error?: undefined;
        fallbackTool?: undefined;
        message?: undefined;
        degraded?: undefined;
        totalResults?: undefined;
    } | {
        mode: string;
        query: string;
        degraded: boolean;
        totalResults: number;
        results: {
            id: string;
            title: string;
            content: string;
            score: number;
            knowledgeType: string;
            category: string;
            language: string;
        }[];
        error?: undefined;
        fallbackTool?: undefined;
        message?: undefined;
    }>;
};
export {};
