/** * WebSocket transport for the Premiere bridge — used by the **UXP** plugin. * * Why this exists separately from `PremiereHttpBridge`: * * UXP plugins **cannot listen on TCP ports**. Adobe sandboxes the Node-ish * runtime they expose — `require("ws").Server` and `http.createServer` are * not reachable. So unlike the CEP path (panel = HTTP server, ggeditor = * HTTP client), the UXP path **flips the transport**: * * - ggeditor (this side) hosts a localhost WebSocket server. * - The UXP plugin connects out to it on launch and stays connected. * - RPC requests flow ggeditor → plugin; responses come back on the same * socket, correlated by an integer `id`. * * Wire shape (mirrors the HTTP /rpc shape so the adapter doesn't care): * * plugin → server (initial frame, exactly once): * { kind: "hello", product, panelKind: "uxp", version } * * server → plugin (per RPC): * { id: "1", method: "get_timeline", params: {} } * * plugin → server (response): * { id: "1", ok: true, result: ... } * { id: "1", ok: false, error: "..." } * * The bridge surfaces the same `health()` / `call()` API as `PremiereHttpBridge` * so the dispatcher in `bridge.ts` can treat both transports uniformly. */ import type { PanelHealth } from "./http-bridge.js"; export interface WsBridgeOptions { /** First port to try. Defaults to 7437 (matches the CEP panel). */ port?: number; /** Bind host. Always 127.0.0.1 in production. */ host?: string; /** Extra ports to try if `port` is busy. Defaults to 7438..7443. */ fallbackPorts?: number[]; } /** * Hosts a localhost WebSocket server. The Premiere UXP plugin connects out. * Exactly one active socket at a time — if a second client connects, the * older one is dropped (most recent connection wins, matches the "user * relaunched the panel" expectation). */ export declare class PremiereWsBridge { private readonly desiredPort; private readonly host; private readonly fallbackPorts; private httpServer?; private wss?; private boundPort?; private socket?; private hello?; private waitingForHello; private nextId; private pending; constructor(opts?: WsBridgeOptions); /** * The port the WS server is actually bound to (after fallback resolution). * Undefined until `start()` resolves. */ getPort(): number | undefined; /** * Start the WS server. Tries `desiredPort` first, then each `fallbackPorts` * entry. Resolves once a port is bound; rejects if every candidate is busy. */ start(): Promise; private listenOn; private onConnection; private onMessage; /** * Wait for the hello frame from a connected plugin. Returns the hello * payload (mirrors `PanelHealth` so `bridge.ts` can treat WS + HTTP the * same), or null if no plugin connects within `timeoutMs`. */ health(timeoutMs?: number): Promise; /** * Round-trip an RPC. Throws if no plugin is connected, the call is * aborted, or the plugin returns an error response. */ call(method: string, params?: Record, opts?: { signal?: AbortSignal; }): Promise; /** * Stop accepting connections, close the active socket, and reject all * pending calls. Safe to call multiple times. */ shutdown(): void; } //# sourceMappingURL=ws-bridge.d.ts.map