import { IConnection } from "../common/Exports.js"; import { SpeechConnectionMessage } from "./SpeechConnectionMessage.Internal.js"; /** * Inline commit: the outbound side of inline commit for one recognizer. Sends audio.commit * messages, holds a commit until the turn has sent its first audio message, and keeps the * bookkeeping of unacknowledged commits (InlineCommitTracker) in step with the audio sent. * * The recognizer decides whether a commit read from the stream is handled at all (session * state, recognizer type); everything after that is here. */ export declare class InlineCommitSender { private privTracker; private privTurnAudioStarted; private privHeldCommit; private privGetRequestId; constructor(getRequestId: () => string); /** * The commit token of a final result message, or 0. The token is in the phrase object: * at the top level of speech.phrase and translation.phrase, and in the nested * SpeechPhrase of translation.response. */ static tokenFromMessage(message: SpeechConnectionMessage): number; /** * Discards all commit state, at the start and end of a recognition. */ reset(reason: string): void; /** * A new turn begins on the same connection; it opens with its wave header. */ onNewTurn(): void; /** * The turn ended or the connection was replaced. A held commit is dropped; if it is still * pending it is re-sent with the replayed audio. */ onTurnClosed(reason: string): void; /** * The turn has sent its first audio message. A held commit is released and queued on the * connection after that message. */ onTurnAudioStarted(connection: IConnection): void; /** * A commit read from the audio stream, at the given position, that the recognizer has * accepted. Sent unless the bookkeeping refuses it. */ onCommitRead(connection: IConnection, token: number, channelId: number | undefined, offsetBytes: number): void; /** * Audio up to the given position has been sent. Pending commits it has reached after a * replay are re-sent. */ onAudioSent(connection: IConnection, endBytes: number): void; /** * Audio is being replayed from the given position (new connection or new turn). Pending * commits are re-placed relative to the replayed audio; those at its start go first. */ onReplay(connection: IConnection, replayStartBytes: number): void; /** * A final result acknowledged the commit with the given token. */ onAcknowledged(token: number): void; private sendResendable; private send; private dropHeldCommit; }