@micdrop/client 3.5.0 → 3.7.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/README.md +1 -1
- package/dist/index.d.mts +118 -7
- package/dist/index.d.ts +118 -7
- package/dist/index.js +315 -117
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +312 -117
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -181,8 +181,8 @@ interface SpeakerEvents {
|
|
|
181
181
|
/**
|
|
182
182
|
* The speaker, as a single object shared by the whole app.
|
|
183
183
|
*
|
|
184
|
-
* It wraps a {@link SpeakerDriver} and plays the
|
|
185
|
-
*
|
|
184
|
+
* It wraps a {@link SpeakerDriver} and plays the PCM sent by the server as it
|
|
185
|
+
* arrives, at the rate the server announces.
|
|
186
186
|
*/
|
|
187
187
|
declare class SpeakerController extends EventEmitter<SpeakerEvents> {
|
|
188
188
|
private driver;
|
|
@@ -239,8 +239,14 @@ declare enum MicdropServerCommands {
|
|
|
239
239
|
SkipAnswer = "SkipAnswer",
|
|
240
240
|
EndCall = "EndCall",
|
|
241
241
|
ToolCall = "ToolCall",
|
|
242
|
-
Classification = "Classification"
|
|
242
|
+
Classification = "Classification",
|
|
243
|
+
SampleRate = "SampleRate"
|
|
243
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Rate of the audio the client records, and of the assistant voice until the
|
|
247
|
+
* server announces another one with a `SampleRate` command.
|
|
248
|
+
*/
|
|
249
|
+
declare const DEFAULT_SAMPLE_RATE = 16000;
|
|
244
250
|
/**
|
|
245
251
|
* Hears whether a sentence has landed, where voice activity detection only
|
|
246
252
|
* hears whether someone is speaking.
|
|
@@ -703,6 +709,7 @@ declare class SileroVAD extends VAD {
|
|
|
703
709
|
private silenceFrames;
|
|
704
710
|
private processing;
|
|
705
711
|
private round;
|
|
712
|
+
private startId;
|
|
706
713
|
constructor(options?: Partial<SileroVADOptions>);
|
|
707
714
|
get isStarted(): boolean;
|
|
708
715
|
get isPaused(): boolean;
|
|
@@ -755,6 +762,63 @@ declare class VolumeVAD extends VAD {
|
|
|
755
762
|
private reset;
|
|
756
763
|
}
|
|
757
764
|
|
|
765
|
+
/** Anything a runtime hands back that has to be released once done with */
|
|
766
|
+
interface Releasable {
|
|
767
|
+
release(): Promise<void>;
|
|
768
|
+
}
|
|
769
|
+
type SessionState<S> = {
|
|
770
|
+
status: 'unloaded';
|
|
771
|
+
} | {
|
|
772
|
+
status: 'loading';
|
|
773
|
+
promise: Promise<S>;
|
|
774
|
+
} | {
|
|
775
|
+
status: 'loaded';
|
|
776
|
+
session: S;
|
|
777
|
+
} | {
|
|
778
|
+
status: 'released';
|
|
779
|
+
};
|
|
780
|
+
/**
|
|
781
|
+
* An inference session created on first use, and released once.
|
|
782
|
+
*
|
|
783
|
+
* Every caller asking while it loads shares the same load, so two of them
|
|
784
|
+
* never create two sessions and leak one. A release during the load disposes
|
|
785
|
+
* of the session as soon as it arrives instead of letting it come back to life,
|
|
786
|
+
* and waits for the runs in flight before freeing the runtime under them. A
|
|
787
|
+
* failed load is forgotten, so the next call tries again.
|
|
788
|
+
*
|
|
789
|
+
* Shared by the Silero models of `@micdrop/web` and `@micdrop/react-native`.
|
|
790
|
+
* `@micdrop/smart-turn` holds the same few lines for its own models, as it
|
|
791
|
+
* depends on no other package.
|
|
792
|
+
*/
|
|
793
|
+
declare class LazySession<S extends Releasable> {
|
|
794
|
+
private name;
|
|
795
|
+
private create;
|
|
796
|
+
private state;
|
|
797
|
+
private runs;
|
|
798
|
+
/**
|
|
799
|
+
* @param name - What the session runs, to name it in errors
|
|
800
|
+
* @param create - Creates the session, called once unless it fails
|
|
801
|
+
*/
|
|
802
|
+
constructor(name: string, create: () => Promise<S>);
|
|
803
|
+
get status(): SessionState<S>['status'];
|
|
804
|
+
/** The session, loaded on the first call */
|
|
805
|
+
get(): Promise<S>;
|
|
806
|
+
/**
|
|
807
|
+
* Runs something on the session, which a release waits for
|
|
808
|
+
* @param run - Uses the session, and only until its promise settles
|
|
809
|
+
*/
|
|
810
|
+
use<T>(run: (session: S) => Promise<T>): Promise<T>;
|
|
811
|
+
/** Releases the session, for good */
|
|
812
|
+
release(): Promise<void>;
|
|
813
|
+
private isLoading;
|
|
814
|
+
private releasedError;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Fetches each address once for as long as the app runs, however many models
|
|
818
|
+
* ask for it. A failed download is forgotten, so a later call tries again.
|
|
819
|
+
*/
|
|
820
|
+
declare function createDownloadCache<T>(download: (url: string) => Promise<T>): (url: string) => Promise<T>;
|
|
821
|
+
|
|
758
822
|
/**
|
|
759
823
|
* Measures how loud the microphone is, the way a browser AnalyserNode does.
|
|
760
824
|
*
|
|
@@ -870,7 +934,30 @@ interface MicdropOptions {
|
|
|
870
934
|
debugLog?: boolean;
|
|
871
935
|
reconnect?: MicdropReconnectOptions;
|
|
872
936
|
}
|
|
937
|
+
/**
|
|
938
|
+
* Where the call stands.
|
|
939
|
+
*
|
|
940
|
+
* - `stopped`: no call, the microphone may still be on for a test
|
|
941
|
+
* - `starting`: opening the microphone and the connection
|
|
942
|
+
* - `started`: the call is on
|
|
943
|
+
* - `reconnecting`: the connection dropped, the call waits for a new one
|
|
944
|
+
*/
|
|
945
|
+
type MicdropStatus = 'stopped' | 'starting' | 'started' | 'reconnecting';
|
|
946
|
+
/**
|
|
947
|
+
* Who has the floor, one at a time.
|
|
948
|
+
*
|
|
949
|
+
* - `idle`: nothing is heard nor awaited, when stopped, paused or muted
|
|
950
|
+
* - `listening`: waiting for the user to speak
|
|
951
|
+
* - `userSpeaking`: the user speaks
|
|
952
|
+
* - `processing`: the server prepares the answer
|
|
953
|
+
* - `assistantSpeaking`: the answer is playing
|
|
954
|
+
*/
|
|
955
|
+
type MicdropActivity = 'idle' | 'listening' | 'userSpeaking' | 'processing' | 'assistantSpeaking';
|
|
873
956
|
interface MicdropState {
|
|
957
|
+
/** Where the call stands, which `isStarting`, `isStarted` and `isReconnecting` spell out */
|
|
958
|
+
status: MicdropStatus;
|
|
959
|
+
/** Who has the floor, which `isListening`, `isUserSpeaking`, `isProcessing` and `isAssistantSpeaking` spell out */
|
|
960
|
+
activity: MicdropActivity;
|
|
874
961
|
isStarting: boolean;
|
|
875
962
|
isStarted: boolean;
|
|
876
963
|
isMuted: boolean;
|
|
@@ -907,16 +994,20 @@ declare class MicdropClient extends EventEmitter<MicdropEvents> implements Micdr
|
|
|
907
994
|
private startTime;
|
|
908
995
|
private lastNotifiedState;
|
|
909
996
|
private _isProcessing;
|
|
997
|
+
private assistantSampleRate;
|
|
910
998
|
private _isMuted;
|
|
911
999
|
private _isPaused;
|
|
912
|
-
private
|
|
913
|
-
private _isStartingCall;
|
|
1000
|
+
private callStatus;
|
|
914
1001
|
private reconnectAttempt;
|
|
915
1002
|
private reconnectTimer?;
|
|
916
1003
|
private connectionTimer?;
|
|
917
1004
|
private echoGuard;
|
|
1005
|
+
private pendingStop?;
|
|
918
1006
|
constructor(options?: MicdropOptions);
|
|
919
1007
|
get vad(): VAD | undefined;
|
|
1008
|
+
get status(): MicdropStatus;
|
|
1009
|
+
get activity(): MicdropActivity;
|
|
1010
|
+
/** The call is on, reconnecting included */
|
|
920
1011
|
get isStarted(): boolean;
|
|
921
1012
|
get isStarting(): boolean;
|
|
922
1013
|
get isReconnecting(): boolean;
|
|
@@ -944,6 +1035,19 @@ declare class MicdropClient extends EventEmitter<MicdropEvents> implements Micdr
|
|
|
944
1035
|
get state(): MicdropState;
|
|
945
1036
|
start: (options: MicdropOptions) => Promise<void>;
|
|
946
1037
|
stop: () => Promise<void>;
|
|
1038
|
+
/** The assistant prepares or speaks an answer */
|
|
1039
|
+
private get isAnswering();
|
|
1040
|
+
/**
|
|
1041
|
+
* Stops the call once the assistant finished its answer, the one it is
|
|
1042
|
+
* still preparing included, such as the goodbye that follows an `EndCall`.
|
|
1043
|
+
* Stops right away when no answer is under way.
|
|
1044
|
+
*
|
|
1045
|
+
* A `start()` or a `stop()` meanwhile cancels the wait, so it never acts on
|
|
1046
|
+
* the next call.
|
|
1047
|
+
* @returns Resolves once the call is stopped, or the wait cancelled
|
|
1048
|
+
*/
|
|
1049
|
+
stopAfterAnswer: () => Promise<void>;
|
|
1050
|
+
private cancelPendingStop;
|
|
947
1051
|
mute: () => void;
|
|
948
1052
|
unmute: () => void;
|
|
949
1053
|
pause: () => void;
|
|
@@ -970,13 +1074,20 @@ declare class MicdropClient extends EventEmitter<MicdropEvents> implements Micdr
|
|
|
970
1074
|
changeSpeakerDevice: (deviceId: string) => Promise<void>;
|
|
971
1075
|
private stopMic;
|
|
972
1076
|
private updateDevices;
|
|
973
|
-
|
|
1077
|
+
/**
|
|
1078
|
+
* Opens the connection, unless one is already open or opening.
|
|
1079
|
+
*
|
|
1080
|
+
* The socket answers through handlers bound to it, so one left behind by a
|
|
1081
|
+
* stop or a reconnection never acts on the call that followed.
|
|
1082
|
+
*/
|
|
1083
|
+
private openWS;
|
|
974
1084
|
private onWSOpen;
|
|
975
1085
|
private onWSMessage;
|
|
976
1086
|
private onWSClose;
|
|
977
1087
|
private onWSError;
|
|
978
1088
|
private stopWS;
|
|
979
1089
|
private scheduleReconnect;
|
|
1090
|
+
private clearReconnectTimer;
|
|
980
1091
|
private onSpeakerStartPlaying;
|
|
981
1092
|
private onSpeakerStopPlaying;
|
|
982
1093
|
/**
|
|
@@ -1019,4 +1130,4 @@ declare enum MicdropStorageKeys {
|
|
|
1019
1130
|
declare function setMicdropStorage(storage: MicdropStorage): void;
|
|
1020
1131
|
declare const storage: MicdropStorage;
|
|
1021
1132
|
|
|
1022
|
-
export { type AudioSink, CONFIRM_MARGIN, DEFAULT_TURN_MAX_WAIT, type DeepPartial, ECHO_TAIL, Mic, MicController, MicDriver, type MicDriverEvents, type MicEvents, MicRecorder, type MicRecorderEvents, type MicRecorderState, type MicSource, Micdrop, type MicdropAnswerMetadata, type MicdropCallSummary, type MicdropClassification, MicdropClient, MicdropClientCommands, MicdropClientError, MicdropClientErrorCode, type MicdropConversation, type MicdropConversationItem, type MicdropConversationMessage, type MicdropConversationToolCall, type MicdropConversationToolResult, type MicdropDevice, type MicdropEvents, type MicdropOptions, type MicdropReconnectOptions, MicdropServerCommands, type MicdropState, type MicdropStorage, MicdropStorageKeys, type MicdropToolCall, MultipleVAD, Pcm16AudioStream, type Pcm16AudioStreamEvents, SILERO_FRAME_SAMPLES, SILERO_SAMPLE_RATE, type ScheduledAudio, type SileroModel, type SileroModelLoader, SileroVAD, type SileroVADOptions, Speaker, SpeakerController, SpeakerDriver, type SpeakerDriverEvents, type SpeakerEvents, type TurnDetector, VAD, type VADConfig, type VADConfigName, type VADEvents, VADStatus, VOLUME_SAMPLE_RATE, VolumeMeter, VolumeVAD, type VolumeVADOptions, type WSCloseEvent, concatFloat32, currentTurn, equalVADConfig, floatToPcm16, getClientErrorFromWSCloseEvent, getClientErrorFromWSCloseEventCode, getTurnClassification, getVAD, getVolume, isRecoverableError, pcm16ToArrayBuffer, pcm16ToFloat, resample, setMicdropStorage, setSileroModelLoader, storage };
|
|
1133
|
+
export { type AudioSink, CONFIRM_MARGIN, DEFAULT_SAMPLE_RATE, DEFAULT_TURN_MAX_WAIT, type DeepPartial, ECHO_TAIL, LazySession, Mic, MicController, MicDriver, type MicDriverEvents, type MicEvents, MicRecorder, type MicRecorderEvents, type MicRecorderState, type MicSource, Micdrop, type MicdropActivity, type MicdropAnswerMetadata, type MicdropCallSummary, type MicdropClassification, MicdropClient, MicdropClientCommands, MicdropClientError, MicdropClientErrorCode, type MicdropConversation, type MicdropConversationItem, type MicdropConversationMessage, type MicdropConversationToolCall, type MicdropConversationToolResult, type MicdropDevice, type MicdropEvents, type MicdropOptions, type MicdropReconnectOptions, MicdropServerCommands, type MicdropState, type MicdropStatus, type MicdropStorage, MicdropStorageKeys, type MicdropToolCall, MultipleVAD, Pcm16AudioStream, type Pcm16AudioStreamEvents, type Releasable, SILERO_FRAME_SAMPLES, SILERO_SAMPLE_RATE, type ScheduledAudio, type SileroModel, type SileroModelLoader, SileroVAD, type SileroVADOptions, Speaker, SpeakerController, SpeakerDriver, type SpeakerDriverEvents, type SpeakerEvents, type TurnDetector, VAD, type VADConfig, type VADConfigName, type VADEvents, VADStatus, VOLUME_SAMPLE_RATE, VolumeMeter, VolumeVAD, type VolumeVADOptions, type WSCloseEvent, concatFloat32, createDownloadCache, currentTurn, equalVADConfig, floatToPcm16, getClientErrorFromWSCloseEvent, getClientErrorFromWSCloseEventCode, getTurnClassification, getVAD, getVolume, isRecoverableError, pcm16ToArrayBuffer, pcm16ToFloat, resample, setMicdropStorage, setSileroModelLoader, storage };
|
package/dist/index.d.ts
CHANGED
|
@@ -181,8 +181,8 @@ interface SpeakerEvents {
|
|
|
181
181
|
/**
|
|
182
182
|
* The speaker, as a single object shared by the whole app.
|
|
183
183
|
*
|
|
184
|
-
* It wraps a {@link SpeakerDriver} and plays the
|
|
185
|
-
*
|
|
184
|
+
* It wraps a {@link SpeakerDriver} and plays the PCM sent by the server as it
|
|
185
|
+
* arrives, at the rate the server announces.
|
|
186
186
|
*/
|
|
187
187
|
declare class SpeakerController extends EventEmitter<SpeakerEvents> {
|
|
188
188
|
private driver;
|
|
@@ -239,8 +239,14 @@ declare enum MicdropServerCommands {
|
|
|
239
239
|
SkipAnswer = "SkipAnswer",
|
|
240
240
|
EndCall = "EndCall",
|
|
241
241
|
ToolCall = "ToolCall",
|
|
242
|
-
Classification = "Classification"
|
|
242
|
+
Classification = "Classification",
|
|
243
|
+
SampleRate = "SampleRate"
|
|
243
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Rate of the audio the client records, and of the assistant voice until the
|
|
247
|
+
* server announces another one with a `SampleRate` command.
|
|
248
|
+
*/
|
|
249
|
+
declare const DEFAULT_SAMPLE_RATE = 16000;
|
|
244
250
|
/**
|
|
245
251
|
* Hears whether a sentence has landed, where voice activity detection only
|
|
246
252
|
* hears whether someone is speaking.
|
|
@@ -703,6 +709,7 @@ declare class SileroVAD extends VAD {
|
|
|
703
709
|
private silenceFrames;
|
|
704
710
|
private processing;
|
|
705
711
|
private round;
|
|
712
|
+
private startId;
|
|
706
713
|
constructor(options?: Partial<SileroVADOptions>);
|
|
707
714
|
get isStarted(): boolean;
|
|
708
715
|
get isPaused(): boolean;
|
|
@@ -755,6 +762,63 @@ declare class VolumeVAD extends VAD {
|
|
|
755
762
|
private reset;
|
|
756
763
|
}
|
|
757
764
|
|
|
765
|
+
/** Anything a runtime hands back that has to be released once done with */
|
|
766
|
+
interface Releasable {
|
|
767
|
+
release(): Promise<void>;
|
|
768
|
+
}
|
|
769
|
+
type SessionState<S> = {
|
|
770
|
+
status: 'unloaded';
|
|
771
|
+
} | {
|
|
772
|
+
status: 'loading';
|
|
773
|
+
promise: Promise<S>;
|
|
774
|
+
} | {
|
|
775
|
+
status: 'loaded';
|
|
776
|
+
session: S;
|
|
777
|
+
} | {
|
|
778
|
+
status: 'released';
|
|
779
|
+
};
|
|
780
|
+
/**
|
|
781
|
+
* An inference session created on first use, and released once.
|
|
782
|
+
*
|
|
783
|
+
* Every caller asking while it loads shares the same load, so two of them
|
|
784
|
+
* never create two sessions and leak one. A release during the load disposes
|
|
785
|
+
* of the session as soon as it arrives instead of letting it come back to life,
|
|
786
|
+
* and waits for the runs in flight before freeing the runtime under them. A
|
|
787
|
+
* failed load is forgotten, so the next call tries again.
|
|
788
|
+
*
|
|
789
|
+
* Shared by the Silero models of `@micdrop/web` and `@micdrop/react-native`.
|
|
790
|
+
* `@micdrop/smart-turn` holds the same few lines for its own models, as it
|
|
791
|
+
* depends on no other package.
|
|
792
|
+
*/
|
|
793
|
+
declare class LazySession<S extends Releasable> {
|
|
794
|
+
private name;
|
|
795
|
+
private create;
|
|
796
|
+
private state;
|
|
797
|
+
private runs;
|
|
798
|
+
/**
|
|
799
|
+
* @param name - What the session runs, to name it in errors
|
|
800
|
+
* @param create - Creates the session, called once unless it fails
|
|
801
|
+
*/
|
|
802
|
+
constructor(name: string, create: () => Promise<S>);
|
|
803
|
+
get status(): SessionState<S>['status'];
|
|
804
|
+
/** The session, loaded on the first call */
|
|
805
|
+
get(): Promise<S>;
|
|
806
|
+
/**
|
|
807
|
+
* Runs something on the session, which a release waits for
|
|
808
|
+
* @param run - Uses the session, and only until its promise settles
|
|
809
|
+
*/
|
|
810
|
+
use<T>(run: (session: S) => Promise<T>): Promise<T>;
|
|
811
|
+
/** Releases the session, for good */
|
|
812
|
+
release(): Promise<void>;
|
|
813
|
+
private isLoading;
|
|
814
|
+
private releasedError;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Fetches each address once for as long as the app runs, however many models
|
|
818
|
+
* ask for it. A failed download is forgotten, so a later call tries again.
|
|
819
|
+
*/
|
|
820
|
+
declare function createDownloadCache<T>(download: (url: string) => Promise<T>): (url: string) => Promise<T>;
|
|
821
|
+
|
|
758
822
|
/**
|
|
759
823
|
* Measures how loud the microphone is, the way a browser AnalyserNode does.
|
|
760
824
|
*
|
|
@@ -870,7 +934,30 @@ interface MicdropOptions {
|
|
|
870
934
|
debugLog?: boolean;
|
|
871
935
|
reconnect?: MicdropReconnectOptions;
|
|
872
936
|
}
|
|
937
|
+
/**
|
|
938
|
+
* Where the call stands.
|
|
939
|
+
*
|
|
940
|
+
* - `stopped`: no call, the microphone may still be on for a test
|
|
941
|
+
* - `starting`: opening the microphone and the connection
|
|
942
|
+
* - `started`: the call is on
|
|
943
|
+
* - `reconnecting`: the connection dropped, the call waits for a new one
|
|
944
|
+
*/
|
|
945
|
+
type MicdropStatus = 'stopped' | 'starting' | 'started' | 'reconnecting';
|
|
946
|
+
/**
|
|
947
|
+
* Who has the floor, one at a time.
|
|
948
|
+
*
|
|
949
|
+
* - `idle`: nothing is heard nor awaited, when stopped, paused or muted
|
|
950
|
+
* - `listening`: waiting for the user to speak
|
|
951
|
+
* - `userSpeaking`: the user speaks
|
|
952
|
+
* - `processing`: the server prepares the answer
|
|
953
|
+
* - `assistantSpeaking`: the answer is playing
|
|
954
|
+
*/
|
|
955
|
+
type MicdropActivity = 'idle' | 'listening' | 'userSpeaking' | 'processing' | 'assistantSpeaking';
|
|
873
956
|
interface MicdropState {
|
|
957
|
+
/** Where the call stands, which `isStarting`, `isStarted` and `isReconnecting` spell out */
|
|
958
|
+
status: MicdropStatus;
|
|
959
|
+
/** Who has the floor, which `isListening`, `isUserSpeaking`, `isProcessing` and `isAssistantSpeaking` spell out */
|
|
960
|
+
activity: MicdropActivity;
|
|
874
961
|
isStarting: boolean;
|
|
875
962
|
isStarted: boolean;
|
|
876
963
|
isMuted: boolean;
|
|
@@ -907,16 +994,20 @@ declare class MicdropClient extends EventEmitter<MicdropEvents> implements Micdr
|
|
|
907
994
|
private startTime;
|
|
908
995
|
private lastNotifiedState;
|
|
909
996
|
private _isProcessing;
|
|
997
|
+
private assistantSampleRate;
|
|
910
998
|
private _isMuted;
|
|
911
999
|
private _isPaused;
|
|
912
|
-
private
|
|
913
|
-
private _isStartingCall;
|
|
1000
|
+
private callStatus;
|
|
914
1001
|
private reconnectAttempt;
|
|
915
1002
|
private reconnectTimer?;
|
|
916
1003
|
private connectionTimer?;
|
|
917
1004
|
private echoGuard;
|
|
1005
|
+
private pendingStop?;
|
|
918
1006
|
constructor(options?: MicdropOptions);
|
|
919
1007
|
get vad(): VAD | undefined;
|
|
1008
|
+
get status(): MicdropStatus;
|
|
1009
|
+
get activity(): MicdropActivity;
|
|
1010
|
+
/** The call is on, reconnecting included */
|
|
920
1011
|
get isStarted(): boolean;
|
|
921
1012
|
get isStarting(): boolean;
|
|
922
1013
|
get isReconnecting(): boolean;
|
|
@@ -944,6 +1035,19 @@ declare class MicdropClient extends EventEmitter<MicdropEvents> implements Micdr
|
|
|
944
1035
|
get state(): MicdropState;
|
|
945
1036
|
start: (options: MicdropOptions) => Promise<void>;
|
|
946
1037
|
stop: () => Promise<void>;
|
|
1038
|
+
/** The assistant prepares or speaks an answer */
|
|
1039
|
+
private get isAnswering();
|
|
1040
|
+
/**
|
|
1041
|
+
* Stops the call once the assistant finished its answer, the one it is
|
|
1042
|
+
* still preparing included, such as the goodbye that follows an `EndCall`.
|
|
1043
|
+
* Stops right away when no answer is under way.
|
|
1044
|
+
*
|
|
1045
|
+
* A `start()` or a `stop()` meanwhile cancels the wait, so it never acts on
|
|
1046
|
+
* the next call.
|
|
1047
|
+
* @returns Resolves once the call is stopped, or the wait cancelled
|
|
1048
|
+
*/
|
|
1049
|
+
stopAfterAnswer: () => Promise<void>;
|
|
1050
|
+
private cancelPendingStop;
|
|
947
1051
|
mute: () => void;
|
|
948
1052
|
unmute: () => void;
|
|
949
1053
|
pause: () => void;
|
|
@@ -970,13 +1074,20 @@ declare class MicdropClient extends EventEmitter<MicdropEvents> implements Micdr
|
|
|
970
1074
|
changeSpeakerDevice: (deviceId: string) => Promise<void>;
|
|
971
1075
|
private stopMic;
|
|
972
1076
|
private updateDevices;
|
|
973
|
-
|
|
1077
|
+
/**
|
|
1078
|
+
* Opens the connection, unless one is already open or opening.
|
|
1079
|
+
*
|
|
1080
|
+
* The socket answers through handlers bound to it, so one left behind by a
|
|
1081
|
+
* stop or a reconnection never acts on the call that followed.
|
|
1082
|
+
*/
|
|
1083
|
+
private openWS;
|
|
974
1084
|
private onWSOpen;
|
|
975
1085
|
private onWSMessage;
|
|
976
1086
|
private onWSClose;
|
|
977
1087
|
private onWSError;
|
|
978
1088
|
private stopWS;
|
|
979
1089
|
private scheduleReconnect;
|
|
1090
|
+
private clearReconnectTimer;
|
|
980
1091
|
private onSpeakerStartPlaying;
|
|
981
1092
|
private onSpeakerStopPlaying;
|
|
982
1093
|
/**
|
|
@@ -1019,4 +1130,4 @@ declare enum MicdropStorageKeys {
|
|
|
1019
1130
|
declare function setMicdropStorage(storage: MicdropStorage): void;
|
|
1020
1131
|
declare const storage: MicdropStorage;
|
|
1021
1132
|
|
|
1022
|
-
export { type AudioSink, CONFIRM_MARGIN, DEFAULT_TURN_MAX_WAIT, type DeepPartial, ECHO_TAIL, Mic, MicController, MicDriver, type MicDriverEvents, type MicEvents, MicRecorder, type MicRecorderEvents, type MicRecorderState, type MicSource, Micdrop, type MicdropAnswerMetadata, type MicdropCallSummary, type MicdropClassification, MicdropClient, MicdropClientCommands, MicdropClientError, MicdropClientErrorCode, type MicdropConversation, type MicdropConversationItem, type MicdropConversationMessage, type MicdropConversationToolCall, type MicdropConversationToolResult, type MicdropDevice, type MicdropEvents, type MicdropOptions, type MicdropReconnectOptions, MicdropServerCommands, type MicdropState, type MicdropStorage, MicdropStorageKeys, type MicdropToolCall, MultipleVAD, Pcm16AudioStream, type Pcm16AudioStreamEvents, SILERO_FRAME_SAMPLES, SILERO_SAMPLE_RATE, type ScheduledAudio, type SileroModel, type SileroModelLoader, SileroVAD, type SileroVADOptions, Speaker, SpeakerController, SpeakerDriver, type SpeakerDriverEvents, type SpeakerEvents, type TurnDetector, VAD, type VADConfig, type VADConfigName, type VADEvents, VADStatus, VOLUME_SAMPLE_RATE, VolumeMeter, VolumeVAD, type VolumeVADOptions, type WSCloseEvent, concatFloat32, currentTurn, equalVADConfig, floatToPcm16, getClientErrorFromWSCloseEvent, getClientErrorFromWSCloseEventCode, getTurnClassification, getVAD, getVolume, isRecoverableError, pcm16ToArrayBuffer, pcm16ToFloat, resample, setMicdropStorage, setSileroModelLoader, storage };
|
|
1133
|
+
export { type AudioSink, CONFIRM_MARGIN, DEFAULT_SAMPLE_RATE, DEFAULT_TURN_MAX_WAIT, type DeepPartial, ECHO_TAIL, LazySession, Mic, MicController, MicDriver, type MicDriverEvents, type MicEvents, MicRecorder, type MicRecorderEvents, type MicRecorderState, type MicSource, Micdrop, type MicdropActivity, type MicdropAnswerMetadata, type MicdropCallSummary, type MicdropClassification, MicdropClient, MicdropClientCommands, MicdropClientError, MicdropClientErrorCode, type MicdropConversation, type MicdropConversationItem, type MicdropConversationMessage, type MicdropConversationToolCall, type MicdropConversationToolResult, type MicdropDevice, type MicdropEvents, type MicdropOptions, type MicdropReconnectOptions, MicdropServerCommands, type MicdropState, type MicdropStatus, type MicdropStorage, MicdropStorageKeys, type MicdropToolCall, MultipleVAD, Pcm16AudioStream, type Pcm16AudioStreamEvents, type Releasable, SILERO_FRAME_SAMPLES, SILERO_SAMPLE_RATE, type ScheduledAudio, type SileroModel, type SileroModelLoader, SileroVAD, type SileroVADOptions, Speaker, SpeakerController, SpeakerDriver, type SpeakerDriverEvents, type SpeakerEvents, type TurnDetector, VAD, type VADConfig, type VADConfigName, type VADEvents, VADStatus, VOLUME_SAMPLE_RATE, VolumeMeter, VolumeVAD, type VolumeVADOptions, type WSCloseEvent, concatFloat32, createDownloadCache, currentTurn, equalVADConfig, floatToPcm16, getClientErrorFromWSCloseEvent, getClientErrorFromWSCloseEventCode, getTurnClassification, getVAD, getVolume, isRecoverableError, pcm16ToArrayBuffer, pcm16ToFloat, resample, setMicdropStorage, setSileroModelLoader, storage };
|