/** * Gateway runtime. Starts a set of {@link Connector}s in parallel, blocks on * SIGINT/SIGTERM, then stops them via Promise.allSettled so one failing stop * cannot strand the rest. * * Signal handling is injectable so tests can drive shutdown without sending * real signals to the test runner. */ import type { Connector, ConnectorStatus } from "./connector.js"; export interface RunGatewayOptions { /** Connectors to run. Order is preserved in status output. */ connectors: Connector[]; /** * Returns a promise that resolves when the runtime should shut down. * Default: resolves on SIGINT or SIGTERM. */ waitForShutdown?: () => Promise; /** Logger; defaults to console.error so info lines never pollute stdout JSON. */ log?: (msg: string) => void; } export interface GatewayStatusReport { ready: boolean; connectors: Array<{ name: string; } & ConnectorStatus>; } /** * Compute a status snapshot for a set of connectors. Pure — no I/O. The * aggregate `ready` is true only when every connector reports ready. */ export declare function getGatewayStatus(connectors: Connector[]): GatewayStatusReport; /** * Resolve on SIGINT/SIGTERM. Exported so it can be tested without sending * real signals to the test runner: tests inject a fake `proc` with the same * shape as `process` and assert listener attach/detach. */ export declare function waitForSignals(proc?: Pick, log?: (msg: string) => void): Promise; /** * Run the gateway until shutdown. Returns when all connectors have stopped. * Throws if no connectors are provided — callers should fail loudly when their * `--only` filter or env config produced an empty set. */ export declare function runGateway(opts: RunGatewayOptions): Promise; /** * Build a filtered list of connectors from a registry by name. Names not in * the registry are reported back so the caller can decide whether to error. */ export declare function selectConnectors(registry: Record T>, names: string[]): { connectors: T[]; unknown: string[]; }; /** * Parse a comma-separated `--only` value into a list of trimmed, non-empty * connector names. */ export declare function parseOnlyFlag(value: string | undefined): string[] | undefined;