@glydeunity/voice-sdk 1.6.23 → 1.6.26
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 +3 -1
- package/dist/glyde-chat.umd.js +17 -39
- package/dist/glyde-chat.umd.js.map +1 -1
- package/dist/index.d.ts +12 -142
- package/dist/voice-sdk.es.js +3429 -3497
- package/dist/voice-sdk.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* ### 1. CDN Users (Minimal Code)
|
|
9
9
|
* ```html
|
|
10
|
-
* <script src="https://
|
|
10
|
+
* <script src="https://unpkg.com/@glydeunity/voice-sdk@latest/dist/glyde-chat.umd.js"></script>
|
|
11
11
|
* <script>
|
|
12
12
|
* GlydeChat.init({
|
|
13
13
|
* publishableKey: 'pk_...',
|
|
@@ -556,42 +556,6 @@ declare interface ConversationSummaryResponse {
|
|
|
556
556
|
* Deepgram agent configuration for LLM and voice settings
|
|
557
557
|
*/
|
|
558
558
|
export declare interface DeepgramAgentConfig {
|
|
559
|
-
tags?: string[];
|
|
560
|
-
think?: {
|
|
561
|
-
provider?: {
|
|
562
|
-
type: string;
|
|
563
|
-
model?: string;
|
|
564
|
-
};
|
|
565
|
-
functions?: Array<{
|
|
566
|
-
name: string;
|
|
567
|
-
description: string;
|
|
568
|
-
parameters: unknown;
|
|
569
|
-
endpoint?: {
|
|
570
|
-
url: string;
|
|
571
|
-
method?: string;
|
|
572
|
-
headers?: Record<string, string>;
|
|
573
|
-
};
|
|
574
|
-
}>;
|
|
575
|
-
};
|
|
576
|
-
speak?: {
|
|
577
|
-
provider?: {
|
|
578
|
-
type: string;
|
|
579
|
-
model?: string;
|
|
580
|
-
};
|
|
581
|
-
};
|
|
582
|
-
listen?: {
|
|
583
|
-
provider?: {
|
|
584
|
-
type: string;
|
|
585
|
-
model?: string;
|
|
586
|
-
version?: string;
|
|
587
|
-
};
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
/**
|
|
592
|
-
* Deepgram agent configuration for LLM and voice settings
|
|
593
|
-
*/
|
|
594
|
-
declare interface DeepgramAgentConfig_2 {
|
|
595
559
|
tags?: string[];
|
|
596
560
|
/** Greeting phrase for the agent (server-controlled). Only used when provided by server. */
|
|
597
561
|
greeting?: string;
|
|
@@ -837,12 +801,6 @@ export declare class GlydeText extends BaseGlydeClient<GlydeTextConfig, TextChat
|
|
|
837
801
|
* @returns True if initialized
|
|
838
802
|
*/
|
|
839
803
|
getIsInitialized(): boolean;
|
|
840
|
-
/**
|
|
841
|
-
* Alias for isInitialized() for backward compatibility
|
|
842
|
-
* @returns True if initialized
|
|
843
|
-
* @deprecated Use isInitialized() from base class instead
|
|
844
|
-
*/
|
|
845
|
-
isInitialized(): boolean;
|
|
846
804
|
/**
|
|
847
805
|
* Get the current context type
|
|
848
806
|
*/
|
|
@@ -879,7 +837,7 @@ export declare class GlydeText extends BaseGlydeClient<GlydeTextConfig, TextChat
|
|
|
879
837
|
export declare interface GlydeTextConfig extends BaseGlydeConfig {
|
|
880
838
|
/**
|
|
881
839
|
* Context type - determines which prompt and tools to use
|
|
882
|
-
* When not specified, defaults to '
|
|
840
|
+
* When not specified, defaults to 'discovery' behavior
|
|
883
841
|
*/
|
|
884
842
|
contextType?: VoiceContextType;
|
|
885
843
|
/** Event callback for text chat events */
|
|
@@ -908,9 +866,7 @@ export declare interface GlydeTextConfig extends BaseGlydeConfig {
|
|
|
908
866
|
* - Playback: AudioWorklet (audio-playback-processor.js) with ring buffer
|
|
909
867
|
* - Ring buffer enables instant interruption (clear buffer when user speaks)
|
|
910
868
|
*/
|
|
911
|
-
export declare class GlydeVoice {
|
|
912
|
-
private config;
|
|
913
|
-
private unityUrl;
|
|
869
|
+
export declare class GlydeVoice extends BaseGlydeClient<GlydeVoiceConfig, VoiceEvent> {
|
|
914
870
|
private active;
|
|
915
871
|
private serverConfig;
|
|
916
872
|
private ws;
|
|
@@ -919,27 +875,19 @@ export declare class GlydeVoice {
|
|
|
919
875
|
private captureWorkletNode;
|
|
920
876
|
private playbackWorkletNode;
|
|
921
877
|
private isMuted;
|
|
878
|
+
private microphoneStarted;
|
|
922
879
|
private readonly outputSampleRate;
|
|
923
880
|
private readonly inputSampleRate;
|
|
924
881
|
private isAgentSpeaking;
|
|
925
882
|
private agentAudioDoneReceived;
|
|
926
|
-
|
|
927
|
-
private pendingContextReinit;
|
|
928
|
-
private pendingContextReinitFallbackTimer;
|
|
929
|
-
private static readonly PENDING_REINIT_FALLBACK_MS;
|
|
883
|
+
private contextSwitchManager;
|
|
930
884
|
private conversationHistory;
|
|
931
885
|
private sessionContext;
|
|
932
886
|
/**
|
|
933
887
|
* Create a new GlydeVoice instance
|
|
934
888
|
* @param config - Configuration options
|
|
935
889
|
*/
|
|
936
|
-
constructor(config:
|
|
937
|
-
/**
|
|
938
|
-
* Get authentication headers based on configured auth method
|
|
939
|
-
* Supports publishableKey, apiKey, and JWT token (authToken)
|
|
940
|
-
* @returns Headers object with appropriate authentication
|
|
941
|
-
*/
|
|
942
|
-
private getAuthHeaders;
|
|
890
|
+
constructor(config: GlydeVoiceConfig);
|
|
943
891
|
/**
|
|
944
892
|
* Fetch voice configuration from Unity API for the current config context.
|
|
945
893
|
* @returns Voice configuration including system prompt, tools, and Deepgram settings
|
|
@@ -964,10 +912,6 @@ export declare class GlydeVoice {
|
|
|
964
912
|
* @returns A blob URL that can be used with audioWorklet.addModule()
|
|
965
913
|
*/
|
|
966
914
|
private createWorkletBlobUrl;
|
|
967
|
-
/**
|
|
968
|
-
* Initialize the audio system with both capture and playback worklets.
|
|
969
|
-
* Uses inline blob URLs to avoid CORS issues when SDK is embedded in external apps.
|
|
970
|
-
*/
|
|
971
915
|
/**
|
|
972
916
|
* Initialize the audio system: AudioContext, worklet modules, playback node,
|
|
973
917
|
* and pre-acquire the microphone stream.
|
|
@@ -999,9 +943,6 @@ export declare class GlydeVoice {
|
|
|
999
943
|
* Clear the playback buffer (for interruption handling)
|
|
1000
944
|
*/
|
|
1001
945
|
private clearPlaybackBuffer;
|
|
1002
|
-
/**
|
|
1003
|
-
* Start capturing microphone audio using AudioWorklet
|
|
1004
|
-
*/
|
|
1005
946
|
/**
|
|
1006
947
|
* Wire the pre-acquired microphone stream to the capture worklet so audio
|
|
1007
948
|
* data starts flowing to the WebSocket. The stream itself was already
|
|
@@ -1028,7 +969,7 @@ export declare class GlydeVoice {
|
|
|
1028
969
|
/**
|
|
1029
970
|
* Get the current server configuration
|
|
1030
971
|
*/
|
|
1031
|
-
getServerConfig():
|
|
972
|
+
getServerConfig(): VoiceConfig | null;
|
|
1032
973
|
/**
|
|
1033
974
|
* Stop the voice session
|
|
1034
975
|
*/
|
|
@@ -1038,9 +979,9 @@ export declare class GlydeVoice {
|
|
|
1038
979
|
*/
|
|
1039
980
|
private cleanup;
|
|
1040
981
|
/**
|
|
1041
|
-
* Emit event to callback
|
|
982
|
+
* Emit event to the configured callback (implements BaseGlydeClient abstract method)
|
|
1042
983
|
*/
|
|
1043
|
-
|
|
984
|
+
protected emitEvent(event: VoiceEvent): void;
|
|
1044
985
|
/**
|
|
1045
986
|
* Render a simple UI widget (optional)
|
|
1046
987
|
*/
|
|
@@ -1089,12 +1030,6 @@ export declare class GlydeVoice {
|
|
|
1089
1030
|
currentJobUuid?: string;
|
|
1090
1031
|
candidateUuid?: string;
|
|
1091
1032
|
}): void;
|
|
1092
|
-
/**
|
|
1093
|
-
* If a context reinit was pending (after context_switch), run it now. Called when the agent
|
|
1094
|
-
* stops speaking (playback buffer empty) or when the fallback timeout fires.
|
|
1095
|
-
* Prefers smooth update (UpdatePrompt) over full reinit; falls back to reinit if update fails.
|
|
1096
|
-
*/
|
|
1097
|
-
private tryFlushPendingContextReinit;
|
|
1098
1033
|
/**
|
|
1099
1034
|
* Update context and system prompt in-place over the existing WebSocket (no reconnect).
|
|
1100
1035
|
* Fetches the new config from Unity, sends Deepgram UpdatePrompt so the agent uses the new
|
|
@@ -1128,34 +1063,6 @@ export declare class GlydeVoice {
|
|
|
1128
1063
|
* Configuration options for GlydeVoice
|
|
1129
1064
|
*/
|
|
1130
1065
|
export declare interface GlydeVoiceConfig extends BaseGlydeConfig {
|
|
1131
|
-
/** Voice context type - determines which prompt and tools to use */
|
|
1132
|
-
contextType: VoiceContextType;
|
|
1133
|
-
/** DOM element to render the widget UI (optional) */
|
|
1134
|
-
container?: HTMLElement | string;
|
|
1135
|
-
/** Event callback for voice agent events */
|
|
1136
|
-
onEvent?: (event: VoiceEvent) => void;
|
|
1137
|
-
/** Transcript callback for conversation text */
|
|
1138
|
-
onTranscript?: (text: string, role: 'user' | 'agent') => void;
|
|
1139
|
-
/** Override system prompt (skips config fetch) */
|
|
1140
|
-
systemPrompt?: string;
|
|
1141
|
-
/** Override Deepgram configuration */
|
|
1142
|
-
deepgramConfig?: DeepgramAgentConfig;
|
|
1143
|
-
/** When true, skip last-3-messages continuity limit for screening (e.g. cdn-test) */
|
|
1144
|
-
skipContinuityLimit?: boolean;
|
|
1145
|
-
/** Max last N messages when skipContinuityLimit is false (default 3; cdn-test use 5; CareerBuddy use 50). */
|
|
1146
|
-
limitToLast?: number;
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
/**
|
|
1150
|
-
* Configuration options for GlydeVoice
|
|
1151
|
-
*/
|
|
1152
|
-
declare interface GlydeVoiceConfig_2 {
|
|
1153
|
-
/** Publishable key for external apps (Screen) */
|
|
1154
|
-
publishableKey?: string;
|
|
1155
|
-
/** API key for programmatic access */
|
|
1156
|
-
apiKey?: string;
|
|
1157
|
-
/** JWT token for GLYDEBuddy passthrough (Teams app) */
|
|
1158
|
-
authToken?: string;
|
|
1159
1066
|
/**
|
|
1160
1067
|
* Voice context type - determines which prompt and tools to use
|
|
1161
1068
|
*
|
|
@@ -1169,17 +1076,6 @@ declare interface GlydeVoiceConfig_2 {
|
|
|
1169
1076
|
* - 'candidate_apply': Known candidate applying to job (contextId = candidate_uuid:job_uuid)
|
|
1170
1077
|
*/
|
|
1171
1078
|
contextType: VoiceContextType;
|
|
1172
|
-
/**
|
|
1173
|
-
* Context identifier - format depends on contextType:
|
|
1174
|
-
* - screening: application_uuid (required)
|
|
1175
|
-
* - job_apply: job_uuid (required)
|
|
1176
|
-
* - candidate_discover: candidate_uuid (required)
|
|
1177
|
-
* - candidate_apply: "candidate_uuid:job_uuid" (required)
|
|
1178
|
-
* - discovery, recruiter, custom, phone: optional
|
|
1179
|
-
*/
|
|
1180
|
-
contextId?: string;
|
|
1181
|
-
/** Unity API base URL - defaults to https://api.glydeunity.com */
|
|
1182
|
-
unityBaseUrl?: string;
|
|
1183
1079
|
/** DOM element to render the widget UI (optional) */
|
|
1184
1080
|
container?: HTMLElement | string;
|
|
1185
1081
|
/** Event callback for voice agent events */
|
|
@@ -1191,16 +1087,12 @@ declare interface GlydeVoiceConfig_2 {
|
|
|
1191
1087
|
role: 'user' | 'agent';
|
|
1192
1088
|
content: string;
|
|
1193
1089
|
}>;
|
|
1194
|
-
/**
|
|
1195
|
-
* When true, request full chat history for screening. Default false = server sends only last limitToLast messages.
|
|
1196
|
-
*/
|
|
1090
|
+
/** When true, skip last-3-messages continuity limit for screening (e.g. cdn-test) */
|
|
1197
1091
|
skipContinuityLimit?: boolean;
|
|
1198
|
-
/**
|
|
1199
|
-
* Max last N messages to include when skipContinuityLimit is false (default 3). Use 5 for cdn-test; 50 for CareerBuddy/discovery/candidate_discover.
|
|
1200
|
-
*/
|
|
1092
|
+
/** Max last N messages when skipContinuityLimit is false (default 3; cdn-test use 5; CareerBuddy use 50). */
|
|
1201
1093
|
limitToLast?: number;
|
|
1202
1094
|
/** Override Deepgram configuration (e.g. model, tags). System prompt and greeting remain server-controlled. */
|
|
1203
|
-
deepgramConfig?:
|
|
1095
|
+
deepgramConfig?: DeepgramAgentConfig;
|
|
1204
1096
|
/**
|
|
1205
1097
|
* Additional tool/function definitions to merge with server-provided functions.
|
|
1206
1098
|
* Server-defined functions are always included; this allows adding extra tools only.
|
|
@@ -1256,15 +1148,6 @@ export declare interface MCPTool {
|
|
|
1256
1148
|
inputSchema?: unknown;
|
|
1257
1149
|
}
|
|
1258
1150
|
|
|
1259
|
-
/**
|
|
1260
|
-
* MCP Tool definition for voice agent
|
|
1261
|
-
*/
|
|
1262
|
-
declare interface MCPTool_2 {
|
|
1263
|
-
name: string;
|
|
1264
|
-
description: string;
|
|
1265
|
-
inputSchema?: unknown;
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
1151
|
/**
|
|
1269
1152
|
* Message / chat icon
|
|
1270
1153
|
*/
|
|
@@ -1585,19 +1468,6 @@ export declare interface VoiceConfig {
|
|
|
1585
1468
|
};
|
|
1586
1469
|
}
|
|
1587
1470
|
|
|
1588
|
-
/**
|
|
1589
|
-
* Voice configuration response from Unity API
|
|
1590
|
-
*/
|
|
1591
|
-
declare interface VoiceConfig_2 {
|
|
1592
|
-
system_prompt: string;
|
|
1593
|
-
available_tools: MCPTool_2[];
|
|
1594
|
-
deepgram_config: DeepgramAgentConfig_2;
|
|
1595
|
-
context: {
|
|
1596
|
-
type: VoiceContextType;
|
|
1597
|
-
id: string | null;
|
|
1598
|
-
};
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
1471
|
/**
|
|
1602
1472
|
* Voice context types supported by the voice agent
|
|
1603
1473
|
*
|