/** * Stable data-plane front door whose internal router generation can be * replaced atomically. * * A singleton daemon keeps this listener for its whole lifetime. Reload builds * a complete router on an ephemeral loopback port, calls `swapTarget`, then * drains the old router. Requests accepted before the swap stay attached to * the old generation; later requests immediately use the new one. */ import { type RouteKitPlatform } from "@velum-labs/routekit-runtime/effect"; import { Effect } from "effect"; import { type GatewayPrincipal } from "./http/auth.js"; export type SwitchingGatewayProxy = { url(): string; port(): number; target(): string; swapTarget(target: string): string; waitForTargetIdle(target: string, graceMs: number): Effect.Effect; retire(graceMs?: number): Effect.Effect; drain(graceMs?: number): Effect.Effect; readonly close: Effect.Effect; }; export type SwitchingGatewayProxyOptions = { target: string; /** Running daemon package version captured by its loaded module. */ packageVersion?: string; host?: string; port?: number; authToken?: string; /** Maximum wait for the active generation to return response headers. */ upstreamHeadersTimeoutMs?: number; /** Resolve a named data-plane principal; preferred over `authToken` alone. */ resolveDataPrincipal?: (presented: string) => GatewayPrincipal | undefined; }; export declare function startSwitchingGatewayProxyEffect(input: SwitchingGatewayProxyOptions): Effect.Effect; /** Promise adapter for the singleton daemon host. */ export declare function startSwitchingGatewayProxy(input: SwitchingGatewayProxyOptions): Promise;