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