/** * Load the in-process Code Mode NAPI addon. * * Same model as MCP: Rust `CodeModeSession` runs inside the Node process. * No `asgrep` CLI spawn on the hot path. * * Resolution order: * 1. `ASGREP_CODEMODE_NAPI_PATH` (dev override) * 2. `@ast-sgrep//ast-sgrep-codemode.node` via launcher (release install) * 3. Local `extension/native/` / cargo `target/release` (dev builds) * * Severed-lane policy: the in-process binding requires an exact native * generation (an ABI mismatch risks crashes, not errors). Older launchers * serve Code Mode over CLI sticky/batch/spawn instead — same tools, slower. */ export declare const CODEMODE_BINDING_VERSION = "2.5.4"; export type NativeSessionConfig = { root?: string; indexPath?: string; limit?: number; useEmbed?: boolean; }; export type NativeBatchCall = { id: string; tool: string; args?: Record; }; export type NativeBatchResult = { id: string; ok: boolean; value?: unknown; error?: string; }; export type NativeBatchResponse = { allOk: boolean; results: NativeBatchResult[]; callCount: number; wallMs: number; mode: string; }; export type NativeSession = { call(tool: string, args?: Record, signal?: AbortSignal): Promise; /** Sync bounded metadata/symbol lookup; omitted on older addons. Throws if busy. */ callNow?(tool: string, args?: Record): unknown; batch(calls: NativeBatchCall[], signal?: AbortSignal): Promise; readonly callCount: number; readonly root: string; }; export type CodemodeNativeBinding = { Session: new (config?: NativeSessionConfig) => NativeSession; bindingVersion(): string; isNative(): boolean; asyncApiVersion(): number; }; /** Load the NAPI binding once. Returns null if unavailable on this host. */ export declare function loadCodemodeNative(): CodemodeNativeBinding | null; export declare function nativeAvailable(): boolean; /** Reset cache (tests). */ export declare function resetNativeCache(): void;