import { type SymbolMatchField } from './search.js';
import type { CallChain, ClassTreeAnalysis, CodebaseIndex, CodeCommandPayload, CodeEdge, CodeNode, CodeNodeType, CodeSearchResult, ContentMatch, DependencyAnalysis, ObservedCapabilities, ParsedFile, RelationMatch } from './types.js';
import type { SourceInlineBlock, SourceInlineDiagnostic } from './source-inline.js';
export declare function createPayload(index: CodebaseIndex, query: Record<string, unknown>, results: unknown, meta?: CodeCommandPayload['meta']): CodeCommandPayload & {
    observedCapabilities: ObservedCapabilities;
};
export declare function findByName(index: CodebaseIndex, name: string, type?: CodeNodeType, file?: string, limit?: number): CodeSearchResult[];
export declare function findByPattern(index: CodebaseIndex, pattern: string, type?: CodeNodeType, limit?: number): CodeSearchResult[];
export declare function findByType(index: CodebaseIndex, type: CodeNodeType, limit?: number): CodeSearchResult[];
export declare function findContent(index: CodebaseIndex, text: string, limit?: number): ContentMatch[];
export declare function nodeById(index: CodebaseIndex): Map<string, CodeNode>;
export declare function outgoingEdges(index: CodebaseIndex, type: CodeEdge['type'], nodeId: string): readonly CodeEdge[];
export declare function incomingEdges(index: CodebaseIndex, type: CodeEdge['type'], nodeId: string): readonly CodeEdge[];
export declare function analyzeCalls(index: CodebaseIndex, functionName: string, file?: string): RelationMatch[];
export declare function analyzeCallers(index: CodebaseIndex, functionName: string, file?: string): RelationMatch[];
export declare function analyzeCallChain(index: CodebaseIndex, fromName: string, toName: string, depth?: number, fromFile?: string, toFile?: string): CallChain[];
export declare function analyzeDeps(index: CodebaseIndex, target: string): DependencyAnalysis;
export declare function analyzeTree(index: CodebaseIndex, className: string, file?: string): ClassTreeAnalysis | null;
export interface ModuleCoupling {
    module: string;
    publicSymbolCount: number;
    afferentCoupling: number;
    efferentCoupling: number;
    instability: number;
    topImporters: string[];
    topDependencies: string[];
    keyClasses: Array<{
        name: string;
        parents: string[];
        childCount: number;
        methodCount: number;
    }>;
}
/**
 * Directory-module for a repo-relative path: everything above the file name.
 * Shared by module-coupling analysis and seam enumeration (src/code/seams.ts)
 * so their module grouping cannot diverge. Root-level files map to ''.
 */
export declare function moduleForRelativePath(relativePath: string): string;
export declare function analyzeModuleCoupling(index: CodebaseIndex, modulePath: string): ModuleCoupling;
export interface ModuleSummaryOptions {
    maxClasses?: number;
    maxFunctions?: number;
    maxEdges?: number;
}
export interface ModuleSummary {
    module: string;
    coupling: ModuleCoupling;
    keyClasses: ModuleCoupling['keyClasses'];
    keyFunctions: Array<{
        name: string;
        relativePath?: string;
        line?: number;
        signature?: string;
        exported: boolean;
        outgoingCalls: number;
        incomingCalls: number;
    }>;
    importEdges: Array<{
        from: string;
        to?: string;
        specifier?: string;
        status: CodeEdge['status'];
        resolutionBasis?: CodeEdge['resolutionBasis'];
        candidates?: CodeEdge['candidates'];
    }>;
    exportedApi: Array<{
        name: string;
        type: CodeNodeType;
        relativePath?: string;
        line?: number;
        signature?: string;
    }>;
}
export type MermaidKind = 'import-graph' | 'class-hierarchy' | 'call-graph';
export interface MermaidOptions {
    maxEdges?: number;
    maxNodes?: number;
}
export declare function summarizeModule(index: CodebaseIndex, modulePath: string, options?: ModuleSummaryOptions): ModuleSummary;
export declare function toMermaid(index: CodebaseIndex, kind: MermaidKind, target: string, options?: MermaidOptions): string;
export interface FusedSearchResult {
    nodeId: string;
    path: string;
    relativePath?: string;
    name: string;
    type: CodeNodeType;
    line?: number;
    endLine?: number;
    excerpt?: string;
    signature?: string;
    containerName?: string;
    language?: string;
    score: number;
    sources: Array<{
        method: string;
        rank: number;
    }>;
    /**
     * Normalized graph PageRank (0–100), present only under `pageRank: true` on
     * elements the ranking covers. The applied factor is `1 + pageRank / 100`,
     * so the boost stays derivable from the result.
     */
    pageRank?: number;
    /** Fuzzy-match evidence from the symbols arm, for highlighting. */
    symbolMatch?: {
        field: SymbolMatchField;
        matchedText: string;
        positions: number[];
        span: number;
    };
    inlineContext?: SourceInlineBlock;
    inlineContextDiagnostic?: SourceInlineDiagnostic;
}
export interface FusedSearchOptions {
    /** `symbols` (default 0 = off) adds the camelCase-aware fuzzy scorer as a fourth RRF arm. */
    weights?: {
        name?: number;
        pattern?: number;
        content?: number;
        symbols?: number;
    };
    /**
     * Blend normalized graph PageRank into fused scores as a bounded multiplier
     * (`score × (1 + normalizedScore/100)`, ≤2×) — the `hotspots --page-rank`
     * formula. A multiplier rather than a fourth RRF arm: a query-independent
     * arm would inject the same globally-important nodes into every query.
     */
    pageRank?: boolean;
    limit?: number;
}
/** Fused search: runs name, pattern, and content search, merges via Reciprocal Rank Fusion */
export declare function fusedSearch(index: CodebaseIndex, query: string, options?: FusedSearchOptions): FusedSearchResult[];
export interface KeySection {
    content: string;
    startLine: number;
    endLine: number;
    reason: string;
}
/** Select the most architecturally significant portion of a file */
export declare function extractKeySection(file: ParsedFile, maxChars: number): KeySection;
