@elevenlabs/client 0.6.0 → 0.6.2

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.
@@ -13,6 +13,9 @@ export declare class WebRTCConnection extends BaseConnection {
13
13
  private audioEventId;
14
14
  private audioCaptureContext;
15
15
  private audioElements;
16
+ private outputDeviceId;
17
+ private outputAnalyser;
18
+ private outputFrequencyData;
16
19
  private constructor();
17
20
  static create(config: ConnectionConfig): Promise<WebRTCConnection>;
18
21
  private setupRoomEventListeners;
@@ -22,4 +25,7 @@ export declare class WebRTCConnection extends BaseConnection {
22
25
  setMicMuted(isMuted: boolean): Promise<void>;
23
26
  private setupAudioCapture;
24
27
  setAudioVolume(volume: number): void;
28
+ setAudioOutputDevice(deviceId: string): Promise<void>;
29
+ setAudioInputDevice(deviceId: string): Promise<void>;
30
+ getOutputByteFrequencyData(): Uint8Array<ArrayBuffer> | null;
25
31
  }
@@ -61,7 +61,42 @@ export type VadScoreEvent = {
61
61
  vad_score: number;
62
62
  };
63
63
  };
64
- export type IncomingSocketEvent = UserTranscriptionEvent | AgentResponseEvent | AgentAudioEvent | InterruptionEvent | InternalTentativeAgentResponseEvent | ConfigEvent | PingEvent | ClientToolCallEvent | VadScoreEvent;
64
+ interface BaseMCPToolCallClientEventData {
65
+ service_id: string;
66
+ tool_call_id: string;
67
+ tool_name: string;
68
+ tool_description?: string;
69
+ parameters: Record<string, any>;
70
+ timestamp: string;
71
+ }
72
+ interface MCPToolCallClientEventLoadingData extends BaseMCPToolCallClientEventData {
73
+ state: "loading";
74
+ }
75
+ interface MCPToolCallClientEventAwaitingApprovalData extends BaseMCPToolCallClientEventData {
76
+ state: "awaiting_approval";
77
+ approval_timeout_secs: number;
78
+ }
79
+ interface MCPToolCallClientEventSuccessData extends BaseMCPToolCallClientEventData {
80
+ state: "success";
81
+ result: any[];
82
+ }
83
+ interface MCPToolCallClientEventFailureData extends BaseMCPToolCallClientEventData {
84
+ state: "failure";
85
+ error_message: string;
86
+ }
87
+ type MCPToolCallClientEventData = MCPToolCallClientEventLoadingData | MCPToolCallClientEventAwaitingApprovalData | MCPToolCallClientEventSuccessData | MCPToolCallClientEventFailureData;
88
+ export type MCPToolCallClientEvent = {
89
+ type: "mcp_tool_call";
90
+ mcp_tool_call: MCPToolCallClientEventData;
91
+ };
92
+ export type AgentResponseCorrectionEvent = {
93
+ type: "agent_response_correction";
94
+ agent_response_correction_event: {
95
+ original_agent_response: string;
96
+ corrected_agent_response: string;
97
+ };
98
+ };
99
+ export type IncomingSocketEvent = UserTranscriptionEvent | AgentResponseEvent | AgentResponseCorrectionEvent | AgentAudioEvent | InterruptionEvent | InternalTentativeAgentResponseEvent | ConfigEvent | PingEvent | ClientToolCallEvent | VadScoreEvent | MCPToolCallClientEvent;
65
100
  export type PongEvent = {
66
101
  type: "pong";
67
102
  event_id: number;
@@ -123,3 +158,4 @@ export type MCPToolApprovalResultEvent = {
123
158
  };
124
159
  export type OutgoingSocketEvent = PongEvent | UserAudioEvent | InitiationClientDataEvent | UserFeedbackEvent | ClientToolResultEvent | ContextualUpdateEvent | UserMessageEvent | UserActivityEvent | MCPToolApprovalResultEvent;
125
160
  export declare function isValidSocketEvent(event: any): event is IncomingSocketEvent;
161
+ export {};
@@ -7,9 +7,11 @@ export declare class Input {
7
7
  readonly context: AudioContext;
8
8
  readonly analyser: AnalyserNode;
9
9
  readonly worklet: AudioWorkletNode;
10
- readonly inputStream: MediaStream;
10
+ inputStream: MediaStream;
11
+ private mediaStreamSource;
11
12
  static create({ sampleRate, format, preferHeadphonesForIosDevices, inputDeviceId, }: FormatConfig & InputConfig): Promise<Input>;
12
13
  private constructor();
13
14
  close(): Promise<void>;
14
15
  setMuted(isMuted: boolean): void;
16
+ setInputDevice(inputDeviceId: string): Promise<void>;
15
17
  }
@@ -4,9 +4,9 @@ export declare class Output {
4
4
  readonly analyser: AnalyserNode;
5
5
  readonly gain: GainNode;
6
6
  readonly worklet: AudioWorkletNode;
7
- readonly audioElement: HTMLAudioElement | null;
8
- readonly audioSource: MediaElementAudioSourceNode | null;
7
+ readonly audioElement: HTMLAudioElement;
9
8
  static create({ sampleRate, format, outputDeviceId, }: FormatConfig): Promise<Output>;
10
9
  private constructor();
10
+ setOutputDevice(deviceId: string): Promise<void>;
11
11
  close(): Promise<void>;
12
12
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "0.6.0";
1
+ export declare const PACKAGE_VERSION = "0.6.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevenlabs/client",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "ElevenLabs JavaScript Client Library",
5
5
  "main": "./dist/lib.umd.js",
6
6
  "module": "./dist/lib.module.js",