@elevenlabs/react-native 0.3.0 → 0.3.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.
package/src/types.ts CHANGED
@@ -1,51 +1,33 @@
1
+ import type * as Types from "@elevenlabs/types";
2
+ import type {
3
+ Incoming,
4
+ Outgoing,
5
+ Interruption,
6
+ ConversationMetadata,
7
+ Ping,
8
+ Role as MessageRole,
9
+ Mode as ConversationMode,
10
+ Status,
11
+ Callbacks,
12
+ } from "@elevenlabs/types";
13
+ export type { Callbacks } from "@elevenlabs/types";
14
+
1
15
  /**
2
16
  * Role in the conversation
3
17
  */
4
- export type Role = "user" | "ai";
18
+ export type Role = MessageRole;
5
19
 
6
20
  /**
7
21
  * Current mode of the conversation
8
22
  */
9
- export type Mode = "speaking" | "listening";
23
+ export type Mode = ConversationMode;
10
24
 
11
- export type ConversationStatus = "disconnected" | "connecting" | "connected";
25
+ export type ConversationStatus = Status;
12
26
 
13
27
  /**
14
28
  * Language support
15
29
  */
16
- export type Language =
17
- | "en"
18
- | "ja"
19
- | "zh"
20
- | "de"
21
- | "hi"
22
- | "fr"
23
- | "ko"
24
- | "pt"
25
- | "pt-br"
26
- | "it"
27
- | "es"
28
- | "id"
29
- | "nl"
30
- | "tr"
31
- | "pl"
32
- | "sv"
33
- | "bg"
34
- | "ro"
35
- | "ar"
36
- | "cs"
37
- | "el"
38
- | "fi"
39
- | "ms"
40
- | "da"
41
- | "ta"
42
- | "uk"
43
- | "ru"
44
- | "hu"
45
- | "hr"
46
- | "sk"
47
- | "no"
48
- | "vi";
30
+ export type Language = Types.ConversationConfigOverrideAgentLanguage;
49
31
 
50
32
  /**
51
33
  * Client tools configuration
@@ -73,22 +55,6 @@ export type ConversationOptions = {
73
55
  >;
74
56
  } & Partial<Callbacks>;
75
57
 
76
- /**
77
- * Callbacks configuration
78
- */
79
- export type Callbacks = {
80
- onConnect?: (props: { conversationId: string }) => void;
81
- // internal debug events, not to be used
82
- onDebug?: (props: unknown) => void;
83
- onDisconnect?: (details: string) => void;
84
- onError?: (message: string, context?: Record<string, unknown>) => void;
85
- onMessage?: (props: { message: ConversationEvent; source: Role }) => void;
86
- onModeChange?: (prop: { mode: Mode }) => void;
87
- onStatusChange?: (prop: { status: ConversationStatus }) => void;
88
- onCanSendFeedbackChange?: (prop: { canSendFeedback: boolean }) => void;
89
- onUnhandledClientToolCall?: (params: ClientToolCallEvent) => void;
90
- };
91
-
92
58
  export type ConversationConfig = {
93
59
  agentId?: string;
94
60
  conversationToken?: string;
@@ -117,139 +83,35 @@ export type ConversationConfig = {
117
83
  userId?: string;
118
84
  };
119
85
 
120
- export type UserTranscriptionEvent = {
121
- type: "user_transcript";
122
- user_transcription_event: { user_transcript: string };
123
- };
124
-
125
- export type AgentResponseEvent = {
126
- type: "agent_response";
127
- agent_response_event: { agent_response: string };
128
- };
129
-
130
- export type AgentResponseCorrectionEvent = {
131
- type: "agent_response_correction";
132
- agent_response_correction_event: {
133
- original_agent_response: string;
134
- corrected_agent_response: string;
135
- };
136
- };
137
- export type AgentAudioEvent = {
138
- type: "audio";
139
- audio_event: {
140
- audio_base_64: string;
141
- event_id: number;
142
- };
143
- };
144
-
145
- export type InterruptionEvent = {
146
- type: "interruption";
147
- interruption_event: {
148
- event_id: number;
149
- };
150
- };
151
-
152
- export type InternalTentativeAgentResponseEvent = {
153
- type: "internal_tentative_agent_response";
154
- tentative_agent_response_internal_event: {
155
- tentative_agent_response: string;
156
- };
157
- };
158
-
159
- export type ConfigEvent = {
160
- type: "conversation_initiation_metadata";
161
- conversation_initiation_metadata_event: {
162
- conversation_id: string;
163
- agent_output_audio_format: string;
164
- user_input_audio_format?: string;
165
- };
166
- };
167
-
168
- export type PingEvent = {
169
- type: "ping";
170
- ping_event: {
171
- event_id: number;
172
- ping_ms?: number;
173
- };
174
- };
175
-
176
- export type ClientToolCallEvent = {
177
- type: "client_tool_call";
178
- client_tool_call: {
179
- tool_name: string;
180
- tool_call_id: string;
181
- parameters: any;
182
- expects_response: boolean;
183
- };
184
- };
185
-
186
- export type PongEvent = {
187
- type: "pong";
188
- event_id: number;
189
- };
190
-
191
- export type UserAudioEvent = {
192
- user_audio_chunk: string;
193
- };
194
-
195
- export type UserFeedbackEvent = {
196
- type: "feedback";
197
- score: "like" | "dislike";
198
- event_id: number;
199
- };
200
-
201
- export type ClientToolResultEvent = {
202
- type: "client_tool_result";
203
- tool_call_id: string;
204
- result: any;
205
- is_error: boolean;
206
- };
207
-
208
- export type ContextualUpdateEvent = {
209
- type: "contextual_update";
210
- text: string;
211
- };
212
-
213
- export type UserMessageEvent = {
214
- type: "user_message";
215
- text: string;
216
- };
217
-
218
- export type UserActivityEvent = {
219
- type: "user_activity";
220
- };
221
-
222
- export type MCPToolApprovalResultEvent = {
223
- type: "mcp_tool_approval_result";
224
- tool_call_id: string;
225
- is_approved: boolean;
226
- };
227
-
228
- export type InitiationClientDataEvent = {
229
- type: "conversation_initiation_client_data";
230
- conversation_config_override?: {
231
- agent?: {
232
- prompt?: {
233
- prompt?: string;
234
- };
235
- first_message?: string;
236
- language?: Language;
237
- };
238
- tts?: {
239
- voice_id?: string;
240
- };
241
- conversation?: {
242
- text_only?: boolean;
243
- };
244
- source_info?: {
245
- source?: string | null;
246
- version?: string | null;
247
- };
248
- };
249
- custom_llm_extra_body?: unknown;
250
- dynamic_variables?: Record<string, string | number | boolean>;
251
- user_id?: string;
252
- };
86
+ // Incoming event types
87
+ export type UserTranscriptionEvent = Incoming.UserTranscriptionClientEvent;
88
+ export type AgentResponseEvent = Incoming.AgentResponseClientEvent;
89
+ export type AgentResponseCorrectionEvent =
90
+ Incoming.AgentResponseCorrectionClientEvent;
91
+ export type AgentAudioEvent = Incoming.AudioClientEvent;
92
+ export type InterruptionEvent = Interruption;
93
+ export type InternalTentativeAgentResponseEvent =
94
+ Incoming.TentativeAgentResponseInternalClientEvent;
95
+ export type ConfigEvent = ConversationMetadata;
96
+ export type PingEvent = Ping;
97
+ export type ClientToolCallEvent = Incoming.ClientToolCallClientEvent;
98
+ export type VadScoreEvent = Incoming.VadScoreClientEvent;
99
+ export type MCPToolCallClientEvent = Incoming.McpToolCallClientEvent;
100
+
101
+ // Outgoing event types
102
+ export type PongEvent = Outgoing.PongClientToOrchestratorEvent;
103
+ export type UserAudioEvent = Outgoing.UserAudio;
104
+ export type UserFeedbackEvent = Outgoing.UserFeedbackClientToOrchestratorEvent;
105
+ export type ClientToolResultEvent =
106
+ Outgoing.ClientToolResultClientToOrchestratorEvent;
107
+ export type ContextualUpdateEvent =
108
+ Outgoing.ContextualUpdateClientToOrchestratorEvent;
109
+ export type UserMessageEvent = Outgoing.UserMessageClientToOrchestratorEvent;
110
+ export type UserActivityEvent = Outgoing.UserActivityClientToOrchestratorEvent;
111
+ export type MCPToolApprovalResultEvent =
112
+ Outgoing.McpToolApprovalResultClientToOrchestratorEvent;
113
+ export type InitiationClientDataEvent =
114
+ Outgoing.ConversationInitiationClientToOrchestratorEvent;
253
115
 
254
116
  export type ConversationEvent =
255
117
  | UserTranscriptionEvent
@@ -260,4 +122,6 @@ export type ConversationEvent =
260
122
  | InternalTentativeAgentResponseEvent
261
123
  | ConfigEvent
262
124
  | PingEvent
263
- | ClientToolCallEvent;
125
+ | ClientToolCallEvent
126
+ | VadScoreEvent
127
+ | MCPToolCallClientEvent;
@@ -21,13 +21,14 @@ export function constructOverrides(
21
21
  conversation: {
22
22
  text_only: config.overrides.conversation?.textOnly,
23
23
  },
24
- source_info: {
25
- source: "react_native_sdk",
26
- version: config.overrides?.client?.version || PACKAGE_VERSION,
27
- },
28
24
  };
29
25
  }
30
26
 
27
+ overridesEvent.source_info = {
28
+ source: "react_native_sdk",
29
+ version: config.overrides?.client?.version || PACKAGE_VERSION,
30
+ };
31
+
31
32
  if (config.customLlmExtraBody) {
32
33
  overridesEvent.custom_llm_extra_body = config.customLlmExtraBody;
33
34
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // This file is auto-generated during build
2
- export const PACKAGE_VERSION = "0.3.0";
2
+ export const PACKAGE_VERSION = "0.3.2";