/**
 * The one open handle on the project's index.
 *
 * `CodeGraph.openSync` costs tens of milliseconds and runs pending migrations,
 * so it happens once for the life of the server rather than once per request.
 * That leaves two things this module has to get right:
 *
 * - **A missing index is guidance, not a stack trace.** `codegraph ui` refuses
 *   to start without one, but a user can delete `.codegraph/` while the viewer
 *   is open, so every endpoint has to be able to say so in the same words the
 *   CLI does.
 * - **A re-index must not be served from a phantom database.** `codegraph init`
 *   on an already-indexed project *replaces the database file* (see
 *   `CodeGraph.recreate`). On POSIX our handle would keep reading the unlinked
 *   inode and happily serve a graph that no longer exists on disk. So the file
 *   identity is re-checked on acquisition — one `stat` — and a swapped file
 *   reopens the connection.
 * - **A sync by ANOTHER process must not be served from memory.** The same
 *   `stat` also notices the database growing, and when it has, the read caches
 *   go (`dropReadCaches`). The query layer holds an LRU of nodes by id which
 *   only a write through *this* instance invalidates, so without it
 *   `/api/node/<id>` keeps answering with a symbol an agent's sync deleted
 *   while `/api/search` — which never caches — correctly says it is gone. That
 *   is not a stale screen, it is two screens contradicting each other; and
 *   because a node's id contains its start line, ANY edit above a symbol
 *   renames it, so this is the common case rather than the corner one.
 */
import { CodeGraph } from '../../index';
/**
 * Holds the project's `CodeGraph` open for the life of the server.
 *
 * Not thread-safe and does not need to be: `node:http` dispatches on one
 * thread, and every read below is synchronous.
 */
export declare class GraphSession {
    readonly projectRoot: string;
    private readonly dbPath;
    private cg;
    private identity;
    constructor(projectRoot: string);
    /**
     * The open graph, opening (or reopening) it if needed.
     *
     * @throws {ApiError} `no-index` when the project has no index,
     *   `index-unusable` when it has one that will not open.
     */
    acquire(): CodeGraph;
    /** Release the handle. Idempotent — the CLI calls it on Ctrl-C. */
    close(): void;
    private closeQuietly;
}
//# sourceMappingURL=session.d.ts.map