import type { AstContext } from './compiler.js';
/**
 * Tree-sitter language label. The literal union covers built-in languages
 * shipped by core; the `(string & {})` extension admits pack-contributed
 * values (e.g., `'rust'`) registered via `PackRegistrationAPI.registerLanguage`
 * (mmnto-ai/totem#1768). Per ADR-097 § 5 Q3 + § 10 the registry is the
 * runtime source of truth; this type alias keeps IntelliSense on built-in
 * names while admitting any registered string.
 */
export type SupportedLanguage = 'typescript' | 'tsx' | 'javascript' | (string & {});
/**
 * Initialize web-tree-sitter WASM engine. Idempotent — safe to call multiple times.
 */
export declare function ensureInit(): Promise<void>;
/**
 * Load a Tree-sitter grammar WASM for the given language. Resolves the
 * language's WASM source via the registry (`LANG_TO_WASM_LOADER`) — built-in
 * loaders use `require.resolve(...)` against tree-sitter-typescript /
 * tree-sitter-javascript; pack-registered loaders return paths to the
 * pack's bundled WASM (per ADR-097 Q2 — WASM bundling decision). The
 * loader thunk is invoked lazily here on first dispatch and the resolved
 * grammar is memoized in `grammarCache`.
 *
 * Throws when the language is not registered. ast-grep dispatch path
 * (`rule-engine.ts`) is fail-loud per mmnto-ai/totem#1653 — silent skip on
 * unmapped extensions was the bug.
 */
export declare function loadGrammar(lang: SupportedLanguage): Promise<import('web-tree-sitter').Language>;
/**
 * Classify specific lines of source code by their AST context.
 *
 * @param content - Full file content (used for parsing)
 * @param lineNumbers - 1-based line numbers to classify
 * @param language - Language to parse as
 * @returns Map from line number to AstContext
 */
export declare function classifyLines(content: string, lineNumbers: number[], language: SupportedLanguage): Promise<Map<number, AstContext>>;
/**
 * Map file extension to a registered Tree-sitter language.
 *
 * Registry-backed per ADR-097 § 10 + mmnto-ai/totem#1653. Built-in entries
 * (`.ts`/`.tsx`/`.jsx`/`.js`/`.mjs`/`.cjs`) self-register at module load
 * (bottom of this file). Pack callbacks add entries during boot via
 * `PackRegistrationAPI.registerLanguage`.
 *
 * Returns undefined when the extension isn't registered. The dispatch
 * path in `rule-engine.ts` treats undefined as fail-loud per #1653 — the
 * silent skip behavior pre-#1653 was a bug.
 */
export declare function extensionToLanguage(ext: string): SupportedLanguage | undefined;
/**
 * Register a (extension, language, wasmLoader) triple. Called by built-ins
 * at module load and by Pack registration callbacks during boot via
 * `PackRegistrationAPI.registerLanguage` (mmnto-ai/totem#1768). Throws when:
 *
 * - The registry is sealed (boot-time-only mutation).
 * - The extension is already registered to a different language (built-in
 *   entries are immutable; pack-vs-pack collisions also rejected).
 * - The language is already registered to a different WASM loader.
 *
 * Both maps are updated together: an extension always points at a language
 * that has a known WASM loader. Partial registration (extension without
 * loader) is rejected.
 */
export declare function registerLang(extension: string, lang: SupportedLanguage, wasmLoader: () => string | Uint8Array | Promise<string | Uint8Array>): void;
/**
 * Snapshot of currently-registered extensions. Used for fail-loud error
 * messages on unmapped extensions and `totem describe` output.
 */
export declare function registeredExtensions(): readonly string[];
/**
 * Snapshot of currently-registered languages. Stable order for deterministic
 * output.
 */
export declare function registeredLanguages(): readonly SupportedLanguage[];
/** True iff the extension is built-in (vs pack-registered). */
export declare function isBuiltinExtension(ext: string): boolean;
/**
 * Mark the language registry as sealed. After this, `registerLang()`
 * calls throw. Called by `pack-discovery.ts` `loadInstalledPacks()` after
 * every pack callback returns.
 */
export declare function sealLangRegistry(): void;
/** True iff the language registry has been sealed. */
export declare function isLangRegistrySealed(): boolean;
/**
 * Test-only: reset the language registry and re-register built-ins. Lets
 * per-test fixtures register without leaking state across tests.
 */
export declare function __resetLangRegistryForTests(): void;
/** Test-only: clear the seal so subsequent registrations succeed. */
export declare function __unsealLangRegistryForTests(): void;
//# sourceMappingURL=ast-classifier.d.ts.map