import type { Server as HttpServer } from "node:http"; import type { WebSocketServer } from "ws"; import type { CanvasHostHandler, CanvasHostServer } from "../canvas-host/server.js"; import type { HeartbeatRunner } from "../infra/heartbeat-runner.js"; import type { PluginServicesHandle } from "../plugins/services.js"; import { type ChannelId } from "../channels/plugins/index.js"; export declare function createGatewayCloseHandler(params: { bonjourStop: (() => Promise) | null; tailscaleCleanup: (() => Promise) | null; canvasHost: CanvasHostHandler | null; canvasHostServer: CanvasHostServer | null; stopChannel: (name: ChannelId, accountId?: string) => Promise; pluginServices: PluginServicesHandle | null; cron: { stop: () => void; }; heartbeatRunner: HeartbeatRunner; nodePresenceTimers: Map>; broadcast: (event: string, payload: unknown, opts?: { dropIfSlow?: boolean; }) => void; tickInterval: ReturnType; healthInterval: ReturnType; dedupeCleanup: ReturnType; agentUnsub: (() => void) | null; heartbeatUnsub: (() => void) | null; chatRunState: { clear: () => void; }; clients: Set<{ socket: { close: (code: number, reason: string) => void; }; }>; configReloader: { stop: () => Promise; }; browserControl: { stop: () => Promise; } | null; wss: WebSocketServer; httpServer: HttpServer; httpServers?: HttpServer[]; }): (opts?: { reason?: string; restartExpectedMs?: number | null; }) => Promise;