/** * Navidrome MCP Server - Web UI stream limiter * Copyright (C) 2025 * SPDX-License-Identifier: AGPL-3.0-or-later */ import type { ServerResponse } from 'node:http'; export type StreamRoute = '/api/events' | '/api/guest/events' | '/api/visualizer'; export type StreamPool = 'guest' | 'host'; export declare const STREAMS_PER_SESSION_ROUTE = 3; export declare const STREAMS_PER_ADDRESS = 6; export declare const MAX_HOST_STREAMS = 200; export declare const STREAMS_PER_GUEST_PAGE = 2; export declare const MAX_GUEST_STREAMS: number; export declare const REFUSED_STREAM_RETRY_MS = 10000; export declare const STREAM_EVICTED_EVENT = "evicted"; /** * Caps the open SSE streams, since each one holds a socket and a write buffer for as long as the peer * stays. A stream over a per-session or per-address cap closes the oldest stream in its scope. A * stream over the cap of its pool, guest or host, is refused, so a flood never evicts a quiet client. * An evicted stream receives the evicted event before it closes. */ export declare class StreamLimiter { private readonly open; /** Returns false when the cap of the stream's pool refuses it, and leaves `res` untouched. */ admit(res: ServerResponse, route: StreamRoute, pool: StreamPool, sessionId: string | null, remoteAddress: string | undefined): boolean; } //# sourceMappingURL=stream-limiter.d.ts.map