@hamsa-ai/voice-agents-sdk 0.4.1-beta.6 → 0.4.1-beta.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hamsa-ai/voice-agents-sdk",
3
- "version": "0.4.1-beta.6",
3
+ "version": "0.4.1-beta.8",
4
4
  "description": "Hamsa AI - Voice Agents JavaScript SDK",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
package/types/main.d.ts CHANGED
@@ -19,6 +19,8 @@ declare class HamsaApiError extends Error {
19
19
  type HamsaVoiceAgentConfig = {
20
20
  /** Base URL for the Hamsa API. Defaults to 'https://api.tryhamsa.com' */
21
21
  API_URL?: string;
22
+ /** LiveKit RTC WebSocket URL. Defaults to 'wss://rtc.eu.tryhamsa.com' */
23
+ LIVEKIT_URL?: string;
22
24
  };
23
25
  /**
24
26
  * Configuration options for starting a voice agent conversation
@@ -306,6 +308,8 @@ declare class HamsaVoiceAgent extends EventEmitter {
306
308
  apiKey: string;
307
309
  /** Base URL for Hamsa API endpoints */
308
310
  API_URL: string;
311
+ /** LiveKit RTC WebSocket URL */
312
+ LIVEKIT_URL: string;
309
313
  /** Job ID for tracking conversation completion status */
310
314
  jobId: string | null;
311
315
  /** Screen wake lock manager to prevent device sleep during calls */
@@ -318,21 +322,23 @@ declare class HamsaVoiceAgent extends EventEmitter {
318
322
  * @param apiKey - Your Hamsa API key (get from https://dashboard.tryhamsa.com)
319
323
  * @param config - Optional configuration settings
320
324
  * @param config.API_URL - Custom API endpoint URL (defaults to https://api.tryhamsa.com)
325
+ * @param config.LIVEKIT_URL - Custom LiveKit RTC URL (defaults to wss://rtc.eu.tryhamsa.com)
321
326
  *
322
327
  * @example
323
328
  * ```typescript
324
- * // Using default API endpoint
329
+ * // Using default endpoints
325
330
  * const agent = new HamsaVoiceAgent('hamsa_api_key_here');
326
331
  *
327
- * // Using custom API endpoint
332
+ * // Using custom endpoints
328
333
  * const agent = new HamsaVoiceAgent('hamsa_api_key_here', {
329
- * API_URL: 'https://custom-api.example.com'
334
+ * API_URL: 'https://custom-api.example.com',
335
+ * LIVEKIT_URL: 'wss://custom-rtc.example.com'
330
336
  * });
331
337
  * ```
332
338
  *
333
339
  * @throws {Error} If apiKey is not provided or invalid
334
340
  */
335
- constructor(apiKey: string, { API_URL }?: HamsaVoiceAgentConfig);
341
+ constructor(apiKey: string, { API_URL, LIVEKIT_URL, }?: HamsaVoiceAgentConfig);
336
342
  /**
337
343
  * Adjusts the volume level for voice agent audio playback
338
344
  *
@@ -876,6 +882,37 @@ declare class HamsaVoiceAgent extends EventEmitter {
876
882
  * ```
877
883
  */
878
884
  getRoom(): Room | null;
885
+ /**
886
+ * Gets the remote audio track from the voice agent for visualization
887
+ *
888
+ * Provides access to the agent's audio track for use with LiveKit React
889
+ * visualization components like BarVisualizer. Returns undefined if not
890
+ * connected or no remote audio track is available.
891
+ *
892
+ * @returns RemoteTrack | undefined - The agent's audio track or undefined if not available
893
+ *
894
+ * @example With LiveKit BarVisualizer
895
+ * ```typescript
896
+ * import { BarVisualizer } from '@livekit/components-react';
897
+ *
898
+ * function AgentVisualizer({ agent }) {
899
+ * const [audioTrack, setAudioTrack] = useState();
900
+ *
901
+ * useEffect(() => {
902
+ * agent.on('trackSubscribed', ({ track }) => {
903
+ * if (track.kind === 'audio') {
904
+ * setAudioTrack(track);
905
+ * }
906
+ * });
907
+ * }, [agent]);
908
+ *
909
+ * if (!audioTrack) return null;
910
+ *
911
+ * return <BarVisualizer trackRef={{ track: audioTrack, source: 'microphone' }} />;
912
+ * }
913
+ * ```
914
+ */
915
+ getRemoteAudioTrack(): RemoteTrack | undefined;
879
916
  }
880
917
  /**
881
918
  * Declaration merging: Add type-safe event methods to HamsaVoiceAgent
@@ -919,5 +956,6 @@ interface HamsaVoiceAgent {
919
956
  }
920
957
  export { HamsaVoiceAgent, HamsaApiError };
921
958
  export default HamsaVoiceAgent;
959
+ export type { LocalTrack, RemoteParticipant, RemoteTrack, RemoteTrackPublication, Room, } from 'livekit-client';
922
960
  export type { AudioLevelsResult, CallAnalyticsResult, ConnectionStatsResult, ParticipantData, PerformanceMetricsResult, TrackStatsResult, } from './classes/livekit-manager';
923
961
  export type { HamsaVoiceAgentEvents, StartOptions, Tool, JobDetails };