import { EventKind, EventPayload, RequestKind, RequestParams, RequestResult } from './protocol'; import { MessageChannel } from './channel'; export interface RequestContext { /** AbortSignal that triggers when a cancel-envelope is received from the client. * A handler can pass it into the underlying fetch to cancel the network * operation. Ignoring it is also OK — older handlers keep working. */ signal: AbortSignal; } export type RequestHandler = (params: RequestParams, ctx: RequestContext) => Promise> | RequestResult; export declare class TransportServer { private handlers; private channels; /** Active requests per channel: channel → id → AbortController. On a cancel * envelope we find the controller and abort it. On disconnect — abort all. */ private active; constructor(); on(kind: K, handler: RequestHandler): void; off(kind: K): void; /** Attach a channel. The server starts handling requests from it and * includes it in broadcasts. On disconnect it automatically removes it and * aborts all in-flight handlers for that channel. */ accept(channel: MessageChannel): void; /** Fan-out an event to all connected channels. */ broadcast(kind: K, payload: EventPayload): void; /** Size of the active pool — for health-check / offscreen cleanup * (if 0, the host can close the offscreen document). */ get connectionCount(): number; private dispatch; private respondOk; private respondErr; } //# sourceMappingURL=transport-server.d.ts.map