elevenlabs-voice-agent-mcp 1.0.14 → 1.1.0

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.
Files changed (158) hide show
  1. package/README.md +202 -23
  2. package/dist/__tests__/mocks/fixtures.d.ts +136 -0
  3. package/dist/__tests__/mocks/fixtures.d.ts.map +1 -0
  4. package/dist/__tests__/mocks/fixtures.js +393 -0
  5. package/dist/__tests__/mocks/fixtures.js.map +1 -0
  6. package/dist/__tests__/schemas/schemas.test.d.ts +7 -0
  7. package/dist/__tests__/schemas/schemas.test.d.ts.map +1 -0
  8. package/dist/__tests__/schemas/schemas.test.js +537 -0
  9. package/dist/__tests__/schemas/schemas.test.js.map +1 -0
  10. package/dist/__tests__/services/elevenlabs-api.test.d.ts +7 -0
  11. package/dist/__tests__/services/elevenlabs-api.test.d.ts.map +1 -0
  12. package/dist/__tests__/services/elevenlabs-api.test.js +272 -0
  13. package/dist/__tests__/services/elevenlabs-api.test.js.map +1 -0
  14. package/dist/__tests__/services/formatters.test.d.ts +7 -0
  15. package/dist/__tests__/services/formatters.test.d.ts.map +1 -0
  16. package/dist/__tests__/services/formatters.test.js +387 -0
  17. package/dist/__tests__/services/formatters.test.js.map +1 -0
  18. package/dist/__tests__/setup.d.ts +7 -0
  19. package/dist/__tests__/setup.d.ts.map +1 -0
  20. package/dist/__tests__/setup.js +25 -0
  21. package/dist/__tests__/setup.js.map +1 -0
  22. package/dist/__tests__/tools/agent-tools.test.d.ts +7 -0
  23. package/dist/__tests__/tools/agent-tools.test.d.ts.map +1 -0
  24. package/dist/__tests__/tools/agent-tools.test.js +343 -0
  25. package/dist/__tests__/tools/agent-tools.test.js.map +1 -0
  26. package/dist/__tests__/tools/batch-calling-tools.test.d.ts +7 -0
  27. package/dist/__tests__/tools/batch-calling-tools.test.d.ts.map +1 -0
  28. package/dist/__tests__/tools/batch-calling-tools.test.js +236 -0
  29. package/dist/__tests__/tools/batch-calling-tools.test.js.map +1 -0
  30. package/dist/__tests__/tools/conversation-tools.test.d.ts +7 -0
  31. package/dist/__tests__/tools/conversation-tools.test.d.ts.map +1 -0
  32. package/dist/__tests__/tools/conversation-tools.test.js +212 -0
  33. package/dist/__tests__/tools/conversation-tools.test.js.map +1 -0
  34. package/dist/__tests__/tools/knowledge-tools.test.d.ts +7 -0
  35. package/dist/__tests__/tools/knowledge-tools.test.d.ts.map +1 -0
  36. package/dist/__tests__/tools/knowledge-tools.test.js +209 -0
  37. package/dist/__tests__/tools/knowledge-tools.test.js.map +1 -0
  38. package/dist/__tests__/tools/outbound-tools.test.d.ts +7 -0
  39. package/dist/__tests__/tools/outbound-tools.test.d.ts.map +1 -0
  40. package/dist/__tests__/tools/outbound-tools.test.js +194 -0
  41. package/dist/__tests__/tools/outbound-tools.test.js.map +1 -0
  42. package/dist/__tests__/tools/phone-number-tools.test.d.ts +7 -0
  43. package/dist/__tests__/tools/phone-number-tools.test.d.ts.map +1 -0
  44. package/dist/__tests__/tools/phone-number-tools.test.js +314 -0
  45. package/dist/__tests__/tools/phone-number-tools.test.js.map +1 -0
  46. package/dist/__tests__/tools/tool-tools.test.d.ts +7 -0
  47. package/dist/__tests__/tools/tool-tools.test.d.ts.map +1 -0
  48. package/dist/__tests__/tools/tool-tools.test.js +287 -0
  49. package/dist/__tests__/tools/tool-tools.test.js.map +1 -0
  50. package/dist/__tests__/tools/utility-tools.test.d.ts +7 -0
  51. package/dist/__tests__/tools/utility-tools.test.d.ts.map +1 -0
  52. package/dist/__tests__/tools/utility-tools.test.js +207 -0
  53. package/dist/__tests__/tools/utility-tools.test.js.map +1 -0
  54. package/dist/__tests__/utils/error-handlers.test.d.ts +7 -0
  55. package/dist/__tests__/utils/error-handlers.test.d.ts.map +1 -0
  56. package/dist/__tests__/utils/error-handlers.test.js +237 -0
  57. package/dist/__tests__/utils/error-handlers.test.js.map +1 -0
  58. package/dist/__tests__/utils/phone-normalizer.test.d.ts +7 -0
  59. package/dist/__tests__/utils/phone-normalizer.test.d.ts.map +1 -0
  60. package/dist/__tests__/utils/phone-normalizer.test.js +224 -0
  61. package/dist/__tests__/utils/phone-normalizer.test.js.map +1 -0
  62. package/dist/__tests__/utils/truncation.test.d.ts +7 -0
  63. package/dist/__tests__/utils/truncation.test.d.ts.map +1 -0
  64. package/dist/__tests__/utils/truncation.test.js +208 -0
  65. package/dist/__tests__/utils/truncation.test.js.map +1 -0
  66. package/dist/constants.d.ts +129 -5
  67. package/dist/constants.d.ts.map +1 -1
  68. package/dist/constants.js +150 -24
  69. package/dist/constants.js.map +1 -1
  70. package/dist/index.d.ts +13 -2
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +27 -3
  73. package/dist/index.js.map +1 -1
  74. package/dist/schemas/agent-schemas.d.ts +23 -8
  75. package/dist/schemas/agent-schemas.d.ts.map +1 -1
  76. package/dist/schemas/agent-schemas.js +23 -8
  77. package/dist/schemas/agent-schemas.js.map +1 -1
  78. package/dist/schemas/batch-calling-schemas.d.ts +24 -9
  79. package/dist/schemas/batch-calling-schemas.d.ts.map +1 -1
  80. package/dist/schemas/batch-calling-schemas.js +24 -9
  81. package/dist/schemas/batch-calling-schemas.js.map +1 -1
  82. package/dist/schemas/common-schemas.d.ts +45 -13
  83. package/dist/schemas/common-schemas.d.ts.map +1 -1
  84. package/dist/schemas/common-schemas.js +45 -13
  85. package/dist/schemas/common-schemas.js.map +1 -1
  86. package/dist/schemas/conversation-schemas.d.ts +12 -5
  87. package/dist/schemas/conversation-schemas.d.ts.map +1 -1
  88. package/dist/schemas/conversation-schemas.js +12 -5
  89. package/dist/schemas/conversation-schemas.js.map +1 -1
  90. package/dist/schemas/outbound-schemas.d.ts +23 -8
  91. package/dist/schemas/outbound-schemas.d.ts.map +1 -1
  92. package/dist/schemas/outbound-schemas.js +23 -8
  93. package/dist/schemas/outbound-schemas.js.map +1 -1
  94. package/dist/schemas/phone-number-schemas.d.ts +37 -14
  95. package/dist/schemas/phone-number-schemas.d.ts.map +1 -1
  96. package/dist/schemas/phone-number-schemas.js +37 -14
  97. package/dist/schemas/phone-number-schemas.js.map +1 -1
  98. package/dist/schemas/tool-schemas.d.ts +27 -9
  99. package/dist/schemas/tool-schemas.d.ts.map +1 -1
  100. package/dist/schemas/tool-schemas.js +34 -11
  101. package/dist/schemas/tool-schemas.js.map +1 -1
  102. package/dist/services/elevenlabs-api.d.ts +108 -14
  103. package/dist/services/elevenlabs-api.d.ts.map +1 -1
  104. package/dist/services/elevenlabs-api.js +108 -14
  105. package/dist/services/elevenlabs-api.js.map +1 -1
  106. package/dist/services/formatters.d.ts +147 -21
  107. package/dist/services/formatters.d.ts.map +1 -1
  108. package/dist/services/formatters.js +147 -21
  109. package/dist/services/formatters.js.map +1 -1
  110. package/dist/tools/agent-tools.d.ts +5 -3
  111. package/dist/tools/agent-tools.d.ts.map +1 -1
  112. package/dist/tools/agent-tools.js +5 -3
  113. package/dist/tools/agent-tools.js.map +1 -1
  114. package/dist/tools/batch-calling-tools.d.ts +5 -3
  115. package/dist/tools/batch-calling-tools.d.ts.map +1 -1
  116. package/dist/tools/batch-calling-tools.js +5 -3
  117. package/dist/tools/batch-calling-tools.js.map +1 -1
  118. package/dist/tools/conversation-tools.d.ts +5 -3
  119. package/dist/tools/conversation-tools.d.ts.map +1 -1
  120. package/dist/tools/conversation-tools.js +5 -3
  121. package/dist/tools/conversation-tools.js.map +1 -1
  122. package/dist/tools/knowledge-tools.d.ts +5 -3
  123. package/dist/tools/knowledge-tools.d.ts.map +1 -1
  124. package/dist/tools/knowledge-tools.js +5 -3
  125. package/dist/tools/knowledge-tools.js.map +1 -1
  126. package/dist/tools/outbound-tools.d.ts +5 -3
  127. package/dist/tools/outbound-tools.d.ts.map +1 -1
  128. package/dist/tools/outbound-tools.js +5 -3
  129. package/dist/tools/outbound-tools.js.map +1 -1
  130. package/dist/tools/phone-number-tools.d.ts +5 -4
  131. package/dist/tools/phone-number-tools.d.ts.map +1 -1
  132. package/dist/tools/phone-number-tools.js +5 -4
  133. package/dist/tools/phone-number-tools.js.map +1 -1
  134. package/dist/tools/tool-tools.d.ts +5 -3
  135. package/dist/tools/tool-tools.d.ts.map +1 -1
  136. package/dist/tools/tool-tools.js +5 -3
  137. package/dist/tools/tool-tools.js.map +1 -1
  138. package/dist/tools/utility-tools.d.ts +5 -3
  139. package/dist/tools/utility-tools.d.ts.map +1 -1
  140. package/dist/tools/utility-tools.js +5 -3
  141. package/dist/tools/utility-tools.js.map +1 -1
  142. package/dist/types.d.ts +457 -10
  143. package/dist/types.d.ts.map +1 -1
  144. package/dist/types.js +15 -3
  145. package/dist/types.js.map +1 -1
  146. package/dist/utils/error-handlers.d.ts +47 -14
  147. package/dist/utils/error-handlers.d.ts.map +1 -1
  148. package/dist/utils/error-handlers.js +47 -14
  149. package/dist/utils/error-handlers.js.map +1 -1
  150. package/dist/utils/phone-normalizer.d.ts +43 -22
  151. package/dist/utils/phone-normalizer.d.ts.map +1 -1
  152. package/dist/utils/phone-normalizer.js +43 -22
  153. package/dist/utils/phone-normalizer.js.map +1 -1
  154. package/dist/utils/truncation.d.ts +46 -22
  155. package/dist/utils/truncation.d.ts.map +1 -1
  156. package/dist/utils/truncation.js +46 -22
  157. package/dist/utils/truncation.js.map +1 -1
  158. package/package.json +10 -4
package/dist/types.d.ts CHANGED
@@ -1,162 +1,470 @@
1
1
  /**
2
- * TypeScript type definitions for ElevenLabs Voice Agent API
3
- *
4
- * Defines interfaces for agents, conversations, tools, and API responses.
2
+ * @fileoverview TypeScript type definitions for ElevenLabs Voice Agent API
3
+ * @description Defines interfaces for agents, conversations, tools, and API responses.
4
+ * These types provide type safety and documentation for all API interactions.
5
+ * @module types
5
6
  */
6
7
  import { SUPPORTED_VOICE_MODELS, SUPPORTED_LANGUAGES, AUTH_TYPES } from "./constants.js";
8
+ /**
9
+ * Output format options for MCP tool responses.
10
+ * @description Controls how tool responses are formatted:
11
+ * - `MARKDOWN`: Human-readable formatted output with headers and lists
12
+ * - `JSON`: Structured data suitable for programmatic consumption
13
+ * @enum {string}
14
+ */
7
15
  export declare enum ResponseFormat {
16
+ /** Human-readable Markdown format */
8
17
  MARKDOWN = "markdown",
18
+ /** Structured JSON format */
9
19
  JSON = "json"
10
20
  }
21
+ /**
22
+ * LLM model identifier type.
23
+ * @description Accepts any string to accommodate new models that ElevenLabs
24
+ * may add without requiring code updates. Common values include Claude and GPT models.
25
+ * @typedef {string} LLMModel
26
+ * @example "claude-sonnet-4-5@20250929"
27
+ * @example "gpt-4o-mini"
28
+ */
11
29
  export type LLMModel = string;
30
+ /**
31
+ * Voice synthesis model type.
32
+ * @description One of the supported ElevenLabs voice models for TTS.
33
+ * @typedef {string} VoiceModel
34
+ */
12
35
  export type VoiceModel = typeof SUPPORTED_VOICE_MODELS[number];
36
+ /**
37
+ * Supported language code type.
38
+ * @description ISO 639-1 language codes supported by the platform.
39
+ * @typedef {string} Language
40
+ */
13
41
  export type Language = typeof SUPPORTED_LANGUAGES[number];
42
+ /**
43
+ * Widget authentication type.
44
+ * @description Controls authentication behavior for embedded widgets.
45
+ * @typedef {string} AuthType
46
+ */
14
47
  export type AuthType = typeof AUTH_TYPES[number];
48
+ /**
49
+ * Agent prompt and LLM configuration.
50
+ * @description Defines the system prompt and language model settings for an agent's
51
+ * conversational behavior.
52
+ * @interface AgentPromptConfig
53
+ */
15
54
  export interface AgentPromptConfig {
55
+ /**
56
+ * System prompt defining the agent's behavior and personality.
57
+ * @description This prompt sets the context for all agent responses.
58
+ */
16
59
  prompt: string;
60
+ /**
61
+ * The LLM model identifier to use for generating responses.
62
+ * @example "claude-sonnet-4-5@20250929"
63
+ */
17
64
  llm: LLMModel;
65
+ /**
66
+ * LLM temperature for response randomness.
67
+ * @description Range 0-2. Higher values produce more creative/random responses.
68
+ */
18
69
  temperature?: number;
70
+ /**
71
+ * Maximum tokens for LLM responses.
72
+ * @description Limits the length of generated responses (1-4096).
73
+ */
19
74
  max_tokens?: number;
75
+ /**
76
+ * Webhook tools the agent can invoke during conversations.
77
+ */
20
78
  tools?: ToolConfig[];
79
+ /**
80
+ * Knowledge base document references.
81
+ * @description IDs of documents added to the agent's knowledge base.
82
+ */
21
83
  knowledge_base?: string[];
22
84
  }
85
+ /**
86
+ * Text-to-speech configuration.
87
+ * @description Controls voice synthesis settings for agent responses.
88
+ * @interface TTSConfig
89
+ */
23
90
  export interface TTSConfig {
91
+ /**
92
+ * ElevenLabs voice ID for speech synthesis.
93
+ * @example "21m00Tcm4TlvDq8ikWAM"
94
+ */
24
95
  voice_id: string;
96
+ /**
97
+ * Voice model to use for synthesis.
98
+ * @example "eleven_turbo_v2_5"
99
+ */
25
100
  model_id: VoiceModel;
101
+ /**
102
+ * Latency optimization level for streaming.
103
+ * @description Higher values reduce latency but may affect quality.
104
+ */
26
105
  optimize_streaming_latency?: number;
106
+ /**
107
+ * Voice stability setting.
108
+ * @description Range 0-1. Higher values produce more consistent voice output.
109
+ */
27
110
  stability?: number;
111
+ /**
112
+ * Voice similarity boost.
113
+ * @description Range 0-1. Higher values make output closer to the original voice.
114
+ */
28
115
  similarity_boost?: number;
116
+ /**
117
+ * Speech rate multiplier.
118
+ * @description Range 0.5-2.0. Default is 1.0 (normal speed).
119
+ */
29
120
  speed?: number;
30
121
  }
31
122
  /**
32
- * Turn-taking configuration for voice agent conversations
123
+ * Turn-taking configuration for voice agent conversations.
124
+ * @description Controls how the agent manages conversational flow and timing.
125
+ * @interface TurnConfig
33
126
  */
34
127
  export interface TurnConfig {
35
- /** Controls how quickly the agent interrupts or waits for user pauses */
128
+ /**
129
+ * Controls how quickly the agent interrupts or waits for user pauses.
130
+ * @description
131
+ * - `patient`: Waits longer before responding
132
+ * - `normal`: Balanced turn-taking
133
+ * - `eager`: Responds quickly to user pauses
134
+ */
36
135
  turn_eagerness?: 'patient' | 'normal' | 'eager';
37
- /** Maximum seconds to wait for user to continue speaking before agent responds (1-30) */
136
+ /**
137
+ * Maximum seconds to wait for user to continue speaking before agent responds.
138
+ * @description Range 1-30 seconds. Default is 10 seconds.
139
+ */
38
140
  turn_timeout?: number;
39
- /** Seconds of complete silence before automatically ending the call (1-600) */
141
+ /**
142
+ * Seconds of complete silence before automatically ending the call.
143
+ * @description Range 1-600 seconds. Default is 15 seconds.
144
+ */
40
145
  silence_end_call_timeout?: number;
41
146
  }
147
+ /**
148
+ * Automatic speech recognition configuration.
149
+ * @description Controls how the agent processes user audio input.
150
+ * @interface ASRConfig
151
+ */
42
152
  export interface ASRConfig {
153
+ /**
154
+ * Recognition quality level.
155
+ * @description Higher quality may increase latency.
156
+ */
43
157
  quality?: "low" | "medium" | "high";
158
+ /**
159
+ * Audio format for user input.
160
+ * @description PCM format with sample rate specification.
161
+ */
44
162
  user_input_audio_format?: "pcm_16000" | "pcm_22050" | "pcm_44100";
45
163
  }
164
+ /**
165
+ * Complete conversation configuration for an agent.
166
+ * @description Combines all settings that control how an agent conducts conversations.
167
+ * @interface ConversationConfig
168
+ */
46
169
  export interface ConversationConfig {
170
+ /**
171
+ * Agent behavior and prompt configuration.
172
+ */
47
173
  agent: {
174
+ /** LLM and prompt settings */
48
175
  prompt: AgentPromptConfig;
176
+ /** Optional greeting message spoken first */
49
177
  first_message?: string;
178
+ /** Primary language for the conversation */
50
179
  language: Language;
51
180
  };
181
+ /** Text-to-speech configuration */
52
182
  tts: TTSConfig;
183
+ /** Automatic speech recognition configuration */
53
184
  asr?: ASRConfig;
185
+ /** Turn-taking behavior configuration */
54
186
  turn?: TurnConfig;
55
187
  }
188
+ /**
189
+ * Platform-specific settings for the agent.
190
+ * @description Configures widget appearance and authentication behavior.
191
+ * @interface PlatformSettings
192
+ */
56
193
  export interface PlatformSettings {
194
+ /**
195
+ * Widget appearance settings.
196
+ */
57
197
  widget?: {
198
+ /** Widget theme color in hex format (e.g., "#FF5733") */
58
199
  color?: string;
200
+ /** URL to avatar image for the widget */
59
201
  avatar_url?: string;
60
202
  };
203
+ /**
204
+ * Authentication settings.
205
+ */
61
206
  auth?: {
207
+ /** Authentication type for widget access */
62
208
  type: AuthType;
209
+ /** Whether open authentication is allowed */
63
210
  open_auth_allowed?: boolean;
64
211
  };
65
212
  }
213
+ /**
214
+ * Complete voice agent entity.
215
+ * @description Represents a fully configured ElevenLabs Voice Agent with all its settings.
216
+ * @interface Agent
217
+ * @example
218
+ * const agent: Agent = {
219
+ * agent_id: "ag_abc123",
220
+ * name: "Customer Support Bot",
221
+ * conversation_config: { ... },
222
+ * created_at: "2025-01-01T00:00:00Z"
223
+ * };
224
+ */
66
225
  export interface Agent {
226
+ /** Unique agent identifier (e.g., "ag_abc123") */
67
227
  agent_id: string;
228
+ /** Display name for the agent */
68
229
  name: string;
230
+ /** Complete conversation configuration */
69
231
  conversation_config: ConversationConfig;
232
+ /** Platform-specific settings */
70
233
  platform_settings?: PlatformSettings;
234
+ /** ISO 8601 timestamp when the agent was created */
71
235
  created_at: string;
236
+ /** ISO 8601 timestamp when the agent was last updated */
72
237
  updated_at?: string;
73
238
  }
239
+ /**
240
+ * Parameter definition for webhook tools.
241
+ * @description Defines a single parameter that a webhook tool accepts.
242
+ * @interface ToolParameter
243
+ */
74
244
  export interface ToolParameter {
245
+ /** Parameter name (used as the key in the request) */
75
246
  name: string;
247
+ /** Data type of the parameter */
76
248
  type: "string" | "number" | "boolean" | "object" | "array";
249
+ /** Human-readable description of what this parameter does */
77
250
  description: string;
251
+ /** Whether this parameter must be provided */
78
252
  required: boolean;
253
+ /** Optional array of allowed values (for enumerated types) */
79
254
  enum?: string[];
80
255
  }
256
+ /**
257
+ * Webhook tool configuration.
258
+ * @description Defines an external tool that the agent can invoke during conversations.
259
+ * @interface ToolConfig
260
+ * @example
261
+ * const tool: ToolConfig = {
262
+ * name: "check_order_status",
263
+ * description: "Look up order status by order ID",
264
+ * type: "webhook",
265
+ * url: "https://api.example.com/orders/status",
266
+ * method: "POST",
267
+ * parameters: [{ name: "order_id", type: "string", required: true, description: "Order ID" }]
268
+ * };
269
+ */
81
270
  export interface ToolConfig {
271
+ /** Unique tool name (alphanumeric, hyphens, underscores) */
82
272
  name: string;
273
+ /** Clear description of what the tool does */
83
274
  description: string;
275
+ /** Tool type - webhook for external HTTP calls, client for browser-side */
84
276
  type: "webhook" | "client";
277
+ /** Webhook URL to call when tool is invoked */
85
278
  url?: string;
279
+ /** HTTP method for the webhook request */
86
280
  method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
281
+ /** Custom headers to include in webhook requests */
87
282
  headers?: Record<string, string>;
283
+ /** Array of parameters the tool accepts */
88
284
  parameters: ToolParameter[];
89
285
  }
286
+ /**
287
+ * Conversation metadata and content.
288
+ * @description Contains all information about a voice agent conversation including
289
+ * transcript, timing, and analysis data.
290
+ * @interface ConversationMetadata
291
+ */
90
292
  export interface ConversationMetadata {
293
+ /** Unique conversation identifier (e.g., "conv_xyz789") */
91
294
  conversation_id: string;
295
+ /** ID of the agent that handled this conversation */
92
296
  agent_id: string;
297
+ /** Current status of the conversation */
93
298
  status: "in_progress" | "completed" | "failed";
299
+ /** ISO 8601 timestamp when the conversation started */
94
300
  started_at: string;
301
+ /** ISO 8601 timestamp when the conversation ended */
95
302
  ended_at?: string;
303
+ /** Total duration of the conversation in seconds */
96
304
  duration_seconds?: number;
305
+ /** Complete conversation transcript */
97
306
  transcript?: TranscriptEntry[];
307
+ /** AI-generated analysis of the conversation */
98
308
  analysis?: ConversationAnalysis;
99
309
  }
310
+ /**
311
+ * Single entry in a conversation transcript.
312
+ * @description Represents one message in the conversation flow.
313
+ * @interface TranscriptEntry
314
+ */
100
315
  export interface TranscriptEntry {
316
+ /** Who sent this message */
101
317
  role: "agent" | "user";
318
+ /** The message content */
102
319
  message: string;
320
+ /** ISO 8601 timestamp of the message */
103
321
  timestamp: string;
322
+ /** Tool invocations made during this turn */
104
323
  tool_calls?: ToolCall[];
105
324
  }
325
+ /**
326
+ * Record of a tool invocation during conversation.
327
+ * @description Captures details of when an agent invoked a webhook tool.
328
+ * @interface ToolCall
329
+ */
106
330
  export interface ToolCall {
331
+ /** Name of the tool that was called */
107
332
  tool_name: string;
333
+ /** Parameters passed to the tool */
108
334
  parameters: Record<string, unknown>;
335
+ /** Result returned by the tool */
109
336
  result?: unknown;
337
+ /** Error message if the tool call failed */
110
338
  error?: string;
111
339
  }
340
+ /**
341
+ * AI-generated conversation analysis.
342
+ * @description Provides insights about the conversation quality and content.
343
+ * @interface ConversationAnalysis
344
+ */
112
345
  export interface ConversationAnalysis {
346
+ /** Detected sentiment of the user during the conversation */
113
347
  user_sentiment?: "positive" | "neutral" | "negative";
348
+ /** Performance score for the agent (0-10) */
114
349
  agent_performance?: number;
350
+ /** Key topics discussed in the conversation */
115
351
  key_topics?: string[];
116
352
  }
353
+ /**
354
+ * ElevenLabs voice entity.
355
+ * @description Represents an available voice for text-to-speech synthesis.
356
+ * @interface Voice
357
+ */
117
358
  export interface Voice {
359
+ /** Unique voice identifier */
118
360
  voice_id: string;
361
+ /** Display name of the voice */
119
362
  name: string;
363
+ /** Voice category (e.g., "premade", "cloned") */
120
364
  category?: string;
365
+ /** Human-readable description of the voice */
121
366
  description?: string;
367
+ /** URL to audio preview of the voice */
122
368
  preview_url?: string;
369
+ /** Descriptive labels for the voice */
123
370
  labels?: {
371
+ /** Voice accent (e.g., "british", "american") */
124
372
  accent?: string;
373
+ /** Additional description */
125
374
  description?: string;
375
+ /** Age category (e.g., "young", "middle_aged", "old") */
126
376
  age?: string;
377
+ /** Gender (e.g., "male", "female") */
127
378
  gender?: string;
379
+ /** Suggested use case (e.g., "narration", "conversational") */
128
380
  use_case?: string;
129
381
  };
130
382
  }
383
+ /**
384
+ * Generic paginated response wrapper.
385
+ * @description Standard pagination structure used across all list endpoints.
386
+ * @interface PaginatedResponse
387
+ * @template T The type of items in the response
388
+ * @example
389
+ * const response: PaginatedResponse<Agent> = {
390
+ * total: 50,
391
+ * count: 20,
392
+ * offset: 0,
393
+ * items: [...],
394
+ * has_more: true,
395
+ * next_offset: 20
396
+ * };
397
+ */
131
398
  export interface PaginatedResponse<T> {
399
+ /** Total number of items available */
132
400
  total: number;
401
+ /** Number of items in this response */
133
402
  count: number;
403
+ /** Starting offset for this page */
134
404
  offset: number;
405
+ /** Array of items */
135
406
  items: T[];
407
+ /** Whether more items exist beyond this page */
136
408
  has_more: boolean;
409
+ /** Offset value for fetching the next page */
137
410
  next_offset?: number;
138
411
  }
412
+ /**
413
+ * Generic API response wrapper.
414
+ * @description Standard response structure for API operations.
415
+ * @interface APIResponse
416
+ * @template T The type of data in the response
417
+ */
139
418
  export interface APIResponse<T> {
419
+ /** Whether the operation succeeded */
140
420
  success: boolean;
421
+ /** Response data (present on success) */
141
422
  data?: T;
423
+ /** Error message (present on failure) */
142
424
  error?: string;
143
425
  }
426
+ /**
427
+ * Knowledge base document for agent training.
428
+ * @description Represents a document that can be added to an agent's knowledge base.
429
+ * @interface KnowledgeBaseDocument
430
+ */
144
431
  export interface KnowledgeBaseDocument {
432
+ /** Type of document content */
145
433
  type: "text" | "url" | "file";
434
+ /** Document content or URL to fetch */
146
435
  content: string;
436
+ /** Optional metadata about the document */
147
437
  metadata?: Record<string, string>;
148
438
  }
439
+ /**
440
+ * Widget embed configuration.
441
+ * @description Settings for generating embeddable voice agent widgets.
442
+ * @interface WidgetConfig
443
+ */
149
444
  export interface WidgetConfig {
445
+ /** Agent ID to embed */
150
446
  agent_id: string;
447
+ /** Widget theme color (hex format) */
151
448
  color?: string;
449
+ /** Avatar image URL */
152
450
  avatar_url?: string;
153
451
  }
452
+ /**
453
+ * Request parameters for initiating a single outbound call.
454
+ * @description Contains all information needed to place an outbound call via Twilio.
455
+ * @interface OutboundCallRequest
456
+ */
154
457
  export interface OutboundCallRequest {
458
+ /** Agent ID to use for the call */
155
459
  agent_id: string;
460
+ /** Phone number ID to use as caller ID */
156
461
  agent_phone_number_id: string;
462
+ /** Destination phone number in E.164 format */
157
463
  to_number: string;
158
464
  /**
159
- * Conversation initiation data for personalization
465
+ * Conversation initiation data for personalization.
466
+ * @description Allows passing dynamic variables and configuration overrides
467
+ * to customize the call for each recipient.
160
468
  * @example
161
469
  * {
162
470
  * dynamic_variables: {
@@ -172,21 +480,52 @@ export interface OutboundCallRequest {
172
480
  */
173
481
  conversation_initiation_client_data?: Record<string, unknown> | null;
174
482
  }
483
+ /**
484
+ * Response from initiating an outbound call.
485
+ * @description Contains the result of a call initiation attempt.
486
+ * @interface OutboundCallResponse
487
+ */
175
488
  export interface OutboundCallResponse {
489
+ /** Whether the call was successfully initiated */
176
490
  success: boolean;
491
+ /** Human-readable status message */
177
492
  message: string;
493
+ /** Conversation ID for tracking (null if initiation failed) */
178
494
  conversation_id: string | null;
495
+ /** Twilio call SID (null if initiation failed) */
179
496
  callSid: string | null;
180
497
  }
498
+ /**
499
+ * Status values for batch calling jobs.
500
+ * @typedef {string} BatchStatus
501
+ */
181
502
  export type BatchStatus = "pending" | "in_progress" | "completed" | "failed" | "cancelled";
503
+ /**
504
+ * Status values for individual recipients in a batch.
505
+ * @description Extends BatchStatus with additional recipient-specific states.
506
+ * @typedef {string} RecipientStatus
507
+ */
182
508
  export type RecipientStatus = BatchStatus | "initiated" | "voicemail";
509
+ /**
510
+ * Phone number provider type.
511
+ * @typedef {string} PhoneProvider
512
+ */
183
513
  export type PhoneProvider = "twilio" | "sip_trunk";
514
+ /**
515
+ * Single recipient in a batch calling job.
516
+ * @description Defines one recipient to call with optional personalization data.
517
+ * @interface OutboundCallRecipient
518
+ */
184
519
  export interface OutboundCallRecipient {
520
+ /** Optional custom tracking ID for this recipient */
185
521
  id?: string;
522
+ /** Phone number in E.164 format (required if whatsapp_user_id not provided) */
186
523
  phone_number?: string;
524
+ /** WhatsApp user ID (alternative to phone_number) */
187
525
  whatsapp_user_id?: string;
188
526
  /**
189
- * Conversation initiation data for personalization
527
+ * Conversation initiation data for personalization.
528
+ * @description Allows passing dynamic variables specific to this recipient.
190
529
  * @example
191
530
  * {
192
531
  * dynamic_variables: {
@@ -197,37 +536,76 @@ export interface OutboundCallRecipient {
197
536
  */
198
537
  conversation_initiation_client_data?: Record<string, unknown>;
199
538
  }
539
+ /**
540
+ * Request parameters for submitting a batch calling job.
541
+ * @description Contains all configuration for a batch of outbound calls.
542
+ * @interface BatchCallRequest
543
+ */
200
544
  export interface BatchCallRequest {
545
+ /** Descriptive name for this batch job */
201
546
  call_name: string;
547
+ /** Agent ID to use for all calls */
202
548
  agent_id: string;
549
+ /** Array of recipients to call (1-10,000) */
203
550
  recipients: OutboundCallRecipient[];
551
+ /** Optional Unix timestamp to schedule batch for future execution */
204
552
  scheduled_time_unix?: number | null;
553
+ /** Optional phone number ID to use as caller ID */
205
554
  agent_phone_number_id?: string | null;
206
555
  }
556
+ /**
557
+ * Response from submitting a batch calling job.
558
+ * @description Contains batch job metadata and status information.
559
+ * @interface BatchCallResponse
560
+ */
207
561
  export interface BatchCallResponse {
562
+ /** Unique batch job identifier */
208
563
  id: string;
564
+ /** Batch job name */
209
565
  name: string;
566
+ /** Agent ID used for the batch */
210
567
  agent_id: string;
568
+ /** Display name of the agent */
211
569
  agent_name: string;
570
+ /** Current batch status */
212
571
  status: BatchStatus;
572
+ /** Unix timestamp when batch was created */
213
573
  created_at_unix: number;
574
+ /** Unix timestamp when batch is scheduled to run */
214
575
  scheduled_time_unix: number;
576
+ /** Unix timestamp of last status update */
215
577
  last_updated_at_unix: number;
578
+ /** Number of calls already dispatched */
216
579
  total_calls_dispatched: number;
580
+ /** Total number of calls scheduled */
217
581
  total_calls_scheduled: number;
582
+ /** Phone number ID used for calling */
218
583
  phone_number_id: string | null;
584
+ /** Phone provider used */
219
585
  phone_provider: PhoneProvider | null;
220
586
  }
587
+ /**
588
+ * Individual recipient status within a batch.
589
+ * @description Tracks the call status for each recipient in a batch job.
590
+ * @interface BatchCallRecipient
591
+ */
221
592
  export interface BatchCallRecipient {
593
+ /** Recipient tracking ID */
222
594
  id: string;
595
+ /** Recipient phone number */
223
596
  phone_number?: string;
597
+ /** Recipient WhatsApp user ID */
224
598
  whatsapp_user_id?: string;
599
+ /** Current call status for this recipient */
225
600
  status: RecipientStatus;
601
+ /** Conversation ID for this call (for transcript lookup) */
226
602
  conversation_id: string;
603
+ /** Unix timestamp when recipient was added */
227
604
  created_at_unix: number;
605
+ /** Unix timestamp of last status update */
228
606
  updated_at_unix: number;
229
607
  /**
230
- * Conversation initiation data for personalization
608
+ * Conversation initiation data used for this recipient.
231
609
  * @example
232
610
  * {
233
611
  * dynamic_variables: {
@@ -238,58 +616,127 @@ export interface BatchCallRecipient {
238
616
  */
239
617
  conversation_initiation_client_data?: Record<string, unknown>;
240
618
  }
619
+ /**
620
+ * Detailed batch call response including all recipients.
621
+ * @description Extends BatchCallResponse with the full list of recipient statuses.
622
+ * @interface BatchCallDetailedResponse
623
+ */
241
624
  export interface BatchCallDetailedResponse extends BatchCallResponse {
625
+ /** Array of all recipients with their current statuses */
242
626
  recipients: BatchCallRecipient[];
243
627
  }
628
+ /**
629
+ * Response from listing workspace batch calls.
630
+ * @description Paginated list of batch calling jobs.
631
+ * @interface WorkspaceBatchCallsResponse
632
+ */
244
633
  export interface WorkspaceBatchCallsResponse {
634
+ /** Array of batch call summaries */
245
635
  batch_calls: BatchCallResponse[];
636
+ /** Cursor for fetching the next page (null if no more pages) */
246
637
  next_doc: string | null;
638
+ /** Whether more batch calls exist beyond this page */
247
639
  has_more: boolean;
248
640
  }
641
+ /**
642
+ * Twilio-provisioned phone number.
643
+ * @description Represents a phone number imported from Twilio.
644
+ * @interface TwilioPhoneNumber
645
+ */
249
646
  export interface TwilioPhoneNumber {
647
+ /** The actual phone number in E.164 format */
250
648
  phone_number: string;
649
+ /** Human-readable label for the phone number */
251
650
  label: string;
651
+ /** Unique identifier for API operations */
252
652
  phone_number_id: string;
653
+ /** Whether this number can receive inbound calls */
253
654
  supports_inbound: boolean;
655
+ /** Whether this number can make outbound calls */
254
656
  supports_outbound: boolean;
657
+ /** Provider type - always "twilio" for this interface */
255
658
  provider: "twilio";
659
+ /** Currently assigned agent (null if unassigned) */
256
660
  assigned_agent: {
257
661
  agent_id: string;
258
662
  agent_name: string;
259
663
  } | null;
260
664
  }
665
+ /**
666
+ * SIP trunk-provisioned phone number.
667
+ * @description Represents a phone number connected via SIP trunk.
668
+ * @interface SIPTrunkPhoneNumber
669
+ */
261
670
  export interface SIPTrunkPhoneNumber {
671
+ /** The actual phone number in E.164 format */
262
672
  phone_number: string;
673
+ /** Human-readable label for the phone number */
263
674
  label: string;
675
+ /** Unique identifier for API operations */
264
676
  phone_number_id: string;
677
+ /** Whether this number can receive inbound calls */
265
678
  supports_inbound: boolean;
679
+ /** Whether this number can make outbound calls */
266
680
  supports_outbound: boolean;
681
+ /** Provider type - always "sip_trunk" for this interface */
267
682
  provider: "sip_trunk";
683
+ /** LiveKit stack configuration */
268
684
  livekit_stack: "standard" | "static";
685
+ /** Currently assigned agent (null if unassigned) */
269
686
  assigned_agent: {
270
687
  agent_id: string;
271
688
  agent_name: string;
272
689
  } | null;
690
+ /** Outbound SIP trunk configuration */
273
691
  outbound_trunk?: Record<string, unknown> | null;
692
+ /** Inbound SIP trunk configuration */
274
693
  inbound_trunk?: Record<string, unknown> | null;
694
+ /** Additional provider-specific configuration */
275
695
  provider_config?: Record<string, unknown> | null;
276
696
  }
697
+ /**
698
+ * Union type for all phone number types.
699
+ * @description Can be either a Twilio or SIP trunk phone number.
700
+ * @typedef {TwilioPhoneNumber | SIPTrunkPhoneNumber} PhoneNumber
701
+ */
277
702
  export type PhoneNumber = TwilioPhoneNumber | SIPTrunkPhoneNumber;
703
+ /**
704
+ * Request parameters for importing a Twilio phone number.
705
+ * @description Contains Twilio credentials and phone number details.
706
+ * @interface ImportPhoneNumberRequest
707
+ */
278
708
  export interface ImportPhoneNumberRequest {
709
+ /** Phone number to import in E.164 format */
279
710
  phone_number: string;
711
+ /** Descriptive label for the phone number */
280
712
  label: string;
713
+ /** Twilio Account SID */
281
714
  sid: string;
715
+ /** Twilio Auth Token */
282
716
  token: string;
717
+ /** Provider type - must be "twilio" */
283
718
  provider: "twilio";
719
+ /** Enable inbound call handling (default: true) */
284
720
  supports_inbound?: boolean;
721
+ /** Enable outbound call capability (default: true) */
285
722
  supports_outbound?: boolean;
723
+ /** Optional regional configuration for Twilio */
286
724
  region_config?: {
725
+ /** ElevenLabs region identifier */
287
726
  region_id: "us1" | "ie1" | "au1";
727
+ /** Regional token */
288
728
  token: string;
729
+ /** Twilio edge location for voice routing */
289
730
  edge_location: "ashburn" | "dublin" | "frankfurt" | "sao-paulo" | "singapore" | "sydney" | "tokyo" | "umatilla" | "roaming";
290
731
  };
291
732
  }
733
+ /**
734
+ * Response from importing a phone number.
735
+ * @description Contains the newly created phone number identifier.
736
+ * @interface ImportPhoneNumberResponse
737
+ */
292
738
  export interface ImportPhoneNumberResponse {
739
+ /** Unique identifier for the imported phone number */
293
740
  phone_number_id: string;
294
741
  }
295
742
  //# sourceMappingURL=types.d.ts.map