import type { MultiModelConfig } from '@zhixuan92/multi-model-agent-core'; /** A running server handle returned by startServe(). */ interface ServeHandle { /** The port the server is listening on (useful when port=0 for ephemeral). */ port: number; /** * Gracefully shut down the server. * Removes any registered SIGTERM/SIGINT handlers to prevent leaks. * After this resolves, the process is no longer listening and may exit safely. */ stop(): Promise; } /** * Wait for in-flight tasks to finish, bounded by `server.limits.shutdownDrainMs`. * * Shutdown already refuses new dispatches before this runs, so the set can only * shrink. Polling is the right shape here rather than a completion hook: the * registry is the single source of truth for what is running, and a hook would * be a second bookkeeping path that could disagree with it. * * Returns after the set empties or the budget expires — never rejects, because a * drain that fails must not turn a graceful shutdown into a crash. What remains * is reported, so an operator can see the work that did not get to finish. */ export declare function drainInFlightTasks(registry: { allInFlight?: () => unknown[]; } | undefined, budgetMs: number, stderr: (s: string) => boolean): Promise; /** * Start the HTTP server with the given config. * * Registers SIGTERM and SIGINT handlers that drain in-flight requests and * exit the process cleanly: new dispatches are refused immediately, then the * server waits up to `server.limits.shutdownDrainMs` for what is already * running to finish. A second signal skips the remaining wait. * * @param config Full MultiModelConfig (includes agents.*, defaults, diagnostics, * and server block). startServer() inspects the agents.* field * and enables real tool handlers when present. * @param exit Process exit function — defaults to process.exit. * Exposed so tests can suppress actual exits. */ export declare function startServe(config: MultiModelConfig, exit?: (code: number) => never, configPath?: string): Promise; export {}; //# sourceMappingURL=serve.d.ts.map