voice-router-dev 0.3.2 → 0.3.3

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,321 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.3.3] - 2026-01-08
9
+
10
+ ### Added
11
+
12
+ #### listTranscripts Implementation
13
+
14
+ Full `listTranscripts()` support for AssemblyAI, Gladia, and Azure using only generated types:
15
+
16
+ ```typescript
17
+ // List recent transcripts with filtering
18
+ const { transcripts, hasMore } = await router.listTranscripts('assemblyai', {
19
+ status: 'completed',
20
+ date: '2026-01-07',
21
+ limit: 50
22
+ })
23
+
24
+ // Date range filtering (Gladia)
25
+ const { transcripts } = await router.listTranscripts('gladia', {
26
+ afterDate: '2026-01-01',
27
+ beforeDate: '2026-01-31'
28
+ })
29
+
30
+ // Provider-specific passthrough
31
+ const { transcripts } = await router.listTranscripts('assemblyai', {
32
+ assemblyai: { after_id: 'cursor-123' }
33
+ })
34
+ ```
35
+
36
+ #### Status Enums for Filtering
37
+
38
+ New status constants with IDE autocomplete:
39
+
40
+ ```typescript
41
+ import { AssemblyAIStatus, GladiaStatus, AzureStatus } from 'voice-router-dev/constants'
42
+
43
+ await router.listTranscripts('assemblyai', {
44
+ status: AssemblyAIStatus.completed // queued | processing | completed | error
45
+ })
46
+
47
+ await router.listTranscripts('gladia', {
48
+ status: GladiaStatus.done // queued | processing | done | error
49
+ })
50
+
51
+ await router.listTranscripts('azure-stt', {
52
+ status: AzureStatus.Succeeded // NotStarted | Running | Succeeded | Failed
53
+ })
54
+ ```
55
+
56
+ #### JSDoc Comments for All Constants
57
+
58
+ All constants now have JSDoc with:
59
+ - Available values listed
60
+ - Usage examples
61
+ - Provider-specific notes
62
+
63
+ ### Changed
64
+
65
+ - All adapter `listTranscripts()` implementations use generated API functions and types only
66
+ - Status mappings use generated enums (`TranscriptStatus`, `TranscriptionControllerListV2StatusItem`, `Status`)
67
+
68
+ ---
69
+
70
+ ## [0.3.0] - 2026-01-07
71
+
72
+ ### Added
73
+
74
+ #### Browser-Safe Constants Export
75
+
76
+ New `/constants` subpath export for browser, Cloudflare Workers, and edge environments:
77
+
78
+ ```typescript
79
+ // Browser-safe import (no node:crypto, ws, or axios)
80
+ import { DeepgramModel, GladiaEncoding, AssemblyAIEncoding } from 'voice-router-dev/constants'
81
+
82
+ const model = DeepgramModel["nova-3"]
83
+ const encoding = GladiaEncoding["wav/pcm"]
84
+ ```
85
+
86
+ The main entry point (`voice-router-dev`) still works but bundles Node.js dependencies.
87
+ Use `/constants` when you only need the enum values without the adapter classes.
88
+
89
+ #### Type-Safe Streaming Enums with Autocomplete
90
+
91
+ New const objects provide IDE autocomplete and compile-time validation for all streaming options.
92
+ All enums are derived from OpenAPI specs and stay in sync with provider APIs.
93
+
94
+ **Deepgram:**
95
+ ```typescript
96
+ import { DeepgramEncoding, DeepgramModel, DeepgramRedact } from 'voice-router-dev'
97
+
98
+ await adapter.transcribeStream({
99
+ deepgramStreaming: {
100
+ encoding: DeepgramEncoding.linear16, // "linear16" | "flac" | "mulaw" | ...
101
+ model: DeepgramModel["nova-3"], // "nova-3" | "nova-2" | "enhanced" | ...
102
+ redact: [DeepgramRedact.pii], // "pii" | "pci" | "numbers"
103
+ }
104
+ })
105
+ ```
106
+
107
+ **Gladia:**
108
+ ```typescript
109
+ import { GladiaEncoding, GladiaSampleRate, GladiaLanguage } from 'voice-router-dev'
110
+
111
+ await adapter.transcribeStream({
112
+ encoding: GladiaEncoding['wav/pcm'], // "wav/pcm" | "wav/alaw" | "wav/ulaw"
113
+ sampleRate: GladiaSampleRate.NUMBER_16000, // 8000 | 16000 | 32000 | 44100 | 48000
114
+ language: GladiaLanguage.en, // 100+ language codes
115
+ })
116
+ ```
117
+
118
+ **AssemblyAI:**
119
+ ```typescript
120
+ import { AssemblyAIEncoding, AssemblyAISpeechModel, AssemblyAISampleRate } from 'voice-router-dev'
121
+
122
+ await adapter.transcribeStream({
123
+ assemblyaiStreaming: {
124
+ encoding: AssemblyAIEncoding.pcmS16le, // "pcm_s16le" | "pcm_mulaw"
125
+ speechModel: AssemblyAISpeechModel.multilingual, // English or multilingual
126
+ sampleRate: AssemblyAISampleRate.rate16000, // 8000-48000
127
+ }
128
+ })
129
+ ```
130
+
131
+ #### Type Safety Audit
132
+
133
+ All enums are either re-exported from OpenAPI-generated types or type-checked with `satisfies`:
134
+
135
+ | Enum | Source | Type Safety |
136
+ |------|--------|-------------|
137
+ | `DeepgramEncoding` | Re-exported from `ListenV1EncodingParameter` | ✅ OpenAPI |
138
+ | `DeepgramRedact` | Re-exported from `ListenV1RedactParameterOneOfItem` | ✅ OpenAPI |
139
+ | `DeepgramModel` | Manual const with `satisfies ListenV1ModelParameter` | ⚠️ Type-checked |
140
+ | `DeepgramTopicMode` | Re-exported from `SharedCustomTopicModeParameter` | ✅ OpenAPI |
141
+ | `GladiaEncoding` | Re-exported from `StreamingSupportedEncodingEnum` | ✅ OpenAPI |
142
+ | `GladiaSampleRate` | Re-exported from `StreamingSupportedSampleRateEnum` | ✅ OpenAPI |
143
+ | `GladiaBitDepth` | Re-exported from `StreamingSupportedBitDepthEnum` | ✅ OpenAPI |
144
+ | `GladiaModel` | Re-exported from `StreamingSupportedModels` | ✅ OpenAPI |
145
+ | `GladiaLanguage` | Re-exported from `TranscriptionLanguageCodeEnum` | ✅ OpenAPI |
146
+ | `AssemblyAIEncoding` | Manual const with `satisfies AudioEncoding` | ⚠️ Type-checked |
147
+ | `AssemblyAISpeechModel` | Manual const with `satisfies StreamingSpeechModel` | ⚠️ Type-checked |
148
+ | `AssemblyAISampleRate` | Manual const (no generated type exists) | ❌ Unchecked |
149
+
150
+ **Why some remain manual:**
151
+ - `DeepgramModel`: OpenAPI generates a type union, not a const object
152
+ - `AssemblyAI*`: Synced from SDK types which are unions, not const objects
153
+ - `AssemblyAISampleRate`: Not defined in any spec (values from SDK documentation)
154
+
155
+ The `satisfies` keyword ensures compile-time errors if values drift from the generated types.
156
+
157
+ #### Full Streaming Implementation for All Providers
158
+
159
+ - **Gladia**: Complete streaming with pre-processing, real-time processing (translation, NER, sentiment), post-processing (summarization, chapterization), and all WebSocket message types
160
+ - **Deepgram**: Full streaming with 30+ options including filler words, numerals, measurements, topics, intents, sentiment, entities, keyterm prompting, and VAD events
161
+ - **AssemblyAI**: v3 Universal Streaming API with end-of-turn detection tuning, VAD threshold, format turns, profanity filtering, keyterms, and dynamic configuration updates
162
+
163
+ #### New Streaming Event Callbacks
164
+
165
+ ```typescript
166
+ await adapter.transcribeStream(options, {
167
+ onTranscript: (event) => { /* interim/final transcripts */ },
168
+ onUtterance: (utterance) => { /* complete utterances */ },
169
+ onSpeechStart: (event) => { /* speech detected */ },
170
+ onSpeechEnd: (event) => { /* speech ended */ },
171
+ onTranslation: (event) => { /* real-time translation (Gladia) */ },
172
+ onSentiment: (event) => { /* sentiment analysis (Gladia) */ },
173
+ onEntity: (event) => { /* named entity recognition (Gladia) */ },
174
+ onSummarization: (event) => { /* post-processing summary (Gladia) */ },
175
+ onChapterization: (event) => { /* auto-chapters (Gladia) */ },
176
+ onMetadata: (metadata) => { /* stream metadata */ },
177
+ onError: (error) => { /* error handling */ },
178
+ onClose: (code, reason) => { /* connection closed */ },
179
+ })
180
+ ```
181
+
182
+ #### AssemblyAI Dynamic Configuration
183
+
184
+ ```typescript
185
+ const session = await adapter.transcribeStream(options, callbacks)
186
+
187
+ // Update configuration mid-stream
188
+ session.updateConfiguration?.({
189
+ end_of_turn_confidence_threshold: 0.8,
190
+ vad_threshold: 0.4,
191
+ format_turns: true,
192
+ })
193
+
194
+ // Force end-of-turn detection
195
+ session.forceEndpoint?.()
196
+ ```
197
+
198
+ ### Changed
199
+
200
+ - `TranscriptionModel` (batch) now uses strict union type (no `| string` fallback)
201
+ - `DeepgramStreamingOptions.model` now uses strict union type (no `| string` fallback)
202
+ - `AssemblyAIStreamingOptions.speechModel` now uses strict union type
203
+ - `ProviderCapabilities` now includes `listTranscripts` and `deleteTranscript` flags
204
+ - `DeepgramStreamingOptions` now includes 30+ typed parameters from OpenAPI spec
205
+ - `AssemblyAIStreamingOptions` now includes all v3 streaming parameters
206
+ - `GladiaStreamingOptions` now includes full pre/realtime/post processing options
207
+ - Provider-specific streaming options now have JSDoc examples for better discoverability
208
+
209
+ ### Deprecated
210
+
211
+ Raw generated enum exports are deprecated in favor of user-friendly aliases:
212
+
213
+ | Deprecated | Use Instead |
214
+ |------------|-------------|
215
+ | `ListenV1EncodingParameter` | `DeepgramEncoding` |
216
+ | `ListenV1ModelParameter` | `DeepgramModel` |
217
+ | `ListenV1RedactParameterOneOfItem` | `DeepgramRedact` |
218
+ | `StreamingSupportedEncodingEnum` | `GladiaEncoding` |
219
+ | `StreamingSupportedSampleRateEnum` | `GladiaSampleRate` |
220
+ | `StreamingSupportedBitDepthEnum` | `GladiaBitDepth` |
221
+
222
+ ---
223
+
224
+ ## Migration Guide (0.2.x → 0.3.0)
225
+
226
+ ### 1. Update Enum Imports
227
+
228
+ **Before (0.2.x):**
229
+ ```typescript
230
+ import {
231
+ ListenV1EncodingParameter,
232
+ StreamingSupportedEncodingEnum
233
+ } from 'voice-router-dev'
234
+
235
+ const encoding = ListenV1EncodingParameter.linear16
236
+ const gladiaEncoding = StreamingSupportedEncodingEnum['wav/pcm']
237
+ ```
238
+
239
+ **After (0.3.0):**
240
+ ```typescript
241
+ import {
242
+ DeepgramEncoding,
243
+ GladiaEncoding
244
+ } from 'voice-router-dev'
245
+
246
+ const encoding = DeepgramEncoding.linear16
247
+ const gladiaEncoding = GladiaEncoding['wav/pcm']
248
+ ```
249
+
250
+ ### 2. Update Model References
251
+
252
+ **Before:**
253
+ ```typescript
254
+ // String literals (still work but no autocomplete)
255
+ model: "nova-3"
256
+ ```
257
+
258
+ **After:**
259
+ ```typescript
260
+ import { DeepgramModel } from 'voice-router-dev'
261
+
262
+ // With autocomplete
263
+ model: DeepgramModel["nova-3"]
264
+ ```
265
+
266
+ ### 3. Update Streaming Options
267
+
268
+ **Before (0.2.x):**
269
+ ```typescript
270
+ await adapter.transcribeStream({
271
+ encoding: 'linear16',
272
+ sampleRate: 16000,
273
+ })
274
+ ```
275
+
276
+ **After (0.3.0):**
277
+ ```typescript
278
+ await adapter.transcribeStream({
279
+ deepgramStreaming: {
280
+ encoding: DeepgramEncoding.linear16,
281
+ sampleRate: 16000,
282
+ // Now supports 30+ additional options with autocomplete
283
+ fillerWords: true,
284
+ smartFormat: true,
285
+ }
286
+ })
287
+ ```
288
+
289
+ ### 4. New Callback Handlers
290
+
291
+ If you were only using `onTranscript`, you now have access to more granular events:
292
+
293
+ ```typescript
294
+ await adapter.transcribeStream(options, {
295
+ onTranscript: (event) => { /* still works */ },
296
+
297
+ // New in 0.3.0:
298
+ onSpeechStart: (event) => console.log('Speech started'),
299
+ onSpeechEnd: (event) => console.log('Speech ended'),
300
+ onUtterance: (utterance) => console.log('Complete utterance:', utterance.text),
301
+ })
302
+ ```
303
+
304
+ ---
305
+
306
+ ## [0.2.8] - 2025-12-30
307
+
308
+ ### Added
309
+ - Typed extended response data with `extendedData` field
310
+ - Request tracking with `requestId` field
311
+ - Type-safe provider-specific options from OpenAPI specs
312
+
313
+ ### Changed
314
+ - Replace 'text' with 'words' in SDK responses
315
+
316
+ ## [0.2.5] - 2025-12-15
317
+
318
+ ### Added
319
+ - Initial OpenAPI-generated types for Gladia, Deepgram, AssemblyAI
320
+ - Webhook normalization handlers
321
+ - Basic streaming support