import http from "http"; import type { ExportedItem } from "../types.js"; import type { Logger } from "../../logger.js"; export type HandlerConfig = { exports: ExportedItem[]; logger: Logger; hasInterrupts: (data: unknown) => boolean; respondToInterrupts: (interrupts: unknown[], responses: unknown[]) => Promise; }; export type HttpConfig = HandlerConfig & { port: number; apiKey?: string; /** Interface to bind to. Default "127.0.0.1" (loopback only). */ host?: string; /** * Allowed Host: header values (DNS-rebinding defense). If unset, defaults * are derived from `host`: loopback binds get an allowlist of loopback * names. Non-loopback binds skip Host validation by default (the strict * API key requirement mitigates DNS rebinding there); pass an explicit * array to lock the server down to specific hostnames. */ allowedHosts?: string[]; }; export type RouteResult = { status: number; body: unknown; }; export declare function createHttpHandler(config: HandlerConfig): (method: string, path: string, body: unknown) => Promise; export declare function startHttpServer(config: HttpConfig): http.Server;