import type { Server } from 'http'; import { type BridgeResult } from './protocol.js'; export interface BridgeContextFrame { describeView?: unknown; selection?: unknown; } export interface BridgeGatewayOptions { /** Authorize a tab registration. Return false to reject the socket. */ authenticate: (apiKey: string, thread: string) => boolean | Promise; callTimeoutMs?: number; confirmTimeoutMs?: number; /** Invoked with piggybacked describeView/selection context from the tab. */ onContext?: (thread: string, context: BridgeContextFrame) => void; onTabChange?: (thread: string, event: 'connect' | 'disconnect') => void; } export declare class BridgeGateway { private readonly authenticate; private readonly callTimeoutMs; private readonly confirmTimeoutMs; private readonly onContext?; private readonly onTabChange?; private readonly tabs; private nextId; private readonly wss; constructor(opts: BridgeGatewayOptions); /** * Claim WS upgrades for `path` on an existing http.Server. Leaves upgrades * for other paths untouched (cumulus federation pattern). */ attach(server: Server, path?: string): this; /** Manifest of the currently connected tab for a thread, or null. */ manifest(thread: string): unknown; hasTab(thread: string): boolean; /** * Dispatch a command to the thread's tab. Resolves with the tab's * { ok, summary, data?, affected? } result, a timeout result, or the * graceful no-session result — never rejects. */ call(thread: string, command: string, params?: object): Promise; /** * Export-tier dispatch: sends a confirm-request and executes only after the * tab reports the user accepted. Declined or timed-out confirms resolve to an * ok:false result. Never rejects. */ callWithConfirm(thread: string, command: string, params?: object, summary?: string): Promise; close(): void; private awaitResult; private onConnection; private dropTab; } //# sourceMappingURL=gateway.d.ts.map