import { type ClarionEngine, type ClarionEvent, type EngineKind, type EngineState, type Listener, type Unsubscribe } from '@clarionhq/core'; import { type AzureEngineOptions, type FlatAzureEngineOptions } from './AzureEngineConfig'; export type { AzureAuth, AzureEngineOptions, AzureRecognition, AzureAdvanced, AzureAutoRetryConfig, AzureTelemetry, AzureOutputFormat, AzureProfanityFilter, FlatAzureEngineOptions, } from './AzureEngineConfig'; /** @internal — test helper to clear the pre-flight cache between specs. */ export declare const __resetPreflightCache: () => void; /** * Probe whether the Azure Speech SDK is reachable with the supplied credentials. * Best-effort: returns true on a successful 1-token auth handshake, false otherwise. * Use before `start()` to fail fast on bad keys / wrong region. * * Accepts the grouped options (preferred) OR the flat 0.1.x shape (deprecated). */ export declare const isAzureAvailable: (options: AzureEngineOptions | FlatAzureEngineOptions) => Promise; /** * Microsoft Cognitive Services Speech SDK wrapped behind `ClarionEngine`. * Final transcript surfaces via the `'final'` event, not the `stop()` promise. */ export declare class AzureEngine implements ClarionEngine { readonly kind: EngineKind; /** See top-level `isAzureAvailable`. */ static isAvailable: (options: AzureEngineOptions | FlatAzureEngineOptions) => Promise; private readonly emitter; private readonly native; private readonly listenerIds; /** Canonical options after normalization (and any tokenProvider results applied). */ private opts; /** Most recent token from a `tokenProvider`, if any. */ private currentToken; /** Token-refresh background timer. Null when auth mode isn't `tokenProvider`. */ private tokenTimer; /** AppState observer for backgrounding. Null when `autoStopOnBackground: false`. */ private appStateObserver; /** NetInfo observer for mid-session drops. Always created; no-ops if NetInfo isn't installed. */ private networkObserver; /** Telemetry state for the current session. Reset on each `start()`. */ private sessionId; private sessionStartMs; private sessionPhraseCount; private sessionHadError; /** Heartbeat for `onUsageUpdate`. */ private usageTimer; /** Per-session accumulated finals (for persistFinals + replay). */ private accumulatedFinals; /** Held-onto session id for `replay()` even after a session ends. */ private lastSessionId; private currentState; constructor(rawOptions: AzureEngineOptions | FlatAzureEngineOptions); get state(): EngineState; /** Readonly view of the canonical options as the engine sees them. */ get options(): Readonly; on(listener: Listener): Unsubscribe; prepare(): Promise; start(): Promise; pause(): Promise; resume(): Promise; stop(): Promise; discard(): Promise; release(): Promise; /** * Replace the current Azure auth token (e.g. when refreshing a short-lived * STS token before it expires). Safe to call at any state — the change * takes effect on the next websocket reconnect / `start()`. * * For `tokenProvider`-based auth, prefer letting the engine refresh * automatically via the timer instead of calling this manually. */ updateAuthToken(token: string): Promise; private prepareOnce; /** * Validate `(subscriptionKey, region)` via Azure's STS endpoint. Only runs * for subscriptionKey auth — other modes validate via their own paths. */ private preflightAuth; /** * Race the native prepare against the configured timeout. Without this the * SDK can sit forever on a slow / blocked / proxied network and never * surface a real error. */ private withPrepareTimeout; /** * Azure auth tokens are time-signed; surface a clean INVALID_CONFIG when * the device clock is grossly wrong instead of a cryptic AUTH_FAILED later. */ private assertClockNotSkewed; private startOnce; /** * Install AppState + NetInfo observers for the current session; both * auto-tear-down via stop/discard/release. */ private startEnvironmentObservers; private stopEnvironmentObservers; private applyRefreshedToken; private buildCurrentNativeConfig; private bindNativeListeners; /** Latest pending partial waiting to be emitted (debounce buffer). */ private pendingPartial; /** Timer for the debounce — fires the latest pending partial. */ private partialTimer; /** * Emit a partial result, optionally debounced. Azure's `Recognizing` events * can fire 5-10×/sec; without throttling the UI re-renders constantly and * text flickers. Default debounce is 100 ms — feels real-time but renders * at a sane rate. */ private emitPartialDebounced; private flushPendingPartial; /** * Emit `'audio-confidence'` when a final's aggregate confidence falls below * the user-configured threshold. Lets UIs show "audio looks unclear" hints * without devs having to inspect every transcript. */ private maybeEmitLowConfidence; private transitionTo; private setState; private emitFinal; private emitError; private emitWarning; private fireSessionStart; private fireSessionEnd; private startUsageHeartbeat; private stopUsageHeartbeat; /** Write the current accumulator to storage. Fire-and-forget; errors emit a warning. */ private persistFinalsAsync; private clearPersistedFinalsAsync; private persistKey; /** * Re-emit a persisted session's finals as `'final'` events. Returns the * count replayed (0 if nothing persisted under that sessionId). */ replay(sessionId: string): Promise; private invokeTelemetry; private toTranscriptResult; private toTranscriptSegment; private toClarionError; private handleNativeError; } //# sourceMappingURL=AzureEngine.d.ts.map