@glydeunity/voice-sdk 1.6.24 → 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/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://cdn.glyde.com/voice-sdk/v1.4.0/glyde-chat.umd.js"></script>
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
  */
@@ -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;
@@ -924,23 +880,14 @@ export declare class GlydeVoice {
924
880
  private readonly inputSampleRate;
925
881
  private isAgentSpeaking;
926
882
  private agentAudioDoneReceived;
927
- /** Pending context reinit after context_switch; run when agent stops speaking or after fallback timeout */
928
- private pendingContextReinit;
929
- private pendingContextReinitFallbackTimer;
930
- private static readonly PENDING_REINIT_FALLBACK_MS;
883
+ private contextSwitchManager;
931
884
  private conversationHistory;
932
885
  private sessionContext;
933
886
  /**
934
887
  * Create a new GlydeVoice instance
935
888
  * @param config - Configuration options
936
889
  */
937
- constructor(config: GlydeVoiceConfig_2);
938
- /**
939
- * Get authentication headers based on configured auth method
940
- * Supports publishableKey, apiKey, and JWT token (authToken)
941
- * @returns Headers object with appropriate authentication
942
- */
943
- private getAuthHeaders;
890
+ constructor(config: GlydeVoiceConfig);
944
891
  /**
945
892
  * Fetch voice configuration from Unity API for the current config context.
946
893
  * @returns Voice configuration including system prompt, tools, and Deepgram settings
@@ -965,10 +912,6 @@ export declare class GlydeVoice {
965
912
  * @returns A blob URL that can be used with audioWorklet.addModule()
966
913
  */
967
914
  private createWorkletBlobUrl;
968
- /**
969
- * Initialize the audio system with both capture and playback worklets.
970
- * Uses inline blob URLs to avoid CORS issues when SDK is embedded in external apps.
971
- */
972
915
  /**
973
916
  * Initialize the audio system: AudioContext, worklet modules, playback node,
974
917
  * and pre-acquire the microphone stream.
@@ -1000,9 +943,6 @@ export declare class GlydeVoice {
1000
943
  * Clear the playback buffer (for interruption handling)
1001
944
  */
1002
945
  private clearPlaybackBuffer;
1003
- /**
1004
- * Start capturing microphone audio using AudioWorklet
1005
- */
1006
946
  /**
1007
947
  * Wire the pre-acquired microphone stream to the capture worklet so audio
1008
948
  * data starts flowing to the WebSocket. The stream itself was already
@@ -1029,7 +969,7 @@ export declare class GlydeVoice {
1029
969
  /**
1030
970
  * Get the current server configuration
1031
971
  */
1032
- getServerConfig(): VoiceConfig_2 | null;
972
+ getServerConfig(): VoiceConfig | null;
1033
973
  /**
1034
974
  * Stop the voice session
1035
975
  */
@@ -1039,9 +979,9 @@ export declare class GlydeVoice {
1039
979
  */
1040
980
  private cleanup;
1041
981
  /**
1042
- * Emit event to callback
982
+ * Emit event to the configured callback (implements BaseGlydeClient abstract method)
1043
983
  */
1044
- private emit;
984
+ protected emitEvent(event: VoiceEvent): void;
1045
985
  /**
1046
986
  * Render a simple UI widget (optional)
1047
987
  */
@@ -1090,12 +1030,6 @@ export declare class GlydeVoice {
1090
1030
  currentJobUuid?: string;
1091
1031
  candidateUuid?: string;
1092
1032
  }): void;
1093
- /**
1094
- * If a context reinit was pending (after context_switch), run it now. Called when the agent
1095
- * stops speaking (playback buffer empty) or when the fallback timeout fires.
1096
- * Prefers smooth update (UpdatePrompt) over full reinit; falls back to reinit if update fails.
1097
- */
1098
- private tryFlushPendingContextReinit;
1099
1033
  /**
1100
1034
  * Update context and system prompt in-place over the existing WebSocket (no reconnect).
1101
1035
  * Fetches the new config from Unity, sends Deepgram UpdatePrompt so the agent uses the new
@@ -1129,34 +1063,6 @@ export declare class GlydeVoice {
1129
1063
  * Configuration options for GlydeVoice
1130
1064
  */
1131
1065
  export declare interface GlydeVoiceConfig extends BaseGlydeConfig {
1132
- /** Voice context type - determines which prompt and tools to use */
1133
- contextType: VoiceContextType;
1134
- /** DOM element to render the widget UI (optional) */
1135
- container?: HTMLElement | string;
1136
- /** Event callback for voice agent events */
1137
- onEvent?: (event: VoiceEvent) => void;
1138
- /** Transcript callback for conversation text */
1139
- onTranscript?: (text: string, role: 'user' | 'agent') => void;
1140
- /** Override system prompt (skips config fetch) */
1141
- systemPrompt?: string;
1142
- /** Override Deepgram configuration */
1143
- deepgramConfig?: DeepgramAgentConfig;
1144
- /** When true, skip last-3-messages continuity limit for screening (e.g. cdn-test) */
1145
- skipContinuityLimit?: boolean;
1146
- /** Max last N messages when skipContinuityLimit is false (default 3; cdn-test use 5; CareerBuddy use 50). */
1147
- limitToLast?: number;
1148
- }
1149
-
1150
- /**
1151
- * Configuration options for GlydeVoice
1152
- */
1153
- declare interface GlydeVoiceConfig_2 {
1154
- /** Publishable key for external apps (Screen) */
1155
- publishableKey?: string;
1156
- /** API key for programmatic access */
1157
- apiKey?: string;
1158
- /** JWT token for GLYDEBuddy passthrough (Teams app) */
1159
- authToken?: string;
1160
1066
  /**
1161
1067
  * Voice context type - determines which prompt and tools to use
1162
1068
  *
@@ -1170,17 +1076,6 @@ declare interface GlydeVoiceConfig_2 {
1170
1076
  * - 'candidate_apply': Known candidate applying to job (contextId = candidate_uuid:job_uuid)
1171
1077
  */
1172
1078
  contextType: VoiceContextType;
1173
- /**
1174
- * Context identifier - format depends on contextType:
1175
- * - screening: application_uuid (required)
1176
- * - job_apply: job_uuid (required)
1177
- * - candidate_discover: candidate_uuid (required)
1178
- * - candidate_apply: "candidate_uuid:job_uuid" (required)
1179
- * - discovery, recruiter, custom, phone: optional
1180
- */
1181
- contextId?: string;
1182
- /** Unity API base URL - defaults to https://api.glydeunity.com */
1183
- unityBaseUrl?: string;
1184
1079
  /** DOM element to render the widget UI (optional) */
1185
1080
  container?: HTMLElement | string;
1186
1081
  /** Event callback for voice agent events */
@@ -1192,16 +1087,12 @@ declare interface GlydeVoiceConfig_2 {
1192
1087
  role: 'user' | 'agent';
1193
1088
  content: string;
1194
1089
  }>;
1195
- /**
1196
- * When true, request full chat history for screening. Default false = server sends only last limitToLast messages.
1197
- */
1090
+ /** When true, skip last-3-messages continuity limit for screening (e.g. cdn-test) */
1198
1091
  skipContinuityLimit?: boolean;
1199
- /**
1200
- * Max last N messages to include when skipContinuityLimit is false (default 3). Use 5 for cdn-test; 50 for CareerBuddy/discovery/candidate_discover.
1201
- */
1092
+ /** Max last N messages when skipContinuityLimit is false (default 3; cdn-test use 5; CareerBuddy use 50). */
1202
1093
  limitToLast?: number;
1203
1094
  /** Override Deepgram configuration (e.g. model, tags). System prompt and greeting remain server-controlled. */
1204
- deepgramConfig?: DeepgramAgentConfig_2;
1095
+ deepgramConfig?: DeepgramAgentConfig;
1205
1096
  /**
1206
1097
  * Additional tool/function definitions to merge with server-provided functions.
1207
1098
  * Server-defined functions are always included; this allows adding extra tools only.
@@ -1257,15 +1148,6 @@ export declare interface MCPTool {
1257
1148
  inputSchema?: unknown;
1258
1149
  }
1259
1150
 
1260
- /**
1261
- * MCP Tool definition for voice agent
1262
- */
1263
- declare interface MCPTool_2 {
1264
- name: string;
1265
- description: string;
1266
- inputSchema?: unknown;
1267
- }
1268
-
1269
1151
  /**
1270
1152
  * Message / chat icon
1271
1153
  */
@@ -1586,19 +1468,6 @@ export declare interface VoiceConfig {
1586
1468
  };
1587
1469
  }
1588
1470
 
1589
- /**
1590
- * Voice configuration response from Unity API
1591
- */
1592
- declare interface VoiceConfig_2 {
1593
- system_prompt: string;
1594
- available_tools: MCPTool_2[];
1595
- deepgram_config: DeepgramAgentConfig_2;
1596
- context: {
1597
- type: VoiceContextType;
1598
- id: string | null;
1599
- };
1600
- }
1601
-
1602
1471
  /**
1603
1472
  * Voice context types supported by the voice agent
1604
1473
  *