/** * Phase: parse * * Chunked parse + resolve loop: reads source in byte-budget chunks, * parses via worker pool (or sequential fallback), resolves imports, * heritage, and calls, synthesizes wildcard bindings. * * This phase encapsulates the entire `runChunkedParseAndResolve` function * from the original pipeline. The chunk loop is a memory optimization * internal to this phase, not a phase boundary. * * @deps structure, markdown, cobol * @reads scannedFiles, allPaths, totalFiles (from structure) * @writes graph (Symbol nodes, IMPORTS/CALLS/EXTENDS/IMPLEMENTS/ACCESSES edges) * @output exportedTypeMap, allFetchCalls, allExtractedRoutes, allDecoratorRoutes, * allToolDefs, allORMQueries, bindingAccumulator */ import type { PipelinePhase } from './types.js'; import type { BindingAccumulator } from '../binding-accumulator.js'; import type { ExtractedFetchCall, ExtractedRoute, ExtractedDecoratorRoute, ExtractedToolDef, ExtractedORMQuery } from '../workers/parse-worker.js'; import type { createResolutionContext } from '../model/resolution-context.js'; import type { ASTCache } from '../ast-cache.js'; export interface ParseOutput { /** * Read-only snapshot of exported type bindings keyed by file path. * * Fully populated by `parse` (sequential path via `enrichExportedTypeMap` * and worker path via `buildExportedTypeMapFromGraph` in the main thread). * Downstream phases — including `crossFile` — receive it as a true * `ReadonlyMap`; `crossFile` builds its own mutable working copy locally * for per-file re-resolution writes, so this snapshot is never mutated * after parse returns. */ readonly exportedTypeMap: ReadonlyMap>; readonly allFetchCalls: readonly ExtractedFetchCall[]; readonly allExtractedRoutes: readonly ExtractedRoute[]; readonly allDecoratorRoutes: readonly ExtractedDecoratorRoute[]; readonly allToolDefs: readonly ExtractedToolDef[]; readonly allORMQueries: readonly ExtractedORMQuery[]; bindingAccumulator: BindingAccumulator; /** Resolution context from the parse phase — carries importMap, namedImportMap, etc. */ resolutionContext: ReturnType; /** Pass-through: all file paths for downstream phases. */ readonly allPaths: readonly string[]; /** Pass-through: shared `allPathSet` from structure (built once, not per-phase). */ readonly allPathSet: ReadonlySet; /** Pass-through: total file count for progress reporting. */ totalFiles: number; /** * True if the parse phase spawned a live worker pool for this run. * False means every chunk ran through the sequential fallback (skipWorkers, * thresholds not met, or pool-creation failure). Primarily a test affordance: * see `PipelineOptions.workerThresholdsForTest`. */ readonly usedWorkerPool: boolean; /** * Cross-phase tree-sitter Tree cache populated by the sequential * parse path. Separate from the chunk-local `astCache` used *inside* * the parse phase (which is cleared between chunks) — this one * survives the whole phase and hands Trees to scope-resolution so * it can skip a second parse. * * Empty entries for files that ran through the worker pool * (workers can't return native tree-sitter Trees across the * MessageChannel). Cache miss is safe — consumers fall back to a * fresh parse. See plan * docs/plans/2026-04-20-002-perf-parse-heritage-mro-plan.md (Unit 4). * * Disposed by `scopeResolutionPhase` (the sole consumer) via * `scopeTreeCache.clear()` after its extract loop finishes. */ readonly scopeTreeCache: ASTCache; } export declare const parsePhase: PipelinePhase;