/**
 * `runScopeResolution` — generic registry-primary resolution
 * orchestrator.
 *
 *     ParsedFile[]  (one per file via `extractParsedFile`)
 *        │  finalizeScopeModel(  + provider hooks adapted to FinalizeHooks)
 *        ▼
 *     ScopeResolutionIndexes
 *        │  resolveReferenceSites
 *        ▼
 *     ReferenceIndex
 *        │  emitReceiverBoundCalls (FIRST — see Contract Invariant I1)
 *        │  emitFreeCallFallback   (THEN)
 *        │  emitReferencesViaLookup (LAST — uses handledSites)
 *        │  emitImportEdges
 *        ▼
 *     KnowledgeGraph
 *
 * Per-language entry points (e.g. `runPythonScopeResolution` in
 * `languages/python/scope-resolver.ts`) construct an `ScopeResolver` and
 * delegate here.
 *
 * Plan: `docs/plans/2026-04-20-001-refactor-emit-pipeline-generalization-plan.md`.
 */
import type { ParsedFile } from '../../../../_shared/index.js';
import type { KnowledgeGraph } from '../../../graph/types.js';
import type { MutableSemanticModel } from '../../model/semantic-model.js';
import { type ResolveStats } from '../../resolve-references.js';
import type { ScopeResolver } from '../contract/scope-resolver.js';
import type { ResolutionOutcome, ResolutionOutcomeRecorder } from '../resolution-outcome.js';
export type ScopeResolutionSubPhase = 'extracting' | 'analyzing types' | 'resolving references' | 'linking symbols';
interface RunScopeResolutionInput {
    readonly graph: KnowledgeGraph;
    /**
     * Semantic model populated by the legacy `parse` phase. Scope-
     * resolution consumes its `TypeRegistry` / `MethodRegistry` /
     * `SymbolTable` lookups instead of rebuilding parallel indexes from
     * `ParsedFile[]`. See ARCHITECTURE.md § "Semantic-model source of
     * truth". Tests that invoke `runScopeResolution` in isolation pass a
     * freshly-created `MutableSemanticModel` populated from the same
     * `ParsedFile[]` to mirror the pipeline shape.
     */
    readonly model: MutableSemanticModel;
    readonly files: readonly {
        readonly path: string;
        readonly content: string;
    }[];
    readonly onWarn?: (message: string) => void;
    /**
     * Optional pre-parsed-Tree lookup keyed by file path. When the
     * pipeline's parse phase ran sequentially, it populated an
     * `ASTCache`; passing that here lets the per-file extract step
     * skip a second `tree-sitter parser.parse(...)` call. Cache miss
     * is safe — falls back to a fresh parse inside the provider.
     */
    readonly treeCache?: {
        get(filePath: string): unknown;
    };
    /**
     * Opaque per-language import-resolution config (e.g. tsconfig path
     * aliases for TypeScript). Loaded once by the caller via
     * `provider.loadResolutionConfig(repoPath)` and threaded into every
     * `provider.resolveImportTarget` call. `undefined` when the
     * provider doesn't supply a config loader.
     */
    readonly resolutionConfig?: unknown;
    /**
     * Pre-extracted ParsedFile artifacts keyed by file path. When a
     * file is present here, the extract loop reuses it directly and
     * skips `extractParsedFile` (which would re-parse the file with
     * tree-sitter on the main thread). Only files matching the
     * provider's language are honored — the loop verifies this
     * implicitly by language filter at the call-site (scopeResolution
     * phase).
     *
     * Worker-mode parses produce these ParsedFile artifacts as a side
     * effect of `extractParsedFile` running inside the worker; threading
     * them here is what lets the warm-cache analyze run skip the ~58s
     * scope-resolution re-parse loop on a multi-thousand-file repo.
     * Cache miss is safe — falls back to fresh extract.
     */
    readonly preExtractedParsedFiles?: ReadonlyMap<string, ParsedFile>;
    /**
     * Optional additive diagnostics sink. Resolver passes call this when they
     * intentionally suppress an edge; the graph remains unchanged.
     */
    readonly recordResolutionOutcome?: ResolutionOutcomeRecorder;
    /**
     * Optional progress callback for UI updates during long-running scope
     * resolution. Called periodically during the extract loop and at each
     * sub-phase boundary (finalize, resolve, emit).
     *
     * @param subPhase  Current sub-phase name for display
     * @param current   Files processed so far (during extract) or total files (at phase boundaries)
     * @param total     Total files in this language
     */
    readonly onProgress?: (subPhase: ScopeResolutionSubPhase, current: number, total: number) => void;
}
interface RunScopeResolutionStats {
    readonly filesProcessed: number;
    readonly filesSkipped: number;
    readonly importsEmitted: number;
    readonly resolve: ResolveStats;
    readonly referenceEdgesEmitted: number;
    readonly referenceSkipped: number;
    readonly resolutionOutcomes: readonly ResolutionOutcome[];
}
export declare function runScopeResolution(input: RunScopeResolutionInput, provider: ScopeResolver): RunScopeResolutionStats;
export {};
