@layercode/js-sdk 2.0.5 → 2.1.0
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/types/index.d.ts
CHANGED
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
* Interface for LayercodeClient public methods
|
|
3
3
|
*/
|
|
4
4
|
interface ILayercodeClient {
|
|
5
|
-
connect(
|
|
6
|
-
|
|
5
|
+
connect(opts?: {
|
|
6
|
+
conversationId?: string;
|
|
7
|
+
newConversation?: boolean;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
disconnect(opts?: {
|
|
10
|
+
clearConversationId?: boolean;
|
|
11
|
+
}): Promise<void>;
|
|
7
12
|
triggerUserTurnStarted(): Promise<void>;
|
|
8
13
|
triggerUserTurnFinished(): Promise<void>;
|
|
9
14
|
getStream(): MediaStream | null;
|
|
@@ -79,6 +84,10 @@ declare class LayercodeClient implements ILayercodeClient {
|
|
|
79
84
|
private activeDeviceId;
|
|
80
85
|
private useSystemDefaultDevice;
|
|
81
86
|
private lastReportedDeviceId;
|
|
87
|
+
private lastKnownSystemDefaultDeviceKey;
|
|
88
|
+
private stopPlayerAmplitude?;
|
|
89
|
+
private stopRecorderAmplitude?;
|
|
90
|
+
private deviceChangeListener;
|
|
82
91
|
_websocketUrl: string;
|
|
83
92
|
status: string;
|
|
84
93
|
userAudioAmplitude: number;
|
|
@@ -122,14 +131,20 @@ declare class LayercodeClient implements ILayercodeClient {
|
|
|
122
131
|
* @param {(amplitude: number) => void} updateInternalState - Function to update the internal amplitude state.
|
|
123
132
|
*/
|
|
124
133
|
private _setupAmplitudeMonitoring;
|
|
134
|
+
private _stopAmplitudeMonitoring;
|
|
125
135
|
/**
|
|
126
136
|
* Connects to the Layercode agent and starts the audio conversation
|
|
127
137
|
* @async
|
|
128
138
|
* @returns {Promise<void>}
|
|
129
139
|
*/
|
|
130
|
-
connect(
|
|
140
|
+
connect(opts?: {
|
|
141
|
+
conversationId?: string;
|
|
142
|
+
newConversation?: boolean;
|
|
143
|
+
}): Promise<void>;
|
|
131
144
|
private _resetTurnTracking;
|
|
132
|
-
disconnect(
|
|
145
|
+
disconnect(opts?: {
|
|
146
|
+
clearConversationId?: boolean;
|
|
147
|
+
}): Promise<void>;
|
|
133
148
|
/**
|
|
134
149
|
* Gets the microphone MediaStream used by this client
|
|
135
150
|
* @returns {MediaStream|null} The microphone stream or null if not initialized
|
|
@@ -152,6 +167,9 @@ declare class LayercodeClient implements ILayercodeClient {
|
|
|
152
167
|
* Sets up the device change event listener
|
|
153
168
|
*/
|
|
154
169
|
private _setupDeviceChangeListener;
|
|
170
|
+
private _teardownDeviceListeners;
|
|
171
|
+
private _performDisconnectCleanup;
|
|
172
|
+
private _getDeviceComparisonKey;
|
|
155
173
|
/**
|
|
156
174
|
* Mutes the microphone to stop sending audio to the server
|
|
157
175
|
* The connection and recording remain active for quick unmute
|
package/package.json
CHANGED