/**
 * HTTP API Server
 *
 * REST API for browser-based clients to query the local .codragraph/ index.
 * Also hosts the MCP server over StreamableHTTP for remote AI tool access.
 *
 * Security: binds to localhost by default (use --host to override).
 * CORS is restricted to localhost, private/LAN networks, and the deployed site.
 */
import express from 'express';
import { type GraphNode, type GraphRelationship } from '../_shared/index.js';
import { type WebDashboardMode } from './web-dashboard.js';
/**
 * Determine whether an HTTP Origin header value is allowed by CORS policy.
 *
 * Permitted origins:
 * - No origin (non-browser requests such as curl or server-to-server calls)
 * - http://localhost:<port> — local development
 * - http://127.0.0.1:<port> — loopback alias
 * - RFC 1918 private/LAN networks (any port):
 *     10.0.0.0/8      → 10.x.x.x
 *     172.16.0.0/12   → 172.16.x.x – 172.31.x.x
 *     192.168.0.0/16  → 192.168.x.x
 * - Hosted CodraGraph web UI — defaults to https://codragraph.vercel.app
 *
 * @param origin - The value of the HTTP `Origin` request header, or `undefined`
 *                 when the header is absent (non-browser request).
 * @returns `true` if the origin is allowed, `false` otherwise.
 */
export declare const isAllowedOrigin: (origin: string | undefined) => boolean;
export interface CreateServerOptions {
    web?: WebDashboardMode;
}
type GraphStreamRecord = {
    type: 'node';
    data: GraphNode;
} | {
    type: 'relationship';
    data: GraphRelationship;
} | {
    type: 'error';
    error: string;
};
export declare class ClientDisconnectedError extends Error {
    constructor();
}
export declare const isIgnorableGraphQueryError: (err: unknown) => boolean;
export interface GraphStoreErrorResponse {
    error: string;
    code: 'GRAPHSTORE_CORRUPT';
    operation: string;
    recovery: string[];
}
export declare const isGraphStoreCorruptionError: (err: unknown) => boolean;
export declare const getGraphStoreErrorResponse: (err: unknown, operation: string) => GraphStoreErrorResponse | null;
export declare const writeNdjsonRecord: (res: express.Response, record: GraphStreamRecord, signal?: AbortSignal) => Promise<void>;
export declare const streamGraphNdjson: (res: express.Response, includeContent?: boolean, signal?: AbortSignal) => Promise<void>;
export declare const createServer: (port: number, host?: string, options?: CreateServerOptions) => Promise<void>;
export {};
