@volley/recognition-client-sdk 0.1.296 → 0.1.381

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1163 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Provider types and enums for recognition services
5
+ * NOTE_TO_AI: DO NOT CHANGE THIS UNLESS EXPLICITLY ASKED. Always ask before making any changes.
6
+ */
7
+ /**
8
+ * Supported speech recognition providers
9
+ */
10
+ declare enum RecognitionProvider {
11
+ ASSEMBLYAI = "assemblyai",
12
+ DEEPGRAM = "deepgram",
13
+ ELEVENLABS = "elevenlabs",
14
+ FIREWORKS = "fireworks",
15
+ GOOGLE = "google",
16
+ GEMINI_BATCH = "gemini-batch",
17
+ OPENAI_BATCH = "openai-batch",
18
+ OPENAI_REALTIME = "openai-realtime"
19
+ }
20
+ /**
21
+ * ASR API type - distinguishes between streaming and file-based transcription APIs
22
+ * - STREAMING: Real-time streaming APIs (Deepgram, AssemblyAI, Google)
23
+ * - FILE_BASED: File upload/batch APIs (OpenAI Batch, Gemini Batch)
24
+ */
25
+ declare enum ASRApiType {
26
+ STREAMING = "streaming",
27
+ FILE_BASED = "file-based"
28
+ }
29
+ /**
30
+ * Deepgram model names
31
+ */
32
+ declare enum DeepgramModel {
33
+ NOVA_2 = "nova-2",
34
+ NOVA_3 = "nova-3",
35
+ FLUX_GENERAL_EN = "flux-general-en"
36
+ }
37
+ /**
38
+ * Google Cloud Speech models
39
+ * @see https://cloud.google.com/speech-to-text/docs/transcription-model
40
+ * @see https://cloud.google.com/speech-to-text/v2/docs/chirp_3-model
41
+ */
42
+ declare enum GoogleModel {
43
+ CHIRP_3 = "chirp_3",
44
+ CHIRP_2 = "chirp_2",
45
+ CHIRP = "chirp",
46
+ LATEST_LONG = "latest_long",
47
+ LATEST_SHORT = "latest_short",
48
+ TELEPHONY = "telephony",
49
+ TELEPHONY_SHORT = "telephony_short",
50
+ DEFAULT = "default",
51
+ COMMAND_AND_SEARCH = "command_and_search",
52
+ PHONE_CALL = "phone_call",
53
+ VIDEO = "video"
54
+ }
55
+ /**
56
+ * Fireworks AI models for ASR
57
+ * @see https://docs.fireworks.ai/guides/querying-asr-models
58
+ * @see https://fireworks.ai/models/fireworks/fireworks-asr-large
59
+ */
60
+ declare enum FireworksModel {
61
+ ASR_V1 = "fireworks-asr-large",
62
+ ASR_V2 = "fireworks-asr-v2",
63
+ WHISPER_V3 = "whisper-v3",
64
+ WHISPER_V3_TURBO = "whisper-v3-turbo"
65
+ }
66
+ /**
67
+ * ElevenLabs Scribe models for speech-to-text
68
+ * @see https://elevenlabs.io/blog/introducing-scribe-v2-realtime
69
+ * @see https://elevenlabs.io/docs/cookbooks/speech-to-text/streaming
70
+ * @see https://elevenlabs.io/docs/api-reference/speech-to-text/convert
71
+ */
72
+ declare enum ElevenLabsModel {
73
+ SCRIBE_V2_REALTIME = "scribe_v2_realtime",
74
+ SCRIBE_V1 = "scribe_v1"
75
+ }
76
+ /**
77
+ * OpenAI Realtime API transcription models
78
+ * These are the verified `input_audio_transcription.model` values.
79
+ * @see https://platform.openai.com/docs/guides/realtime
80
+ */
81
+ declare enum OpenAIRealtimeModel {
82
+ GPT_4O_MINI_TRANSCRIBE = "gpt-4o-mini-transcribe"
83
+ }
84
+ /**
85
+ * Type alias for any model from any provider
86
+ */
87
+ type RecognitionModel = DeepgramModel | GoogleModel | FireworksModel | ElevenLabsModel | OpenAIRealtimeModel | string;
88
+
89
+ /**
90
+ * Audio encoding types
91
+ */
92
+ declare enum AudioEncoding {
93
+ ENCODING_UNSPECIFIED = 0,
94
+ LINEAR16 = 1,
95
+ OGG_OPUS = 2,
96
+ FLAC = 3,
97
+ MULAW = 4,
98
+ ALAW = 5
99
+ }
100
+ declare namespace AudioEncoding {
101
+ /**
102
+ * Convert numeric ID to AudioEncoding enum
103
+ * @param id - Numeric encoding identifier (0-5)
104
+ * @returns AudioEncoding enum value or undefined if invalid
105
+ */
106
+ function fromId(id: number): AudioEncoding | undefined;
107
+ /**
108
+ * Convert string name to AudioEncoding enum
109
+ * @param nameStr - String name like "linear16", "LINEAR16", "ogg_opus", "OGG_OPUS", etc. (case insensitive)
110
+ * @returns AudioEncoding enum value or undefined if invalid
111
+ */
112
+ function fromName(nameStr: string): AudioEncoding | undefined;
113
+ /**
114
+ * Convert AudioEncoding enum to numeric ID
115
+ * @param encoding - AudioEncoding enum value
116
+ * @returns Numeric ID (0-5)
117
+ */
118
+ function toId(encoding: AudioEncoding): number;
119
+ /**
120
+ * Convert AudioEncoding enum to string name
121
+ * @param encoding - AudioEncoding enum value
122
+ * @returns String name like "LINEAR16", "MULAW", etc.
123
+ */
124
+ function toName(encoding: AudioEncoding): string;
125
+ /**
126
+ * Check if a numeric ID is a valid encoding
127
+ * @param id - Numeric identifier to validate
128
+ * @returns true if valid encoding ID
129
+ */
130
+ function isIdValid(id: number): boolean;
131
+ /**
132
+ * Check if a string name is a valid encoding
133
+ * @param nameStr - String name to validate
134
+ * @returns true if valid encoding name
135
+ */
136
+ function isNameValid(nameStr: string): boolean;
137
+ }
138
+ /**
139
+ * Common sample rates (in Hz)
140
+ */
141
+ declare enum SampleRate {
142
+ RATE_8000 = 8000,
143
+ RATE_16000 = 16000,
144
+ RATE_22050 = 22050,
145
+ RATE_24000 = 24000,
146
+ RATE_32000 = 32000,
147
+ RATE_44100 = 44100,
148
+ RATE_48000 = 48000
149
+ }
150
+ declare namespace SampleRate {
151
+ /**
152
+ * Convert Hz value to SampleRate enum
153
+ * @param hz - Sample rate in Hz (8000, 16000, etc.)
154
+ * @returns SampleRate enum value or undefined if invalid
155
+ */
156
+ function fromHz(hz: number): SampleRate | undefined;
157
+ /**
158
+ * Convert string name to SampleRate enum
159
+ * @param nameStr - String name like "rate_8000", "RATE_16000", etc. (case insensitive)
160
+ * @returns SampleRate enum value or undefined if invalid
161
+ */
162
+ function fromName(nameStr: string): SampleRate | undefined;
163
+ /**
164
+ * Convert SampleRate enum to Hz value
165
+ * @param rate - SampleRate enum value
166
+ * @returns Hz value (8000, 16000, etc.)
167
+ */
168
+ function toHz(rate: SampleRate): number;
169
+ /**
170
+ * Convert SampleRate enum to string name
171
+ * @param rate - SampleRate enum value
172
+ * @returns String name like "RATE_8000", "RATE_16000", etc.
173
+ */
174
+ function toName(rate: SampleRate): string;
175
+ /**
176
+ * Check if a numeric Hz value is a valid sample rate
177
+ * @param hz - Hz value to validate
178
+ * @returns true if valid sample rate
179
+ */
180
+ function isHzValid(hz: number): boolean;
181
+ /**
182
+ * Check if a string name is a valid sample rate
183
+ * @param nameStr - String name to validate
184
+ * @returns true if valid sample rate name
185
+ */
186
+ function isNameValid(nameStr: string): boolean;
187
+ }
188
+ /**
189
+ * Supported languages for recognition
190
+ * Using BCP-47 language tags
191
+ */
192
+ declare enum Language {
193
+ ENGLISH_US = "en-US",
194
+ ENGLISH_GB = "en-GB",
195
+ SPANISH_ES = "es-ES",
196
+ SPANISH_MX = "es-MX",
197
+ FRENCH_FR = "fr-FR",
198
+ GERMAN_DE = "de-DE",
199
+ ITALIAN_IT = "it-IT",
200
+ PORTUGUESE_BR = "pt-BR",
201
+ JAPANESE_JP = "ja-JP",
202
+ KOREAN_KR = "ko-KR",
203
+ CHINESE_CN = "zh-CN",
204
+ CHINESE_TW = "zh-TW"
205
+ }
206
+
207
+ /**
208
+ * Recognition Result Types V1
209
+ * NOTE_TO_AI: DO NOT CHANGE THIS UNLESS EXPLICITLY ASKED. Always ask before making any changes.
210
+ * Types and schemas for recognition results sent to SDK clients
211
+ */
212
+
213
+ /**
214
+ * Message type discriminator for recognition results V1
215
+ */
216
+ declare enum RecognitionResultTypeV1 {
217
+ TRANSCRIPTION = "Transcription",
218
+ FUNCTION_CALL = "FunctionCall",
219
+ METADATA = "Metadata",
220
+ ERROR = "Error",
221
+ CLIENT_CONTROL_MESSAGE = "ClientControlMessage"
222
+ }
223
+ /**
224
+ * Transcription result V1 - contains transcript message
225
+ * In the long run game side should not need to know it. In the short run it is send back to client.
226
+ * NOTE_TO_AI: DO NOT CHANGE THIS UNLESS EXPLICITLY ASKED. Always ask before making any changes.
227
+ */
228
+ declare const TranscriptionResultSchemaV1: z.ZodObject<{
229
+ type: z.ZodLiteral<RecognitionResultTypeV1.TRANSCRIPTION>;
230
+ audioUtteranceId: z.ZodString;
231
+ finalTranscript: z.ZodString;
232
+ finalTranscriptConfidence: z.ZodOptional<z.ZodNumber>;
233
+ pendingTranscript: z.ZodOptional<z.ZodString>;
234
+ pendingTranscriptConfidence: z.ZodOptional<z.ZodNumber>;
235
+ is_finished: z.ZodBoolean;
236
+ voiceStart: z.ZodOptional<z.ZodNumber>;
237
+ voiceDuration: z.ZodOptional<z.ZodNumber>;
238
+ voiceEnd: z.ZodOptional<z.ZodNumber>;
239
+ startTimestamp: z.ZodOptional<z.ZodNumber>;
240
+ endTimestamp: z.ZodOptional<z.ZodNumber>;
241
+ receivedAtMs: z.ZodOptional<z.ZodNumber>;
242
+ accumulatedAudioTimeMs: z.ZodOptional<z.ZodNumber>;
243
+ }, "strip", z.ZodTypeAny, {
244
+ type: RecognitionResultTypeV1.TRANSCRIPTION;
245
+ audioUtteranceId: string;
246
+ finalTranscript: string;
247
+ is_finished: boolean;
248
+ finalTranscriptConfidence?: number | undefined;
249
+ pendingTranscript?: string | undefined;
250
+ pendingTranscriptConfidence?: number | undefined;
251
+ voiceStart?: number | undefined;
252
+ voiceDuration?: number | undefined;
253
+ voiceEnd?: number | undefined;
254
+ startTimestamp?: number | undefined;
255
+ endTimestamp?: number | undefined;
256
+ receivedAtMs?: number | undefined;
257
+ accumulatedAudioTimeMs?: number | undefined;
258
+ }, {
259
+ type: RecognitionResultTypeV1.TRANSCRIPTION;
260
+ audioUtteranceId: string;
261
+ finalTranscript: string;
262
+ is_finished: boolean;
263
+ finalTranscriptConfidence?: number | undefined;
264
+ pendingTranscript?: string | undefined;
265
+ pendingTranscriptConfidence?: number | undefined;
266
+ voiceStart?: number | undefined;
267
+ voiceDuration?: number | undefined;
268
+ voiceEnd?: number | undefined;
269
+ startTimestamp?: number | undefined;
270
+ endTimestamp?: number | undefined;
271
+ receivedAtMs?: number | undefined;
272
+ accumulatedAudioTimeMs?: number | undefined;
273
+ }>;
274
+ type TranscriptionResultV1 = z.infer<typeof TranscriptionResultSchemaV1>;
275
+ /**
276
+ * Function call result V1 - similar to LLM function call
277
+ * In the long run game server should know it, rather than TV or client.
278
+ */
279
+ declare const FunctionCallResultSchemaV1: z.ZodObject<{
280
+ type: z.ZodLiteral<RecognitionResultTypeV1.FUNCTION_CALL>;
281
+ audioUtteranceId: z.ZodString;
282
+ functionName: z.ZodString;
283
+ functionArgJson: z.ZodString;
284
+ }, "strip", z.ZodTypeAny, {
285
+ type: RecognitionResultTypeV1.FUNCTION_CALL;
286
+ audioUtteranceId: string;
287
+ functionName: string;
288
+ functionArgJson: string;
289
+ }, {
290
+ type: RecognitionResultTypeV1.FUNCTION_CALL;
291
+ audioUtteranceId: string;
292
+ functionName: string;
293
+ functionArgJson: string;
294
+ }>;
295
+ type FunctionCallResultV1 = z.infer<typeof FunctionCallResultSchemaV1>;
296
+ /**
297
+ * Metadata result V1 - contains metadata, timing information, and ASR config
298
+ * Sent when the provider connection closes to provide final timing metrics and config
299
+ * In the long run game server should know it, rather than TV or client.
300
+ */
301
+ declare const MetadataResultSchemaV1: z.ZodObject<{
302
+ type: z.ZodLiteral<RecognitionResultTypeV1.METADATA>;
303
+ audioUtteranceId: z.ZodString;
304
+ recordingStartMs: z.ZodOptional<z.ZodNumber>;
305
+ recordingEndMs: z.ZodOptional<z.ZodNumber>;
306
+ transcriptEndMs: z.ZodOptional<z.ZodNumber>;
307
+ socketCloseAtMs: z.ZodOptional<z.ZodNumber>;
308
+ duration: z.ZodOptional<z.ZodNumber>;
309
+ volume: z.ZodOptional<z.ZodNumber>;
310
+ accumulatedAudioTimeMs: z.ZodOptional<z.ZodNumber>;
311
+ costInUSD: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
312
+ apiType: z.ZodOptional<z.ZodNativeEnum<typeof ASRApiType>>;
313
+ asrConfig: z.ZodOptional<z.ZodString>;
314
+ rawAsrMetadata: z.ZodOptional<z.ZodString>;
315
+ }, "strip", z.ZodTypeAny, {
316
+ type: RecognitionResultTypeV1.METADATA;
317
+ audioUtteranceId: string;
318
+ recordingStartMs?: number | undefined;
319
+ recordingEndMs?: number | undefined;
320
+ transcriptEndMs?: number | undefined;
321
+ socketCloseAtMs?: number | undefined;
322
+ duration?: number | undefined;
323
+ volume?: number | undefined;
324
+ accumulatedAudioTimeMs?: number | undefined;
325
+ costInUSD?: number | undefined;
326
+ apiType?: ASRApiType | undefined;
327
+ asrConfig?: string | undefined;
328
+ rawAsrMetadata?: string | undefined;
329
+ }, {
330
+ type: RecognitionResultTypeV1.METADATA;
331
+ audioUtteranceId: string;
332
+ recordingStartMs?: number | undefined;
333
+ recordingEndMs?: number | undefined;
334
+ transcriptEndMs?: number | undefined;
335
+ socketCloseAtMs?: number | undefined;
336
+ duration?: number | undefined;
337
+ volume?: number | undefined;
338
+ accumulatedAudioTimeMs?: number | undefined;
339
+ costInUSD?: number | undefined;
340
+ apiType?: ASRApiType | undefined;
341
+ asrConfig?: string | undefined;
342
+ rawAsrMetadata?: string | undefined;
343
+ }>;
344
+ type MetadataResultV1 = z.infer<typeof MetadataResultSchemaV1>;
345
+ /**
346
+ * Error type enum V1 - categorizes different types of errors
347
+ */
348
+ declare enum ErrorTypeV1 {
349
+ AUTHENTICATION_ERROR = "authentication_error",
350
+ VALIDATION_ERROR = "validation_error",
351
+ PROVIDER_ERROR = "provider_error",
352
+ TIMEOUT_ERROR = "timeout_error",
353
+ QUOTA_EXCEEDED = "quota_exceeded",
354
+ CONNECTION_ERROR = "connection_error",
355
+ UNKNOWN_ERROR = "unknown_error"
356
+ }
357
+ /**
358
+ * Error result V1 - contains error message
359
+ * In the long run game server should know it, rather than TV or client.
360
+ */
361
+ declare const ErrorResultSchemaV1: z.ZodObject<{
362
+ type: z.ZodLiteral<RecognitionResultTypeV1.ERROR>;
363
+ audioUtteranceId: z.ZodString;
364
+ errorType: z.ZodOptional<z.ZodNativeEnum<typeof ErrorTypeV1>>;
365
+ message: z.ZodOptional<z.ZodString>;
366
+ code: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
367
+ description: z.ZodOptional<z.ZodString>;
368
+ }, "strip", z.ZodTypeAny, {
369
+ type: RecognitionResultTypeV1.ERROR;
370
+ audioUtteranceId: string;
371
+ errorType?: ErrorTypeV1 | undefined;
372
+ message?: string | undefined;
373
+ code?: string | number | undefined;
374
+ description?: string | undefined;
375
+ }, {
376
+ type: RecognitionResultTypeV1.ERROR;
377
+ audioUtteranceId: string;
378
+ errorType?: ErrorTypeV1 | undefined;
379
+ message?: string | undefined;
380
+ code?: string | number | undefined;
381
+ description?: string | undefined;
382
+ }>;
383
+ type ErrorResultV1 = z.infer<typeof ErrorResultSchemaV1>;
384
+
385
+ /**
386
+ * Recognition Context Types V1
387
+ * NOTE_TO_AI: DO NOT CHANGE THIS UNLESS EXPLICITLY ASKED. Always ask before making any changes.
388
+ * Types and schemas for recognition context data
389
+ */
390
+
391
+ /**
392
+ * Message type discriminator for recognition context V1
393
+ */
394
+ declare enum RecognitionContextTypeV1 {
395
+ GAME_CONTEXT = "GameContext",
396
+ CONTROL_SIGNAL = "ControlSignal",
397
+ ASR_REQUEST = "ASRRequest"
398
+ }
399
+ /**
400
+ * Control signal types for recognition V1
401
+ */
402
+ declare enum ControlSignalTypeV1 {
403
+ START_RECORDING = "start_recording",
404
+ STOP_RECORDING = "stop_recording"
405
+ }
406
+ /**
407
+ * Game context V1 - contains game state information
408
+ */
409
+ declare const GameContextSchemaV1: z.ZodObject<{
410
+ type: z.ZodLiteral<RecognitionContextTypeV1.GAME_CONTEXT>;
411
+ gameId: z.ZodString;
412
+ gamePhase: z.ZodString;
413
+ promptSTT: z.ZodOptional<z.ZodString>;
414
+ promptSTF: z.ZodOptional<z.ZodString>;
415
+ promptTTF: z.ZodOptional<z.ZodString>;
416
+ slotMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
417
+ }, "strip", z.ZodTypeAny, {
418
+ type: RecognitionContextTypeV1.GAME_CONTEXT;
419
+ gameId: string;
420
+ gamePhase: string;
421
+ promptSTT?: string | undefined;
422
+ promptSTF?: string | undefined;
423
+ promptTTF?: string | undefined;
424
+ slotMap?: Record<string, string[]> | undefined;
425
+ }, {
426
+ type: RecognitionContextTypeV1.GAME_CONTEXT;
427
+ gameId: string;
428
+ gamePhase: string;
429
+ promptSTT?: string | undefined;
430
+ promptSTF?: string | undefined;
431
+ promptTTF?: string | undefined;
432
+ slotMap?: Record<string, string[]> | undefined;
433
+ }>;
434
+ type GameContextV1 = z.infer<typeof GameContextSchemaV1>;
435
+
436
+ /**
437
+ * Unified ASR Request Configuration
438
+ *
439
+ * Provider-agnostic configuration for ASR (Automatic Speech Recognition) requests.
440
+ * This interface provides a consistent API for clients regardless of the underlying provider.
441
+ *
442
+ * All fields use library-defined enums for type safety and consistency.
443
+ * Provider-specific mappers will convert these to provider-native formats.
444
+ */
445
+
446
+ /**
447
+ * Final transcript stability modes
448
+ *
449
+ * Controls timeout duration for fallback final transcript after stopRecording().
450
+ * Similar to AssemblyAI's turn detection confidence modes but applied to our
451
+ * internal timeout mechanism when vendors don't respond with is_final=true.
452
+ *
453
+ * @see https://www.assemblyai.com/docs/speech-to-text/universal-streaming/turn-detection
454
+ */
455
+ declare enum FinalTranscriptStability {
456
+ /**
457
+ * Aggressive mode: 100ms timeout
458
+ * Fast response, optimized for short utterances and quick back-and-forth
459
+ * Use cases: IVR, quick commands, retail confirmations
460
+ */
461
+ AGGRESSIVE = "aggressive",
462
+ /**
463
+ * Balanced mode: 200ms timeout (default)
464
+ * Natural middle ground for most conversational scenarios
465
+ * Use cases: General customer support, tech support, typical voice interactions
466
+ */
467
+ BALANCED = "balanced",
468
+ /**
469
+ * Conservative mode: 400ms timeout
470
+ * Wait longer for providers, optimized for complex/reflective speech
471
+ * Use cases: Healthcare, complex queries, careful thought processes
472
+ */
473
+ CONSERVATIVE = "conservative",
474
+ /**
475
+ * Experimental mode: 10000ms (10 seconds) timeout
476
+ * Very long wait for batch/async providers that need significant processing time
477
+ * Use cases: Batch processing (Gemini, OpenAI Whisper), complex audio analysis
478
+ * Note: Should be cancelled immediately when transcript is received
479
+ */
480
+ EXPERIMENTAL = "experimental"
481
+ }
482
+ /**
483
+ * Unified ASR request configuration
484
+ *
485
+ * This configuration is used by:
486
+ * - Client SDKs to specify recognition parameters
487
+ * - Demo applications for user input
488
+ * - Service layer to configure provider sessions
489
+ *
490
+ * Core fields only - all provider-specific options go in providerOptions
491
+ *
492
+ * @example
493
+ * ```typescript
494
+ * const config: ASRRequestConfig = {
495
+ * provider: RecognitionProvider.GOOGLE,
496
+ * model: GoogleModel.LATEST_LONG,
497
+ * language: Language.ENGLISH_US,
498
+ * sampleRate: SampleRate.RATE_16000, // or just 16000
499
+ * encoding: AudioEncoding.LINEAR16,
500
+ * providerOptions: {
501
+ * google: {
502
+ * enableAutomaticPunctuation: true,
503
+ * interimResults: true,
504
+ * singleUtterance: false
505
+ * }
506
+ * }
507
+ * };
508
+ * ```
509
+ */
510
+ interface ASRRequestConfig {
511
+ /**
512
+ * The ASR provider to use
513
+ * Must be one of the supported providers in RecognitionProvider enum
514
+ */
515
+ provider: RecognitionProvider | string;
516
+ /**
517
+ * Optional model specification for the provider
518
+ * Can be provider-specific model enum or string
519
+ * If not specified, provider's default model will be used
520
+ */
521
+ model?: RecognitionModel;
522
+ /**
523
+ * Language/locale for recognition
524
+ * Use Language enum for common languages
525
+ * Can also accept BCP-47 language tags as strings
526
+ */
527
+ language: Language | string;
528
+ /**
529
+ * Audio sample rate in Hz
530
+ * Prefer using SampleRate enum values for standard rates
531
+ * Can also accept numeric Hz values (e.g., 16000)
532
+ */
533
+ sampleRate: SampleRate | number;
534
+ /**
535
+ * Audio encoding format
536
+ * Must match the actual audio data being sent
537
+ * Use AudioEncoding enum for standard formats
538
+ */
539
+ encoding: AudioEncoding | string;
540
+ /**
541
+ * Enable interim (partial) results during recognition
542
+ * When true, receive real-time updates before finalization
543
+ * When false, only receive final results
544
+ * Default: false
545
+ */
546
+ interimResults?: boolean;
547
+ /**
548
+ * Require GameContext before starting recognition such as song titles
549
+ * When true, server waits for GameContext message before processing audio
550
+ * When false, recognition starts immediately
551
+ * Default: false
552
+ */
553
+ useContext?: boolean;
554
+ /**
555
+ * Final transcript stability mode
556
+ *
557
+ * Controls timeout duration for fallback final transcript when provider
558
+ * doesn't respond with is_final=true after stopRecording().
559
+ *
560
+ * - aggressive: 100ms - fast response, may cut off slow providers
561
+ * - balanced: 200ms - current default, good for most cases
562
+ * - conservative: 400ms - wait longer for complex utterances
563
+ *
564
+ * @default 'balanced'
565
+ * @see FinalTranscriptStability enum for detailed descriptions
566
+ */
567
+ finalTranscriptStability?: FinalTranscriptStability | string;
568
+ /**
569
+ * Additional provider-specific options
570
+ *
571
+ * Common options per provider:
572
+ * - Deepgram: punctuate, smart_format, diarize, utterances
573
+ * - Google: enableAutomaticPunctuation, singleUtterance, enableWordTimeOffsets
574
+ * - AssemblyAI: formatTurns, filter_profanity, word_boost
575
+ *
576
+ * Note: interimResults is now a top-level field, but can still be overridden per provider
577
+ *
578
+ * @example
579
+ * ```typescript
580
+ * providerOptions: {
581
+ * google: {
582
+ * enableAutomaticPunctuation: true,
583
+ * singleUtterance: false,
584
+ * enableWordTimeOffsets: false
585
+ * }
586
+ * }
587
+ * ```
588
+ */
589
+ providerOptions?: Record<string, any>;
590
+ /**
591
+ * Optional fallback ASR configurations
592
+ *
593
+ * List of alternative ASR configurations to use if the primary fails.
594
+ * Each fallback config is a complete ASRRequestConfig that will be tried
595
+ * in order until one succeeds.
596
+ *
597
+ * @example
598
+ * ```typescript
599
+ * fallbackModels: [
600
+ * {
601
+ * provider: RecognitionProvider.DEEPGRAM,
602
+ * model: DeepgramModel.NOVA_2,
603
+ * language: Language.ENGLISH_US,
604
+ * sampleRate: 16000,
605
+ * encoding: AudioEncoding.LINEAR16
606
+ * },
607
+ * {
608
+ * provider: RecognitionProvider.GOOGLE,
609
+ * model: GoogleModel.LATEST_SHORT,
610
+ * language: Language.ENGLISH_US,
611
+ * sampleRate: 16000,
612
+ * encoding: AudioEncoding.LINEAR16
613
+ * }
614
+ * ]
615
+ * ```
616
+ */
617
+ fallbackModels?: ASRRequestConfig[];
618
+ }
619
+
620
+ /**
621
+ * Standard stage/environment constants used across all services
622
+ */
623
+ declare const STAGES: {
624
+ readonly LOCAL: "local";
625
+ readonly DEV: "dev";
626
+ readonly STAGING: "staging";
627
+ readonly PRODUCTION: "production";
628
+ };
629
+ type Stage = typeof STAGES[keyof typeof STAGES];
630
+
631
+ /**
632
+ * Generic WebSocket protocol types and utilities
633
+ * Supports flexible versioning and message types
634
+ * Used by both client and server implementations
635
+ */
636
+
637
+ /**
638
+ * Base message structure - completely flexible
639
+ * @template V - Version type (number, string, etc.)
640
+ */
641
+ interface Message<V = number> {
642
+ v: V;
643
+ type: string;
644
+ data?: unknown;
645
+ }
646
+ /**
647
+ * Version serializer interface
648
+ * Converts between version type V and byte representation
649
+ */
650
+ interface VersionSerializer<V> {
651
+ serialize: (v: V) => number;
652
+ deserialize: (byte: number) => V;
653
+ }
654
+
655
+ /**
656
+ * WebSocketAudioClient - Abstract base class for WebSocket clients
657
+ * Sends audio and control messages, receives responses from server
658
+ *
659
+ * Features:
660
+ * - Generic version type support (number, string, etc.)
661
+ * - Type-safe upward/downward message data
662
+ * - Client-side backpressure monitoring
663
+ * - Abstract hooks for application-specific logic
664
+ * - Format-agnostic audio protocol (supports any encoding)
665
+ */
666
+
667
+ type ClientConfig = {
668
+ url: string;
669
+ highWM?: number;
670
+ lowWM?: number;
671
+ };
672
+ /**
673
+ * WebSocketAudioClient - Abstract base class for WebSocket clients
674
+ * that send audio frames and JSON messages
675
+ *
676
+ * @template V - Version type (number, string, object, etc.)
677
+ * @template TUpward - Type of upward message data (Client -> Server)
678
+ * @template TDownward - Type of downward message data (Server -> Client)
679
+ *
680
+ * @example
681
+ * ```typescript
682
+ * class MyClient extends WebSocketAudioClient<number, MyUpMsg, MyDownMsg> {
683
+ * protected onConnected() {
684
+ * console.log('Connected!');
685
+ * }
686
+ *
687
+ * protected onMessage(msg) {
688
+ * console.log('Received:', msg.type, msg.data);
689
+ * }
690
+ *
691
+ * protected onDisconnected(code, reason) {
692
+ * console.log('Disconnected:', code, reason);
693
+ * }
694
+ *
695
+ * protected onError(error) {
696
+ * console.error('Error:', error);
697
+ * }
698
+ * }
699
+ *
700
+ * const client = new MyClient({ url: 'ws://localhost:8080' });
701
+ * client.connect();
702
+ * client.sendMessage(1, 'configure', { language: 'en' });
703
+ * client.sendAudio(audioData);
704
+ * ```
705
+ */
706
+ declare abstract class WebSocketAudioClient<V = number, // Version type (default: number)
707
+ TUpward = unknown, // Upward message data type
708
+ TDownward = unknown> {
709
+ private cfg;
710
+ protected versionSerializer: VersionSerializer<V>;
711
+ private ws;
712
+ private seq;
713
+ private HWM;
714
+ private LWM;
715
+ constructor(cfg: ClientConfig, versionSerializer?: VersionSerializer<V>);
716
+ /**
717
+ * Hook: Called when WebSocket connection is established
718
+ */
719
+ protected abstract onConnected(): void;
720
+ /**
721
+ * Hook: Called when WebSocket connection closes
722
+ * @param code - Close code (see WebSocketCloseCode enum)
723
+ * @param reason - Human-readable close reason
724
+ */
725
+ protected abstract onDisconnected(code: number, reason: string): void;
726
+ /**
727
+ * Hook: Called when WebSocket error occurs
728
+ */
729
+ protected abstract onError(error: Event): void;
730
+ /**
731
+ * Hook: Called when downward message arrives from server
732
+ * Override this to handle messages (optional - default does nothing)
733
+ */
734
+ protected onMessage(_msg: Message<V> & {
735
+ data: TDownward;
736
+ }): void;
737
+ connect(): void;
738
+ /**
739
+ * Send JSON message to server
740
+ * @param version - Message version
741
+ * @param type - Message type (developer defined)
742
+ * @param data - Message payload (typed)
743
+ */
744
+ sendMessage(version: V, type: string, data: TUpward): void;
745
+ /**
746
+ * Send audio frame with specified encoding and sample rate
747
+ * @param audioData - Audio data (any format: Int16Array, Uint8Array, ArrayBuffer, etc.)
748
+ * @param version - Audio frame version
749
+ * @param encodingId - Audio encoding ID (0-5, e.g., AudioEncoding.LINEAR16)
750
+ * @param sampleRate - Sample rate in Hz (e.g., 16000)
751
+ */
752
+ sendAudio(audioData: ArrayBuffer | ArrayBufferView, version: V, encodingId: number, sampleRate: number): void;
753
+ /**
754
+ * Get current WebSocket buffer size
755
+ */
756
+ getBufferedAmount(): number;
757
+ /**
758
+ * Check if local buffer is backpressured
759
+ */
760
+ isLocalBackpressured(): boolean;
761
+ /**
762
+ * Check if ready to send audio
763
+ * Verifies: connection open, no local buffer pressure
764
+ */
765
+ canSend(): boolean;
766
+ /**
767
+ * Check if connection is open
768
+ */
769
+ isOpen(): boolean;
770
+ /**
771
+ * Get current connection state
772
+ */
773
+ getReadyState(): number;
774
+ /**
775
+ * Close the WebSocket connection
776
+ * Protected method for subclasses to implement disconnect logic
777
+ * @param code - WebSocket close code (default: 1000 = normal closure)
778
+ * @param reason - Human-readable close reason
779
+ */
780
+ protected closeConnection(code?: number, reason?: string): void;
781
+ }
782
+
783
+ /**
784
+ * Recognition Client Types
785
+ *
786
+ * Type definitions and interfaces for the recognition client SDK.
787
+ * These interfaces enable dependency injection, testing, and alternative implementations.
788
+ */
789
+
790
+ /**
791
+ * Client connection state enum
792
+ * Represents the various states a recognition client can be in during its lifecycle
793
+ */
794
+ declare enum ClientState {
795
+ /** Initial state, no connection established */
796
+ INITIAL = "initial",
797
+ /** Actively establishing WebSocket connection */
798
+ CONNECTING = "connecting",
799
+ /** WebSocket connected but waiting for server ready signal */
800
+ CONNECTED = "connected",
801
+ /** Server ready, can send audio */
802
+ READY = "ready",
803
+ /** Sent stop signal, waiting for final transcript */
804
+ STOPPING = "stopping",
805
+ /** Connection closed normally after stop */
806
+ STOPPED = "stopped",
807
+ /** Connection failed or lost unexpectedly */
808
+ FAILED = "failed"
809
+ }
810
+ /**
811
+ * Callback URL configuration with message type filtering
812
+ */
813
+ interface RecognitionCallbackUrl {
814
+ /** The callback URL endpoint */
815
+ url: string;
816
+ /** Array of message types to send to this URL. If empty/undefined, all types are sent */
817
+ messageTypes?: Array<string | number>;
818
+ }
819
+ interface IRecognitionClientConfig {
820
+ /**
821
+ * WebSocket endpoint URL (optional)
822
+ * Either `url` or `stage` must be provided.
823
+ * If both are provided, `url` takes precedence.
824
+ *
825
+ * Example with explicit URL:
826
+ * ```typescript
827
+ * { url: 'wss://custom-endpoint.example.com/ws/v1/recognize' }
828
+ * ```
829
+ */
830
+ url?: string;
831
+ /**
832
+ * Stage for recognition service (recommended)
833
+ * Either `url` or `stage` must be provided.
834
+ * If both are provided, `url` takes precedence.
835
+ * Defaults to production if neither is provided.
836
+ *
837
+ * Example with STAGES enum (recommended):
838
+ * ```typescript
839
+ * import { STAGES } from '@recog/shared-types';
840
+ * { stage: STAGES.STAGING }
841
+ * ```
842
+ *
843
+ * String values also accepted:
844
+ * ```typescript
845
+ * { stage: 'staging' } // STAGES.LOCAL | STAGES.DEV | STAGES.STAGING | STAGES.PRODUCTION
846
+ * ```
847
+ */
848
+ stage?: Stage | string;
849
+ /** ASR configuration (provider, model, language, etc.) - optional */
850
+ asrRequestConfig?: ASRRequestConfig;
851
+ /** Game context for improved recognition accuracy */
852
+ gameContext?: GameContextV1;
853
+ /** Audio utterance ID (optional) - if not provided, a UUID v4 will be generated */
854
+ audioUtteranceId?: string;
855
+ /** Callback URLs for server-side notifications with optional message type filtering (optional)
856
+ * Game side only need to use it if another service need to be notified about the transcription results.
857
+ */
858
+ callbackUrls?: RecognitionCallbackUrl[];
859
+ /** User identification (optional) */
860
+ userId?: string;
861
+ /** Game session identification (optional). called 'sessionId' in Platform and most games. */
862
+ gameSessionId?: string;
863
+ /** Device identification (optional) */
864
+ deviceId?: string;
865
+ /** Account identification (optional) */
866
+ accountId?: string;
867
+ /** Question answer identifier for tracking Q&A sessions (optional and tracking purpose only) */
868
+ questionAnswerId?: string;
869
+ /** Platform for audio recording device (optional, e.g., 'ios', 'android', 'web', 'unity') */
870
+ platform?: string;
871
+ /** Callback when transcript is received */
872
+ onTranscript?: (result: TranscriptionResultV1) => void;
873
+ /**
874
+ * Callback when function call is received
875
+ * Note: Not supported in 2025. P2 feature for future speech-to-function-call capability.
876
+ */
877
+ onFunctionCall?: (result: FunctionCallResultV1) => void;
878
+ /** Callback when metadata is received. Only once after transcription is complete.*/
879
+ onMetadata?: (metadata: MetadataResultV1) => void;
880
+ /** Callback when error occurs */
881
+ onError?: (error: ErrorResultV1) => void;
882
+ /** Callback when connected to WebSocket */
883
+ onConnected?: () => void;
884
+ /**
885
+ * Callback when WebSocket disconnects
886
+ * @param code - WebSocket close code (1000 = normal, 1006 = abnormal, etc.)
887
+ * @param reason - Close reason string
888
+ */
889
+ onDisconnected?: (code: number, reason: string) => void;
890
+ /** High water mark for backpressure control (bytes) */
891
+ highWaterMark?: number;
892
+ /** Low water mark for backpressure control (bytes) */
893
+ lowWaterMark?: number;
894
+ /** Maximum buffer duration in seconds (default: 60s) */
895
+ maxBufferDurationSec?: number;
896
+ /** Expected chunks per second for ring buffer sizing (default: 100) */
897
+ chunksPerSecond?: number;
898
+ /**
899
+ * Connection retry configuration (optional)
900
+ * Only applies to initial connection establishment, not mid-stream interruptions.
901
+ *
902
+ * Default: { maxAttempts: 4, delayMs: 200 } (try once, retry 3 times = 4 total attempts)
903
+ *
904
+ * Timing: Attempt 1 → FAIL → wait 200ms → Attempt 2 → FAIL → wait 200ms → Attempt 3 → FAIL → wait 200ms → Attempt 4
905
+ *
906
+ * Example:
907
+ * ```typescript
908
+ * {
909
+ * connectionRetry: {
910
+ * maxAttempts: 2, // Try connecting up to 2 times (1 retry)
911
+ * delayMs: 500 // Wait 500ms between attempts
912
+ * }
913
+ * }
914
+ * ```
915
+ */
916
+ connectionRetry?: {
917
+ /** Maximum number of connection attempts (default: 4, min: 1, max: 5) */
918
+ maxAttempts?: number;
919
+ /** Delay in milliseconds between retry attempts (default: 200ms) */
920
+ delayMs?: number;
921
+ };
922
+ /**
923
+ * Optional logger function for debugging
924
+ * If not provided, no logging will occur
925
+ * @param level - Log level: 'debug', 'info', 'warn', 'error'
926
+ * @param message - Log message
927
+ * @param data - Optional additional data
928
+ */
929
+ logger?: (level: 'debug' | 'info' | 'warn' | 'error', message: string, data?: any) => void;
930
+ }
931
+ /**
932
+ * Recognition Client Interface
933
+ *
934
+ * Main interface for real-time speech recognition clients.
935
+ * Provides methods for connection management, audio streaming, and session control.
936
+ */
937
+ interface IRecognitionClient {
938
+ /**
939
+ * Connect to the WebSocket endpoint
940
+ * @returns Promise that resolves when connected
941
+ * @throws Error if connection fails or times out
942
+ */
943
+ connect(): Promise<void>;
944
+ /**
945
+ * Send audio data to the recognition service
946
+ * Audio is buffered locally and sent when connection is ready.
947
+ * @param audioData - PCM audio data as ArrayBuffer, typed array view, or Blob
948
+ */
949
+ sendAudio(audioData: ArrayBuffer | ArrayBufferView | Blob): void;
950
+ /**
951
+ * Stop recording and wait for final transcript
952
+ * The server will close the connection after sending the final transcript.
953
+ * @returns Promise that resolves when final transcript is received
954
+ */
955
+ stopRecording(): Promise<void>;
956
+ /**
957
+ * Force stop and immediately close connection without waiting for server
958
+ *
959
+ * WARNING: This is an abnormal shutdown that bypasses the graceful stop flow:
960
+ * - Does NOT wait for server to process remaining audio
961
+ * - Does NOT receive final transcript from server
962
+ * - Immediately closes WebSocket connection
963
+ * - Cleans up resources (buffers, listeners)
964
+ *
965
+ * Use Cases:
966
+ * - User explicitly cancels/abandons session
967
+ * - Timeout scenarios where waiting is not acceptable
968
+ * - Need immediate cleanup and can't wait for server
969
+ *
970
+ * RECOMMENDED: Use stopRecording() for normal shutdown.
971
+ * Only use this when immediate disconnection is required.
972
+ */
973
+ stopAbnormally(): void;
974
+ /**
975
+ * Get the audio utterance ID for this session
976
+ * Available immediately after client construction.
977
+ * @returns UUID v4 string identifying this recognition session
978
+ */
979
+ getAudioUtteranceId(): string;
980
+ /**
981
+ * Get the current state of the client
982
+ * @returns Current ClientState value
983
+ */
984
+ getState(): ClientState;
985
+ /**
986
+ * Check if WebSocket connection is open
987
+ * @returns true if connected and ready to communicate
988
+ */
989
+ isConnected(): boolean;
990
+ /**
991
+ * Check if client is currently connecting
992
+ * @returns true if connection is in progress
993
+ */
994
+ isConnecting(): boolean;
995
+ /**
996
+ * Check if client is currently stopping
997
+ * @returns true if stopRecording() is in progress
998
+ */
999
+ isStopping(): boolean;
1000
+ /**
1001
+ * Check if transcription has finished
1002
+ * @returns true if the transcription is complete
1003
+ */
1004
+ isTranscriptionFinished(): boolean;
1005
+ /**
1006
+ * Check if the audio buffer has overflowed
1007
+ * @returns true if the ring buffer has wrapped around
1008
+ */
1009
+ isBufferOverflowing(): boolean;
1010
+ /**
1011
+ * Get client statistics
1012
+ * @returns Statistics about audio transmission and buffering
1013
+ */
1014
+ getStats(): IRecognitionClientStats;
1015
+ /**
1016
+ * Get the WebSocket URL being used by this client
1017
+ * Available immediately after client construction.
1018
+ * @returns WebSocket URL string
1019
+ */
1020
+ getUrl(): string;
1021
+ }
1022
+ /**
1023
+ * Client statistics interface
1024
+ */
1025
+ interface IRecognitionClientStats {
1026
+ /** Total audio bytes sent to server */
1027
+ audioBytesSent: number;
1028
+ /** Total number of audio chunks sent */
1029
+ audioChunksSent: number;
1030
+ /** Total number of audio chunks buffered */
1031
+ audioChunksBuffered: number;
1032
+ /** Number of times the ring buffer overflowed */
1033
+ bufferOverflowCount: number;
1034
+ /** Current number of chunks in buffer */
1035
+ currentBufferedChunks: number;
1036
+ /** Whether the ring buffer has wrapped (overwritten old data) */
1037
+ hasWrapped: boolean;
1038
+ }
1039
+ /**
1040
+ * Configuration for RealTimeTwoWayWebSocketRecognitionClient
1041
+ * This extends IRecognitionClientConfig and is the main configuration interface
1042
+ * for creating a new RealTimeTwoWayWebSocketRecognitionClient instance.
1043
+ */
1044
+ interface RealTimeTwoWayWebSocketRecognitionClientConfig extends IRecognitionClientConfig {
1045
+ }
1046
+
1047
+ /**
1048
+ * RealTimeTwoWayWebSocketRecognitionClient - Clean, compact SDK for real-time speech recognition
1049
+ *
1050
+ * Features:
1051
+ * - Ring buffer-based audio storage with fixed memory footprint
1052
+ * - Automatic buffering when disconnected, immediate send when connected
1053
+ * - Buffer persists after flush (for future retry/reconnection scenarios)
1054
+ * - Built on WebSocketAudioClient for robust protocol handling
1055
+ * - Simple API: connect() → sendAudio() → stopRecording()
1056
+ * - Type-safe message handling with callbacks
1057
+ * - Automatic backpressure management
1058
+ * - Overflow detection with buffer state tracking
1059
+ *
1060
+ * Example:
1061
+ * ```typescript
1062
+ * const client = new RealTimeTwoWayWebSocketRecognitionClient({
1063
+ * url: 'ws://localhost:3101/ws/v1/recognize',
1064
+ * onTranscript: (result) => console.log(result.finalTranscript),
1065
+ * onError: (error) => console.error(error),
1066
+ * maxBufferDurationSec: 60 // Ring buffer for 60 seconds
1067
+ * });
1068
+ *
1069
+ * await client.connect();
1070
+ *
1071
+ * // Send audio chunks - always stored in ring buffer, sent if connected
1072
+ * micStream.on('data', (chunk) => client.sendAudio(chunk));
1073
+ *
1074
+ * // Signal end of audio and wait for final results
1075
+ * await client.stopRecording();
1076
+ *
1077
+ * // Server will close connection after sending finals
1078
+ * // No manual cleanup needed - browser handles it
1079
+ * ```
1080
+ */
1081
+
1082
+ /**
1083
+ * Re-export TranscriptionResultV1 as TranscriptionResult for backward compatibility
1084
+ */
1085
+ type TranscriptionResult = TranscriptionResultV1;
1086
+
1087
+ /**
1088
+ * RealTimeTwoWayWebSocketRecognitionClient - SDK-level client for real-time speech recognition
1089
+ *
1090
+ * Implements IRecognitionClient interface for dependency injection and testing.
1091
+ * Extends WebSocketAudioClient with local audio buffering and simple callback-based API.
1092
+ */
1093
+ declare class RealTimeTwoWayWebSocketRecognitionClient extends WebSocketAudioClient<number, any, any> implements IRecognitionClient {
1094
+ private static readonly PROTOCOL_VERSION;
1095
+ private config;
1096
+ private audioBuffer;
1097
+ private messageHandler;
1098
+ private state;
1099
+ private connectionPromise;
1100
+ private isDebugLogEnabled;
1101
+ private audioBytesSent;
1102
+ private audioChunksSent;
1103
+ private audioStatsLogInterval;
1104
+ private lastAudioStatsLog;
1105
+ constructor(config: RealTimeTwoWayWebSocketRecognitionClientConfig);
1106
+ /**
1107
+ * Internal logging helper - only logs if a logger was provided in config
1108
+ * Debug logs are additionally gated by isDebugLogEnabled flag
1109
+ * @param level - Log level: debug, info, warn, or error
1110
+ * @param message - Message to log
1111
+ * @param data - Optional additional data to log
1112
+ */
1113
+ private log;
1114
+ /**
1115
+ * Clean up internal resources to free memory
1116
+ * Called when connection closes (normally or abnormally)
1117
+ */
1118
+ private cleanup;
1119
+ connect(): Promise<void>;
1120
+ /**
1121
+ * Attempt to connect with retry logic
1122
+ * Only retries on initial connection establishment, not mid-stream interruptions
1123
+ */
1124
+ private connectWithRetry;
1125
+ sendAudio(audioData: ArrayBuffer | ArrayBufferView | Blob): void;
1126
+ private sendAudioInternal;
1127
+ stopRecording(): Promise<void>;
1128
+ stopAbnormally(): void;
1129
+ getAudioUtteranceId(): string;
1130
+ getUrl(): string;
1131
+ getState(): ClientState;
1132
+ isConnected(): boolean;
1133
+ isConnecting(): boolean;
1134
+ isStopping(): boolean;
1135
+ isTranscriptionFinished(): boolean;
1136
+ isBufferOverflowing(): boolean;
1137
+ getStats(): IRecognitionClientStats;
1138
+ protected onConnected(): void;
1139
+ protected onDisconnected(code: number, reason: string): void;
1140
+ /**
1141
+ * Get human-readable description for WebSocket close code
1142
+ */
1143
+ private getCloseCodeDescription;
1144
+ protected onError(error: Event): void;
1145
+ protected onMessage(msg: {
1146
+ v: number;
1147
+ type: string;
1148
+ data: any;
1149
+ }): void;
1150
+ /**
1151
+ * Handle control messages from server
1152
+ * @param msg - Control message containing server actions
1153
+ */
1154
+ private handleControlMessage;
1155
+ /**
1156
+ * Send audio immediately to the server (without buffering)
1157
+ * @param audioData - Audio data to send
1158
+ */
1159
+ private sendAudioNow;
1160
+ }
1161
+
1162
+ export { AudioEncoding, ControlSignalTypeV1 as ControlSignal, RealTimeTwoWayWebSocketRecognitionClient, RecognitionContextTypeV1 };
1163
+ export type { GameContextV1, RealTimeTwoWayWebSocketRecognitionClientConfig, TranscriptionResult };