@azure/ai-voicelive 1.0.0-alpha.20251117.2
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/LICENSE +21 -0
- package/README.md +358 -0
- package/dist/browser/auth/credentialHandler.d.ts +43 -0
- package/dist/browser/auth/credentialHandler.js +147 -0
- package/dist/browser/auth/credentialHandler.js.map +1 -0
- package/dist/browser/errors/connectionErrors.d.ts +68 -0
- package/dist/browser/errors/connectionErrors.js +136 -0
- package/dist/browser/errors/connectionErrors.js.map +1 -0
- package/dist/browser/errors/index.d.ts +2 -0
- package/dist/browser/errors/index.js +4 -0
- package/dist/browser/errors/index.js.map +1 -0
- package/dist/browser/handlers/sessionHandlers.d.ts +250 -0
- package/dist/browser/handlers/sessionHandlers.js +4 -0
- package/dist/browser/handlers/sessionHandlers.js.map +1 -0
- package/dist/browser/handlers/subscriptionManager.d.ts +54 -0
- package/dist/browser/handlers/subscriptionManager.js +250 -0
- package/dist/browser/handlers/subscriptionManager.js.map +1 -0
- package/dist/browser/index.d.ts +7 -0
- package/dist/browser/index.js +12 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/logger.d.ts +2 -0
- package/dist/browser/logger.js +5 -0
- package/dist/browser/logger.js.map +1 -0
- package/dist/browser/models/index.d.ts +2 -0
- package/dist/browser/models/index.js +4 -0
- package/dist/browser/models/index.js.map +1 -0
- package/dist/browser/models/models.d.ts +2154 -0
- package/dist/browser/models/models.js +2251 -0
- package/dist/browser/models/models.js.map +1 -0
- package/dist/browser/package.json +3 -0
- package/dist/browser/protocol/messageParser.d.ts +42 -0
- package/dist/browser/protocol/messageParser.js +150 -0
- package/dist/browser/protocol/messageParser.js.map +1 -0
- package/dist/browser/voiceLiveClient.d.ts +65 -0
- package/dist/browser/voiceLiveClient.js +81 -0
- package/dist/browser/voiceLiveClient.js.map +1 -0
- package/dist/browser/voiceLiveSession.d.ts +138 -0
- package/dist/browser/voiceLiveSession.js +429 -0
- package/dist/browser/voiceLiveSession.js.map +1 -0
- package/dist/browser/websocket/connectionManager.d.ts +88 -0
- package/dist/browser/websocket/connectionManager.js +183 -0
- package/dist/browser/websocket/connectionManager.js.map +1 -0
- package/dist/browser/websocket/websocketBrowser.d.ts +26 -0
- package/dist/browser/websocket/websocketBrowser.js +175 -0
- package/dist/browser/websocket/websocketBrowser.js.map +1 -0
- package/dist/browser/websocket/websocketFactory.d.ts +23 -0
- package/dist/browser/websocket/websocketFactory.js +80 -0
- package/dist/browser/websocket/websocketFactory.js.map +1 -0
- package/dist/browser/websocket/websocketLike.d.ts +78 -0
- package/dist/browser/websocket/websocketLike.js +13 -0
- package/dist/browser/websocket/websocketLike.js.map +1 -0
- package/dist/browser/websocket/websocketNode.d.ts +26 -0
- package/dist/browser/websocket/websocketNode.js +180 -0
- package/dist/browser/websocket/websocketNode.js.map +1 -0
- package/dist/commonjs/auth/credentialHandler.d.ts +43 -0
- package/dist/commonjs/auth/credentialHandler.js +151 -0
- package/dist/commonjs/auth/credentialHandler.js.map +1 -0
- package/dist/commonjs/errors/connectionErrors.d.ts +68 -0
- package/dist/commonjs/errors/connectionErrors.js +146 -0
- package/dist/commonjs/errors/connectionErrors.js.map +1 -0
- package/dist/commonjs/errors/index.d.ts +2 -0
- package/dist/commonjs/errors/index.js +7 -0
- package/dist/commonjs/errors/index.js.map +1 -0
- package/dist/commonjs/handlers/sessionHandlers.d.ts +250 -0
- package/dist/commonjs/handlers/sessionHandlers.js +5 -0
- package/dist/commonjs/handlers/sessionHandlers.js.map +1 -0
- package/dist/commonjs/handlers/subscriptionManager.d.ts +54 -0
- package/dist/commonjs/handlers/subscriptionManager.js +255 -0
- package/dist/commonjs/handlers/subscriptionManager.js.map +1 -0
- package/dist/commonjs/index.d.ts +7 -0
- package/dist/commonjs/index.js +45 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/logger.d.ts +2 -0
- package/dist/commonjs/logger.js +8 -0
- package/dist/commonjs/logger.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +2 -0
- package/dist/commonjs/models/index.js +27 -0
- package/dist/commonjs/models/index.js.map +1 -0
- package/dist/commonjs/models/models.d.ts +2154 -0
- package/dist/commonjs/models/models.js +2463 -0
- package/dist/commonjs/models/models.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/protocol/messageParser.d.ts +42 -0
- package/dist/commonjs/protocol/messageParser.js +154 -0
- package/dist/commonjs/protocol/messageParser.js.map +1 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/commonjs/voiceLiveClient.d.ts +65 -0
- package/dist/commonjs/voiceLiveClient.js +85 -0
- package/dist/commonjs/voiceLiveClient.js.map +1 -0
- package/dist/commonjs/voiceLiveSession.d.ts +138 -0
- package/dist/commonjs/voiceLiveSession.js +433 -0
- package/dist/commonjs/voiceLiveSession.js.map +1 -0
- package/dist/commonjs/websocket/connectionManager.d.ts +88 -0
- package/dist/commonjs/websocket/connectionManager.js +187 -0
- package/dist/commonjs/websocket/connectionManager.js.map +1 -0
- package/dist/commonjs/websocket/websocketBrowser.d.ts +26 -0
- package/dist/commonjs/websocket/websocketBrowser.js +179 -0
- package/dist/commonjs/websocket/websocketBrowser.js.map +1 -0
- package/dist/commonjs/websocket/websocketFactory.d.ts +23 -0
- package/dist/commonjs/websocket/websocketFactory.js +86 -0
- package/dist/commonjs/websocket/websocketFactory.js.map +1 -0
- package/dist/commonjs/websocket/websocketLike.d.ts +78 -0
- package/dist/commonjs/websocket/websocketLike.js +16 -0
- package/dist/commonjs/websocket/websocketLike.js.map +1 -0
- package/dist/commonjs/websocket/websocketNode.d.ts +26 -0
- package/dist/commonjs/websocket/websocketNode.js +185 -0
- package/dist/commonjs/websocket/websocketNode.js.map +1 -0
- package/dist/esm/auth/credentialHandler.d.ts +43 -0
- package/dist/esm/auth/credentialHandler.js +147 -0
- package/dist/esm/auth/credentialHandler.js.map +1 -0
- package/dist/esm/errors/connectionErrors.d.ts +68 -0
- package/dist/esm/errors/connectionErrors.js +136 -0
- package/dist/esm/errors/connectionErrors.js.map +1 -0
- package/dist/esm/errors/index.d.ts +2 -0
- package/dist/esm/errors/index.js +4 -0
- package/dist/esm/errors/index.js.map +1 -0
- package/dist/esm/handlers/sessionHandlers.d.ts +250 -0
- package/dist/esm/handlers/sessionHandlers.js +4 -0
- package/dist/esm/handlers/sessionHandlers.js.map +1 -0
- package/dist/esm/handlers/subscriptionManager.d.ts +54 -0
- package/dist/esm/handlers/subscriptionManager.js +250 -0
- package/dist/esm/handlers/subscriptionManager.js.map +1 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/logger.d.ts +2 -0
- package/dist/esm/logger.js +5 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.js +4 -0
- package/dist/esm/models/index.js.map +1 -0
- package/dist/esm/models/models.d.ts +2154 -0
- package/dist/esm/models/models.js +2251 -0
- package/dist/esm/models/models.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/protocol/messageParser.d.ts +42 -0
- package/dist/esm/protocol/messageParser.js +150 -0
- package/dist/esm/protocol/messageParser.js.map +1 -0
- package/dist/esm/voiceLiveClient.d.ts +65 -0
- package/dist/esm/voiceLiveClient.js +81 -0
- package/dist/esm/voiceLiveClient.js.map +1 -0
- package/dist/esm/voiceLiveSession.d.ts +138 -0
- package/dist/esm/voiceLiveSession.js +429 -0
- package/dist/esm/voiceLiveSession.js.map +1 -0
- package/dist/esm/websocket/connectionManager.d.ts +88 -0
- package/dist/esm/websocket/connectionManager.js +183 -0
- package/dist/esm/websocket/connectionManager.js.map +1 -0
- package/dist/esm/websocket/websocketBrowser.d.ts +26 -0
- package/dist/esm/websocket/websocketBrowser.js +175 -0
- package/dist/esm/websocket/websocketBrowser.js.map +1 -0
- package/dist/esm/websocket/websocketFactory.d.ts +23 -0
- package/dist/esm/websocket/websocketFactory.js +80 -0
- package/dist/esm/websocket/websocketFactory.js.map +1 -0
- package/dist/esm/websocket/websocketLike.d.ts +78 -0
- package/dist/esm/websocket/websocketLike.js +13 -0
- package/dist/esm/websocket/websocketLike.js.map +1 -0
- package/dist/esm/websocket/websocketNode.d.ts +26 -0
- package/dist/esm/websocket/websocketNode.js +180 -0
- package/dist/esm/websocket/websocketNode.js.map +1 -0
- package/dist/react-native/auth/credentialHandler.d.ts +43 -0
- package/dist/react-native/auth/credentialHandler.js +147 -0
- package/dist/react-native/auth/credentialHandler.js.map +1 -0
- package/dist/react-native/errors/connectionErrors.d.ts +68 -0
- package/dist/react-native/errors/connectionErrors.js +136 -0
- package/dist/react-native/errors/connectionErrors.js.map +1 -0
- package/dist/react-native/errors/index.d.ts +2 -0
- package/dist/react-native/errors/index.js +4 -0
- package/dist/react-native/errors/index.js.map +1 -0
- package/dist/react-native/handlers/sessionHandlers.d.ts +250 -0
- package/dist/react-native/handlers/sessionHandlers.js +4 -0
- package/dist/react-native/handlers/sessionHandlers.js.map +1 -0
- package/dist/react-native/handlers/subscriptionManager.d.ts +54 -0
- package/dist/react-native/handlers/subscriptionManager.js +250 -0
- package/dist/react-native/handlers/subscriptionManager.js.map +1 -0
- package/dist/react-native/index.d.ts +7 -0
- package/dist/react-native/index.js +12 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/logger.d.ts +2 -0
- package/dist/react-native/logger.js +5 -0
- package/dist/react-native/logger.js.map +1 -0
- package/dist/react-native/models/index.d.ts +2 -0
- package/dist/react-native/models/index.js +4 -0
- package/dist/react-native/models/index.js.map +1 -0
- package/dist/react-native/models/models.d.ts +2154 -0
- package/dist/react-native/models/models.js +2251 -0
- package/dist/react-native/models/models.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/protocol/messageParser.d.ts +42 -0
- package/dist/react-native/protocol/messageParser.js +150 -0
- package/dist/react-native/protocol/messageParser.js.map +1 -0
- package/dist/react-native/voiceLiveClient.d.ts +65 -0
- package/dist/react-native/voiceLiveClient.js +81 -0
- package/dist/react-native/voiceLiveClient.js.map +1 -0
- package/dist/react-native/voiceLiveSession.d.ts +138 -0
- package/dist/react-native/voiceLiveSession.js +429 -0
- package/dist/react-native/voiceLiveSession.js.map +1 -0
- package/dist/react-native/websocket/connectionManager.d.ts +88 -0
- package/dist/react-native/websocket/connectionManager.js +183 -0
- package/dist/react-native/websocket/connectionManager.js.map +1 -0
- package/dist/react-native/websocket/websocketBrowser.d.ts +26 -0
- package/dist/react-native/websocket/websocketBrowser.js +175 -0
- package/dist/react-native/websocket/websocketBrowser.js.map +1 -0
- package/dist/react-native/websocket/websocketFactory.d.ts +23 -0
- package/dist/react-native/websocket/websocketFactory.js +80 -0
- package/dist/react-native/websocket/websocketFactory.js.map +1 -0
- package/dist/react-native/websocket/websocketLike.d.ts +78 -0
- package/dist/react-native/websocket/websocketLike.js +13 -0
- package/dist/react-native/websocket/websocketLike.js.map +1 -0
- package/dist/react-native/websocket/websocketNode.d.ts +26 -0
- package/dist/react-native/websocket/websocketNode.js +180 -0
- package/dist/react-native/websocket/websocketNode.js.map +1 -0
- package/package.json +150 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { logger } from "../logger.js";
|
|
4
|
+
/**
|
|
5
|
+
* Internal implementation of VoiceLiveSubscription
|
|
6
|
+
*/
|
|
7
|
+
export class VoiceLiveSubscriptionImpl {
|
|
8
|
+
_isActive = true;
|
|
9
|
+
_handlers;
|
|
10
|
+
_subscriptionId;
|
|
11
|
+
constructor(handlers, subscriptionId) {
|
|
12
|
+
this._handlers = handlers;
|
|
13
|
+
this._subscriptionId = subscriptionId;
|
|
14
|
+
}
|
|
15
|
+
get isActive() {
|
|
16
|
+
return this._isActive;
|
|
17
|
+
}
|
|
18
|
+
get subscriptionId() {
|
|
19
|
+
return this._subscriptionId;
|
|
20
|
+
}
|
|
21
|
+
async close() {
|
|
22
|
+
if (!this._isActive) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
this._isActive = false;
|
|
26
|
+
logger.info("VoiceLive subscription closed", { subscriptionId: this._subscriptionId });
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Process a connection event
|
|
30
|
+
*/
|
|
31
|
+
async processConnectionEvent(eventType, args, context) {
|
|
32
|
+
if (!this._isActive) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
switch (eventType) {
|
|
37
|
+
case "connected":
|
|
38
|
+
await this._handlers.onConnected?.(args, context);
|
|
39
|
+
break;
|
|
40
|
+
case "disconnected":
|
|
41
|
+
await this._handlers.onDisconnected?.(args, context);
|
|
42
|
+
break;
|
|
43
|
+
case "error":
|
|
44
|
+
await this._handlers.onError?.(args, context);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
logger.error(`Error in ${eventType} handler`, {
|
|
50
|
+
error,
|
|
51
|
+
subscriptionId: this._subscriptionId,
|
|
52
|
+
});
|
|
53
|
+
// Don't rethrow - follow Azure SDK pattern of logging but not stopping other handlers
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Process a server event
|
|
58
|
+
*/
|
|
59
|
+
async processServerEvent(event, context) {
|
|
60
|
+
if (!this._isActive) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
// Call the general server event handler
|
|
65
|
+
await this._handlers.onServerEvent?.(event, context);
|
|
66
|
+
// Call specific handlers based on event type
|
|
67
|
+
switch (event.type) {
|
|
68
|
+
// Session events
|
|
69
|
+
case "session.created":
|
|
70
|
+
await this._handlers.onSessionCreated?.(event, context);
|
|
71
|
+
break;
|
|
72
|
+
case "session.updated":
|
|
73
|
+
await this._handlers.onSessionUpdated?.(event, context);
|
|
74
|
+
break;
|
|
75
|
+
case "session.avatar.connecting":
|
|
76
|
+
await this._handlers.onSessionAvatarConnecting?.(event, context);
|
|
77
|
+
break;
|
|
78
|
+
// Input audio buffer events
|
|
79
|
+
case "input_audio_buffer.committed":
|
|
80
|
+
await this._handlers.onInputAudioBufferCommitted?.(event, context);
|
|
81
|
+
break;
|
|
82
|
+
case "input_audio_buffer.cleared":
|
|
83
|
+
await this._handlers.onInputAudioBufferCleared?.(event, context);
|
|
84
|
+
break;
|
|
85
|
+
case "input_audio_buffer.speech_started":
|
|
86
|
+
await this._handlers.onInputAudioBufferSpeechStarted?.(event, context);
|
|
87
|
+
break;
|
|
88
|
+
case "input_audio_buffer.speech_stopped":
|
|
89
|
+
await this._handlers.onInputAudioBufferSpeechStopped?.(event, context);
|
|
90
|
+
break;
|
|
91
|
+
// Conversation item events
|
|
92
|
+
case "conversation.item.created":
|
|
93
|
+
await this._handlers.onConversationItemCreated?.(event, context);
|
|
94
|
+
break;
|
|
95
|
+
case "conversation.item.input_audio_transcription.completed":
|
|
96
|
+
await this._handlers.onConversationItemInputAudioTranscriptionCompleted?.(event, context);
|
|
97
|
+
break;
|
|
98
|
+
case "conversation.item.input_audio_transcription.failed":
|
|
99
|
+
await this._handlers.onConversationItemInputAudioTranscriptionFailed?.(event, context);
|
|
100
|
+
break;
|
|
101
|
+
case "conversation.item.input_audio_transcription.delta":
|
|
102
|
+
await this._handlers.onConversationItemInputAudioTranscriptionDelta?.(event, context);
|
|
103
|
+
break;
|
|
104
|
+
case "conversation.item.truncated":
|
|
105
|
+
await this._handlers.onConversationItemTruncated?.(event, context);
|
|
106
|
+
break;
|
|
107
|
+
case "conversation.item.deleted":
|
|
108
|
+
await this._handlers.onConversationItemDeleted?.(event, context);
|
|
109
|
+
break;
|
|
110
|
+
case "conversation.item.retrieved":
|
|
111
|
+
await this._handlers.onConversationItemRetrieved?.(event, context);
|
|
112
|
+
break;
|
|
113
|
+
// Response lifecycle events
|
|
114
|
+
case "response.created":
|
|
115
|
+
await this._handlers.onResponseCreated?.(event, context);
|
|
116
|
+
break;
|
|
117
|
+
case "response.done":
|
|
118
|
+
await this._handlers.onResponseDone?.(event, context);
|
|
119
|
+
break;
|
|
120
|
+
case "response.output_item.added":
|
|
121
|
+
await this._handlers.onResponseOutputItemAdded?.(event, context);
|
|
122
|
+
break;
|
|
123
|
+
case "response.output_item.done":
|
|
124
|
+
await this._handlers.onResponseOutputItemDone?.(event, context);
|
|
125
|
+
break;
|
|
126
|
+
case "response.content_part.added":
|
|
127
|
+
await this._handlers.onResponseContentPartAdded?.(event, context);
|
|
128
|
+
break;
|
|
129
|
+
case "response.content_part.done":
|
|
130
|
+
await this._handlers.onResponseContentPartDone?.(event, context);
|
|
131
|
+
break;
|
|
132
|
+
// Response text events
|
|
133
|
+
case "response.text.delta":
|
|
134
|
+
await this._handlers.onResponseTextDelta?.(event, context);
|
|
135
|
+
break;
|
|
136
|
+
case "response.text.done":
|
|
137
|
+
await this._handlers.onResponseTextDone?.(event, context);
|
|
138
|
+
break;
|
|
139
|
+
// Response audio events
|
|
140
|
+
case "response.audio.delta":
|
|
141
|
+
await this._handlers.onResponseAudioDelta?.(event, context);
|
|
142
|
+
break;
|
|
143
|
+
case "response.audio.done":
|
|
144
|
+
await this._handlers.onResponseAudioDone?.(event, context);
|
|
145
|
+
break;
|
|
146
|
+
case "response.audio_transcript.delta":
|
|
147
|
+
await this._handlers.onResponseAudioTranscriptDelta?.(event, context);
|
|
148
|
+
break;
|
|
149
|
+
case "response.audio_transcript.done":
|
|
150
|
+
await this._handlers.onResponseAudioTranscriptDone?.(event, context);
|
|
151
|
+
break;
|
|
152
|
+
// Response animation events
|
|
153
|
+
case "response.animation_blendshapes.delta":
|
|
154
|
+
await this._handlers.onResponseAnimationBlendshapeDelta?.(event, context);
|
|
155
|
+
break;
|
|
156
|
+
case "response.animation_blendshapes.done":
|
|
157
|
+
await this._handlers.onResponseAnimationBlendshapeDone?.(event, context);
|
|
158
|
+
break;
|
|
159
|
+
case "response.animation_viseme.delta":
|
|
160
|
+
await this._handlers.onResponseAnimationVisemeDelta?.(event, context);
|
|
161
|
+
break;
|
|
162
|
+
case "response.animation_viseme.done":
|
|
163
|
+
await this._handlers.onResponseAnimationVisemeDone?.(event, context);
|
|
164
|
+
break;
|
|
165
|
+
// Response timing events
|
|
166
|
+
case "response.audio_timestamp.delta":
|
|
167
|
+
await this._handlers.onResponseAudioTimestampDelta?.(event, context);
|
|
168
|
+
break;
|
|
169
|
+
case "response.audio_timestamp.done":
|
|
170
|
+
await this._handlers.onResponseAudioTimestampDone?.(event, context);
|
|
171
|
+
break;
|
|
172
|
+
// Function call events
|
|
173
|
+
case "response.function_call_arguments.delta":
|
|
174
|
+
await this._handlers.onResponseFunctionCallArgumentsDelta?.(event, context);
|
|
175
|
+
break;
|
|
176
|
+
case "response.function_call_arguments.done":
|
|
177
|
+
await this._handlers.onResponseFunctionCallArgumentsDone?.(event, context);
|
|
178
|
+
break;
|
|
179
|
+
// Error events
|
|
180
|
+
case "error":
|
|
181
|
+
await this._handlers.onServerError?.(event, context);
|
|
182
|
+
break;
|
|
183
|
+
// Note: No default case needed - any unmapped events will still trigger onServerEvent above
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
logger.error(`Error in server event handler for ${event.type}`, {
|
|
188
|
+
error,
|
|
189
|
+
eventType: event.type,
|
|
190
|
+
subscriptionId: this._subscriptionId,
|
|
191
|
+
});
|
|
192
|
+
// Don't rethrow - follow Azure SDK pattern
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Manages multiple subscriptions for a VoiceLive session
|
|
198
|
+
*/
|
|
199
|
+
export class SubscriptionManager {
|
|
200
|
+
_subscriptions = new Map();
|
|
201
|
+
_nextSubscriptionId = 1;
|
|
202
|
+
/**
|
|
203
|
+
* Create a new subscription
|
|
204
|
+
*/
|
|
205
|
+
createSubscription(handlers) {
|
|
206
|
+
const subscriptionId = `sub_${this._nextSubscriptionId++}`;
|
|
207
|
+
const subscription = new VoiceLiveSubscriptionImpl(handlers, subscriptionId);
|
|
208
|
+
this._subscriptions.set(subscriptionId, subscription);
|
|
209
|
+
logger.info("VoiceLive subscription created", { subscriptionId });
|
|
210
|
+
return subscription;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Remove a subscription
|
|
214
|
+
*/
|
|
215
|
+
removeSubscription(subscriptionId) {
|
|
216
|
+
this._subscriptions.delete(subscriptionId);
|
|
217
|
+
logger.info("VoiceLive subscription removed", { subscriptionId });
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Process a connection event for all active subscriptions
|
|
221
|
+
*/
|
|
222
|
+
async processConnectionEvent(eventType, args, context) {
|
|
223
|
+
const activeSubscriptions = Array.from(this._subscriptions.values()).filter((sub) => sub.isActive);
|
|
224
|
+
// Process all subscriptions concurrently
|
|
225
|
+
await Promise.allSettled(activeSubscriptions.map((sub) => sub.processConnectionEvent(eventType, args, context)));
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Process a server event for all active subscriptions
|
|
229
|
+
*/
|
|
230
|
+
async processServerEvent(event, context) {
|
|
231
|
+
const activeSubscriptions = Array.from(this._subscriptions.values()).filter((sub) => sub.isActive);
|
|
232
|
+
// Process all subscriptions concurrently
|
|
233
|
+
await Promise.allSettled(activeSubscriptions.map((sub) => sub.processServerEvent(event, context)));
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Close all subscriptions
|
|
237
|
+
*/
|
|
238
|
+
async closeAll() {
|
|
239
|
+
const subscriptions = Array.from(this._subscriptions.values());
|
|
240
|
+
await Promise.allSettled(subscriptions.map((sub) => sub.close()));
|
|
241
|
+
this._subscriptions.clear();
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Get count of active subscriptions
|
|
245
|
+
*/
|
|
246
|
+
get activeCount() {
|
|
247
|
+
return Array.from(this._subscriptions.values()).filter((sub) => sub.isActive).length;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=subscriptionManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptionManager.js","sourceRoot":"","sources":["../../../src/handlers/subscriptionManager.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,yBAAyB;IAC5B,SAAS,GAAG,IAAI,CAAC;IACjB,SAAS,CAA2B;IACpC,eAAe,CAAS;IAEhC,YAAY,QAAkC,EAAE,cAAsB;QACpE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC,+BAA+B,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,sBAAsB,CAC1B,SAAiD,EACjD,IAAiE,EACjE,OAA0B;QAE1B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,QAAQ,SAAS,EAAE,CAAC;gBAClB,KAAK,WAAW;oBACd,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,IAA0B,EAAE,OAAO,CAAC,CAAC;oBACxE,MAAM;gBACR,KAAK,cAAc;oBACjB,MAAM,IAAI,CAAC,SAAS,CAAC,cAAc,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CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;IACvF,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n VoiceLiveSessionHandlers,\n VoiceLiveSubscription,\n ConnectionContext,\n SessionContext,\n ConnectedEventArgs,\n DisconnectedEventArgs,\n ErrorEventArgs,\n} from \"./sessionHandlers.js\";\nimport type { ServerEventUnion } from \"../models/index.js\";\nimport { logger } from \"../logger.js\";\n\n/**\n * Internal implementation of VoiceLiveSubscription\n */\nexport class VoiceLiveSubscriptionImpl implements VoiceLiveSubscription {\n private _isActive = true;\n private _handlers: VoiceLiveSessionHandlers;\n private _subscriptionId: string;\n\n constructor(handlers: VoiceLiveSessionHandlers, subscriptionId: string) {\n this._handlers = handlers;\n this._subscriptionId = subscriptionId;\n }\n\n get isActive(): boolean {\n return this._isActive;\n }\n\n get subscriptionId(): string {\n return this._subscriptionId;\n }\n\n async close(): Promise<void> {\n if (!this._isActive) {\n return;\n }\n\n this._isActive = false;\n logger.info(\"VoiceLive subscription closed\", { subscriptionId: this._subscriptionId });\n }\n\n /**\n * Process a connection event\n */\n async processConnectionEvent(\n eventType: \"connected\" | \"disconnected\" | \"error\",\n args: ConnectedEventArgs | DisconnectedEventArgs | ErrorEventArgs,\n context: ConnectionContext,\n ): Promise<void> {\n if (!this._isActive) {\n return;\n }\n\n try {\n switch (eventType) {\n case \"connected\":\n await this._handlers.onConnected?.(args as ConnectedEventArgs, context);\n break;\n case \"disconnected\":\n await this._handlers.onDisconnected?.(args as DisconnectedEventArgs, context);\n break;\n case \"error\":\n await this._handlers.onError?.(args as ErrorEventArgs, context);\n break;\n }\n } catch (error) {\n logger.error(`Error in ${eventType} handler`, {\n error,\n subscriptionId: this._subscriptionId,\n });\n // Don't rethrow - follow Azure SDK pattern of logging but not stopping other handlers\n }\n }\n\n /**\n * Process a server event\n */\n async processServerEvent(event: ServerEventUnion, context: SessionContext): Promise<void> {\n if (!this._isActive) {\n return;\n }\n\n try {\n // Call the general server event handler\n await this._handlers.onServerEvent?.(event, context);\n\n // Call specific handlers based on event type\n switch (event.type) {\n // Session events\n case \"session.created\":\n await this._handlers.onSessionCreated?.(event as any, context);\n break;\n case \"session.updated\":\n await this._handlers.onSessionUpdated?.(event as any, context);\n break;\n case \"session.avatar.connecting\":\n await this._handlers.onSessionAvatarConnecting?.(event as any, context);\n break;\n\n // Input audio buffer events\n case \"input_audio_buffer.committed\":\n await this._handlers.onInputAudioBufferCommitted?.(event as any, context);\n break;\n case \"input_audio_buffer.cleared\":\n await this._handlers.onInputAudioBufferCleared?.(event as any, context);\n break;\n case \"input_audio_buffer.speech_started\":\n await this._handlers.onInputAudioBufferSpeechStarted?.(event as any, context);\n break;\n case \"input_audio_buffer.speech_stopped\":\n await this._handlers.onInputAudioBufferSpeechStopped?.(event as any, context);\n break;\n\n // Conversation item events\n case \"conversation.item.created\":\n await this._handlers.onConversationItemCreated?.(event as any, context);\n break;\n case \"conversation.item.input_audio_transcription.completed\":\n await this._handlers.onConversationItemInputAudioTranscriptionCompleted?.(\n event as any,\n context,\n );\n break;\n case \"conversation.item.input_audio_transcription.failed\":\n await this._handlers.onConversationItemInputAudioTranscriptionFailed?.(\n event as any,\n context,\n );\n break;\n case \"conversation.item.input_audio_transcription.delta\":\n await this._handlers.onConversationItemInputAudioTranscriptionDelta?.(\n event as any,\n context,\n );\n break;\n case \"conversation.item.truncated\":\n await this._handlers.onConversationItemTruncated?.(event as any, context);\n break;\n case \"conversation.item.deleted\":\n await this._handlers.onConversationItemDeleted?.(event as any, context);\n break;\n case \"conversation.item.retrieved\":\n await this._handlers.onConversationItemRetrieved?.(event as any, context);\n break;\n\n // Response lifecycle events\n case \"response.created\":\n await this._handlers.onResponseCreated?.(event as any, context);\n break;\n case \"response.done\":\n await this._handlers.onResponseDone?.(event as any, context);\n break;\n case \"response.output_item.added\":\n await this._handlers.onResponseOutputItemAdded?.(event as any, context);\n break;\n case \"response.output_item.done\":\n await this._handlers.onResponseOutputItemDone?.(event as any, context);\n break;\n case \"response.content_part.added\":\n await this._handlers.onResponseContentPartAdded?.(event as any, context);\n break;\n case \"response.content_part.done\":\n await this._handlers.onResponseContentPartDone?.(event as any, context);\n break;\n\n // Response text events\n case \"response.text.delta\":\n await this._handlers.onResponseTextDelta?.(event as any, context);\n break;\n case \"response.text.done\":\n await this._handlers.onResponseTextDone?.(event as any, context);\n break;\n\n // Response audio events\n case \"response.audio.delta\":\n await this._handlers.onResponseAudioDelta?.(event as any, context);\n break;\n case \"response.audio.done\":\n await this._handlers.onResponseAudioDone?.(event as any, context);\n break;\n case \"response.audio_transcript.delta\":\n await this._handlers.onResponseAudioTranscriptDelta?.(event as any, context);\n break;\n case \"response.audio_transcript.done\":\n await this._handlers.onResponseAudioTranscriptDone?.(event as any, context);\n break;\n\n // Response animation events\n case \"response.animation_blendshapes.delta\":\n await this._handlers.onResponseAnimationBlendshapeDelta?.(event as any, context);\n break;\n case \"response.animation_blendshapes.done\":\n await this._handlers.onResponseAnimationBlendshapeDone?.(event as any, context);\n break;\n case \"response.animation_viseme.delta\":\n await this._handlers.onResponseAnimationVisemeDelta?.(event as any, context);\n break;\n case \"response.animation_viseme.done\":\n await this._handlers.onResponseAnimationVisemeDone?.(event as any, context);\n break;\n\n // Response timing events\n case \"response.audio_timestamp.delta\":\n await this._handlers.onResponseAudioTimestampDelta?.(event as any, context);\n break;\n case \"response.audio_timestamp.done\":\n await this._handlers.onResponseAudioTimestampDone?.(event as any, context);\n break;\n\n // Function call events\n case \"response.function_call_arguments.delta\":\n await this._handlers.onResponseFunctionCallArgumentsDelta?.(event as any, context);\n break;\n case \"response.function_call_arguments.done\":\n await this._handlers.onResponseFunctionCallArgumentsDone?.(event as any, context);\n break;\n\n // Error events\n case \"error\":\n await this._handlers.onServerError?.(event as any, context);\n break;\n\n // Note: No default case needed - any unmapped events will still trigger onServerEvent above\n }\n } catch (error) {\n logger.error(`Error in server event handler for ${event.type}`, {\n error,\n eventType: event.type,\n subscriptionId: this._subscriptionId,\n });\n // Don't rethrow - follow Azure SDK pattern\n }\n }\n}\n\n/**\n * Manages multiple subscriptions for a VoiceLive session\n */\nexport class SubscriptionManager {\n private _subscriptions = new Map<string, VoiceLiveSubscriptionImpl>();\n private _nextSubscriptionId = 1;\n\n /**\n * Create a new subscription\n */\n createSubscription(handlers: VoiceLiveSessionHandlers): VoiceLiveSubscription {\n const subscriptionId = `sub_${this._nextSubscriptionId++}`;\n const subscription = new VoiceLiveSubscriptionImpl(handlers, subscriptionId);\n\n this._subscriptions.set(subscriptionId, subscription);\n\n logger.info(\"VoiceLive subscription created\", { subscriptionId });\n return subscription;\n }\n\n /**\n * Remove a subscription\n */\n removeSubscription(subscriptionId: string): void {\n this._subscriptions.delete(subscriptionId);\n logger.info(\"VoiceLive subscription removed\", { subscriptionId });\n }\n\n /**\n * Process a connection event for all active subscriptions\n */\n async processConnectionEvent(\n eventType: \"connected\" | \"disconnected\" | \"error\",\n args: ConnectedEventArgs | DisconnectedEventArgs | ErrorEventArgs,\n context: ConnectionContext,\n ): Promise<void> {\n const activeSubscriptions = Array.from(this._subscriptions.values()).filter(\n (sub) => sub.isActive,\n );\n\n // Process all subscriptions concurrently\n await Promise.allSettled(\n activeSubscriptions.map((sub) => sub.processConnectionEvent(eventType, args, context)),\n );\n }\n\n /**\n * Process a server event for all active subscriptions\n */\n async processServerEvent(event: ServerEventUnion, context: SessionContext): Promise<void> {\n const activeSubscriptions = Array.from(this._subscriptions.values()).filter(\n (sub) => sub.isActive,\n );\n\n // Process all subscriptions concurrently\n await Promise.allSettled(\n activeSubscriptions.map((sub) => sub.processServerEvent(event, context)),\n );\n }\n\n /**\n * Close all subscriptions\n */\n async closeAll(): Promise<void> {\n const subscriptions = Array.from(this._subscriptions.values());\n await Promise.allSettled(subscriptions.map((sub) => sub.close()));\n this._subscriptions.clear();\n }\n\n /**\n * Get count of active subscriptions\n */\n get activeCount(): number {\n return Array.from(this._subscriptions.values()).filter((sub) => sub.isActive).length;\n }\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { VoiceLiveErrorDetails, ErrorResponse, LogProbProperties, ClientEvent, ClientEventUnion, KnownClientEventType, ClientEventType, ClientEventSessionUpdate, RequestSession, KnownModality, Modality, Animation, KnownAnimationOutputType, AnimationOutputType, Voice, KnownOAIVoice, OAIVoice, OpenAIVoice, AzureVoice, AzureVoiceUnion, KnownAzureVoiceType, AzureVoiceType, AzureCustomVoice, AzureStandardVoice, AzurePersonalVoice, KnownPersonalVoiceModels, PersonalVoiceModels, KnownInputAudioFormat, InputAudioFormat, KnownOutputAudioFormat, OutputAudioFormat, TurnDetection, TurnDetectionUnion, KnownTurnDetectionType, TurnDetectionType, ServerVad, EouDetection, EouDetectionUnion, AzureSemanticDetection, KnownEouThresholdLevel, EouThresholdLevel, AzureSemanticDetectionEn, AzureSemanticDetectionMultilingual, AzureSemanticVad, AzureSemanticVadEn, AzureSemanticVadMultilingual, AudioNoiseReduction, AudioEchoCancellation, AvatarConfig, IceServer, VideoParams, VideoCrop, VideoResolution, Background, AudioInputTranscriptionOptions, KnownAudioTimestampType, AudioTimestampType, Tool, ToolUnion, KnownToolType, ToolType, FunctionTool, ToolChoice, KnownToolChoiceLiteral, ToolChoiceLiteral, ToolChoiceSelection, ToolChoiceSelectionUnion, ToolChoiceFunctionSelection, ClientEventSessionAvatarConnect, ClientEventInputAudioTurnStart, ClientEventInputAudioTurnAppend, ClientEventInputAudioTurnEnd, ClientEventInputAudioTurnCancel, ClientEventInputAudioClear, ClientEventInputAudioBufferAppend, ClientEventInputAudioBufferCommit, ClientEventInputAudioBufferClear, ClientEventConversationItemCreate, ConversationRequestItem, ConversationRequestItemUnion, KnownItemType, ItemType, MessageItem, MessageItemUnion, KnownMessageRole, MessageRole, MessageContentPart, MessageContentPartUnion, KnownContentPartType, ContentPartType, InputTextContentPart, InputAudioContentPart, OutputTextContentPart, KnownItemParamStatus, ItemParamStatus, SystemMessageItem, UserMessageItem, AssistantMessageItem, FunctionCallItem, FunctionCallOutputItem, ClientEventConversationItemTruncate, ClientEventConversationItemDelete, ClientEventResponseCreate, ResponseCreateParams, ClientEventResponseCancel, ClientEventConversationItemRetrieve, SessionBase, ConversationItemBase, Response, KnownResponseStatus, ResponseStatus, ResponseStatusDetails, ResponseStatusDetailsUnion, ResponseCancelledDetails, ResponseIncompleteDetails, ResponseFailedDetails, ResponseItem, ResponseItemUnion, ResponseMessageItem, ContentPart, ContentPartUnion, RequestTextContentPart, RequestAudioContentPart, ResponseTextContentPart, ResponseAudioContentPart, KnownResponseItemStatus, ResponseItemStatus, ResponseFunctionCallItem, ResponseFunctionCallOutputItem, TokenUsage, InputTokenDetails, CachedTokenDetails, OutputTokenDetails, ServerEvent, ServerEventUnion, KnownServerEventType, ServerEventType, ServerEventError, ServerEventErrorDetails, ServerEventSessionCreated, ResponseSession, AgentConfig, ServerEventSessionUpdated, ServerEventSessionAvatarConnecting, ServerEventInputAudioBufferCommitted, ServerEventInputAudioBufferCleared, ServerEventInputAudioBufferSpeechStarted, ServerEventInputAudioBufferSpeechStopped, ServerEventConversationItemCreated, ServerEventConversationItemInputAudioTranscriptionCompleted, ServerEventConversationItemInputAudioTranscriptionFailed, ServerEventConversationItemTruncated, ServerEventConversationItemDeleted, ServerEventResponseCreated, ServerEventResponseDone, ServerEventResponseOutputItemAdded, ServerEventResponseOutputItemDone, ServerEventResponseContentPartAdded, ServerEventResponseContentPartDone, ServerEventResponseTextDelta, ServerEventResponseTextDone, ServerEventResponseAudioTranscriptDelta, ServerEventResponseAudioTranscriptDone, ServerEventResponseAudioDelta, ServerEventResponseAudioDone, ServerEventResponseAnimationBlendshapeDelta, ServerEventResponseAnimationBlendshapeDone, ServerEventResponseAudioTimestampDelta, ServerEventResponseAudioTimestampDone, ServerEventResponseAnimationVisemeDelta, ServerEventResponseAnimationVisemeDone, ServerEventConversationItemInputAudioTranscriptionDelta, ServerEventConversationItemRetrieved, ServerEventResponseFunctionCallArgumentsDelta, ServerEventResponseFunctionCallArgumentsDone, } from "./models/index.js";
|
|
2
|
+
export { VoiceLiveClient, VoiceLiveClientOptions } from "./voiceLiveClient.js";
|
|
3
|
+
export { VoiceLiveSession, VoiceLiveSessionOptions, ConnectOptions, SendEventOptions, AudioStreamOptions, TurnOptions, CreateSessionOptions, StartSessionOptions, } from "./voiceLiveSession.js";
|
|
4
|
+
export type { VoiceLiveSessionHandlers, VoiceLiveSubscription, ConnectionContext, SessionContext, ConnectedEventArgs, DisconnectedEventArgs, ErrorEventArgs, } from "./handlers/sessionHandlers.js";
|
|
5
|
+
export { ConnectionState } from "./websocket/connectionManager.js";
|
|
6
|
+
export { VoiceLiveError, VoiceLiveConnectionError, VoiceLiveAuthenticationError, VoiceLiveProtocolError, VoiceLiveErrorCodes, classifyConnectionError, classifyProtocolError, } from "./errors/index.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
export { KnownClientEventType, KnownModality, KnownAnimationOutputType, KnownOAIVoice, KnownAzureVoiceType, KnownPersonalVoiceModels, KnownInputAudioFormat, KnownOutputAudioFormat, KnownTurnDetectionType, KnownEouThresholdLevel, KnownAudioTimestampType, KnownToolType, KnownToolChoiceLiteral, KnownItemType, KnownMessageRole, KnownContentPartType, KnownItemParamStatus, KnownResponseStatus, KnownResponseItemStatus, KnownServerEventType, } from "./models/index.js";
|
|
4
|
+
// Main client export
|
|
5
|
+
export { VoiceLiveClient } from "./voiceLiveClient.js";
|
|
6
|
+
// Session export
|
|
7
|
+
export { VoiceLiveSession, } from "./voiceLiveSession.js";
|
|
8
|
+
// WebSocket and connection exports
|
|
9
|
+
export { ConnectionState } from "./websocket/connectionManager.js";
|
|
10
|
+
// Error exports
|
|
11
|
+
export { VoiceLiveError, VoiceLiveConnectionError, VoiceLiveAuthenticationError, VoiceLiveProtocolError, VoiceLiveErrorCodes, classifyConnectionError, classifyProtocolError, } from "./errors/index.js";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAML,oBAAoB,EAIpB,aAAa,EAGb,wBAAwB,EAGxB,aAAa,EAKb,mBAAmB,EAKnB,wBAAwB,EAExB,qBAAqB,EAErB,sBAAsB,EAItB,sBAAsB,EAMtB,sBAAsB,EAgBtB,uBAAuB,EAIvB,aAAa,EAIb,sBAAsB,EAiBtB,aAAa,EAIb,gBAAgB,EAIhB,oBAAoB,EAKpB,oBAAoB,EAgBpB,mBAAmB,EAgBnB,uBAAuB,EAUvB,oBAAoB,GAwCrB,MAAM,mBAAmB,CAAC;AAE3B,qBAAqB;AACrB,OAAO,EAAE,eAAe,EAA0B,MAAM,sBAAsB,CAAC;AAE/E,iBAAiB;AACjB,OAAO,EACL,gBAAgB,GAQjB,MAAM,uBAAuB,CAAC;AAa/B,mCAAmC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,gBAAgB;AAChB,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,4BAA4B,EAC5B,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport {\n VoiceLiveErrorDetails,\n ErrorResponse,\n LogProbProperties,\n ClientEvent,\n ClientEventUnion,\n KnownClientEventType,\n ClientEventType,\n ClientEventSessionUpdate,\n RequestSession,\n KnownModality,\n Modality,\n Animation,\n KnownAnimationOutputType,\n AnimationOutputType,\n Voice,\n KnownOAIVoice,\n OAIVoice,\n OpenAIVoice,\n AzureVoice,\n AzureVoiceUnion,\n KnownAzureVoiceType,\n AzureVoiceType,\n AzureCustomVoice,\n AzureStandardVoice,\n AzurePersonalVoice,\n KnownPersonalVoiceModels,\n PersonalVoiceModels,\n KnownInputAudioFormat,\n InputAudioFormat,\n KnownOutputAudioFormat,\n OutputAudioFormat,\n TurnDetection,\n TurnDetectionUnion,\n KnownTurnDetectionType,\n TurnDetectionType,\n ServerVad,\n EouDetection,\n EouDetectionUnion,\n AzureSemanticDetection,\n KnownEouThresholdLevel,\n EouThresholdLevel,\n AzureSemanticDetectionEn,\n AzureSemanticDetectionMultilingual,\n AzureSemanticVad,\n AzureSemanticVadEn,\n AzureSemanticVadMultilingual,\n AudioNoiseReduction,\n AudioEchoCancellation,\n AvatarConfig,\n IceServer,\n VideoParams,\n VideoCrop,\n VideoResolution,\n Background,\n AudioInputTranscriptionOptions,\n KnownAudioTimestampType,\n AudioTimestampType,\n Tool,\n ToolUnion,\n KnownToolType,\n ToolType,\n FunctionTool,\n ToolChoice,\n KnownToolChoiceLiteral,\n ToolChoiceLiteral,\n ToolChoiceSelection,\n ToolChoiceSelectionUnion,\n ToolChoiceFunctionSelection,\n ClientEventSessionAvatarConnect,\n ClientEventInputAudioTurnStart,\n ClientEventInputAudioTurnAppend,\n ClientEventInputAudioTurnEnd,\n ClientEventInputAudioTurnCancel,\n ClientEventInputAudioClear,\n ClientEventInputAudioBufferAppend,\n ClientEventInputAudioBufferCommit,\n ClientEventInputAudioBufferClear,\n ClientEventConversationItemCreate,\n ConversationRequestItem,\n ConversationRequestItemUnion,\n KnownItemType,\n ItemType,\n MessageItem,\n MessageItemUnion,\n KnownMessageRole,\n MessageRole,\n MessageContentPart,\n MessageContentPartUnion,\n KnownContentPartType,\n ContentPartType,\n InputTextContentPart,\n InputAudioContentPart,\n OutputTextContentPart,\n KnownItemParamStatus,\n ItemParamStatus,\n SystemMessageItem,\n UserMessageItem,\n AssistantMessageItem,\n FunctionCallItem,\n FunctionCallOutputItem,\n ClientEventConversationItemTruncate,\n ClientEventConversationItemDelete,\n ClientEventResponseCreate,\n ResponseCreateParams,\n ClientEventResponseCancel,\n ClientEventConversationItemRetrieve,\n SessionBase,\n ConversationItemBase,\n Response,\n KnownResponseStatus,\n ResponseStatus,\n ResponseStatusDetails,\n ResponseStatusDetailsUnion,\n ResponseCancelledDetails,\n ResponseIncompleteDetails,\n ResponseFailedDetails,\n ResponseItem,\n ResponseItemUnion,\n ResponseMessageItem,\n ContentPart,\n ContentPartUnion,\n RequestTextContentPart,\n RequestAudioContentPart,\n ResponseTextContentPart,\n ResponseAudioContentPart,\n KnownResponseItemStatus,\n ResponseItemStatus,\n ResponseFunctionCallItem,\n ResponseFunctionCallOutputItem,\n TokenUsage,\n InputTokenDetails,\n CachedTokenDetails,\n OutputTokenDetails,\n ServerEvent,\n ServerEventUnion,\n KnownServerEventType,\n ServerEventType,\n ServerEventError,\n ServerEventErrorDetails,\n ServerEventSessionCreated,\n ResponseSession,\n AgentConfig,\n ServerEventSessionUpdated,\n ServerEventSessionAvatarConnecting,\n ServerEventInputAudioBufferCommitted,\n ServerEventInputAudioBufferCleared,\n ServerEventInputAudioBufferSpeechStarted,\n ServerEventInputAudioBufferSpeechStopped,\n ServerEventConversationItemCreated,\n ServerEventConversationItemInputAudioTranscriptionCompleted,\n ServerEventConversationItemInputAudioTranscriptionFailed,\n ServerEventConversationItemTruncated,\n ServerEventConversationItemDeleted,\n ServerEventResponseCreated,\n ServerEventResponseDone,\n ServerEventResponseOutputItemAdded,\n ServerEventResponseOutputItemDone,\n ServerEventResponseContentPartAdded,\n ServerEventResponseContentPartDone,\n ServerEventResponseTextDelta,\n ServerEventResponseTextDone,\n ServerEventResponseAudioTranscriptDelta,\n ServerEventResponseAudioTranscriptDone,\n ServerEventResponseAudioDelta,\n ServerEventResponseAudioDone,\n ServerEventResponseAnimationBlendshapeDelta,\n ServerEventResponseAnimationBlendshapeDone,\n ServerEventResponseAudioTimestampDelta,\n ServerEventResponseAudioTimestampDone,\n ServerEventResponseAnimationVisemeDelta,\n ServerEventResponseAnimationVisemeDone,\n ServerEventConversationItemInputAudioTranscriptionDelta,\n ServerEventConversationItemRetrieved,\n ServerEventResponseFunctionCallArgumentsDelta,\n ServerEventResponseFunctionCallArgumentsDone,\n} from \"./models/index.js\";\n\n// Main client export\nexport { VoiceLiveClient, VoiceLiveClientOptions } from \"./voiceLiveClient.js\";\n\n// Session export\nexport {\n VoiceLiveSession,\n VoiceLiveSessionOptions,\n ConnectOptions,\n SendEventOptions,\n AudioStreamOptions,\n TurnOptions,\n CreateSessionOptions,\n StartSessionOptions,\n} from \"./voiceLiveSession.js\";\n\n// Handler-based subscription exports (Azure SDK pattern)\nexport type {\n VoiceLiveSessionHandlers,\n VoiceLiveSubscription,\n ConnectionContext,\n SessionContext,\n ConnectedEventArgs,\n DisconnectedEventArgs,\n ErrorEventArgs,\n} from \"./handlers/sessionHandlers.js\";\n\n// WebSocket and connection exports\nexport { ConnectionState } from \"./websocket/connectionManager.js\";\n\n// Error exports\nexport {\n VoiceLiveError,\n VoiceLiveConnectionError,\n VoiceLiveAuthenticationError,\n VoiceLiveProtocolError,\n VoiceLiveErrorCodes,\n classifyConnectionError,\n classifyProtocolError,\n} from \"./errors/index.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"ai-voicelive\");\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { VoiceLiveErrorDetails, ErrorResponse, LogProbProperties, ClientEvent, ClientEventUnion, KnownClientEventType, ClientEventType, ClientEventSessionUpdate, RequestSession, KnownModality, Modality, Animation, KnownAnimationOutputType, AnimationOutputType, Voice, KnownOAIVoice, OAIVoice, OpenAIVoice, AzureVoice, AzureVoiceUnion, KnownAzureVoiceType, AzureVoiceType, AzureCustomVoice, AzureStandardVoice, AzurePersonalVoice, KnownPersonalVoiceModels, PersonalVoiceModels, KnownInputAudioFormat, InputAudioFormat, KnownOutputAudioFormat, OutputAudioFormat, TurnDetection, TurnDetectionUnion, KnownTurnDetectionType, TurnDetectionType, ServerVad, EouDetection, EouDetectionUnion, AzureSemanticDetection, KnownEouThresholdLevel, EouThresholdLevel, AzureSemanticDetectionEn, AzureSemanticDetectionMultilingual, AzureSemanticVad, AzureSemanticVadEn, AzureSemanticVadMultilingual, AudioNoiseReduction, AudioEchoCancellation, AvatarConfig, IceServer, VideoParams, VideoCrop, VideoResolution, Background, AudioInputTranscriptionOptions, KnownAudioTimestampType, AudioTimestampType, Tool, ToolUnion, KnownToolType, ToolType, FunctionTool, ToolChoice, KnownToolChoiceLiteral, ToolChoiceLiteral, ToolChoiceSelection, ToolChoiceSelectionUnion, ToolChoiceFunctionSelection, ClientEventSessionAvatarConnect, ClientEventInputAudioTurnStart, ClientEventInputAudioTurnAppend, ClientEventInputAudioTurnEnd, ClientEventInputAudioTurnCancel, ClientEventInputAudioClear, ClientEventInputAudioBufferAppend, ClientEventInputAudioBufferCommit, ClientEventInputAudioBufferClear, ClientEventConversationItemCreate, ConversationRequestItem, ConversationRequestItemUnion, KnownItemType, ItemType, MessageItem, MessageItemUnion, KnownMessageRole, MessageRole, MessageContentPart, MessageContentPartUnion, KnownContentPartType, ContentPartType, InputTextContentPart, InputAudioContentPart, OutputTextContentPart, KnownItemParamStatus, ItemParamStatus, SystemMessageItem, UserMessageItem, AssistantMessageItem, FunctionCallItem, FunctionCallOutputItem, ClientEventConversationItemTruncate, ClientEventConversationItemDelete, ClientEventResponseCreate, ResponseCreateParams, ClientEventResponseCancel, ClientEventConversationItemRetrieve, SessionBase, ConversationItemBase, Response, KnownResponseStatus, ResponseStatus, ResponseStatusDetails, ResponseStatusDetailsUnion, ResponseCancelledDetails, ResponseIncompleteDetails, ResponseFailedDetails, ResponseItem, ResponseItemUnion, ResponseMessageItem, ContentPart, ContentPartUnion, RequestTextContentPart, RequestAudioContentPart, ResponseTextContentPart, ResponseAudioContentPart, KnownResponseItemStatus, ResponseItemStatus, ResponseFunctionCallItem, ResponseFunctionCallOutputItem, TokenUsage, InputTokenDetails, CachedTokenDetails, OutputTokenDetails, ServerEvent, ServerEventUnion, KnownServerEventType, ServerEventType, ServerEventError, ServerEventErrorDetails, ServerEventSessionCreated, ResponseSession, AgentConfig, ServerEventSessionUpdated, ServerEventSessionAvatarConnecting, ServerEventInputAudioBufferCommitted, ServerEventInputAudioBufferCleared, ServerEventInputAudioBufferSpeechStarted, ServerEventInputAudioBufferSpeechStopped, ServerEventConversationItemCreated, ServerEventConversationItemInputAudioTranscriptionCompleted, ServerEventConversationItemInputAudioTranscriptionFailed, ServerEventConversationItemTruncated, ServerEventConversationItemDeleted, ServerEventResponseCreated, ServerEventResponseDone, ServerEventResponseOutputItemAdded, ServerEventResponseOutputItemDone, ServerEventResponseContentPartAdded, ServerEventResponseContentPartDone, ServerEventResponseTextDelta, ServerEventResponseTextDone, ServerEventResponseAudioTranscriptDelta, ServerEventResponseAudioTranscriptDone, ServerEventResponseAudioDelta, ServerEventResponseAudioDone, ServerEventResponseAnimationBlendshapeDelta, ServerEventResponseAnimationBlendshapeDone, ServerEventResponseAudioTimestampDelta, ServerEventResponseAudioTimestampDone, ServerEventResponseAnimationVisemeDelta, ServerEventResponseAnimationVisemeDone, ServerEventConversationItemInputAudioTranscriptionDelta, ServerEventConversationItemRetrieved, ServerEventResponseFunctionCallArgumentsDelta, ServerEventResponseFunctionCallArgumentsDone, } from "./models.js";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
export { KnownClientEventType, KnownModality, KnownAnimationOutputType, KnownOAIVoice, KnownAzureVoiceType, KnownPersonalVoiceModels, KnownInputAudioFormat, KnownOutputAudioFormat, KnownTurnDetectionType, KnownEouThresholdLevel, KnownAudioTimestampType, KnownToolType, KnownToolChoiceLiteral, KnownItemType, KnownMessageRole, KnownContentPartType, KnownItemParamStatus, KnownResponseStatus, KnownResponseItemStatus, KnownServerEventType, } from "./models.js";
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAML,oBAAoB,EAIpB,aAAa,EAGb,wBAAwB,EAGxB,aAAa,EAKb,mBAAmB,EAKnB,wBAAwB,EAExB,qBAAqB,EAErB,sBAAsB,EAItB,sBAAsB,EAMtB,sBAAsB,EAgBtB,uBAAuB,EAIvB,aAAa,EAIb,sBAAsB,EAiBtB,aAAa,EAIb,gBAAgB,EAIhB,oBAAoB,EAKpB,oBAAoB,EAgBpB,mBAAmB,EAgBnB,uBAAuB,EAUvB,oBAAoB,GAwCrB,MAAM,aAAa,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport {\n VoiceLiveErrorDetails,\n ErrorResponse,\n LogProbProperties,\n ClientEvent,\n ClientEventUnion,\n KnownClientEventType,\n ClientEventType,\n ClientEventSessionUpdate,\n RequestSession,\n KnownModality,\n Modality,\n Animation,\n KnownAnimationOutputType,\n AnimationOutputType,\n Voice,\n KnownOAIVoice,\n OAIVoice,\n OpenAIVoice,\n AzureVoice,\n AzureVoiceUnion,\n KnownAzureVoiceType,\n AzureVoiceType,\n AzureCustomVoice,\n AzureStandardVoice,\n AzurePersonalVoice,\n KnownPersonalVoiceModels,\n PersonalVoiceModels,\n KnownInputAudioFormat,\n InputAudioFormat,\n KnownOutputAudioFormat,\n OutputAudioFormat,\n TurnDetection,\n TurnDetectionUnion,\n KnownTurnDetectionType,\n TurnDetectionType,\n ServerVad,\n EouDetection,\n EouDetectionUnion,\n AzureSemanticDetection,\n KnownEouThresholdLevel,\n EouThresholdLevel,\n AzureSemanticDetectionEn,\n AzureSemanticDetectionMultilingual,\n AzureSemanticVad,\n AzureSemanticVadEn,\n AzureSemanticVadMultilingual,\n AudioNoiseReduction,\n AudioEchoCancellation,\n AvatarConfig,\n IceServer,\n VideoParams,\n VideoCrop,\n VideoResolution,\n Background,\n AudioInputTranscriptionOptions,\n KnownAudioTimestampType,\n AudioTimestampType,\n Tool,\n ToolUnion,\n KnownToolType,\n ToolType,\n FunctionTool,\n ToolChoice,\n KnownToolChoiceLiteral,\n ToolChoiceLiteral,\n ToolChoiceSelection,\n ToolChoiceSelectionUnion,\n ToolChoiceFunctionSelection,\n ClientEventSessionAvatarConnect,\n ClientEventInputAudioTurnStart,\n ClientEventInputAudioTurnAppend,\n ClientEventInputAudioTurnEnd,\n ClientEventInputAudioTurnCancel,\n ClientEventInputAudioClear,\n ClientEventInputAudioBufferAppend,\n ClientEventInputAudioBufferCommit,\n ClientEventInputAudioBufferClear,\n ClientEventConversationItemCreate,\n ConversationRequestItem,\n ConversationRequestItemUnion,\n KnownItemType,\n ItemType,\n MessageItem,\n MessageItemUnion,\n KnownMessageRole,\n MessageRole,\n MessageContentPart,\n MessageContentPartUnion,\n KnownContentPartType,\n ContentPartType,\n InputTextContentPart,\n InputAudioContentPart,\n OutputTextContentPart,\n KnownItemParamStatus,\n ItemParamStatus,\n SystemMessageItem,\n UserMessageItem,\n AssistantMessageItem,\n FunctionCallItem,\n FunctionCallOutputItem,\n ClientEventConversationItemTruncate,\n ClientEventConversationItemDelete,\n ClientEventResponseCreate,\n ResponseCreateParams,\n ClientEventResponseCancel,\n ClientEventConversationItemRetrieve,\n SessionBase,\n ConversationItemBase,\n Response,\n KnownResponseStatus,\n ResponseStatus,\n ResponseStatusDetails,\n ResponseStatusDetailsUnion,\n ResponseCancelledDetails,\n ResponseIncompleteDetails,\n ResponseFailedDetails,\n ResponseItem,\n ResponseItemUnion,\n ResponseMessageItem,\n ContentPart,\n ContentPartUnion,\n RequestTextContentPart,\n RequestAudioContentPart,\n ResponseTextContentPart,\n ResponseAudioContentPart,\n KnownResponseItemStatus,\n ResponseItemStatus,\n ResponseFunctionCallItem,\n ResponseFunctionCallOutputItem,\n TokenUsage,\n InputTokenDetails,\n CachedTokenDetails,\n OutputTokenDetails,\n ServerEvent,\n ServerEventUnion,\n KnownServerEventType,\n ServerEventType,\n ServerEventError,\n ServerEventErrorDetails,\n ServerEventSessionCreated,\n ResponseSession,\n AgentConfig,\n ServerEventSessionUpdated,\n ServerEventSessionAvatarConnecting,\n ServerEventInputAudioBufferCommitted,\n ServerEventInputAudioBufferCleared,\n ServerEventInputAudioBufferSpeechStarted,\n ServerEventInputAudioBufferSpeechStopped,\n ServerEventConversationItemCreated,\n ServerEventConversationItemInputAudioTranscriptionCompleted,\n ServerEventConversationItemInputAudioTranscriptionFailed,\n ServerEventConversationItemTruncated,\n ServerEventConversationItemDeleted,\n ServerEventResponseCreated,\n ServerEventResponseDone,\n ServerEventResponseOutputItemAdded,\n ServerEventResponseOutputItemDone,\n ServerEventResponseContentPartAdded,\n ServerEventResponseContentPartDone,\n ServerEventResponseTextDelta,\n ServerEventResponseTextDone,\n ServerEventResponseAudioTranscriptDelta,\n ServerEventResponseAudioTranscriptDone,\n ServerEventResponseAudioDelta,\n ServerEventResponseAudioDone,\n ServerEventResponseAnimationBlendshapeDelta,\n ServerEventResponseAnimationBlendshapeDone,\n ServerEventResponseAudioTimestampDelta,\n ServerEventResponseAudioTimestampDone,\n ServerEventResponseAnimationVisemeDelta,\n ServerEventResponseAnimationVisemeDone,\n ServerEventConversationItemInputAudioTranscriptionDelta,\n ServerEventConversationItemRetrieved,\n ServerEventResponseFunctionCallArgumentsDelta,\n ServerEventResponseFunctionCallArgumentsDone,\n} from \"./models.js\";\n"]}
|