@framers/agentos 0.1.74 → 0.1.76

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.
Files changed (138) hide show
  1. package/README.md +139 -34
  2. package/dist/core/agency/AgentCommunicationBus.d.ts +1 -0
  3. package/dist/core/agency/AgentCommunicationBus.d.ts.map +1 -1
  4. package/dist/core/agency/AgentCommunicationBus.js +62 -8
  5. package/dist/core/agency/AgentCommunicationBus.js.map +1 -1
  6. package/dist/core/agency/IAgentCommunicationBus.d.ts +1 -1
  7. package/dist/core/agency/IAgentCommunicationBus.d.ts.map +1 -1
  8. package/dist/orchestration/builders/index.d.ts +1 -1
  9. package/dist/orchestration/builders/index.d.ts.map +1 -1
  10. package/dist/orchestration/builders/index.js +1 -1
  11. package/dist/orchestration/builders/index.js.map +1 -1
  12. package/dist/orchestration/builders/nodes.d.ts +15 -0
  13. package/dist/orchestration/builders/nodes.d.ts.map +1 -1
  14. package/dist/orchestration/builders/nodes.js +33 -0
  15. package/dist/orchestration/builders/nodes.js.map +1 -1
  16. package/dist/orchestration/runtime/LoopController.d.ts +10 -10
  17. package/dist/orchestration/runtime/LoopController.d.ts.map +1 -1
  18. package/dist/orchestration/runtime/LoopController.js +1 -1
  19. package/dist/orchestration/runtime/LoopController.js.map +1 -1
  20. package/dist/orchestration/runtime/index.d.ts +1 -1
  21. package/dist/orchestration/runtime/index.d.ts.map +1 -1
  22. package/dist/orchestration/runtime/index.js.map +1 -1
  23. package/dist/speech/FallbackProxy.d.ts +104 -0
  24. package/dist/speech/FallbackProxy.d.ts.map +1 -0
  25. package/dist/speech/FallbackProxy.js +151 -0
  26. package/dist/speech/FallbackProxy.js.map +1 -0
  27. package/dist/speech/SpeechProviderResolver.d.ts +103 -0
  28. package/dist/speech/SpeechProviderResolver.d.ts.map +1 -0
  29. package/dist/speech/SpeechProviderResolver.js +256 -0
  30. package/dist/speech/SpeechProviderResolver.js.map +1 -0
  31. package/dist/speech/SpeechRuntime.d.ts +23 -1
  32. package/dist/speech/SpeechRuntime.d.ts.map +1 -1
  33. package/dist/speech/SpeechRuntime.js +82 -8
  34. package/dist/speech/SpeechRuntime.js.map +1 -1
  35. package/dist/speech/index.d.ts +6 -0
  36. package/dist/speech/index.d.ts.map +1 -1
  37. package/dist/speech/index.js +6 -0
  38. package/dist/speech/index.js.map +1 -1
  39. package/dist/speech/providerCatalog.d.ts.map +1 -1
  40. package/dist/speech/providerCatalog.js +15 -1
  41. package/dist/speech/providerCatalog.js.map +1 -1
  42. package/dist/speech/providers/AssemblyAISTTProvider.d.ts +49 -0
  43. package/dist/speech/providers/AssemblyAISTTProvider.d.ts.map +1 -0
  44. package/dist/speech/providers/AssemblyAISTTProvider.js +151 -0
  45. package/dist/speech/providers/AssemblyAISTTProvider.js.map +1 -0
  46. package/dist/speech/providers/AzureSpeechSTTProvider.d.ts +48 -0
  47. package/dist/speech/providers/AzureSpeechSTTProvider.d.ts.map +1 -0
  48. package/dist/speech/providers/AzureSpeechSTTProvider.js +90 -0
  49. package/dist/speech/providers/AzureSpeechSTTProvider.js.map +1 -0
  50. package/dist/speech/providers/AzureSpeechTTSProvider.d.ts +60 -0
  51. package/dist/speech/providers/AzureSpeechTTSProvider.d.ts.map +1 -0
  52. package/dist/speech/providers/AzureSpeechTTSProvider.js +127 -0
  53. package/dist/speech/providers/AzureSpeechTTSProvider.js.map +1 -0
  54. package/dist/speech/providers/DeepgramBatchSTTProvider.d.ts +55 -0
  55. package/dist/speech/providers/DeepgramBatchSTTProvider.d.ts.map +1 -0
  56. package/dist/speech/providers/DeepgramBatchSTTProvider.js +102 -0
  57. package/dist/speech/providers/DeepgramBatchSTTProvider.js.map +1 -0
  58. package/dist/speech/types.d.ts +35 -0
  59. package/dist/speech/types.d.ts.map +1 -1
  60. package/dist/voice/CallManager.d.ts +1 -1
  61. package/dist/voice/CallManager.d.ts.map +1 -1
  62. package/dist/voice/CallManager.js +9 -0
  63. package/dist/voice/CallManager.js.map +1 -1
  64. package/dist/voice/MediaStreamParser.d.ts +83 -0
  65. package/dist/voice/MediaStreamParser.d.ts.map +1 -0
  66. package/dist/voice/MediaStreamParser.js +2 -0
  67. package/dist/voice/MediaStreamParser.js.map +1 -0
  68. package/dist/voice/TelephonyStreamTransport.d.ts +112 -0
  69. package/dist/voice/TelephonyStreamTransport.d.ts.map +1 -0
  70. package/dist/voice/TelephonyStreamTransport.js +208 -0
  71. package/dist/voice/TelephonyStreamTransport.js.map +1 -0
  72. package/dist/voice/index.d.ts +10 -0
  73. package/dist/voice/index.d.ts.map +1 -1
  74. package/dist/voice/index.js +11 -0
  75. package/dist/voice/index.js.map +1 -1
  76. package/dist/voice/parsers/PlivoMediaStreamParser.d.ts +43 -0
  77. package/dist/voice/parsers/PlivoMediaStreamParser.d.ts.map +1 -0
  78. package/dist/voice/parsers/PlivoMediaStreamParser.js +92 -0
  79. package/dist/voice/parsers/PlivoMediaStreamParser.js.map +1 -0
  80. package/dist/voice/parsers/TelnyxMediaStreamParser.d.ts +51 -0
  81. package/dist/voice/parsers/TelnyxMediaStreamParser.d.ts.map +1 -0
  82. package/dist/voice/parsers/TelnyxMediaStreamParser.js +103 -0
  83. package/dist/voice/parsers/TelnyxMediaStreamParser.js.map +1 -0
  84. package/dist/voice/parsers/TwilioMediaStreamParser.d.ts +50 -0
  85. package/dist/voice/parsers/TwilioMediaStreamParser.d.ts.map +1 -0
  86. package/dist/voice/parsers/TwilioMediaStreamParser.js +144 -0
  87. package/dist/voice/parsers/TwilioMediaStreamParser.js.map +1 -0
  88. package/dist/voice/providers/plivo.d.ts +77 -0
  89. package/dist/voice/providers/plivo.d.ts.map +1 -0
  90. package/dist/voice/providers/plivo.js +180 -0
  91. package/dist/voice/providers/plivo.js.map +1 -0
  92. package/dist/voice/providers/telnyx.d.ts +93 -0
  93. package/dist/voice/providers/telnyx.d.ts.map +1 -0
  94. package/dist/voice/providers/telnyx.js +193 -0
  95. package/dist/voice/providers/telnyx.js.map +1 -0
  96. package/dist/voice/providers/twilio.d.ts +79 -0
  97. package/dist/voice/providers/twilio.d.ts.map +1 -0
  98. package/dist/voice/providers/twilio.js +191 -0
  99. package/dist/voice/providers/twilio.js.map +1 -0
  100. package/dist/voice/twiml.d.ts +69 -0
  101. package/dist/voice/twiml.d.ts.map +1 -0
  102. package/dist/voice/twiml.js +92 -0
  103. package/dist/voice/twiml.js.map +1 -0
  104. package/dist/voice/types.d.ts +9 -1
  105. package/dist/voice/types.d.ts.map +1 -1
  106. package/dist/voice-pipeline/AcousticEndpointDetector.d.ts +90 -0
  107. package/dist/voice-pipeline/AcousticEndpointDetector.d.ts.map +1 -0
  108. package/dist/voice-pipeline/AcousticEndpointDetector.js +123 -0
  109. package/dist/voice-pipeline/AcousticEndpointDetector.js.map +1 -0
  110. package/dist/voice-pipeline/HardCutBargeinHandler.d.ts +67 -0
  111. package/dist/voice-pipeline/HardCutBargeinHandler.d.ts.map +1 -0
  112. package/dist/voice-pipeline/HardCutBargeinHandler.js +55 -0
  113. package/dist/voice-pipeline/HardCutBargeinHandler.js.map +1 -0
  114. package/dist/voice-pipeline/HeuristicEndpointDetector.d.ts +128 -0
  115. package/dist/voice-pipeline/HeuristicEndpointDetector.d.ts.map +1 -0
  116. package/dist/voice-pipeline/HeuristicEndpointDetector.js +240 -0
  117. package/dist/voice-pipeline/HeuristicEndpointDetector.js.map +1 -0
  118. package/dist/voice-pipeline/SoftFadeBargeinHandler.d.ts +96 -0
  119. package/dist/voice-pipeline/SoftFadeBargeinHandler.d.ts.map +1 -0
  120. package/dist/voice-pipeline/SoftFadeBargeinHandler.js +69 -0
  121. package/dist/voice-pipeline/SoftFadeBargeinHandler.js.map +1 -0
  122. package/dist/voice-pipeline/VoicePipelineOrchestrator.d.ts +122 -0
  123. package/dist/voice-pipeline/VoicePipelineOrchestrator.d.ts.map +1 -0
  124. package/dist/voice-pipeline/VoicePipelineOrchestrator.js +317 -0
  125. package/dist/voice-pipeline/VoicePipelineOrchestrator.js.map +1 -0
  126. package/dist/voice-pipeline/WebSocketStreamTransport.d.ts +148 -0
  127. package/dist/voice-pipeline/WebSocketStreamTransport.d.ts.map +1 -0
  128. package/dist/voice-pipeline/WebSocketStreamTransport.js +207 -0
  129. package/dist/voice-pipeline/WebSocketStreamTransport.js.map +1 -0
  130. package/dist/voice-pipeline/index.d.ts +13 -0
  131. package/dist/voice-pipeline/index.d.ts.map +1 -0
  132. package/dist/voice-pipeline/index.js +13 -0
  133. package/dist/voice-pipeline/index.js.map +1 -0
  134. package/dist/voice-pipeline/types.d.ts +905 -0
  135. package/dist/voice-pipeline/types.d.ts.map +1 -0
  136. package/dist/voice-pipeline/types.js +23 -0
  137. package/dist/voice-pipeline/types.js.map +1 -0
  138. package/package.json +6 -1
@@ -0,0 +1,317 @@
1
+ /**
2
+ * @module voice-pipeline/VoicePipelineOrchestrator
3
+ *
4
+ * Central state machine that wires together transport, STT, endpoint detection,
5
+ * TTS, barge-in handling, and the agent session into a coordinated real-time
6
+ * voice conversation loop.
7
+ *
8
+ * State transitions:
9
+ * ```
10
+ * IDLE → startSession() → LISTENING
11
+ * LISTENING → turn_complete → PROCESSING
12
+ * PROCESSING → LLM tokens start → SPEAKING
13
+ * SPEAKING → TTS complete → LISTENING
14
+ * SPEAKING → barge-in → INTERRUPTING → LISTENING
15
+ * ANY → transport disconnect → CLOSED
16
+ * ```
17
+ */
18
+ import { EventEmitter } from 'node:events';
19
+ import { randomUUID } from 'node:crypto';
20
+ /**
21
+ * VoicePipelineOrchestrator is the central state machine for the AgentOS
22
+ * streaming voice pipeline. It coordinates audio capture, speech recognition,
23
+ * endpoint detection, agent inference, text-to-speech synthesis, and barge-in
24
+ * handling into a seamless real-time conversation loop.
25
+ *
26
+ * Emits:
27
+ * - `'state_changed'` ({ from: PipelineState, to: PipelineState })
28
+ */
29
+ export class VoicePipelineOrchestrator extends EventEmitter {
30
+ /** Current pipeline state (read-only). */
31
+ get state() {
32
+ return this._state;
33
+ }
34
+ constructor(config) {
35
+ super();
36
+ this.config = config;
37
+ /** Current pipeline state. */
38
+ this._state = 'idle';
39
+ /** Active sub-sessions and components, set during startSession. */
40
+ this._sttSession = null;
41
+ this._ttsSession = null;
42
+ this._endpointDetector = null;
43
+ this._bargeinHandler = null;
44
+ this._transport = null;
45
+ this._agentSession = null;
46
+ /** Watchdog timer ID for max turn duration. */
47
+ this._watchdogTimer = null;
48
+ /** Tracks cumulative TTS text for barge-in context. */
49
+ this._currentTTSText = '';
50
+ /** Tracks cumulative played duration for barge-in context. */
51
+ this._currentPlayedMs = 0;
52
+ }
53
+ /**
54
+ * Start a voice session. Accepts pre-built components via overrides for testing.
55
+ * In production, components are resolved from ExtensionManager (future task).
56
+ *
57
+ * @param transport - The bidirectional audio/text stream transport.
58
+ * @param agentSession - The agent session adapter for turn-based conversation.
59
+ * @param overrides - Optional pre-built components (for testing or manual wiring).
60
+ * @returns A live VoicePipelineSession object.
61
+ */
62
+ async startSession(transport, agentSession, overrides) {
63
+ if (this._state !== 'idle') {
64
+ throw new Error(`Cannot start session in state '${this._state}'; expected 'idle'.`);
65
+ }
66
+ this._transport = transport;
67
+ this._agentSession = agentSession;
68
+ const stt = overrides?.streamingSTT;
69
+ const tts = overrides?.streamingTTS;
70
+ const endpointDetector = overrides?.endpointDetector;
71
+ const bargeinHandler = overrides?.bargeinHandler;
72
+ if (!stt)
73
+ throw new Error('streamingSTT is required (pass via overrides or wait for ExtensionManager support).');
74
+ if (!tts)
75
+ throw new Error('streamingTTS is required (pass via overrides or wait for ExtensionManager support).');
76
+ if (!endpointDetector)
77
+ throw new Error('endpointDetector is required.');
78
+ if (!bargeinHandler)
79
+ throw new Error('bargeinHandler is required.');
80
+ // Create sub-sessions
81
+ const sttSession = await stt.startSession({ language: this.config.language });
82
+ const ttsSession = await tts.startSession({
83
+ voice: this.config.voice,
84
+ format: this.config.format,
85
+ });
86
+ this._sttSession = sttSession;
87
+ this._ttsSession = ttsSession;
88
+ this._endpointDetector = endpointDetector;
89
+ this._bargeinHandler = bargeinHandler;
90
+ // Wire everything up
91
+ this._wireTransportToSTT(transport, sttSession);
92
+ this._wireSTTToEndpoint(sttSession, endpointDetector, transport);
93
+ this._wireTurnComplete(endpointDetector, transport, agentSession, ttsSession);
94
+ this._wireTTSToTransport(ttsSession, transport);
95
+ this._wireBargein(sttSession, ttsSession, bargeinHandler, transport, agentSession);
96
+ this._wireDisconnect(transport, sttSession, ttsSession);
97
+ // Transition to listening
98
+ this._setState('listening');
99
+ // Start watchdog
100
+ this._resetWatchdog();
101
+ // Build and return the VoicePipelineSession object
102
+ const sessionId = randomUUID();
103
+ const orchestrator = this;
104
+ const session = Object.assign(new EventEmitter(), {
105
+ sessionId,
106
+ get state() {
107
+ return orchestrator._state;
108
+ },
109
+ transport,
110
+ async close(reason) {
111
+ await orchestrator.stopSession(reason);
112
+ },
113
+ });
114
+ // Forward state_changed events to the session
115
+ this.on('state_changed', (evt) => session.emit('state_change', evt.to));
116
+ return session;
117
+ }
118
+ /**
119
+ * Stop the current session, tearing down all sub-sessions and timers.
120
+ *
121
+ * @param reason - Optional human-readable reason for diagnostics.
122
+ */
123
+ async stopSession(reason) {
124
+ if (this._state === 'closed')
125
+ return;
126
+ this._clearWatchdog();
127
+ this._sttSession?.close();
128
+ this._ttsSession?.close();
129
+ this._transport?.close(1000, reason);
130
+ this._setState('closed');
131
+ // Clean up references
132
+ this._sttSession = null;
133
+ this._ttsSession = null;
134
+ this._endpointDetector = null;
135
+ this._bargeinHandler = null;
136
+ this._transport = null;
137
+ this._agentSession = null;
138
+ }
139
+ // --------------------------------------------------------------------------
140
+ // Wiring helpers
141
+ // --------------------------------------------------------------------------
142
+ /**
143
+ * Forward audio frames from transport to STT session.
144
+ */
145
+ _wireTransportToSTT(transport, sttSession) {
146
+ transport.on('audio', (frame) => {
147
+ sttSession.pushAudio(frame);
148
+ });
149
+ }
150
+ /**
151
+ * Forward STT transcript events to endpoint detector and transport.
152
+ */
153
+ _wireSTTToEndpoint(sttSession, endpointDetector, transport) {
154
+ sttSession.on('transcript', (transcript) => {
155
+ endpointDetector.pushTranscript(transcript);
156
+ transport.sendControl({
157
+ type: 'transcript',
158
+ text: transcript.text,
159
+ isFinal: transcript.isFinal,
160
+ confidence: transcript.confidence,
161
+ });
162
+ });
163
+ }
164
+ /**
165
+ * Handle turn_complete from endpoint detector — transition through
166
+ * PROCESSING → SPEAKING → LISTENING.
167
+ */
168
+ _wireTurnComplete(endpointDetector, transport, agentSession, ttsSession) {
169
+ endpointDetector.on('turn_complete', async (event) => {
170
+ if (this._state !== 'listening')
171
+ return;
172
+ this._clearWatchdog();
173
+ this._setState('processing');
174
+ transport.sendControl({ type: 'agent_thinking' });
175
+ const metadata = {
176
+ speakers: [],
177
+ endpointReason: event.reason,
178
+ speechDurationMs: event.durationMs,
179
+ wasInterrupted: false,
180
+ transcriptConfidence: event.confidence,
181
+ };
182
+ const tokenStream = agentSession.sendText(event.transcript, metadata);
183
+ this._setState('speaking');
184
+ this._currentTTSText = '';
185
+ this._currentPlayedMs = 0;
186
+ transport.sendControl({ type: 'agent_speaking', text: '' });
187
+ for await (const token of tokenStream) {
188
+ if (this._state !== 'speaking')
189
+ break; // barge-in happened
190
+ this._currentTTSText += token;
191
+ ttsSession.pushTokens(token);
192
+ }
193
+ if (this._state === 'speaking') {
194
+ await ttsSession.flush();
195
+ }
196
+ });
197
+ }
198
+ /**
199
+ * Forward TTS audio chunks to the transport and handle utterance completion.
200
+ */
201
+ _wireTTSToTransport(ttsSession, transport) {
202
+ ttsSession.on('audio', (chunk) => {
203
+ if (this._state === 'speaking') {
204
+ this._currentPlayedMs += chunk.durationMs;
205
+ transport.sendAudio(chunk);
206
+ }
207
+ });
208
+ ttsSession.on('flush_complete', () => {
209
+ if (this._state === 'speaking') {
210
+ this._setState('listening');
211
+ transport.sendControl({
212
+ type: 'agent_done',
213
+ text: this._currentTTSText,
214
+ durationMs: this._currentPlayedMs,
215
+ });
216
+ this._endpointDetector?.reset();
217
+ this._resetWatchdog();
218
+ }
219
+ });
220
+ }
221
+ /**
222
+ * Wire barge-in detection: when speech is detected during SPEAKING state,
223
+ * consult the barge-in handler and act accordingly.
224
+ */
225
+ _wireBargein(sttSession, ttsSession, bargeinHandler, transport, agentSession) {
226
+ sttSession.on('speech_start', async () => {
227
+ // Also push VAD event to endpoint detector
228
+ this._endpointDetector?.pushVadEvent({
229
+ type: 'speech_start',
230
+ timestamp: Date.now(),
231
+ source: 'stt',
232
+ });
233
+ if (this._state === 'speaking') {
234
+ const action = await bargeinHandler.handleBargein({
235
+ speechDurationMs: 0,
236
+ interruptedText: this._currentTTSText,
237
+ playedDurationMs: this._currentPlayedMs,
238
+ });
239
+ if (action.type === 'cancel') {
240
+ this._setState('interrupting');
241
+ ttsSession.cancel();
242
+ agentSession.abort?.();
243
+ transport.sendControl({ type: 'barge_in', action });
244
+ this._setState('listening');
245
+ this._endpointDetector?.reset();
246
+ this._resetWatchdog();
247
+ }
248
+ else if (action.type === 'pause') {
249
+ transport.sendControl({ type: 'barge_in', action });
250
+ }
251
+ // 'ignore' and 'resume' — do nothing
252
+ }
253
+ });
254
+ sttSession.on('speech_end', () => {
255
+ this._endpointDetector?.pushVadEvent({
256
+ type: 'speech_end',
257
+ timestamp: Date.now(),
258
+ source: 'stt',
259
+ });
260
+ });
261
+ }
262
+ /**
263
+ * Handle transport disconnect — close everything.
264
+ */
265
+ _wireDisconnect(transport, sttSession, ttsSession) {
266
+ transport.on('close', () => {
267
+ this._clearWatchdog();
268
+ this._setState('closed');
269
+ sttSession.close();
270
+ ttsSession.close();
271
+ });
272
+ }
273
+ // --------------------------------------------------------------------------
274
+ // State management
275
+ // --------------------------------------------------------------------------
276
+ /**
277
+ * Transition to a new pipeline state, emitting a `state_changed` event.
278
+ */
279
+ _setState(state) {
280
+ const from = this._state;
281
+ if (from === state)
282
+ return;
283
+ this._state = state;
284
+ this.emit('state_changed', { from, to: state });
285
+ }
286
+ // --------------------------------------------------------------------------
287
+ // Watchdog timer
288
+ // --------------------------------------------------------------------------
289
+ /**
290
+ * Reset the watchdog timer for max turn duration. If the pipeline stays in
291
+ * LISTENING for longer than `maxTurnDurationMs` (default 30s) without a
292
+ * turn_complete, force a timeout.
293
+ */
294
+ _resetWatchdog() {
295
+ this._clearWatchdog();
296
+ const maxMs = this.config.maxTurnDurationMs ?? 30000;
297
+ this._watchdogTimer = setTimeout(() => {
298
+ if (this._state === 'listening') {
299
+ this._endpointDetector?.pushVadEvent({
300
+ type: 'speech_end',
301
+ timestamp: Date.now(),
302
+ source: 'vad',
303
+ });
304
+ }
305
+ }, maxMs);
306
+ }
307
+ /**
308
+ * Clear the watchdog timer if active.
309
+ */
310
+ _clearWatchdog() {
311
+ if (this._watchdogTimer !== null) {
312
+ clearTimeout(this._watchdogTimer);
313
+ this._watchdogTimer = null;
314
+ }
315
+ }
316
+ }
317
+ //# sourceMappingURL=VoicePipelineOrchestrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VoicePipelineOrchestrator.js","sourceRoot":"","sources":["../../src/voice-pipeline/VoicePipelineOrchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAuCzC;;;;;;;;GAQG;AACH,MAAM,OAAO,yBAA0B,SAAQ,YAAY;IAqBzD,0CAA0C;IAC1C,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,YAA6B,MAA2B;QACtD,KAAK,EAAE,CAAC;QADmB,WAAM,GAAN,MAAM,CAAqB;QAzBxD,8BAA8B;QACtB,WAAM,GAAkB,MAAM,CAAC;QAEvC,mEAAmE;QAC3D,gBAAW,GAA+B,IAAI,CAAC;QAC/C,gBAAW,GAA+B,IAAI,CAAC;QAC/C,sBAAiB,GAA6B,IAAI,CAAC;QACnD,oBAAe,GAA2B,IAAI,CAAC;QAC/C,eAAU,GAA4B,IAAI,CAAC;QA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ACK,cAAc;QACpB,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,EAAE,CAAC;YACjC,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAClC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC7B,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * @module voice-pipeline/WebSocketStreamTransport
3
+ *
4
+ * A concrete {@link IStreamTransport} implementation that wraps a WebSocket
5
+ * connection (or any WebSocket-compatible object). Binary messages are decoded
6
+ * as Float32Array audio frames; text messages are parsed as
7
+ * {@link ClientTextMessage} control envelopes.
8
+ *
9
+ * The transport is intentionally transport-agnostic: it accepts any object that
10
+ * exposes the `ws` package's `WebSocket` interface (readyState, send, close, and
11
+ * the standard event emitter surface). This makes it trivially testable with a
12
+ * plain `EventEmitter` mock.
13
+ */
14
+ import { EventEmitter } from 'node:events';
15
+ import type { IStreamTransport, AudioFrame, EncodedAudioChunk, TransportControlMessage, ServerTextMessage } from './types.js';
16
+ /**
17
+ * Subset of the WebSocket API required by {@link WebSocketStreamTransport}.
18
+ * Both the `ws` npm package and the browser's native WebSocket satisfy this.
19
+ */
20
+ export interface WebSocketLike extends NodeJS.EventEmitter {
21
+ /** WebSocket ready-state constant for the OPEN state (= 1). */
22
+ readonly OPEN?: number;
23
+ /** WebSocket ready-state constant for the CLOSED state (= 3). */
24
+ readonly CLOSED?: number;
25
+ /** Current ready state of the socket. */
26
+ readonly readyState: number;
27
+ /**
28
+ * Send data over the socket.
29
+ *
30
+ * @param data — Binary `Buffer` or text `string` payload.
31
+ * @param cb — Optional completion callback used by the `ws` library.
32
+ */
33
+ send(data: Buffer | string, cb?: (err?: Error) => void): void;
34
+ /**
35
+ * Initiate a graceful close handshake.
36
+ *
37
+ * @param code — Optional numeric close code (default 1000).
38
+ * @param reason — Optional human-readable reason string.
39
+ */
40
+ close(code?: number, reason?: string): void;
41
+ }
42
+ /**
43
+ * Constructor options for {@link WebSocketStreamTransport}.
44
+ */
45
+ export interface WebSocketStreamTransportConfig {
46
+ /**
47
+ * Sample rate (in Hz) used to populate {@link AudioFrame.sampleRate} on
48
+ * inbound binary messages. Must match the rate the remote client is sending.
49
+ * @example 16000
50
+ */
51
+ sampleRate: number;
52
+ }
53
+ /**
54
+ * Bidirectional voice pipeline transport backed by a WebSocket connection.
55
+ *
56
+ * ### Inbound wire format
57
+ * - **Binary frame** → decoded as a `Float32Array` view, wrapped in an
58
+ * {@link AudioFrame}, and re-emitted as `'audio_frame'`.
59
+ * - **Text frame** → `JSON.parse()`d and re-emitted as `'control'` carrying
60
+ * the raw {@link ClientTextMessage} object.
61
+ *
62
+ * ### Outbound API
63
+ * - {@link sendAudio} — serialises an {@link EncodedAudioChunk} or
64
+ * {@link AudioFrame} to a binary `Buffer` and calls `ws.send()`.
65
+ * - {@link sendControl} — JSON-stringifies a {@link TransportControlMessage}
66
+ * or {@link ServerTextMessage} and calls `ws.send()`.
67
+ *
68
+ * ### Lifecycle events (re-emitted on `this`)
69
+ * | WS event | Transport emission |
70
+ * |----------|--------------------|
71
+ * | `open` | `'connected'` |
72
+ * | `close` | `'disconnected'` |
73
+ * | `error` | `'error'` |
74
+ *
75
+ * @fires audio_frame — `(frame: AudioFrame)` for every inbound binary message.
76
+ * @fires control — `(msg: ClientTextMessage)` for every inbound text message.
77
+ * @fires connected — Socket transitioned to OPEN state.
78
+ * @fires disconnected — Socket has been fully closed.
79
+ * @fires error — Socket-level error occurred.
80
+ */
81
+ export declare class WebSocketStreamTransport extends EventEmitter implements IStreamTransport {
82
+ /** Stable UUID assigned at construction time. */
83
+ readonly id: string;
84
+ /** Current connection state. Updated in response to WebSocket events. */
85
+ private _state;
86
+ /** The underlying WebSocket connection. */
87
+ private readonly _ws;
88
+ /** Audio sample rate propagated into every decoded {@link AudioFrame}. */
89
+ private readonly _sampleRate;
90
+ /**
91
+ * Create a new transport wrapping an existing WebSocket connection.
92
+ *
93
+ * The constructor inspects `ws.readyState` to determine the initial
94
+ * {@link state}: if the socket is already OPEN (readyState === 1) the state
95
+ * is set to `'open'`; otherwise it is set to `'connecting'` and will
96
+ * transition to `'open'` when the `'open'` event fires.
97
+ *
98
+ * @param ws — WebSocket connection (or compatible mock).
99
+ * @param config — Transport-level configuration.
100
+ */
101
+ constructor(ws: WebSocketLike, config: WebSocketStreamTransportConfig);
102
+ /**
103
+ * Current connection state of the underlying WebSocket.
104
+ * Read-only from the outside; updated internally by WS event handlers.
105
+ */
106
+ get state(): 'connecting' | 'open' | 'closing' | 'closed';
107
+ /**
108
+ * Send a synthesised audio chunk to the remote client for playback.
109
+ *
110
+ * If `chunk` carries an {@link EncodedAudioChunk} (has an `audio` Buffer
111
+ * property), that buffer is sent directly. If it carries an {@link AudioFrame}
112
+ * (has a `samples` Float32Array), the samples are copied into a new `Buffer`
113
+ * and sent.
114
+ *
115
+ * @param chunk — Encoded audio chunk or raw PCM frame to deliver.
116
+ * @returns Resolves once the data has been handed to the OS socket buffer.
117
+ */
118
+ sendAudio(chunk: EncodedAudioChunk | AudioFrame): Promise<void>;
119
+ /**
120
+ * Send a JSON control message to the remote client.
121
+ *
122
+ * The message is JSON-stringified before transmission. Both
123
+ * {@link TransportControlMessage} and {@link ServerTextMessage} are accepted
124
+ * since they share the same serialisation path.
125
+ *
126
+ * @param msg — Server-side protocol message.
127
+ * @returns Resolves once the message has been handed to the OS socket buffer.
128
+ */
129
+ sendControl(msg: TransportControlMessage | ServerTextMessage): Promise<void>;
130
+ /**
131
+ * Initiate a graceful close of the transport.
132
+ *
133
+ * Sets internal state to `'closing'` immediately, then delegates to the
134
+ * underlying WebSocket's `close()` method. The `'disconnected'` event will
135
+ * fire once the socket's `'close'` event is received.
136
+ *
137
+ * @param code — Optional numeric WebSocket close code (default 1000).
138
+ * @param reason — Optional human-readable close reason.
139
+ */
140
+ close(code?: number, reason?: string): void;
141
+ /**
142
+ * Attach listeners to the underlying WebSocket for the events that matter to
143
+ * the voice pipeline. All listener state is contained here; no cleanup method
144
+ * is currently needed since the transport's lifetime is tied to the socket's.
145
+ */
146
+ private _attachWsListeners;
147
+ }
148
+ //# sourceMappingURL=WebSocketStreamTransport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSocketStreamTransport.d.ts","sourceRoot":"","sources":["../../src/voice-pipeline/WebSocketStreamTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,EACV,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EAEvB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAOpB;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,MAAM,CAAC,YAAY;IACxD,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC;IAC9D;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7C;AAMD;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,wBAAyB,SAAQ,YAAa,YAAW,gBAAgB;IAKpF,iDAAiD;IACjD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,yEAAyE;IACzE,OAAO,CAAC,MAAM,CAA+C;IAM7D,2CAA2C;IAC3C,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