import type { Resource } from "webappwiz/disposable"; import type { Transcriber } from "./transcriber.js"; /** The socket a relay answers on: a server's end of the page's `DictationSocket`. */ export interface DictationPeer { send(message: string): void; /** Ends the take's socket, once it is done or failed. */ hangUp(): void; } /** * One take's socket on the server, relaying the page's audio to a * transcription and its text back as {@link DictationMessage}s. Hand * `receive` each message the socket gets, and dispose it when the socket * closes, which takes the transcription with it. */ export declare class DictationRelay implements Resource { private readonly peer; /** The take's transcription, or nothing once it failed to start. */ private readonly transcription; /** * Starts listening at once. A `transcriber` that rejects with a * {@link DictationFailure} names the cred it needs to the page. */ constructor(peer: DictationPeer, transcriber: Promise); /** Takes audio as bytes, PCM16 at `SAMPLE_RATE`, and "finish" as text. */ receive(message: string | Uint8Array): void; dispose(): void; private say; }