511
  K   ˆl–Ü4ý('ÜZÔâ€vã,ÜÅ£�þBË,¬ãdnIj0�r?Äƒið·Ã_“I|¥ŽõHºl=$¤�zTÖ™	ÂÁ 3    /**
 * MCP per-connection session â€” speaks the JSON-RPC protocol (initialize,
 * tools/list, tools/call) over a single {@link JsonRpcTransport}. It owns
 * per-client state only (which protocol version the client asked for, whether
 * it advertised `roots`, the one-shot roots/list latch); the heavyweight
 * resources (CodeGraph, watcher, ToolHandler) live in the shared
 * {@link MCPEngine} so daemon mode can collapse N inotify sets / DB handles
 * to one.
 *
 * The state-machine itself mirrors what `MCPServer` used to do inline before
 * issue #411 split it out â€” the same regression tests in
 * `__tests__/mcp-initialize.test.ts` still drive this code path.
 */
import { JsonRpcTransport } from './transport';
import { MCPEngine } from './engine';
import { ExploreSessionState } from './explore-session-state';
/**
 * MCP Server Info â€” kept on the session because some clients log it. The
 * version tracks the real package version (was a hard-coded '0.1.0').
 */
export declare const SERVER_INFO: {
    name: string;
    version: string;
};
/**
 * Instructions for the `initialize` response, with the update-availability
 * notice appended when one is known (#1243). Exported so the proxy's local
 * handshake sends the IDENTICAL payload â€” same convention as SERVER_INFO.
 * `getUpdateNotice` is a memoized synchronous cache read, so the #172
 * respond-fast contract holds; when no notice exists the instructions are
 * byte-identical to the bare constants.
 *
 * Test-authoring note: on a machine whose real `~/.codegraph` cache knows a
 * newer release, spawned servers append the notice â€” a test asserting exact
 * instructions equality must set `CODEGRAPH_NO_UPDATE_CHECK=1` in the spawn
 * env or it will fail only in the weeks after a release ships.
 */
export declare function initializeInstructions(base: string, notice?: string | null): string;
/** MCP Protocol Version (latest the server claims). */
export declare const PROTOCOL_VERSION = "2024-11-05";
export interface MCPSessionOptions {
    /**
     * Explicit project path from the `--path` CLI flag. When set, the session
     * will not bother asking the client for `roots/list` â€” we already know
     * where the project lives.
     */
    explicitProjectPath?: string | null;
}
/**
 * One MCP client's view of the server. Created fresh per stdio launch
 * (direct mode) or per socket connection (daemon mode).
 */
export declare class MCPSession {
    private transport;
    private engine;
    private clientSupportsRoots;
    /** From the initialize handshake â€” attributes usage rollups to the agent host. */
    private clientInfo;
    private rootsAttempted;
    private resolvePromise;
    private explicitProjectPath;
    /**
     * What `codegraph_explore` has already returned to THIS client, per project
     * (CG-17). Owned by the session, not the engine: the daemon shares one engine
     * (and one ToolHandler, and a pool of worker threads) across every connected
     * client, so state kept over there would blend two agents' histories and let
     * one session's calls suppress source the other has never seen. It dies with
     * the session â€” a reconnecting client starts clean.
     */
    private readonly exploreSession;
    constructor(transport: JsonRpcTransport, engine: MCPEngine, opts?: MCPSessionOptions);
    /**
     * Start handling messages from the transport. Returns immediately â€” the
     * session lives for as long as the transport is open.
     */
    start(): void;
    /**
     * Tear down the session. Does NOT touch the engine (the engine may serve
     * other sessions) or call `process.exit` (the daemon decides when to exit).
     */
    stop(): void;
    /** Underlying transport â€” exposed for daemon-side close hooks. */
    getTransport(): JsonRpcTransport;
    /**
     * This session's explore call history (CG-17). Exposed so tests can assert
     * that two sessions on one daemon keep separate state; nothing in the server
     * reaches for anot