@framers/agentos 0.1.110 → 0.1.111
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/package.json +1 -1
|
@@ -3,100 +3,342 @@ import type { SpeechProviderKind, SpeechToTextProvider, TextToSpeechProvider, Sp
|
|
|
3
3
|
/**
|
|
4
4
|
* Central resolver for speech providers (STT, TTS, VAD, wake-word).
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* Resolution filters by `isConfigured`, applies {@link ProviderRequirements},
|
|
8
|
-
* and optionally wraps multiple candidates in a {@link FallbackSTTProxy} or
|
|
9
|
-
* {@link FallbackTTSProxy} when fallback mode is enabled in the config.
|
|
6
|
+
* ## Resolution Algorithm
|
|
10
7
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* 1. **Registration** — Providers are registered via {@link register} with a
|
|
9
|
+
* unique `id`, a `kind` (stt/tts/vad/wake-word), a numeric `priority`,
|
|
10
|
+
* and a boolean `isConfigured` flag.
|
|
11
|
+
*
|
|
12
|
+
* 2. **Filtering** — When a consumer calls {@link resolveSTT}, {@link resolveTTS},
|
|
13
|
+
* {@link resolveVAD}, or {@link resolveWakeWord}, the resolver filters
|
|
14
|
+
* registrations by `kind` and `isConfigured === true`.
|
|
15
|
+
*
|
|
16
|
+
* 3. **Requirements matching** — Optional {@link ProviderRequirements} further
|
|
17
|
+
* filter by `streaming`, `local`, and `features` capabilities from the
|
|
18
|
+
* provider's catalog entry.
|
|
19
|
+
*
|
|
20
|
+
* 4. **Priority ordering** — Remaining candidates are sorted by ascending
|
|
21
|
+
* `priority` (lower number = tried first). Core providers default to 100,
|
|
22
|
+
* extensions to 200, and user-preferred providers get boosted to 50+.
|
|
23
|
+
*
|
|
24
|
+
* 5. **Fallback wrapping** — When `config.stt.fallback` or `config.tts.fallback`
|
|
25
|
+
* is `true` and multiple candidates survive, they are wrapped in a
|
|
26
|
+
* {@link FallbackSTTProxy} or {@link FallbackTTSProxy} that tries each in
|
|
27
|
+
* order, emitting `provider_fallback` events on failure.
|
|
28
|
+
*
|
|
29
|
+
* ## Priority Tiers
|
|
30
|
+
*
|
|
31
|
+
* | Tier | Priority Range | Source |
|
|
32
|
+
* |------|---------------|--------|
|
|
33
|
+
* | User-preferred | 50–59 | `config.stt.preferred` / `config.tts.preferred` |
|
|
34
|
+
* | Core | 100 | Built-in provider catalog |
|
|
35
|
+
* | Extension | 200 | Discovered via ExtensionManager |
|
|
36
|
+
*
|
|
37
|
+
* ## Events
|
|
38
|
+
*
|
|
39
|
+
* | Event | Payload | When |
|
|
40
|
+
* |-------|---------|------|
|
|
41
|
+
* | `provider_registered` | `{ id, kind, source }` | A provider is registered via {@link register} |
|
|
42
|
+
*
|
|
43
|
+
* @see {@link FallbackSTTProxy} for the STT fallback chain implementation
|
|
44
|
+
* @see {@link FallbackTTSProxy} for the TTS fallback chain implementation
|
|
45
|
+
* @see {@link ProviderRequirements} for available filtering criteria
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const resolver = new SpeechProviderResolver(
|
|
50
|
+
* { stt: { preferred: ['deepgram-batch'], fallback: true } },
|
|
51
|
+
* process.env,
|
|
52
|
+
* );
|
|
53
|
+
* await resolver.refresh();
|
|
54
|
+
* const stt = resolver.resolveSTT({ features: ['diarization'] });
|
|
55
|
+
* ```
|
|
13
56
|
*/
|
|
14
57
|
export declare class SpeechProviderResolver extends EventEmitter {
|
|
15
58
|
private readonly config?;
|
|
16
59
|
private readonly env;
|
|
17
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Internal registry of all providers keyed by their unique string id.
|
|
62
|
+
* Overwrites are allowed — re-registering with the same id replaces the
|
|
63
|
+
* previous entry, which lets hot-reload and extension refresh work seamlessly.
|
|
64
|
+
*/
|
|
18
65
|
private registrations;
|
|
19
66
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
67
|
+
* Creates a new SpeechProviderResolver.
|
|
68
|
+
*
|
|
69
|
+
* @param config - Optional resolver configuration controlling preferred
|
|
70
|
+
* providers and fallback behaviour for each provider kind.
|
|
71
|
+
* @param env - Environment variable map used to check whether a provider's
|
|
72
|
+
* required API keys are present. Defaults to `process.env` so unit tests
|
|
73
|
+
* can inject a controlled map without polluting the real environment.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* // Production: use real env vars
|
|
78
|
+
* const resolver = new SpeechProviderResolver({ stt: { fallback: true } });
|
|
79
|
+
*
|
|
80
|
+
* // Testing: inject controlled env
|
|
81
|
+
* const resolver = new SpeechProviderResolver(undefined, { OPENAI_API_KEY: 'test' });
|
|
82
|
+
* ```
|
|
22
83
|
*/
|
|
23
84
|
constructor(config?: SpeechResolverConfig | undefined, env?: Record<string, string | undefined>);
|
|
24
85
|
/**
|
|
25
|
-
* Register a provider
|
|
26
|
-
*
|
|
86
|
+
* Register a provider, overwriting any existing registration with the same id.
|
|
87
|
+
*
|
|
88
|
+
* Emits a `provider_registered` event with `{ id, kind, source }` so that
|
|
89
|
+
* listeners (e.g. UI dashboards, logging middleware) can track what's available.
|
|
90
|
+
*
|
|
91
|
+
* @param reg - The full registration object including the provider instance,
|
|
92
|
+
* catalog entry, priority, and configuration status.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* resolver.register({
|
|
97
|
+
* id: 'custom-stt',
|
|
98
|
+
* kind: 'stt',
|
|
99
|
+
* provider: myCustomProvider,
|
|
100
|
+
* catalogEntry: { id: 'custom-stt', kind: 'stt', label: 'Custom', envVars: [], local: false, description: '' },
|
|
101
|
+
* isConfigured: true,
|
|
102
|
+
* priority: 150,
|
|
103
|
+
* source: 'extension',
|
|
104
|
+
* });
|
|
105
|
+
* ```
|
|
27
106
|
*/
|
|
28
107
|
register(reg: ProviderRegistration): void;
|
|
29
108
|
/**
|
|
30
|
-
* List all registrations for a given kind, sorted ascending by
|
|
31
|
-
* (lower number = higher priority).
|
|
109
|
+
* List all registrations for a given provider kind, sorted ascending by
|
|
110
|
+
* priority (lower number = higher priority = tried first).
|
|
111
|
+
*
|
|
112
|
+
* This returns both configured and unconfigured providers — use
|
|
113
|
+
* `.filter(r => r.isConfigured)` if you only want usable ones.
|
|
114
|
+
*
|
|
115
|
+
* @param kind - The provider kind to filter by.
|
|
116
|
+
* @returns A new array of registrations sorted by ascending priority.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const allSTT = resolver.listProviders('stt');
|
|
121
|
+
* const configured = allSTT.filter(r => r.isConfigured);
|
|
122
|
+
* console.log(`${configured.length} of ${allSTT.length} STT providers ready`);
|
|
123
|
+
* ```
|
|
32
124
|
*/
|
|
33
125
|
listProviders(kind: SpeechProviderKind): ProviderRegistration[];
|
|
34
126
|
/**
|
|
35
127
|
* Resolve the best STT provider matching optional {@link ProviderRequirements}.
|
|
36
128
|
*
|
|
37
|
-
* When `config.stt.fallback` is true and multiple candidates exist, wraps
|
|
38
|
-
* in a {@link FallbackSTTProxy}
|
|
129
|
+
* When `config.stt.fallback` is `true` and multiple candidates exist, wraps
|
|
130
|
+
* them in a {@link FallbackSTTProxy} that tries providers in priority order.
|
|
131
|
+
* Otherwise returns the single highest-priority match.
|
|
132
|
+
*
|
|
133
|
+
* @param requirements - Optional filtering criteria (streaming, local, features,
|
|
134
|
+
* preferredIds).
|
|
135
|
+
* @returns The resolved STT provider, possibly wrapped in a FallbackSTTProxy.
|
|
136
|
+
* @throws {Error} When no configured STT provider matches the requirements.
|
|
137
|
+
*
|
|
138
|
+
* @see {@link FallbackSTTProxy} for fallback chain behaviour
|
|
139
|
+
* @see {@link ProviderRequirements} for available filter options
|
|
39
140
|
*
|
|
40
|
-
* @
|
|
141
|
+
* @example
|
|
142
|
+
* ```ts
|
|
143
|
+
* // Simple: best available
|
|
144
|
+
* const stt = resolver.resolveSTT();
|
|
145
|
+
*
|
|
146
|
+
* // With requirements
|
|
147
|
+
* const stt = resolver.resolveSTT({ streaming: true, features: ['diarization'] });
|
|
148
|
+
*
|
|
149
|
+
* // With explicit preference ordering
|
|
150
|
+
* const stt = resolver.resolveSTT({ preferredIds: ['deepgram-batch', 'openai-whisper'] });
|
|
151
|
+
* ```
|
|
41
152
|
*/
|
|
42
153
|
resolveSTT(requirements?: ProviderRequirements): SpeechToTextProvider;
|
|
43
154
|
/**
|
|
44
155
|
* Resolve the best TTS provider matching optional {@link ProviderRequirements}.
|
|
45
156
|
*
|
|
46
|
-
* When `config.tts.fallback` is true and multiple candidates exist, wraps
|
|
47
|
-
* in a {@link FallbackTTSProxy}
|
|
157
|
+
* When `config.tts.fallback` is `true` and multiple candidates exist, wraps
|
|
158
|
+
* them in a {@link FallbackTTSProxy} that tries providers in priority order.
|
|
159
|
+
* Otherwise returns the single highest-priority match.
|
|
160
|
+
*
|
|
161
|
+
* @param requirements - Optional filtering criteria (streaming, local, features,
|
|
162
|
+
* preferredIds).
|
|
163
|
+
* @returns The resolved TTS provider, possibly wrapped in a FallbackTTSProxy.
|
|
164
|
+
* @throws {Error} When no configured TTS provider matches the requirements.
|
|
48
165
|
*
|
|
49
|
-
* @
|
|
166
|
+
* @see {@link FallbackTTSProxy} for fallback chain behaviour
|
|
167
|
+
* @see {@link ProviderRequirements} for available filter options
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const tts = resolver.resolveTTS();
|
|
172
|
+
* const result = await tts.synthesize('Hello!');
|
|
173
|
+
* ```
|
|
50
174
|
*/
|
|
51
175
|
resolveTTS(requirements?: ProviderRequirements): TextToSpeechProvider;
|
|
52
176
|
/**
|
|
53
177
|
* Resolve the highest-priority configured VAD provider.
|
|
54
178
|
*
|
|
55
|
-
*
|
|
179
|
+
* VAD providers don't support fallback chains because voice activity detection
|
|
180
|
+
* is a real-time frame-by-frame operation where mid-session provider switching
|
|
181
|
+
* would cause state inconsistency.
|
|
182
|
+
*
|
|
183
|
+
* @returns The resolved VAD provider instance.
|
|
184
|
+
* @throws {Error} When no VAD provider is registered and configured.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```ts
|
|
188
|
+
* const vad = resolver.resolveVAD();
|
|
189
|
+
* const decision = vad.processFrame(audioFrame);
|
|
190
|
+
* ```
|
|
56
191
|
*/
|
|
57
192
|
resolveVAD(): SpeechVadProvider;
|
|
58
193
|
/**
|
|
59
194
|
* Resolve the highest-priority configured wake-word provider, or `null`
|
|
60
195
|
* when none is registered.
|
|
196
|
+
*
|
|
197
|
+
* Returns `null` instead of throwing because wake-word detection is an
|
|
198
|
+
* optional feature — many deployments operate without it.
|
|
199
|
+
*
|
|
200
|
+
* @returns The resolved wake-word provider, or `null` if none is available.
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* const wakeWord = resolver.resolveWakeWord();
|
|
205
|
+
* if (wakeWord) {
|
|
206
|
+
* const detection = await wakeWord.detect(frame, sampleRate);
|
|
207
|
+
* }
|
|
208
|
+
* ```
|
|
61
209
|
*/
|
|
62
210
|
resolveWakeWord(): WakeWordProvider | null;
|
|
63
211
|
/**
|
|
64
|
-
*
|
|
65
|
-
* extension providers
|
|
66
|
-
*
|
|
212
|
+
* Populate the resolver by registering core providers from the static catalog,
|
|
213
|
+
* optionally discovering extension providers, and applying user-configured
|
|
214
|
+
* preferred priorities.
|
|
215
|
+
*
|
|
216
|
+
* The three-phase refresh sequence is:
|
|
217
|
+
* 1. {@link registerCoreProviders} — register all built-in providers from the
|
|
218
|
+
* static catalog, marking each as configured/unconfigured based on env vars.
|
|
219
|
+
* 2. {@link discoverExtensionProviders} — if an ExtensionManager is provided,
|
|
220
|
+
* discover and register any additional speech providers from extensions.
|
|
221
|
+
* 3. {@link applyPreferredPriorities} — boost priority for providers listed in
|
|
222
|
+
* the user's `config.stt.preferred` / `config.tts.preferred` arrays.
|
|
67
223
|
*
|
|
68
|
-
* @param extensionManager Optional object exposing `getDescriptorsByKind(kind)`.
|
|
224
|
+
* @param extensionManager - Optional object exposing `getDescriptorsByKind(kind)`.
|
|
225
|
+
* Uses `any` type because the ExtensionManager interface is defined in the
|
|
226
|
+
* extensions package and importing it here would create a circular dependency.
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```ts
|
|
230
|
+
* const resolver = new SpeechProviderResolver(config, process.env);
|
|
231
|
+
* await resolver.refresh(extensionManager);
|
|
232
|
+
* // Now all providers are registered and ready to resolve.
|
|
233
|
+
* ```
|
|
69
234
|
*/
|
|
70
235
|
refresh(extensionManager?: any): Promise<void>;
|
|
71
236
|
/**
|
|
72
237
|
* Core resolution algorithm shared by {@link resolveSTT} and {@link resolveTTS}.
|
|
73
238
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
239
|
+
* ## Algorithm
|
|
240
|
+
*
|
|
241
|
+
* **Path A — Preferred IDs provided:**
|
|
242
|
+
* When `requirements.preferredIds` is set, iterate through the IDs in the
|
|
243
|
+
* caller's specified order. For each ID, look up the registration and include
|
|
244
|
+
* it only if it matches the kind, is configured, and satisfies all other
|
|
245
|
+
* requirements. This preserves the caller's explicit ordering preference.
|
|
246
|
+
*
|
|
247
|
+
* **Path B — No preferred IDs:**
|
|
248
|
+
* Return all configured providers of the requested kind that match the
|
|
249
|
+
* requirements, sorted by ascending priority (lower = better). This is the
|
|
250
|
+
* default path for most callers.
|
|
251
|
+
*
|
|
252
|
+
* @param kind - The provider kind to resolve ('stt', 'tts', etc.).
|
|
253
|
+
* @param requirements - Optional filtering criteria.
|
|
254
|
+
* @returns An ordered array of matching registrations (best first).
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```ts
|
|
258
|
+
* // Internal usage — called by resolveSTT/resolveTTS:
|
|
259
|
+
* const candidates = this.resolveByKind('stt', { streaming: true });
|
|
260
|
+
* ```
|
|
77
261
|
*/
|
|
78
262
|
private resolveByKind;
|
|
79
263
|
/**
|
|
80
|
-
* Check whether a registration satisfies the given requirements
|
|
81
|
-
*
|
|
264
|
+
* Check whether a registration satisfies the given requirements.
|
|
265
|
+
*
|
|
266
|
+
* Each requirement field is independently checked. A `undefined` requirement
|
|
267
|
+
* field means "no constraint" — only explicitly set fields are enforced.
|
|
268
|
+
* All specified fields must match for the provider to qualify.
|
|
269
|
+
*
|
|
270
|
+
* @param reg - The provider registration to test.
|
|
271
|
+
* @param req - The requirements to match against. If `undefined`, all
|
|
272
|
+
* providers match.
|
|
273
|
+
* @returns `true` if the registration satisfies all specified requirements.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* // Matches: streaming=true required, provider has streaming=true
|
|
278
|
+
* this.matchesRequirements(reg, { streaming: true }); // true
|
|
279
|
+
*
|
|
280
|
+
* // Fails: feature 'diarization' required but provider only has ['cloud']
|
|
281
|
+
* this.matchesRequirements(reg, { features: ['diarization'] }); // false
|
|
282
|
+
* ```
|
|
82
283
|
*/
|
|
83
284
|
private matchesRequirements;
|
|
84
285
|
/**
|
|
85
|
-
* Register providers from the static core
|
|
86
|
-
*
|
|
87
|
-
*
|
|
286
|
+
* Register providers from the static core catalog.
|
|
287
|
+
*
|
|
288
|
+
* Each provider is marked `isConfigured` based on whether ALL of its required
|
|
289
|
+
* environment variables are set (non-empty). Providers with `available === false`
|
|
290
|
+
* in the catalog are skipped entirely — they represent planned but not yet
|
|
291
|
+
* implemented backends (e.g. NVIDIA NeMo, Bark).
|
|
292
|
+
*
|
|
293
|
+
* Core providers are registered with `priority: 100` and `source: 'core'`.
|
|
294
|
+
* The `provider` field is set to `null` (lazy instantiation) — actual provider
|
|
295
|
+
* instances are created on first use by the SpeechRuntime.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```ts
|
|
299
|
+
* // Called internally by refresh():
|
|
300
|
+
* this.registerCoreProviders();
|
|
301
|
+
* ```
|
|
88
302
|
*/
|
|
89
303
|
private registerCoreProviders;
|
|
90
304
|
/**
|
|
91
305
|
* Discover speech providers exposed by an ExtensionManager via
|
|
92
|
-
* `getDescriptorsByKind()`.
|
|
93
|
-
*
|
|
306
|
+
* `getDescriptorsByKind()`.
|
|
307
|
+
*
|
|
308
|
+
* Extension providers are registered with `priority: 200` (lower than core's
|
|
309
|
+
* 100) so they serve as fallbacks unless the user explicitly boosts them via
|
|
310
|
+
* `config.stt.preferred` / `config.tts.preferred`.
|
|
311
|
+
*
|
|
312
|
+
* The `extensionManager` parameter uses `any` because the ExtensionManager
|
|
313
|
+
* type lives in the extensions package — importing it would create a circular
|
|
314
|
+
* dependency. We only rely on the `getDescriptorsByKind` method signature.
|
|
315
|
+
*
|
|
316
|
+
* @param extensionManager - Object exposing `getDescriptorsByKind(kind)` that
|
|
317
|
+
* returns an array of `{ id: string; payload: unknown }` descriptors.
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```ts
|
|
321
|
+
* // Called internally by refresh():
|
|
322
|
+
* this.discoverExtensionProviders(extensionManager);
|
|
323
|
+
* ```
|
|
94
324
|
*/
|
|
95
325
|
private discoverExtensionProviders;
|
|
96
326
|
/**
|
|
97
327
|
* Boost priority for providers listed in `config.stt.preferred` /
|
|
98
|
-
* `config.tts.preferred`.
|
|
99
|
-
*
|
|
328
|
+
* `config.tts.preferred`.
|
|
329
|
+
*
|
|
330
|
+
* Earlier entries in the preferred array get lower priority numbers
|
|
331
|
+
* (= higher priority). The sequence starts at 50, so the first preferred
|
|
332
|
+
* provider gets priority 50, second gets 51, etc. This places them above
|
|
333
|
+
* all core (100) and extension (200) providers but still allows the
|
|
334
|
+
* priority to be numerically distinguished.
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* ```ts
|
|
338
|
+
* // config.stt.preferred = ['assemblyai', 'openai-whisper']
|
|
339
|
+
* // Result: assemblyai.priority = 50, openai-whisper.priority = 51
|
|
340
|
+
* this.applyPreferredPriorities();
|
|
341
|
+
* ```
|
|
100
342
|
*/
|
|
101
343
|
private applyPreferredPriorities;
|
|
102
344
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpeechProviderResolver.d.ts","sourceRoot":"","sources":["../../src/speech/SpeechProviderResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAIpB
|
|
1
|
+
{"version":3,"file":"SpeechProviderResolver.d.ts","sourceRoot":"","sources":["../../src/speech/SpeechProviderResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAIpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,qBAAa,sBAAuB,SAAQ,YAAY;IA2BpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG;IA3BtB;;;;OAIG;IACH,OAAO,CAAC,aAAa,CAA2C;IAEhE;;;;;;;;;;;;;;;;;OAiBG;gBAEgB,MAAM,CAAC,EAAE,oBAAoB,YAAA,EAC7B,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe;IAKxE;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CAAC,GAAG,EAAE,oBAAoB,GAAG,IAAI;IAKzC;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CAAC,IAAI,EAAE,kBAAkB,GAAG,oBAAoB,EAAE;IAM/D;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,UAAU,CAAC,YAAY,CAAC,EAAE,oBAAoB,GAAG,oBAAoB;IAiBrE;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,UAAU,CAAC,YAAY,CAAC,EAAE,oBAAoB,GAAG,oBAAoB;IAgBrE;;;;;;;;;;;;;;;OAeG;IACH,UAAU,IAAI,iBAAiB;IAQ/B;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe,IAAI,gBAAgB,GAAG,IAAI;IAS1C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,OAAO,CAAC,gBAAgB,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAcpD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,OAAO,CAAC,aAAa;IAsBrB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,mBAAmB;IAkB3B;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,qBAAqB;IA0C7B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,0BAA0B;IA6ClC;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,wBAAwB;CAcjC"}
|