@framers/agentos 0.1.110 → 0.1.112
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/dist/api/agency.d.ts.map +1 -1
- package/dist/api/agency.js +38 -2
- package/dist/api/agency.js.map +1 -1
- package/dist/api/agent.js +1 -1
- package/dist/api/agent.js.map +1 -1
- package/dist/api/strategies/debate.d.ts.map +1 -1
- package/dist/api/strategies/debate.js.map +1 -1
- package/dist/api/strategies/graph.d.ts.map +1 -1
- package/dist/api/strategies/graph.js +1 -2
- package/dist/api/strategies/graph.js.map +1 -1
- package/dist/api/strategies/hierarchical.d.ts.map +1 -1
- package/dist/api/strategies/hierarchical.js +1 -2
- package/dist/api/strategies/hierarchical.js.map +1 -1
- package/dist/api/strategies/index.d.ts +1 -9
- package/dist/api/strategies/index.d.ts.map +1 -1
- package/dist/api/strategies/index.js +1 -11
- package/dist/api/strategies/index.js.map +1 -1
- package/dist/api/strategies/parallel.d.ts.map +1 -1
- package/dist/api/strategies/parallel.js +23 -4
- package/dist/api/strategies/parallel.js.map +1 -1
- package/dist/api/strategies/review-loop.d.ts.map +1 -1
- package/dist/api/strategies/review-loop.js.map +1 -1
- package/dist/api/strategies/sequential.d.ts.map +1 -1
- package/dist/api/strategies/sequential.js +1 -2
- package/dist/api/strategies/sequential.js.map +1 -1
- package/dist/api/strategies/shared.d.ts +8 -0
- package/dist/api/strategies/shared.d.ts.map +1 -1
- package/dist/api/strategies/shared.js +10 -1
- package/dist/api/strategies/shared.js.map +1 -1
- package/dist/api/types.d.ts +6 -0
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js.map +1 -1
- package/dist/memory/AgentMemory.d.ts +2 -1
- package/dist/memory/AgentMemory.d.ts.map +1 -1
- package/dist/memory/AgentMemory.js +1 -1
- package/dist/memory/AgentMemory.js.map +1 -1
- package/dist/memory/CognitiveMemoryManager.d.ts.map +1 -1
- package/dist/memory/CognitiveMemoryManager.js +7 -2
- package/dist/memory/CognitiveMemoryManager.js.map +1 -1
- package/dist/memory/facade/Memory.d.ts.map +1 -1
- package/dist/memory/facade/Memory.js +6 -9
- package/dist/memory/facade/Memory.js.map +1 -1
- package/dist/memory/store/MemoryStore.d.ts +9 -0
- package/dist/memory/store/MemoryStore.d.ts.map +1 -1
- package/dist/memory/store/MemoryStore.js +66 -6
- package/dist/memory/store/MemoryStore.js.map +1 -1
- package/dist/memory/store/SqliteMemoryGraph.d.ts.map +1 -1
- package/dist/memory/store/SqliteMemoryGraph.js +27 -13
- package/dist/memory/store/SqliteMemoryGraph.js.map +1 -1
- package/dist/speech/FallbackProxy.d.ts +194 -41
- package/dist/speech/FallbackProxy.d.ts.map +1 -1
- package/dist/speech/FallbackProxy.js +155 -32
- package/dist/speech/FallbackProxy.js.map +1 -1
- package/dist/speech/SpeechProviderResolver.d.ts +278 -36
- package/dist/speech/SpeechProviderResolver.d.ts.map +1 -1
- package/dist/speech/SpeechProviderResolver.js +306 -40
- package/dist/speech/SpeechProviderResolver.js.map +1 -1
- package/dist/speech/providers/AssemblyAISTTProvider.d.ts +119 -19
- package/dist/speech/providers/AssemblyAISTTProvider.d.ts.map +1 -1
- package/dist/speech/providers/AssemblyAISTTProvider.js +153 -25
- package/dist/speech/providers/AssemblyAISTTProvider.js.map +1 -1
- package/dist/speech/providers/AzureSpeechSTTProvider.d.ts +121 -17
- package/dist/speech/providers/AzureSpeechSTTProvider.d.ts.map +1 -1
- package/dist/speech/providers/AzureSpeechSTTProvider.js +122 -14
- package/dist/speech/providers/AzureSpeechSTTProvider.js.map +1 -1
- package/dist/speech/providers/AzureSpeechTTSProvider.d.ts +130 -15
- package/dist/speech/providers/AzureSpeechTTSProvider.d.ts.map +1 -1
- package/dist/speech/providers/AzureSpeechTTSProvider.js +163 -18
- package/dist/speech/providers/AzureSpeechTTSProvider.js.map +1 -1
- package/dist/speech/providers/BuiltInAdaptiveVadProvider.d.ts +159 -0
- package/dist/speech/providers/BuiltInAdaptiveVadProvider.d.ts.map +1 -1
- package/dist/speech/providers/BuiltInAdaptiveVadProvider.js +119 -0
- package/dist/speech/providers/BuiltInAdaptiveVadProvider.js.map +1 -1
- package/dist/speech/providers/DeepgramBatchSTTProvider.d.ts +102 -16
- package/dist/speech/providers/DeepgramBatchSTTProvider.d.ts.map +1 -1
- package/dist/speech/providers/DeepgramBatchSTTProvider.js +108 -13
- package/dist/speech/providers/DeepgramBatchSTTProvider.js.map +1 -1
- package/dist/speech/providers/ElevenLabsTextToSpeechProvider.d.ts +149 -0
- package/dist/speech/providers/ElevenLabsTextToSpeechProvider.d.ts.map +1 -1
- package/dist/speech/providers/ElevenLabsTextToSpeechProvider.js +137 -2
- package/dist/speech/providers/ElevenLabsTextToSpeechProvider.js.map +1 -1
- package/dist/speech/providers/OpenAITextToSpeechProvider.d.ts +125 -0
- package/dist/speech/providers/OpenAITextToSpeechProvider.d.ts.map +1 -1
- package/dist/speech/providers/OpenAITextToSpeechProvider.js +128 -4
- package/dist/speech/providers/OpenAITextToSpeechProvider.js.map +1 -1
- package/dist/speech/providers/OpenAIWhisperSpeechToTextProvider.d.ts +110 -0
- package/dist/speech/providers/OpenAIWhisperSpeechToTextProvider.d.ts.map +1 -1
- package/dist/speech/providers/OpenAIWhisperSpeechToTextProvider.js +115 -0
- package/dist/speech/providers/OpenAIWhisperSpeechToTextProvider.js.map +1 -1
- package/dist/voice/CallManager.d.ts.map +1 -1
- package/dist/voice/CallManager.js +9 -1
- package/dist/voice/CallManager.js.map +1 -1
- package/dist/voice/MediaStreamParser.d.ts +115 -6
- package/dist/voice/MediaStreamParser.d.ts.map +1 -1
- package/dist/voice/MediaStreamParser.js +44 -0
- package/dist/voice/MediaStreamParser.js.map +1 -1
- package/dist/voice/TelephonyStreamTransport.d.ts +112 -20
- package/dist/voice/TelephonyStreamTransport.d.ts.map +1 -1
- package/dist/voice/TelephonyStreamTransport.js +136 -30
- package/dist/voice/TelephonyStreamTransport.js.map +1 -1
- package/dist/voice/parsers/PlivoMediaStreamParser.d.ts +64 -6
- package/dist/voice/parsers/PlivoMediaStreamParser.d.ts.map +1 -1
- package/dist/voice/parsers/PlivoMediaStreamParser.js +67 -6
- package/dist/voice/parsers/PlivoMediaStreamParser.js.map +1 -1
- package/dist/voice/parsers/TelnyxMediaStreamParser.d.ts +55 -8
- package/dist/voice/parsers/TelnyxMediaStreamParser.d.ts.map +1 -1
- package/dist/voice/parsers/TelnyxMediaStreamParser.js +60 -9
- package/dist/voice/parsers/TelnyxMediaStreamParser.js.map +1 -1
- package/dist/voice/parsers/TwilioMediaStreamParser.d.ts +73 -11
- package/dist/voice/parsers/TwilioMediaStreamParser.d.ts.map +1 -1
- package/dist/voice/parsers/TwilioMediaStreamParser.js +81 -12
- package/dist/voice/parsers/TwilioMediaStreamParser.js.map +1 -1
- package/dist/voice/providers/plivo.d.ts +108 -12
- package/dist/voice/providers/plivo.d.ts.map +1 -1
- package/dist/voice/providers/plivo.js +106 -9
- package/dist/voice/providers/plivo.js.map +1 -1
- package/dist/voice/providers/telnyx.d.ts +110 -20
- package/dist/voice/providers/telnyx.d.ts.map +1 -1
- package/dist/voice/providers/telnyx.js +111 -20
- package/dist/voice/providers/telnyx.js.map +1 -1
- package/dist/voice/providers/twilio.d.ts +91 -13
- package/dist/voice/providers/twilio.d.ts.map +1 -1
- package/dist/voice/providers/twilio.js +94 -14
- package/dist/voice/providers/twilio.js.map +1 -1
- package/dist/voice/twiml.d.ts +70 -12
- package/dist/voice/twiml.d.ts.map +1 -1
- package/dist/voice/twiml.js +70 -12
- package/dist/voice/twiml.js.map +1 -1
- package/dist/voice/types.d.ts +142 -15
- package/dist/voice/types.d.ts.map +1 -1
- package/dist/voice/types.js +34 -3
- package/dist/voice/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,38 +2,90 @@
|
|
|
2
2
|
// FallbackSTTProxy
|
|
3
3
|
// ---------------------------------------------------------------------------
|
|
4
4
|
/**
|
|
5
|
-
* A {@link SpeechToTextProvider} that wraps an ordered chain of STT providers
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* A {@link SpeechToTextProvider} that wraps an ordered chain of STT providers
|
|
6
|
+
* and implements automatic failover.
|
|
7
|
+
*
|
|
8
|
+
* ## Retry Chain Logic
|
|
9
|
+
*
|
|
10
|
+
* Providers are tried left-to-right (index 0 first, then 1, etc.). The first
|
|
11
|
+
* successful transcription result is returned immediately. When a provider
|
|
12
|
+
* throws:
|
|
13
|
+
*
|
|
14
|
+
* - **If it is NOT the last provider:** The error is caught, a
|
|
15
|
+
* `provider_fallback` event is emitted on the shared {@link EventEmitter},
|
|
16
|
+
* and the next provider is tried. Errors are caught per-provider so that a
|
|
17
|
+
* single API outage doesn't block the entire pipeline.
|
|
18
|
+
*
|
|
19
|
+
* - **If it IS the last provider:** The error is re-thrown to the caller,
|
|
20
|
+
* since there are no more fallbacks to try.
|
|
21
|
+
*
|
|
22
|
+
* - **If the chain is empty:** An `Error('No providers in fallback chain')`
|
|
23
|
+
* is thrown immediately.
|
|
24
|
+
*
|
|
25
|
+
* ## Why Errors are Caught Per-Provider
|
|
26
|
+
*
|
|
27
|
+
* Each provider in the chain operates independently. A Deepgram API key
|
|
28
|
+
* expiration should not prevent OpenAI Whisper from transcribing the same
|
|
29
|
+
* audio. Catching errors per-provider ensures maximum availability at the
|
|
30
|
+
* cost of slightly increased latency when early providers fail.
|
|
31
|
+
*
|
|
32
|
+
* @see {@link ProviderFallbackEvent} for the event payload shape
|
|
33
|
+
* @see {@link SpeechProviderResolver.resolveSTT} for how this proxy is created
|
|
9
34
|
*
|
|
10
35
|
* @example
|
|
11
36
|
* ```ts
|
|
12
37
|
* const proxy = new FallbackSTTProxy([whisperProvider, deepgramProvider], emitter);
|
|
13
38
|
* const result = await proxy.transcribe(audio);
|
|
39
|
+
* // If whisperProvider fails, deepgramProvider is tried automatically.
|
|
14
40
|
* ```
|
|
15
41
|
*/
|
|
16
42
|
export class FallbackSTTProxy {
|
|
17
43
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
44
|
+
* Creates a new FallbackSTTProxy wrapping the given provider chain.
|
|
45
|
+
*
|
|
46
|
+
* @param chain - Ordered list of STT providers to try. Must contain at least
|
|
47
|
+
* one entry for `transcribe()` to succeed, though an empty chain is allowed
|
|
48
|
+
* at construction time (it will always throw on transcribe).
|
|
49
|
+
* @param emitter - EventEmitter on which `provider_fallback` events are
|
|
50
|
+
* published. Typically the {@link SpeechProviderResolver} instance.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* const proxy = new FallbackSTTProxy(
|
|
55
|
+
* [primaryProvider, fallbackProvider],
|
|
56
|
+
* resolver, // extends EventEmitter
|
|
57
|
+
* );
|
|
58
|
+
* ```
|
|
22
59
|
*/
|
|
23
60
|
constructor(chain, emitter) {
|
|
24
61
|
this.chain = chain;
|
|
25
62
|
this.emitter = emitter;
|
|
26
63
|
this.id = chain[0]?.id ?? 'fallback-stt';
|
|
27
|
-
this.displayName = `Fallback STT (${chain.map((p) => p.id).join('
|
|
64
|
+
this.displayName = `Fallback STT (${chain.map((p) => p.id).join(' \u2192 ')})`;
|
|
65
|
+
// Only the primary provider's streaming capability is exposed because
|
|
66
|
+
// we cannot seamlessly switch to a fallback mid-stream.
|
|
28
67
|
this.supportsStreaming = chain[0]?.supportsStreaming ?? false;
|
|
29
68
|
}
|
|
30
69
|
/**
|
|
31
|
-
* Attempt transcription using each provider in order.
|
|
70
|
+
* Attempt transcription using each provider in the chain in order.
|
|
32
71
|
*
|
|
33
72
|
* Emits a `provider_fallback` event (typed as {@link ProviderFallbackEvent})
|
|
34
|
-
* whenever a non-final provider throws.
|
|
35
|
-
* when the entire chain is exhausted
|
|
36
|
-
*
|
|
73
|
+
* whenever a non-final provider throws. Re-throws the last provider's error
|
|
74
|
+
* when the entire chain is exhausted.
|
|
75
|
+
*
|
|
76
|
+
* @param audio - The audio input to transcribe.
|
|
77
|
+
* @param options - Optional transcription settings (language, model, etc.).
|
|
78
|
+
* @returns The transcription result from the first provider that succeeds.
|
|
79
|
+
* @throws {Error} `'No providers in fallback chain'` when the chain is empty.
|
|
80
|
+
* @throws {Error} The last provider's error when all providers in the chain fail.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const result = await proxy.transcribe(
|
|
85
|
+
* { data: wavBuffer, mimeType: 'audio/wav' },
|
|
86
|
+
* { language: 'en-US' },
|
|
87
|
+
* );
|
|
88
|
+
* ```
|
|
37
89
|
*/
|
|
38
90
|
async transcribe(audio, options) {
|
|
39
91
|
if (this.chain.length === 0) {
|
|
@@ -44,6 +96,8 @@ export class FallbackSTTProxy {
|
|
|
44
96
|
return await this.chain[i].transcribe(audio, options);
|
|
45
97
|
}
|
|
46
98
|
catch (error) {
|
|
99
|
+
// Only emit a fallback event when there IS a next provider to fall back to.
|
|
100
|
+
// The last provider's error is re-thrown to the caller as-is.
|
|
47
101
|
if (i < this.chain.length - 1) {
|
|
48
102
|
const event = {
|
|
49
103
|
from: this.chain[i].id,
|
|
@@ -58,10 +112,21 @@ export class FallbackSTTProxy {
|
|
|
58
112
|
}
|
|
59
113
|
}
|
|
60
114
|
}
|
|
61
|
-
// Unreachable —
|
|
115
|
+
// Unreachable in practice — the loop either returns a result or throws.
|
|
116
|
+
// TypeScript's control flow analysis cannot prove this, so we need an
|
|
117
|
+
// explicit throw to satisfy the return type.
|
|
62
118
|
throw new Error('No providers in fallback chain');
|
|
63
119
|
}
|
|
64
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Returns the human-readable name of the primary (first) provider in the chain.
|
|
122
|
+
*
|
|
123
|
+
* @returns The provider name string, or `'fallback'` if the chain is empty.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* proxy.getProviderName(); // 'OpenAI Whisper' (from the first chain entry)
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
65
130
|
getProviderName() {
|
|
66
131
|
return this.chain[0]?.getProviderName() ?? 'fallback';
|
|
67
132
|
}
|
|
@@ -70,39 +135,71 @@ export class FallbackSTTProxy {
|
|
|
70
135
|
// FallbackTTSProxy
|
|
71
136
|
// ---------------------------------------------------------------------------
|
|
72
137
|
/**
|
|
73
|
-
* A {@link TextToSpeechProvider} that wraps an ordered chain of TTS providers
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
138
|
+
* A {@link TextToSpeechProvider} that wraps an ordered chain of TTS providers
|
|
139
|
+
* and implements automatic failover.
|
|
140
|
+
*
|
|
141
|
+
* ## Retry Chain Logic
|
|
142
|
+
*
|
|
143
|
+
* Identical to {@link FallbackSTTProxy}: providers are tried left-to-right,
|
|
144
|
+
* the first successful synthesis result is returned, and `provider_fallback`
|
|
145
|
+
* events are emitted on each intermediate failure.
|
|
146
|
+
*
|
|
147
|
+
* ## Voice Listing
|
|
77
148
|
*
|
|
78
|
-
* Voice listing is delegated to the first provider that exposes
|
|
79
|
-
* `listAvailableVoices()
|
|
149
|
+
* Voice listing is delegated to the first provider in the chain that exposes
|
|
150
|
+
* a `listAvailableVoices()` method. If no provider supports this, an empty
|
|
151
|
+
* array is returned. This is a best-effort approach — the voice list may not
|
|
152
|
+
* reflect the provider that actually handles synthesis if the primary fails.
|
|
153
|
+
*
|
|
154
|
+
* @see {@link ProviderFallbackEvent} for the event payload shape
|
|
155
|
+
* @see {@link SpeechProviderResolver.resolveTTS} for how this proxy is created
|
|
80
156
|
*
|
|
81
157
|
* @example
|
|
82
158
|
* ```ts
|
|
83
159
|
* const proxy = new FallbackTTSProxy([elevenlabsProvider, openaiTtsProvider], emitter);
|
|
84
160
|
* const audio = await proxy.synthesize('Hello world');
|
|
161
|
+
* // If ElevenLabs fails, OpenAI TTS is tried automatically.
|
|
85
162
|
* ```
|
|
86
163
|
*/
|
|
87
164
|
export class FallbackTTSProxy {
|
|
88
165
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
166
|
+
* Creates a new FallbackTTSProxy wrapping the given provider chain.
|
|
167
|
+
*
|
|
168
|
+
* @param chain - Ordered list of TTS providers to try.
|
|
169
|
+
* @param emitter - EventEmitter on which `provider_fallback` events are published.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* const proxy = new FallbackTTSProxy(
|
|
174
|
+
* [elevenlabsProvider, openaiTtsProvider],
|
|
175
|
+
* resolver,
|
|
176
|
+
* );
|
|
177
|
+
* ```
|
|
91
178
|
*/
|
|
92
179
|
constructor(chain, emitter) {
|
|
93
180
|
this.chain = chain;
|
|
94
181
|
this.emitter = emitter;
|
|
95
182
|
this.id = chain[0]?.id ?? 'fallback-tts';
|
|
96
|
-
this.displayName = `Fallback TTS (${chain.map((p) => p.id).join('
|
|
183
|
+
this.displayName = `Fallback TTS (${chain.map((p) => p.id).join(' \u2192 ')})`;
|
|
97
184
|
this.supportsStreaming = chain[0]?.supportsStreaming ?? false;
|
|
98
185
|
}
|
|
99
186
|
/**
|
|
100
|
-
* Attempt synthesis using each provider in order.
|
|
187
|
+
* Attempt synthesis using each provider in the chain in order.
|
|
101
188
|
*
|
|
102
189
|
* Emits a `provider_fallback` event (typed as {@link ProviderFallbackEvent})
|
|
103
|
-
* whenever a non-final provider throws.
|
|
104
|
-
* when the entire chain is exhausted
|
|
105
|
-
*
|
|
190
|
+
* whenever a non-final provider throws. Re-throws the last provider's error
|
|
191
|
+
* when the entire chain is exhausted.
|
|
192
|
+
*
|
|
193
|
+
* @param text - The text to synthesize into speech.
|
|
194
|
+
* @param options - Optional synthesis settings (voice, speed, format, etc.).
|
|
195
|
+
* @returns The synthesis result from the first provider that succeeds.
|
|
196
|
+
* @throws {Error} `'No providers in fallback chain'` when the chain is empty.
|
|
197
|
+
* @throws {Error} The last provider's error when all providers in the chain fail.
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* const result = await proxy.synthesize('Hello world', { voice: 'nova' });
|
|
202
|
+
* ```
|
|
106
203
|
*/
|
|
107
204
|
async synthesize(text, options) {
|
|
108
205
|
if (this.chain.length === 0) {
|
|
@@ -113,6 +210,8 @@ export class FallbackTTSProxy {
|
|
|
113
210
|
return await this.chain[i].synthesize(text, options);
|
|
114
211
|
}
|
|
115
212
|
catch (error) {
|
|
213
|
+
// Emit fallback event for all providers except the last one.
|
|
214
|
+
// See FallbackSTTProxy.transcribe for detailed rationale.
|
|
116
215
|
if (i < this.chain.length - 1) {
|
|
117
216
|
const event = {
|
|
118
217
|
from: this.chain[i].id,
|
|
@@ -130,14 +229,37 @@ export class FallbackTTSProxy {
|
|
|
130
229
|
// Unreachable — TypeScript requires an explicit throw after the loop.
|
|
131
230
|
throw new Error('No providers in fallback chain');
|
|
132
231
|
}
|
|
133
|
-
/**
|
|
232
|
+
/**
|
|
233
|
+
* Returns the human-readable name of the primary (first) provider.
|
|
234
|
+
*
|
|
235
|
+
* @returns The provider name string, or `'fallback'` if the chain is empty.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* proxy.getProviderName(); // 'ElevenLabs' (from the first chain entry)
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
134
242
|
getProviderName() {
|
|
135
243
|
return this.chain[0]?.getProviderName() ?? 'fallback';
|
|
136
244
|
}
|
|
137
245
|
/**
|
|
138
|
-
* Returns voice list from the first provider in the chain that
|
|
139
|
-
* `listAvailableVoices()`.
|
|
140
|
-
*
|
|
246
|
+
* Returns the voice list from the first provider in the chain that supports
|
|
247
|
+
* `listAvailableVoices()`.
|
|
248
|
+
*
|
|
249
|
+
* Iterates through the chain looking for any provider that implements this
|
|
250
|
+
* optional method. Returns an empty array when no provider supports voice
|
|
251
|
+
* listing. This is a best-effort approach — if the primary provider fails
|
|
252
|
+
* during synthesis and a fallback provider handles it, the returned voice
|
|
253
|
+
* list may not match the provider that actually produced the audio.
|
|
254
|
+
*
|
|
255
|
+
* @returns A promise resolving to an array of available voices, or an empty
|
|
256
|
+
* array if no provider in the chain supports voice listing.
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* ```ts
|
|
260
|
+
* const voices = await proxy.listAvailableVoices();
|
|
261
|
+
* // voices from the first provider that implements the method
|
|
262
|
+
* ```
|
|
141
263
|
*/
|
|
142
264
|
async listAvailableVoices() {
|
|
143
265
|
for (const provider of this.chain) {
|
|
@@ -145,6 +267,7 @@ export class FallbackTTSProxy {
|
|
|
145
267
|
return provider.listAvailableVoices();
|
|
146
268
|
}
|
|
147
269
|
}
|
|
270
|
+
// No provider in the chain supports voice listing.
|
|
148
271
|
return [];
|
|
149
272
|
}
|
|
150
273
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FallbackProxy.js","sourceRoot":"","sources":["../../src/speech/FallbackProxy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FallbackProxy.js","sourceRoot":"","sources":["../../src/speech/FallbackProxy.ts"],"names":[],"mappings":"AA8CA,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,OAAO,gBAAgB;IAqB3B;;;;;;;;;;;;;;;;OAgBG;IACH,YACmB,KAA6B,EAC7B,OAAqB;QADrB,UAAK,GAAL,KAAK,CAAwB;QAC7B,YAAO,GAAP,OAAO,CAAc;QAEtC,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,cAAc,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,iBAAiB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAC/E,sEAAsE;QACtE,wDAAwD;QACxD,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,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