@vellumai/vellum-gateway 0.4.23 → 0.4.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.
Files changed (2) hide show
  1. package/ARCHITECTURE.md +4 -39
  2. package/package.json +1 -1
package/ARCHITECTURE.md CHANGED
@@ -1045,12 +1045,9 @@ Call behavior is controlled via the `calls` config block in the assistant config
1045
1045
  | `calls.disclosure.text` | string | *(default disclosure prompt)* | The disclosure instruction included in the system prompt. |
1046
1046
  | `calls.safety.denyCategories` | string[] | `[]` | Categories of calls to deny (e.g., emergency numbers are always denied regardless of this setting). |
1047
1047
  | `calls.model` | string | *(unset — uses default model)* | Optional override for the LLM model used in voice call conversations. |
1048
- | `calls.voice.mode` | enum | `'twilio_standard'` | Voice quality mode. Options: `twilio_standard` (standard Twilio TTS with Google voices — fully supported), `twilio_elevenlabs_tts` (ElevenLabs voices through Twilio ConversationRelay — fully supported), `elevenlabs_agent` (full ElevenLabs conversational agent — experimental/restricted, blocked by runtime guard). |
1049
1048
  | `calls.voice.language` | string | `'en-US'` | Language code for TTS and transcription. |
1050
1049
  | `calls.voice.transcriptionProvider` | enum | `'Deepgram'` | Speech-to-text provider (`Deepgram` or `Google`). |
1051
- | `calls.voice.fallbackToStandardOnError` | boolean | `true` | When an ElevenLabs mode is active, automatically fall back to standard Twilio TTS if ElevenLabs config is invalid or mode is restricted (e.g., `elevenlabs_agent` guard). When `false`, errors return HTTP 500 (invalid config) or 501 (restricted mode) instead of falling back. |
1052
- | `calls.voice.elevenlabs.voiceId` | string | `''` | ElevenLabs voice ID, used by `twilio_elevenlabs_tts` mode. |
1053
- | `calls.voice.elevenlabs.agentId` | string | `''` | ElevenLabs agent ID, used by `elevenlabs_agent` mode. |
1050
+ | `elevenlabs.voiceId` | string | `'21m00Tcm4TlvDq8ikWAM'` | ElevenLabs voice ID used by both in-app TTS and phone calls. Defaults to Rachel. |
1054
1051
 
1055
1052
  ### Caller Identity Resolution
1056
1053
 
@@ -1067,43 +1064,11 @@ Both the resolved mode and source are logged at info level on success, and rejec
1067
1064
 
1068
1065
  ### Voice Quality Profile Resolution
1069
1066
 
1070
- Voice and TTS settings are configurable via the `calls.voice` config block — they are not hardcoded. The function `resolveVoiceQualityProfile()` in `voice-quality.ts` reads the current config and resolves it into an effective `VoiceQualityProfile` containing the TTS provider, voice spec string, language, transcription provider, and fallback policy.
1067
+ Voice and TTS settings are configurable via the `calls.voice` config block — they are not hardcoded. The function `resolveVoiceQualityProfile()` in `voice-quality.ts` reads the current config and resolves it into a `VoiceQualityProfile` containing the TTS provider, voice spec string, language, and transcription provider.
1071
1068
 
1072
- The resolution logic works as follows:
1069
+ All calls use **ElevenLabs** as the TTS provider via Twilio ConversationRelay. The voice ID is read from the shared `elevenlabs.voiceId` config key (defaulting to Rachel — `21m00Tcm4TlvDq8ikWAM`). Optional tuning parameters (`voiceModelId`, `speed`, `stability`, `similarityBoost`) are also read from the top-level `elevenlabs` config. When `voiceModelId` is set, the emitted voice spec uses the Twilio ConversationRelay extended format: `voiceId-model-speed_stability_similarity`. When `voiceModelId` is empty (the default), only the bare `voiceId` is sent.
1073
1070
 
1074
- - **`twilio_standard`** (fully supported) Returns a profile using Google TTS with a default Google voice (`Google.en-US-Journey-O`). This is the default when no voice config is changed.
1075
- - **`twilio_elevenlabs_tts`** (fully supported) — Builds an ElevenLabs voice spec string from `voiceId`, `voiceModelId`, and tuning parameters (speed, stability, similarity). The Twilio ConversationRelay format is `voiceId-model-speed_stability_similarity` where speed is 0.7–1.2 and stability/similarity are 0.0–1.0. If `voiceId` is empty and fallback is enabled, silently falls back to the `twilio_standard` profile.
1076
- - **`elevenlabs_agent`** (experimental/restricted) — Requires `agentId` to be set. If `agentId` is empty and fallback is enabled, silently falls back to `twilio_standard`. Even when the profile resolves successfully, a runtime guard in `handleVoiceWebhook` blocks this mode before any ElevenLabs API calls are made (see below). No register-call flow is reachable while the guard is active.
1077
-
1078
- When `fallbackToStandardOnError` is `true` (default), any misconfiguration or runtime error in ElevenLabs modes causes a graceful fallback to standard Twilio TTS rather than a call failure. Validation errors are captured in `validationErrors` on the profile for logging.
1079
-
1080
- ### Voice Mode Guardrails in `handleVoiceWebhook`
1081
-
1082
- The voice webhook (`twilio-routes.ts`) enforces two sequential guardrails before returning TwiML:
1083
-
1084
- **WS-A: Invalid profile guard** — If `isVoiceProfileValid(profile)` returns false (i.e., there are validation errors such as missing `voiceId` or `agentId`):
1085
- - `fallbackToStandardOnError=true` (default): the profile has already been resolved to `twilio_standard` by the profile resolver; proceeds normally.
1086
- - `fallbackToStandardOnError=false`: returns **HTTP 500** with the validation error details.
1087
-
1088
- **WS-B: `elevenlabs_agent` mode guard** — If the resolved profile mode is `elevenlabs_agent`, a guard fires *before* any ElevenLabs API calls because consultation bridging (`waiting_on_user`) is not yet supported in this mode. No ElevenLabs register-call or other API calls are attempted while this guard is active:
1089
- - `fallbackToStandardOnError=true` (default): logs a warning, replaces the profile with `twilio_standard`, and returns standard ConversationRelay TwiML.
1090
- - `fallbackToStandardOnError=false`: returns **HTTP 501** `"elevenlabs_agent mode is restricted: consultation bridging (waiting_on_user) is not yet supported."`.
1091
-
1092
- The guard order ensures invalid configs are caught first (WS-A), then mode-level restrictions are enforced (WS-B). For `twilio_standard` and `twilio_elevenlabs_tts` modes, both guards pass and the webhook proceeds to return ConversationRelay TwiML.
1093
-
1094
- ```mermaid
1095
- flowchart TD
1096
- A["handleVoiceWebhook"] --> B["resolveVoiceQualityProfile()"]
1097
- B --> C{"isVoiceProfileValid?<br/>(WS-A)"}
1098
- C -- "yes" --> D{"mode == elevenlabs_agent?<br/>(WS-B)"}
1099
- C -- "no, fallback=true" --> F["proceed with standard profile"]
1100
- C -- "no, fallback=false" --> G["HTTP 500: config error"]
1101
- D -- "no (twilio_standard /<br/>twilio_elevenlabs_tts)" --> H["return ConversationRelay TwiML"]
1102
- D -- "yes, fallback=true" --> I["warn + fallback to<br/>standard TwiML"]
1103
- D -- "yes, fallback=false" --> J["HTTP 501: consultation<br/>bridging not supported"]
1104
- F --> H
1105
- I --> H
1106
- ```
1071
+ The voice webhook in `twilio-routes.ts` calls `resolveVoiceQualityProfile()` and passes the result directly to `generateTwiML()` to produce ConversationRelay TwiML.
1107
1072
 
1108
1073
  ---
1109
1074
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/vellum-gateway",
3
- "version": "0.4.23",
3
+ "version": "0.4.26",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./twilio/verify": "./src/twilio/verify.ts",