realtime-voice-agents 2.0.1 → 2.2.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.
- package/README.md +58 -2
- package/dist/{BaseRealtimeProvider-BehPNT1r.d.cts → BaseRealtimeProvider-BL75_HHh.d.cts} +53 -3
- package/dist/{BaseRealtimeProvider-DI4pKtOb.cjs → BaseRealtimeProvider-C2mRn1V_.cjs} +10 -0
- package/dist/{BaseRealtimeProvider-BQigr5mB.mjs → BaseRealtimeProvider-C9C3s8jx.mjs} +10 -0
- package/dist/{BaseRealtimeProvider-ClP8Wx1X.d.mts → BaseRealtimeProvider-CWJ81HIt.d.mts} +53 -3
- package/dist/{GeminiLiveProvider-DvkTgzjG.d.cts → GeminiLiveProvider-Cc1dkxW6.d.cts} +1 -1
- package/dist/{GeminiLiveProvider-x2nyx5aO.d.mts → GeminiLiveProvider-TvY_cQQZ.d.mts} +1 -1
- package/dist/{OpenAICompatibleProvider-Bdtl-UXH.mjs → OpenAICompatibleProvider-D-2OOVBU.mjs} +98 -11
- package/dist/{OpenAICompatibleProvider-NS4cKVQj.cjs → OpenAICompatibleProvider-Mp0Mefbh.cjs} +98 -11
- package/dist/audio.cjs +9 -6
- package/dist/audio.d.cts +51 -1
- package/dist/audio.d.mts +51 -1
- package/dist/audio.mjs +2 -2
- package/dist/gemini.cjs +16 -6
- package/dist/gemini.d.cts +8 -3
- package/dist/gemini.d.mts +8 -3
- package/dist/gemini.mjs +16 -6
- package/dist/index.cjs +356 -16
- package/dist/index.d.cts +211 -2
- package/dist/index.d.mts +211 -2
- package/dist/index.mjs +355 -16
- package/dist/{BackgroundAudioPlayer-iMcivjis.mjs → noise-CJ789zzj.mjs} +94 -1
- package/dist/{BackgroundAudioPlayer-jfRULWKC.cjs → noise-D9jKottW.cjs} +111 -0
- package/dist/openai.cjs +22 -8
- package/dist/openai.d.cts +31 -3
- package/dist/openai.d.mts +31 -3
- package/dist/openai.mjs +22 -8
- package/dist/{session-config-BVLl7-ha.mjs → session-config-CbifLlkV.mjs} +1 -1
- package/dist/{session-config-c8sOw1XL.cjs → session-config-CqJm2Kxz.cjs} +1 -1
- package/dist/testing.cjs +29 -2
- package/dist/testing.d.cts +31 -1
- package/dist/testing.d.mts +31 -1
- package/dist/testing.mjs +29 -2
- package/dist/xai.cjs +23 -9
- package/dist/xai.d.cts +7 -2
- package/dist/xai.d.mts +7 -2
- package/dist/xai.mjs +23 -9
- package/package.json +1 -1
package/dist/xai.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as ProviderSessionInit, l as VadConfig, n as ProviderFactory } from "./BaseRealtimeProvider-BL75_HHh.cjs";
|
|
2
2
|
//#region src/xai.d.ts
|
|
3
3
|
declare const XAI_BASE_URL = "wss://api.x.ai/v1/realtime";
|
|
4
4
|
/** Env vars checked (in order) when no explicit apiKey is passed. */
|
|
@@ -29,7 +29,12 @@ declare function buildXaiSessionUpdate(init: ProviderSessionInit, config?: {
|
|
|
29
29
|
defaultVoice?: string;
|
|
30
30
|
extraSessionOptions?: Record<string, unknown>;
|
|
31
31
|
}): Record<string, unknown>;
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Create an xAI Grok Voice provider factory for the bridge. Credentials are
|
|
34
|
+
* resolved per call (see `openaiRealtime` — a missing key fails that call's
|
|
35
|
+
* connect so a fallback chain can absorb it, instead of crashing config
|
|
36
|
+
* construction).
|
|
37
|
+
*/
|
|
33
38
|
declare function xaiRealtime(options?: XaiRealtimeOptions): ProviderFactory;
|
|
34
39
|
//#endregion
|
|
35
40
|
export { XAI_BASE_URL, XAI_DEFAULT_MODEL, XAI_DEFAULT_VOICE, XAI_KEY_ENV_VARS, XaiRealtimeOptions, buildXaiSessionUpdate, xaiRealtime };
|
package/dist/xai.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as ProviderSessionInit, l as VadConfig, n as ProviderFactory } from "./BaseRealtimeProvider-CWJ81HIt.mjs";
|
|
2
2
|
//#region src/xai.d.ts
|
|
3
3
|
declare const XAI_BASE_URL = "wss://api.x.ai/v1/realtime";
|
|
4
4
|
/** Env vars checked (in order) when no explicit apiKey is passed. */
|
|
@@ -29,7 +29,12 @@ declare function buildXaiSessionUpdate(init: ProviderSessionInit, config?: {
|
|
|
29
29
|
defaultVoice?: string;
|
|
30
30
|
extraSessionOptions?: Record<string, unknown>;
|
|
31
31
|
}): Record<string, unknown>;
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Create an xAI Grok Voice provider factory for the bridge. Credentials are
|
|
34
|
+
* resolved per call (see `openaiRealtime` — a missing key fails that call's
|
|
35
|
+
* connect so a fallback chain can absorb it, instead of crashing config
|
|
36
|
+
* construction).
|
|
37
|
+
*/
|
|
33
38
|
declare function xaiRealtime(options?: XaiRealtimeOptions): ProviderFactory;
|
|
34
39
|
//#endregion
|
|
35
40
|
export { XAI_BASE_URL, XAI_DEFAULT_MODEL, XAI_DEFAULT_VOICE, XAI_KEY_ENV_VARS, XaiRealtimeOptions, buildXaiSessionUpdate, xaiRealtime };
|
package/dist/xai.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as deepMerge } from "./BaseRealtimeProvider-
|
|
2
|
-
import { n as buildTurnDetection } from "./session-config-
|
|
1
|
+
import { n as deepMerge } from "./BaseRealtimeProvider-C9C3s8jx.mjs";
|
|
2
|
+
import { n as buildTurnDetection } from "./session-config-CbifLlkV.mjs";
|
|
3
3
|
import { t as resolveApiKey } from "./env-DUwUWTsg.mjs";
|
|
4
|
-
import { t as OpenAICompatibleProvider } from "./OpenAICompatibleProvider-
|
|
4
|
+
import { t as OpenAICompatibleProvider } from "./OpenAICompatibleProvider-D-2OOVBU.mjs";
|
|
5
5
|
//#region src/xai.ts
|
|
6
6
|
/**
|
|
7
7
|
* xAI Grok Voice Agent provider — `realtime-voice-agents/xai`.
|
|
@@ -58,13 +58,15 @@ function buildXaiSessionUpdate(init, config = {}) {
|
|
|
58
58
|
session
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Create an xAI Grok Voice provider factory for the bridge. Credentials are
|
|
63
|
+
* resolved per call (see `openaiRealtime` — a missing key fails that call's
|
|
64
|
+
* connect so a fallback chain can absorb it, instead of crashing config
|
|
65
|
+
* construction).
|
|
66
|
+
*/
|
|
62
67
|
function xaiRealtime(options = {}) {
|
|
63
|
-
const apiKey = resolveApiKey(options.apiKey, XAI_KEY_ENV_VARS);
|
|
64
|
-
if (!apiKey) throw new Error(`xaiRealtime: apiKey missing (pass apiKey or set one of ${XAI_KEY_ENV_VARS.join("/")})`);
|
|
65
68
|
const transcription = options.transcription === false ? false : options.transcription ? { language: options.transcription.languageHint } : void 0;
|
|
66
69
|
const config = {
|
|
67
|
-
apiKey,
|
|
68
70
|
model: options.model ?? "grok-voice-latest",
|
|
69
71
|
voice: options.voice ?? "eve",
|
|
70
72
|
baseUrl: options.baseUrl ?? "wss://api.x.ai/v1/realtime",
|
|
@@ -77,10 +79,22 @@ function xaiRealtime(options = {}) {
|
|
|
77
79
|
buildSession: buildXaiSessionUpdate,
|
|
78
80
|
capabilityOverrides: {
|
|
79
81
|
truncate: false,
|
|
80
|
-
vadInterruptControl: false
|
|
82
|
+
vadInterruptControl: false,
|
|
83
|
+
vadTuning: {
|
|
84
|
+
defaultServerThreshold: .85,
|
|
85
|
+
minServerThreshold: .1,
|
|
86
|
+
maxServerThreshold: .9
|
|
87
|
+
}
|
|
81
88
|
}
|
|
82
89
|
};
|
|
83
|
-
return ({ logger }) =>
|
|
90
|
+
return ({ logger }) => {
|
|
91
|
+
const apiKey = resolveApiKey(options.apiKey, XAI_KEY_ENV_VARS);
|
|
92
|
+
if (!apiKey) throw new Error(`xaiRealtime: apiKey missing (pass apiKey or set one of ${XAI_KEY_ENV_VARS.join("/")})`);
|
|
93
|
+
return new OpenAICompatibleProvider({
|
|
94
|
+
...config,
|
|
95
|
+
apiKey
|
|
96
|
+
}, logger);
|
|
97
|
+
};
|
|
84
98
|
}
|
|
85
99
|
//#endregion
|
|
86
100
|
export { XAI_BASE_URL, XAI_DEFAULT_MODEL, XAI_DEFAULT_VOICE, XAI_KEY_ENV_VARS, buildXaiSessionUpdate, xaiRealtime };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "realtime-voice-agents",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Provider-agnostic bridge between Twilio Media Streams and realtime speech-to-speech AI APIs (OpenAI Realtime, xAI Grok Voice, Gemini Live). Multi-agent handoffs, Zod tools with execution strategies, mark-based playback tracking, interruption guards, and hold audio — for Node.js voice agents over the phone.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"twilio",
|