import { Readable, Writable } from 'node:stream';
import { E as EngramAccessService } from './access-service-_AEUMVyX.js';
import './storage.js';
import './page-versioning.js';
import './consolidation-operator.js';
import './types.js';
import './memory-projection-store-D3vBHS4J.js';
import 'better-sqlite3';
import './recall-xray.js';
import './recall-explain-renderer.js';
import './recall-state.js';
import './recall-audit-anomaly.js';
import './recall-audit.js';
import './explicit-capture.js';
import './orchestrator-ChkesB8U.js';
import './buffer.js';
import './port-hqGnoStS.js';
import './transcript.js';
import './session-integrity.js';
import './summarizer.js';
import './model-registry.js';
import './local-llm.js';
import './fallback-llm.js';
import './live-connectors-runner.js';
import './framework-CyHYDcri.js';
import './relevance.js';
import './negative.js';
import './session-observer-state.js';
import './embedding-fallback.js';
import './semantic-consolidation-ByBXb-sf.js';
import './codex-materialize-CQlLTzke.js';
import './logger.js';
import 'zod';
import './policy-runtime.js';
import './profiling.js';
import './cross-namespace-budget.js';
import './graph-snapshot.js';
import './graph.js';
import './trust-zones.js';
import './memory-worth-outcomes.js';
import './capsule-cli.js';

type JsonRpcId = string | number | null;
type JsonRpcRequest = {
    jsonrpc?: string;
    id?: JsonRpcId;
    method?: string;
    params?: Record<string, unknown>;
};
declare class EngramMcpServer {
    private readonly service;
    private buffer;
    private flushTask;
    private readonly tools;
    private readonly authenticatedPrincipal?;
    /**
     * MCP client info keyed by server-assigned session ID. On each `initialize`
     * handshake the server generates a UUID, stores the client's clientInfo
     * against it, and returns the ID as `Mcp-Session-Id` in the response
     * metadata. Subsequent requests from the same client include this header,
     * allowing per-session clientInfo lookup without cross-session leaks.
     */
    private clientInfoBySession;
    /**
     * Session IDs generated during initialize, keyed by caller-supplied correlation
     * ID (unique per HTTP request) to avoid collisions when multiple clients send
     * initialize with the same JSON-RPC id concurrently.
     */
    private initSessionIds;
    /** Whether oai-mem-citation guidance is explicitly enabled via config. */
    private readonly citationsEnabled;
    /** Whether to auto-enable citations for Codex adapter connections. */
    private readonly citationsAutoDetect;
    constructor(service: EngramAccessService, options?: {
        principal?: string;
        citationsEnabled?: boolean;
        citationsAutoDetect?: boolean;
    });
    /** Get clientInfo for a specific MCP session. Returns undefined for non-MCP requests. */
    getClientInfo(sessionId?: string): {
        name: string;
        version?: string;
    } | undefined;
    /** Pop the session ID generated during an initialize handshake, keyed by correlation ID. */
    popInitSessionId(correlationId: string): string | undefined;
    handleRequest(request: JsonRpcRequest, options?: {
        principalOverride?: string;
        sessionId?: string;
        correlationId?: string;
    }): Promise<Record<string, unknown> | null>;
    runStdio(input: Readable, output: Writable): Promise<void>;
    private scheduleFlush;
    private flushBuffer;
    private writeMessage;
    /**
     * Determine whether oai-mem-citation guidance should be appended to recall.
     * Returns true when explicitly enabled via config OR when auto-detect is
     * active and the current MCP session belongs to a Codex adapter client.
     *
     * When no sessionId is provided (e.g., stdio transport where there are no
     * HTTP headers carrying mcp-session-id), fall back to checking if there is
     * exactly one known session whose clientInfo matches the Codex pattern.
     * This covers the common stdio case where a single client connection exists.
     */
    private shouldEmitCitations;
    /** Check whether a clientInfo record identifies a Codex adapter client. */
    private isCodexClient;
    /**
     * Build citation metadata for each recall result that has a path.
     * Line range defaults to 1-1 when not determinable from the summary.
     */
    private buildRecallCitations;
    private callTool;
}

export { EngramMcpServer };
