agora-agents 3.0.0-alpha.2 → 3.0.0-alpha.3
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 +4 -4
- package/dist/cjs/AgoraPoolClient.d.ts +16 -3
- package/dist/cjs/AgoraPoolClient.js +26 -12
- package/dist/cjs/agentkit/Agent.js +17 -7
- package/dist/cjs/agentkit/AgentSession.js +6 -2
- package/dist/cjs/agentkit/avatar-types.d.ts +6 -0
- package/dist/cjs/agentkit/index.d.ts +5 -7
- package/dist/cjs/agentkit/index.js +7 -6
- package/dist/cjs/agentkit/presets.js +3 -3
- package/dist/cjs/agentkit/preview/client.d.ts +6 -5
- package/dist/cjs/agentkit/preview/client.js +7 -7
- package/dist/cjs/agentkit/preview/gemini-tts.d.ts +3 -31
- package/dist/cjs/agentkit/preview/gemini-tts.js +4 -30
- package/dist/cjs/agentkit/preview/index.d.ts +2 -2
- package/dist/cjs/agentkit/preview/index.js +4 -4
- package/dist/cjs/agentkit/token.d.ts +9 -7
- package/dist/cjs/agentkit/token.js +8 -7
- package/dist/cjs/agentkit/types.d.ts +12 -3
- package/dist/cjs/agentkit/v3.js +13 -7
- package/dist/cjs/agentkit/vendors/avatar.d.ts +6 -0
- package/dist/cjs/agentkit/vendors/avatar.js +14 -2
- package/dist/cjs/agentkit/vendors/stt.d.ts +35 -0
- package/dist/cjs/agentkit/vendors/stt.js +19 -2
- package/dist/cjs/agentkit/vendors/tts.d.ts +72 -18
- package/dist/cjs/agentkit/vendors/tts.js +60 -11
- package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +13 -0
- package/dist/cjs/api/resources/agents/types/GetTurnsAgentsResponse.d.ts +3 -1
- package/dist/cjs/api/types/Asr.d.ts +4 -1
- package/dist/cjs/api/types/CartesiaTts.d.ts +10 -0
- package/dist/cjs/api/types/CartesiaTts.js +9 -0
- package/dist/cjs/api/types/CartesiaTtsParams.d.ts +1 -1
- package/dist/cjs/api/types/DeepgramAsrParams.d.ts +1 -1
- package/dist/cjs/api/types/FishAudioTts.d.ts +10 -0
- package/dist/cjs/api/types/FishAudioTts.js +9 -0
- package/dist/cjs/api/types/FishAudioTtsParams.d.ts +1 -1
- package/dist/cjs/api/types/GeminiTts.d.ts +9 -0
- package/dist/cjs/api/types/GeminiTts.js +3 -0
- package/dist/cjs/api/types/GeminiTtsParams.d.ts +15 -0
- package/dist/cjs/api/types/GeminiTtsParams.js +3 -0
- package/dist/cjs/api/types/RtzrAsr.d.ts +10 -0
- package/dist/cjs/api/types/RtzrAsr.js +3 -0
- package/dist/cjs/api/types/RtzrAsrParams.d.ts +31 -0
- package/dist/cjs/api/types/RtzrAsrParams.js +3 -0
- package/dist/cjs/api/types/SarvamTtsParams.d.ts +12 -8
- package/dist/cjs/api/types/SarvamTtsParams.js +1 -1
- package/dist/cjs/api/types/Tts.d.ts +4 -1
- package/dist/cjs/api/types/index.d.ts +4 -0
- package/dist/cjs/api/types/index.js +4 -0
- package/dist/cjs/core/auth/publicAuthorization.d.ts +3 -0
- package/dist/cjs/core/auth/publicAuthorization.js +37 -0
- package/dist/cjs/index.d.ts +4 -4
- package/dist/cjs/index.js +7 -5
- package/dist/cjs/v3/transport.js +4 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/AgoraPoolClient.d.mts +16 -3
- package/dist/esm/AgoraPoolClient.mjs +26 -12
- package/dist/esm/agentkit/Agent.mjs +17 -7
- package/dist/esm/agentkit/AgentSession.mjs +6 -2
- package/dist/esm/agentkit/avatar-types.d.mts +6 -0
- package/dist/esm/agentkit/index.d.mts +5 -7
- package/dist/esm/agentkit/index.mjs +2 -3
- package/dist/esm/agentkit/presets.mjs +3 -3
- package/dist/esm/agentkit/preview/client.d.mts +6 -5
- package/dist/esm/agentkit/preview/client.mjs +7 -7
- package/dist/esm/agentkit/preview/gemini-tts.d.mts +3 -31
- package/dist/esm/agentkit/preview/gemini-tts.mjs +1 -28
- package/dist/esm/agentkit/preview/index.d.mts +2 -2
- package/dist/esm/agentkit/preview/index.mjs +1 -1
- package/dist/esm/agentkit/token.d.mts +9 -7
- package/dist/esm/agentkit/token.mjs +8 -7
- package/dist/esm/agentkit/types.d.mts +12 -3
- package/dist/esm/agentkit/v3.mjs +13 -7
- package/dist/esm/agentkit/vendors/avatar.d.mts +6 -0
- package/dist/esm/agentkit/vendors/avatar.mjs +14 -2
- package/dist/esm/agentkit/vendors/stt.d.mts +35 -0
- package/dist/esm/agentkit/vendors/stt.mjs +17 -1
- package/dist/esm/agentkit/vendors/tts.d.mts +72 -18
- package/dist/esm/agentkit/vendors/tts.mjs +58 -10
- package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +13 -0
- package/dist/esm/api/resources/agents/types/GetTurnsAgentsResponse.d.mts +3 -1
- package/dist/esm/api/types/Asr.d.mts +4 -1
- package/dist/esm/api/types/CartesiaTts.d.mts +10 -0
- package/dist/esm/api/types/CartesiaTts.mjs +8 -1
- package/dist/esm/api/types/CartesiaTtsParams.d.mts +1 -1
- package/dist/esm/api/types/DeepgramAsrParams.d.mts +1 -1
- package/dist/esm/api/types/FishAudioTts.d.mts +10 -0
- package/dist/esm/api/types/FishAudioTts.mjs +8 -1
- package/dist/esm/api/types/FishAudioTtsParams.d.mts +1 -1
- package/dist/esm/api/types/GeminiTts.d.mts +9 -0
- package/dist/esm/api/types/GeminiTts.mjs +2 -0
- package/dist/esm/api/types/GeminiTtsParams.d.mts +15 -0
- package/dist/esm/api/types/GeminiTtsParams.mjs +2 -0
- package/dist/esm/api/types/RtzrAsr.d.mts +10 -0
- package/dist/esm/api/types/RtzrAsr.mjs +2 -0
- package/dist/esm/api/types/RtzrAsrParams.d.mts +31 -0
- package/dist/esm/api/types/RtzrAsrParams.mjs +2 -0
- package/dist/esm/api/types/SarvamTtsParams.d.mts +12 -8
- package/dist/esm/api/types/SarvamTtsParams.mjs +1 -1
- package/dist/esm/api/types/Tts.d.mts +4 -1
- package/dist/esm/api/types/index.d.mts +4 -0
- package/dist/esm/api/types/index.mjs +4 -0
- package/dist/esm/core/auth/publicAuthorization.d.mts +3 -0
- package/dist/esm/core/auth/publicAuthorization.mjs +33 -0
- package/dist/esm/index.d.mts +4 -4
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/v3/transport.mjs +4 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/openapi.yaml +13 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,14 +11,14 @@ The Agora Agents SDK for TypeScript lets you build real-time voice agents on Ago
|
|
|
11
11
|
|
|
12
12
|
`Agent` is the configuration builder. Choose `config.createSession(...).start()` for a running conversation, or `await config.save({name})` for a `SavedAgent`. Continue with the returned session or saved handle: `saved.update(revisedConfig)`, `assignNumber()`, `unassignNumber()`, `listNumbers()`, and `delete()`.
|
|
13
13
|
|
|
14
|
-
**Saving agents and project provisioning are part of SDK preview `3.0.0-alpha.
|
|
14
|
+
**Saving agents and project provisioning are part of SDK preview `3.0.0-alpha.3`.** Existing session behavior is unchanged. Use `client.secrets` and `secretRef()` for stored credentials, `withVariable()` for template/extraction definitions, and `client.numbers` to register numbers. Number listing scans project pages and filters assignments locally. `client.campaigns` provides typed campaign creation, reads, updates, pause/resume/cancel, and deletion.
|
|
15
15
|
|
|
16
|
-
Start with [Saving agents](docs/guides/saved-agents.md). Use `saved.createSession(...).start()` to run a saved configuration. Builders with secret references or variable definitions automatically start an ephemeral session without saving first. These sessions support values, labels, optional RTC token/encryption, retention, graceful stop, start, stop, and get-info. Runtime updates support RTC token, messages, and complete model params replacement; conversation actions remain unavailable. The public client
|
|
16
|
+
Start with [Saving agents](docs/guides/saved-agents.md). Use `saved.createSession(...).start()` to run a saved configuration. Builders with secret references or variable definitions automatically start an ephemeral session without saving first. These sessions support values, labels, optional RTC token/encryption, retention, graceful stop, start, stop, and get-info. Runtime updates support RTC token, messages, and complete model params replacement; conversation actions remain unavailable. The public client supports Agora token007 and Customer ID/Secret HTTP Basic authentication at the public preview origin; no internal gateway headers are needed. Advanced users can access 32 operations, ETags, raw headers, pagination, and project session reads and start/stop/update through the [transport reference](docs/reference/v3.md). [Staging setup and mapping limits](docs/guides/v3-preview.md) remain documented separately.
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
20
20
|
```sh
|
|
21
|
-
npm install agora-agents@3.0.0-alpha.
|
|
21
|
+
npm install agora-agents@3.0.0-alpha.3
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
## Quick Start
|
|
@@ -283,6 +283,6 @@ See the [Avatar Integration guide](./docs/guides/avatars.md) for sample-rate req
|
|
|
283
283
|
|
|
284
284
|
### Installing a preview checkout
|
|
285
285
|
|
|
286
|
-
The v3 alpha preview is distributed separately from stable 2.x packages. This checkout targets `3.0.0-alpha.
|
|
286
|
+
The v3 alpha preview is distributed separately from stable 2.x packages. This checkout targets `3.0.0-alpha.3`. Git installs run `prepare` to build importable CommonJS/ESM output; lifecycle scripts and development dependencies must be enabled. To build a checkout on Windows, PowerShell, Command Prompt, macOS, or Linux, run `npm install` then `npm run build` (the clean step uses Node).
|
|
287
287
|
|
|
288
288
|
Use `agent.createEphemeralSession(options)` to explicitly start an unsaved Platform configuration. Use `agent.call(options)` or `saved.call(options)` for an outbound phone session, then call `start()` on the returned handle.
|
|
@@ -5,11 +5,12 @@ import { AgoraClient as BaseAgoraClient } from "./Client.js";
|
|
|
5
5
|
import { Pool } from "./core/domain/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* Auth mode for the client:
|
|
8
|
+
* - `basic`: Customer ID and Secret for HTTP Basic authentication
|
|
8
9
|
* - `token`: Pre-built `agora token=<value>` auth header
|
|
9
10
|
* - `app-credentials`: appId + appCertificate only; AgentSession generates
|
|
10
11
|
* a fresh ConvoAI token per API call
|
|
11
12
|
*/
|
|
12
|
-
export type AgoraAuthMode = "token" | "app-credentials";
|
|
13
|
+
export type AgoraAuthMode = "basic" | "token" | "app-credentials";
|
|
13
14
|
export declare namespace AgoraClient {
|
|
14
15
|
type Options<TArea extends AgoraArea = AgoraArea> = BaseOptions<TArea> & AuthOptions;
|
|
15
16
|
interface BaseOptions<TArea extends AgoraArea = AgoraArea> extends Omit<BaseClientOptions, "baseUrl" | "environment" | "username" | "password" | "authorization"> {
|
|
@@ -20,8 +21,17 @@ export declare namespace AgoraClient {
|
|
|
20
21
|
/** Agora App ID — used as the `appid` path parameter and for RTC token generation */
|
|
21
22
|
appId: string;
|
|
22
23
|
}
|
|
24
|
+
/** Use Customer ID and Customer Secret for HTTP Basic REST authentication. */
|
|
25
|
+
interface BasicAuthOptions {
|
|
26
|
+
customerId: string;
|
|
27
|
+
customerSecret: string;
|
|
28
|
+
appCertificate?: string;
|
|
29
|
+
authToken?: never;
|
|
30
|
+
}
|
|
23
31
|
/** Use a pre-built Agora token for REST API authentication. Pass the raw token; the SDK sets `Authorization: agora token=<authToken>` automatically. */
|
|
24
32
|
interface TokenAuthOptions {
|
|
33
|
+
customerId?: never;
|
|
34
|
+
customerSecret?: never;
|
|
25
35
|
appCertificate?: string;
|
|
26
36
|
authToken: string;
|
|
27
37
|
}
|
|
@@ -30,10 +40,12 @@ export declare namespace AgoraClient {
|
|
|
30
40
|
* ConvoAI token per API call — no Customer Secret required.
|
|
31
41
|
*/
|
|
32
42
|
interface AppCredentialsOptions {
|
|
43
|
+
customerId?: never;
|
|
44
|
+
customerSecret?: never;
|
|
33
45
|
appCertificate: string;
|
|
34
46
|
authToken?: never;
|
|
35
47
|
}
|
|
36
|
-
type AuthOptions = TokenAuthOptions | AppCredentialsOptions;
|
|
48
|
+
type AuthOptions = BasicAuthOptions | TokenAuthOptions | AppCredentialsOptions;
|
|
37
49
|
interface RequestOptions extends BaseRequestOptions {
|
|
38
50
|
}
|
|
39
51
|
}
|
|
@@ -41,7 +53,8 @@ export declare namespace AgoraClient {
|
|
|
41
53
|
* AgoraClient extends the base client with domain pool support for
|
|
42
54
|
* regional URL cycling and automatic domain selection.
|
|
43
55
|
*
|
|
44
|
-
*
|
|
56
|
+
* Three authentication modes are supported. For HTTP Basic authentication,
|
|
57
|
+
* supply customerId and customerSecret; appCertificate is optional for RTC signing.
|
|
45
58
|
*
|
|
46
59
|
* **App credentials (recommended)** — no Customer Secret needed; AgentSession
|
|
47
60
|
* generates a short-lived ConvoAI token per API call:
|
|
@@ -24,6 +24,8 @@ exports.AgoraClient = void 0;
|
|
|
24
24
|
const index_js_1 = require("./v3/index.js");
|
|
25
25
|
const token_js_1 = require("./agentkit/token.js");
|
|
26
26
|
const Client_js_1 = require("./Client.js");
|
|
27
|
+
const BasicAuth_js_1 = require("./core/auth/BasicAuth.js");
|
|
28
|
+
const publicAuthorization_js_1 = require("./core/auth/publicAuthorization.js");
|
|
27
29
|
const index_js_2 = require("./core/domain/index.js");
|
|
28
30
|
const publicHeaders_js_1 = require("./core/publicHeaders.js");
|
|
29
31
|
const index_js_3 = require("./errors/index.js");
|
|
@@ -69,7 +71,8 @@ function createClientPool(area) {
|
|
|
69
71
|
* AgoraClient extends the base client with domain pool support for
|
|
70
72
|
* regional URL cycling and automatic domain selection.
|
|
71
73
|
*
|
|
72
|
-
*
|
|
74
|
+
* Three authentication modes are supported. For HTTP Basic authentication,
|
|
75
|
+
* supply customerId and customerSecret; appCertificate is optional for RTC signing.
|
|
73
76
|
*
|
|
74
77
|
* **App credentials (recommended)** — no Customer Secret needed; AgentSession
|
|
75
78
|
* generates a short-lived ConvoAI token per API call:
|
|
@@ -108,6 +111,8 @@ class AgoraClient extends Client_js_1.AgoraClient {
|
|
|
108
111
|
var _a, _b, _c, _d;
|
|
109
112
|
const pool = createClientPool(options.area);
|
|
110
113
|
for (const key of Object.keys(options)) {
|
|
114
|
+
if (key === "customerId" || key === "customerSecret")
|
|
115
|
+
continue;
|
|
111
116
|
if ([
|
|
112
117
|
"customerid",
|
|
113
118
|
"customersecret",
|
|
@@ -117,29 +122,38 @@ class AgoraClient extends Client_js_1.AgoraClient {
|
|
|
117
122
|
"password",
|
|
118
123
|
"authorization",
|
|
119
124
|
].includes(key.replace(/_/g, "").toLowerCase())) {
|
|
120
|
-
throw new Error(`${key} is not supported; use appId/appCertificate or
|
|
125
|
+
throw new Error(`${key} is not supported; use appId/appCertificate, authToken, or customerId/customerSecret`);
|
|
121
126
|
}
|
|
122
127
|
}
|
|
123
|
-
const
|
|
124
|
-
const
|
|
128
|
+
const { authToken, appId, appCertificate, customerId, customerSecret } = options, rest = __rest(options, ["authToken", "appId", "appCertificate", "customerId", "customerSecret"]);
|
|
129
|
+
const basic = customerId !== undefined || customerSecret !== undefined;
|
|
130
|
+
if (basic && authToken !== undefined)
|
|
131
|
+
throw new Error("customerId/customerSecret cannot be combined with authToken");
|
|
132
|
+
if (basic)
|
|
133
|
+
(0, publicAuthorization_js_1.validateBasicCredentials)(customerId, customerSecret);
|
|
134
|
+
const authMode = basic ? "basic" : authToken !== undefined ? "token" : "app-credentials";
|
|
125
135
|
if (authMode === "app-credentials" && !appCertificate)
|
|
126
|
-
throw new Error("appCertificate or
|
|
127
|
-
const authorization = () =>
|
|
128
|
-
|
|
129
|
-
|
|
136
|
+
throw new Error("appCertificate, authToken, or customerId/customerSecret is required");
|
|
137
|
+
const authorization = () => {
|
|
138
|
+
if (authMode === "basic")
|
|
139
|
+
return BasicAuth_js_1.BasicAuth.toAuthorizationHeader({ username: customerId, password: customerSecret });
|
|
140
|
+
if (authMode === "token")
|
|
141
|
+
return `agora token=${authToken}`;
|
|
142
|
+
return `agora token=${(0, token_js_1.generateConvoAIToken)({ appId, appCertificate: appCertificate, channelName: "", uid: 0 })}`;
|
|
143
|
+
};
|
|
130
144
|
const originalFetch = (_a = options.fetch) !== null && _a !== void 0 ? _a : globalThis.fetch;
|
|
131
|
-
const
|
|
145
|
+
const authenticatedFetch = (input, init) => __awaiter(this, void 0, void 0, function* () {
|
|
132
146
|
const finalHeaders = new Headers(input instanceof Request ? input.headers : undefined);
|
|
133
147
|
new Headers(init === null || init === void 0 ? void 0 : init.headers).forEach((value, key) => finalHeaders.set(key, value));
|
|
134
148
|
const auth = finalHeaders.get("authorization");
|
|
135
|
-
if (auth !== null
|
|
136
|
-
|
|
149
|
+
if (auth !== null)
|
|
150
|
+
(0, publicAuthorization_js_1.validatePublicAuthorization)(auth);
|
|
137
151
|
for (const name of finalHeaders.keys())
|
|
138
152
|
if ((0, publicHeaders_js_1.isInternalHeader)(name))
|
|
139
153
|
throw new Error(`${name} is an internal header and is not supported`);
|
|
140
154
|
return originalFetch(input, init);
|
|
141
155
|
});
|
|
142
|
-
super(Object.assign(Object.assign({}, rest), { fetch:
|
|
156
|
+
super(Object.assign(Object.assign({}, rest), { fetch: authenticatedFetch, username: "", password: "", authorization, baseUrl: () => pool.getCurrentURL() }));
|
|
143
157
|
this._pool = pool;
|
|
144
158
|
this.appId = appId;
|
|
145
159
|
this.appCertificate = appCertificate;
|
|
@@ -714,9 +714,8 @@ class Agent {
|
|
|
714
714
|
else {
|
|
715
715
|
// opts is narrowed to the appId/appCertificate branch here
|
|
716
716
|
const { appId, appCertificate, expiresIn } = opts;
|
|
717
|
-
//
|
|
718
|
-
//
|
|
719
|
-
// works for both numeric and string UIDs.
|
|
717
|
+
// Build the ConvoAI-specific Token007 with RTC, RTM, and ConvoAI
|
|
718
|
+
// services. The account string works for numeric UIDs.
|
|
720
719
|
token = (0, token_js_1.generateConvoAIToken)({
|
|
721
720
|
appId,
|
|
722
721
|
appCertificate,
|
|
@@ -844,11 +843,14 @@ class Agent {
|
|
|
844
843
|
return newAgent;
|
|
845
844
|
}
|
|
846
845
|
_resolvePlatformAsrConfig() {
|
|
847
|
-
var _a, _b, _c, _d;
|
|
846
|
+
var _a, _b, _c, _d, _e;
|
|
848
847
|
const config = this._stt ? Object.assign({}, this._stt) : { vendor: this._client.area === index_js_1.Area.CN ? "fengming" : "ares" };
|
|
849
|
-
const params = config.params;
|
|
850
|
-
|
|
851
|
-
|
|
848
|
+
const params = Object.assign({}, config.params);
|
|
849
|
+
if (["assemblyai", "google", "microsoft", "sarvam", "speechmatics"].includes(config.vendor)) {
|
|
850
|
+
(_a = params.language) !== null && _a !== void 0 ? _a : (params.language = config.language);
|
|
851
|
+
}
|
|
852
|
+
const language = (_e = (_d = (_c = (_b = this._turnDetection) === null || _b === void 0 ? void 0 : _b.language) !== null && _c !== void 0 ? _c : config.language) !== null && _d !== void 0 ? _d : params === null || params === void 0 ? void 0 : params.language) !== null && _e !== void 0 ? _e : (["ares", "fengming"].includes(config.vendor) ? DEFAULT_TURN_DETECTION_LANGUAGE : undefined);
|
|
853
|
+
return Object.assign(Object.assign(Object.assign({}, config), { params }), (typeof language === "string" ? { language } : {}));
|
|
852
854
|
}
|
|
853
855
|
_resolveAsrConfig(turnDetectionConfig) {
|
|
854
856
|
const asrConfig = this._stt !== undefined
|
|
@@ -864,6 +866,14 @@ class Agent {
|
|
|
864
866
|
delete params.language_codes;
|
|
865
867
|
asrConfig.params = params;
|
|
866
868
|
}
|
|
869
|
+
if (asrConfig.vendor === "deepgram" && asrConfig.params !== undefined) {
|
|
870
|
+
const params = Object.assign({}, asrConfig.params);
|
|
871
|
+
if (params.api_key === undefined && params.key !== undefined) {
|
|
872
|
+
params.api_key = params.key;
|
|
873
|
+
}
|
|
874
|
+
delete params.key;
|
|
875
|
+
asrConfig.params = params;
|
|
876
|
+
}
|
|
867
877
|
// Turn detection is the single source of truth for the top-level
|
|
868
878
|
// interaction language. Provider-specific languages remain in params.
|
|
869
879
|
asrConfig.language = turnDetectionConfig.language;
|
|
@@ -295,9 +295,13 @@ class AgentSession {
|
|
|
295
295
|
}
|
|
296
296
|
// Validate TTS sample rate against avatar requirements
|
|
297
297
|
// Note: tts can be a string (shorthand) or an object with params
|
|
298
|
-
//
|
|
298
|
+
// Sample-rate fields vary by provider, so check the generated wire names dynamically.
|
|
299
299
|
const ttsParams = tts && typeof tts !== "string" ? tts.params : undefined;
|
|
300
|
-
const sampleRate = ttsParams && "sample_rate" in ttsParams
|
|
300
|
+
const sampleRate = ttsParams && "sample_rate" in ttsParams
|
|
301
|
+
? ttsParams.sample_rate
|
|
302
|
+
: ttsParams && "speech_sample_rate" in ttsParams
|
|
303
|
+
? ttsParams.speech_sample_rate
|
|
304
|
+
: undefined;
|
|
301
305
|
if (typeof sampleRate === "number") {
|
|
302
306
|
if ((0, avatar_types_js_1.isHeyGenAvatar)(strictAvatar) || (0, avatar_types_js_1.isLiveAvatarAvatar)(strictAvatar) || (0, avatar_types_js_1.isAkoolAvatar)(strictAvatar)) {
|
|
303
307
|
(0, avatar_types_js_1.validateTtsSampleRate)(strictAvatar, sampleRate);
|
|
@@ -77,6 +77,12 @@ export interface AnamAvatarConfig {
|
|
|
77
77
|
api_key: string;
|
|
78
78
|
/** Anam avatar ID (optional) */
|
|
79
79
|
avatar_id?: string;
|
|
80
|
+
/** Anam avatar model, such as `cara_mk4` for Cara 4 portrait mode */
|
|
81
|
+
avatar_model?: string;
|
|
82
|
+
/** Output video width in pixels; set together with `video_height` */
|
|
83
|
+
video_width?: number;
|
|
84
|
+
/** Output video height in pixels; set together with `video_width` */
|
|
85
|
+
video_height?: number;
|
|
80
86
|
[key: string]: unknown;
|
|
81
87
|
};
|
|
82
88
|
}
|
|
@@ -31,13 +31,11 @@ export type { AgentPreset, AsrPreset, DeepgramPresetModel, LlmPreset, MiniMaxPre
|
|
|
31
31
|
export { AgentPresets, normalizePresetInput } from "./presets.js";
|
|
32
32
|
export type { PreviewFeature, PreviewRoute } from "./preview/client.js";
|
|
33
33
|
export { createPreviewRoute, PREVIEW_API_BASE_URL, PREVIEW_FEATURE_HEADER, PreviewFeatures, previewRequestHeaders, requiredPreviewFeatures, } from "./preview/client.js";
|
|
34
|
-
export type { GeminiTTSConfig, GeminiTTSModel, GeminiTTSOptions } from "./preview/gemini-tts.js";
|
|
35
|
-
export { GeminiTTS, GeminiTTSModels } from "./preview/gemini-tts.js";
|
|
36
34
|
export type { AvatarVendor, CNAvatarVendor, CNLlmVendor, CNMllmVendor, CNSttVendor, CNTtsVendor, GlobalAvatarVendor, GlobalLlmVendor, GlobalMllmVendor, GlobalSttVendor, GlobalTtsVendor, LlmVendor, SttVendor, TtsVendor, } from "./region-vendors.js";
|
|
37
35
|
export { UnsupportedSessionOperationError } from "./session-backend.js";
|
|
38
36
|
export type { GenerateConvoAITokenOptions, GenerateTokenOptions, } from "./token.js";
|
|
39
37
|
export { ExpiresIn, generateConvoAIToken, generateRtcToken, MAX_EXPIRY_SECONDS, } from "./token.js";
|
|
40
|
-
export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AsrVendorName, AvatarConfig, AvatarWireVendor, CallOptions, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentGeneratedConfig, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsGeneratedLlmProvider, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GeminiAsrParams, GenericTts, GenericTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, GradiumTts, GradiumTtsParams, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmStyle, LlmTool, LlmToolExecution, LlmToolFunction, LlmToolServer, McpServer, McpServersItem, MicrosoftTts, MicrosoftTtsParams, MinimaxTts, MinimaxTtsParams, MistralTts, MistralTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTts, MurfTtsParams, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, RimeTts, RimeTtsParams, RtcConfig, SalConfig, SalMode, SarvamTts, SarvamTtsParams, SayOptions, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SmallestAiAsr, SmallestAiAsrParams, SmallestAiTts, SmallestAiTtsParams, SpatiusAvatarParams, SpeakPriority, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, SttConfig, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TurnDetectionConfig, TurnDetectionLanguage, TurnDetectionNestedConfig, TurnDetectionType, TypecastTts, TypecastTtsParams, XAiAsr, XAiAsrParams, XAiTts, XAiTtsParams, } from "./types.js";
|
|
38
|
+
export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AsrVendorName, AvatarConfig, AvatarWireVendor, CallOptions, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentGeneratedConfig, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsGeneratedLlmProvider, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GeminiAsrParams, GenericTts, GenericTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, GradiumTts, GradiumTtsParams, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmStyle, LlmTool, LlmToolExecution, LlmToolFunction, LlmToolServer, McpServer, McpServersItem, MicrosoftTts, MicrosoftTtsParams, MinimaxTts, MinimaxTtsParams, MistralTts, MistralTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTts, MurfTtsParams, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, RimeTts, RimeTtsParams, RtcConfig, RtzrAsr, RtzrAsrParams, SalConfig, SalMode, SarvamTts, SarvamTtsParams, SayOptions, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SmallestAiAsr, SmallestAiAsrParams, SmallestAiTts, SmallestAiTtsParams, SpatiusAvatarParams, SpeakConfig, SpeakPriority, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, SttConfig, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TurnDetectionConfig, TurnDetectionLanguage, TurnDetectionNestedConfig, TurnDetectionType, TypecastTts, TypecastTtsParams, XAiAsr, XAiAsrParams, XAiTts, XAiTtsParams, } from "./types.js";
|
|
41
39
|
export type { AssignNumberOptions, DeployOptions, SaveOptions, SecretRef, VariableDefinition } from "./v3.js";
|
|
42
40
|
export { DeployedAgent, NumberNotFoundError, SavedAgent, SecretRefNotSupportedError, secretRef, UnsupportedFieldError, } from "./v3.js";
|
|
43
41
|
export type { AkoolAvatarOptions, AnamAvatarOptions, GenericAvatarOptions, HeyGenAvatarOptions, LemonSliceOptions, LiveAvatarAvatarOptions, ProtofaceOptions, TavusOptions, } from "./vendors/avatar.js";
|
|
@@ -50,7 +48,7 @@ export type { AmazonBedrockOptions, AnthropicOptions, AzureOpenAIOptions, Custom
|
|
|
50
48
|
export { AmazonBedrock, Anthropic, AzureOpenAI, CustomLLM, Dify, Gemini, Groq, OpenAI, VertexAILLM, } from "./vendors/llm.js";
|
|
51
49
|
export type { AzureOpenAIRealtimeOptions, AzureOpenAIRealtimeParams, GeminiLiveModel, GeminiLiveOptions, GeminiLiveVoice, GeminiPreviewVoice, GeminiThinkingLevel, OpenAIGPTLiveOptions, OpenAIRealtimeOptions, QwenOmniOptions, VertexAIOptions, XaiGrokOptions, } from "./vendors/mllm.js";
|
|
52
50
|
export { AzureOpenAIRealtime, GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLive, GeminiLiveModels, GeminiThinkingLevels, OpenAIGPTLive, OpenAIRealtime, QwenOmni, VertexAI, XaiGrok, } from "./vendors/mllm.js";
|
|
53
|
-
export type { AmazonSTTOptions, AresSTTOptions, AssemblyAISTTOptions, DeepgramSTTOptions, GeminiSTTModel, GeminiSTTOptions, GoogleSTTOptions, MicrosoftSTTOptions, OpenAISTTOptions, SarvamSTTOptions, SmallestAISTTOptions, SpeechmaticsSTTOptions, XAiSTTOptions, } from "./vendors/stt.js";
|
|
54
|
-
export { AmazonSTT, AresSTT, AssemblyAISTT, DeepgramSTT, GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode, GoogleSTT, MicrosoftSTT, OpenAISTT, SarvamSTT, SmallestAISTT, SpeechmaticsSTT, XAiSTT, } from "./vendors/stt.js";
|
|
55
|
-
export type { AmazonTTSOptions, CartesiaTTSOptions, DeepgramTTSOptions, ElevenLabsTTSOptions, FishAudioTTSOptions, GenericTTSOptions, GoogleTTSOptions, GradiumTTSOptions, HumeAITTSOptions, MicrosoftTTSOptions, MiniMaxTTSOptions, MistralTTSOptions, MurfTTSOptions, OpenAITTSOptions, RimeTTSOptions, SarvamTTSOptions, SmallestAITTSOptions, TypecastTTSOptions, XAiTTSOptions, } from "./vendors/tts.js";
|
|
56
|
-
export { AmazonTTS, CartesiaTTS, DeepgramTTS, ElevenLabsTTS, FishAudioTTS, GenericTTS, GoogleTTS, GradiumTTS, HumeAITTS, MicrosoftTTS, MiniMaxTTS, MistralTTS, MurfTTS, OpenAITTS, RimeTTS, SarvamTTS, SmallestAITTS, TypecastTTS, XAiTTS, } from "./vendors/tts.js";
|
|
51
|
+
export type { AmazonSTTOptions, AresSTTOptions, AssemblyAISTTOptions, DeepgramSTTOptions, GeminiSTTModel, GeminiSTTOptions, GoogleSTTOptions, MicrosoftSTTOptions, OpenAISTTOptions, RTZRSTTOptions, SarvamSTTOptions, SmallestAISTTOptions, SpeechmaticsSTTOptions, XAiSTTOptions, } from "./vendors/stt.js";
|
|
52
|
+
export { AmazonSTT, AresSTT, AssemblyAISTT, DeepgramSTT, GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode, GoogleSTT, MicrosoftSTT, OpenAISTT, RTZRSTT, SarvamSTT, SmallestAISTT, SpeechmaticsSTT, XAiSTT, } from "./vendors/stt.js";
|
|
53
|
+
export type { AmazonTTSOptions, CartesiaTTSOptions, DeepgramTTSOptions, ElevenLabsTTSOptions, FishAudioTTSOptions, GeminiTTSConfig, GeminiTTSModel, GeminiTTSOptions, GenericTTSOptions, GoogleTTSOptions, GradiumTTSOptions, HumeAITTSOptions, MicrosoftTTSOptions, MiniMaxTTSOptions, MistralTTSOptions, MurfTTSOptions, OpenAITTSOptions, RimeTTSOptions, SarvamTTSOptions, SmallestAITTSOptions, TypecastTTSOptions, XAiTTSOptions, } from "./vendors/tts.js";
|
|
54
|
+
export { AmazonTTS, CartesiaTTS, DeepgramTTS, ElevenLabsTTS, FishAudioTTS, GeminiTTS, GeminiTTSModels, GenericTTS, GoogleTTS, GradiumTTS, HumeAITTS, MicrosoftTTS, MiniMaxTTS, MistralTTS, MurfTTS, OpenAITTS, RimeTTS, SarvamTTS, SarvamTTSLanguage, SmallestAITTS, TypecastTTS, XAiTTS, } from "./vendors/tts.js";
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
*/
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.PREVIEW_FEATURE_HEADER = exports.PREVIEW_API_BASE_URL = exports.createPreviewRoute = exports.normalizePresetInput = exports.AgentPresets = exports.redactSecrets = exports.redactHeadersForDebug = exports.REDACTED = exports.TurnDetectionTypeValues = exports.ThinkOnThinkingActionInterrupt = exports.ThinkOnThinkingActionIgnore = exports.ThinkOnSpeakingActionInterrupt = exports.ThinkOnSpeakingActionIgnore = exports.ThinkOnListeningActionInterrupt = exports.ThinkOnListeningActionInject = exports.ThinkOnListeningActionIgnore = exports.SpeakPriorityValues = exports.SpeakPriorityInterrupt = exports.SpeakPriorityIgnore = exports.SpeakPriorityAppend = exports.SilenceActionValues = exports.SalModeValues = exports.MllmTurnDetectionModeValues = exports.MllmTurnDetectionModeServerVad = exports.MllmTurnDetectionModeSemanticVad = exports.MllmTurnDetectionModeAgoraVad = exports.InterruptionModeValues = exports.InterruptionModeStartOfSpeech = exports.InterruptionModeKeywords = exports.InterruptionDisabledStrategyIgnore = exports.InterruptionDisabledStrategyAppend = exports.InterruptionDisabledStrategy = exports.Geofence = exports.FillerWordsSelectionRule = exports.DataChannel = exports.CredentialMode = exports.AudioScenario = exports.validateTtsSampleRate = exports.validateAvatarConfig = exports.toBaseAvatarConfig = exports.isSpatiusAvatar = exports.isSensetimeAvatar = exports.isLiveAvatarAvatar = exports.isHeyGenAvatar = exports.isGenericAvatar = exports.isAvatarTokenManaged = exports.isAnamAvatar = exports.isAkoolAvatar = exports.AgentSession = exports.Agent = void 0;
|
|
24
|
-
exports.TencentTTS = exports.TencentSTT = exports.TencentLLM = exports.StepFunTTS = exports.SpatiusAvatar = exports.SensetimeAvatar = exports.MiniMaxCNTTS = exports.MicrosoftCNTTS = exports.MicrosoftCNSTT = exports.FengmingSTT = exports.DeepSeekLLM = exports.CosyVoiceTTS = exports.BytedanceTTS = exports.BytedanceLLM = exports.BytedanceDuplexTTS = exports.AliyunLLM = exports.BaseTTS = exports.BaseSTT = exports.BaseMLLM = exports.BaseLLM = exports.BaseCNTTS = exports.BaseCNSTT = exports.BaseCNMLLM = exports.BaseCNLLM = exports.BaseCNAvatar = exports.BaseAvatar = exports.Tavus = exports.Protoface = exports.LiveAvatarAvatar = exports.LemonSlice = exports.HeyGenAvatar = exports.GenericAvatar = exports.AnamAvatar = exports.AkoolAvatar = exports.UnsupportedFieldError = exports.secretRef = exports.SecretRefNotSupportedError = exports.SavedAgent = exports.NumberNotFoundError = exports.DeployedAgent = exports.MAX_EXPIRY_SECONDS = exports.generateRtcToken = exports.generateConvoAIToken = exports.ExpiresIn = exports.UnsupportedSessionOperationError = exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.XAiTTS = exports.TypecastTTS = exports.SmallestAITTS = exports.SarvamTTS = exports.RimeTTS = exports.OpenAITTS = exports.MurfTTS = void 0;
|
|
24
|
+
exports.XfyunDialectSTT = exports.XfyunBigModelSTT = exports.TencentTTS = exports.TencentSTT = exports.TencentLLM = exports.StepFunTTS = exports.SpatiusAvatar = exports.SensetimeAvatar = exports.MiniMaxCNTTS = exports.MicrosoftCNTTS = exports.MicrosoftCNSTT = exports.FengmingSTT = exports.DeepSeekLLM = exports.CosyVoiceTTS = exports.BytedanceTTS = exports.BytedanceLLM = exports.BytedanceDuplexTTS = exports.AliyunLLM = exports.BaseTTS = exports.BaseSTT = exports.BaseMLLM = exports.BaseLLM = exports.BaseCNTTS = exports.BaseCNSTT = exports.BaseCNMLLM = exports.BaseCNLLM = exports.BaseCNAvatar = exports.BaseAvatar = exports.Tavus = exports.Protoface = exports.LiveAvatarAvatar = exports.LemonSlice = exports.HeyGenAvatar = exports.GenericAvatar = exports.AnamAvatar = exports.AkoolAvatar = exports.UnsupportedFieldError = exports.secretRef = exports.SecretRefNotSupportedError = exports.SavedAgent = exports.NumberNotFoundError = exports.DeployedAgent = exports.MAX_EXPIRY_SECONDS = exports.generateRtcToken = exports.generateConvoAIToken = exports.ExpiresIn = exports.UnsupportedSessionOperationError = exports.requiredPreviewFeatures = exports.previewRequestHeaders = exports.PreviewFeatures = void 0;
|
|
25
|
+
exports.MiniMaxTTS = exports.MicrosoftTTS = exports.HumeAITTS = exports.GradiumTTS = exports.GoogleTTS = exports.GenericTTS = exports.GeminiTTSModels = exports.GeminiTTS = exports.FishAudioTTS = exports.ElevenLabsTTS = exports.DeepgramTTS = exports.CartesiaTTS = exports.AmazonTTS = exports.XAiSTT = exports.SpeechmaticsSTT = exports.SmallestAISTT = exports.SarvamSTT = exports.RTZRSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.GoogleSTT = exports.GeminiTranscriptionMode = exports.GeminiSTTModels = exports.GeminiSTT = exports.DeepgramSTT = exports.AssemblyAISTT = exports.AresSTT = exports.AmazonSTT = exports.XaiGrok = exports.VertexAI = exports.QwenOmni = exports.OpenAIRealtime = exports.OpenAIGPTLive = exports.GeminiThinkingLevels = exports.GeminiLiveModels = exports.GeminiLive = exports.GEMINI_PREVIEW_MLLM_URL = exports.GEMINI_MLLM_URL = exports.GEMINI_MLLM_DEFAULT_MODEL = exports.AzureOpenAIRealtime = exports.VertexAILLM = exports.OpenAI = exports.Groq = exports.Gemini = exports.Dify = exports.CustomLLM = exports.AzureOpenAI = exports.Anthropic = exports.AmazonBedrock = exports.XfyunSTT = void 0;
|
|
26
|
+
exports.XAiTTS = exports.TypecastTTS = exports.SmallestAITTS = exports.SarvamTTSLanguage = exports.SarvamTTS = exports.RimeTTS = exports.OpenAITTS = exports.MurfTTS = exports.MistralTTS = void 0;
|
|
27
27
|
// Core classes
|
|
28
28
|
var Agent_js_1 = require("./Agent.js");
|
|
29
29
|
Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return Agent_js_1.Agent; } });
|
|
@@ -86,9 +86,6 @@ Object.defineProperty(exports, "PREVIEW_FEATURE_HEADER", { enumerable: true, get
|
|
|
86
86
|
Object.defineProperty(exports, "PreviewFeatures", { enumerable: true, get: function () { return client_js_1.PreviewFeatures; } });
|
|
87
87
|
Object.defineProperty(exports, "previewRequestHeaders", { enumerable: true, get: function () { return client_js_1.previewRequestHeaders; } });
|
|
88
88
|
Object.defineProperty(exports, "requiredPreviewFeatures", { enumerable: true, get: function () { return client_js_1.requiredPreviewFeatures; } });
|
|
89
|
-
var gemini_tts_js_1 = require("./preview/gemini-tts.js");
|
|
90
|
-
Object.defineProperty(exports, "GeminiTTS", { enumerable: true, get: function () { return gemini_tts_js_1.GeminiTTS; } });
|
|
91
|
-
Object.defineProperty(exports, "GeminiTTSModels", { enumerable: true, get: function () { return gemini_tts_js_1.GeminiTTSModels; } });
|
|
92
89
|
var session_backend_js_1 = require("./session-backend.js");
|
|
93
90
|
Object.defineProperty(exports, "UnsupportedSessionOperationError", { enumerable: true, get: function () { return session_backend_js_1.UnsupportedSessionOperationError; } });
|
|
94
91
|
// Token generation
|
|
@@ -183,6 +180,7 @@ Object.defineProperty(exports, "GeminiTranscriptionMode", { enumerable: true, ge
|
|
|
183
180
|
Object.defineProperty(exports, "GoogleSTT", { enumerable: true, get: function () { return stt_js_1.GoogleSTT; } });
|
|
184
181
|
Object.defineProperty(exports, "MicrosoftSTT", { enumerable: true, get: function () { return stt_js_1.MicrosoftSTT; } });
|
|
185
182
|
Object.defineProperty(exports, "OpenAISTT", { enumerable: true, get: function () { return stt_js_1.OpenAISTT; } });
|
|
183
|
+
Object.defineProperty(exports, "RTZRSTT", { enumerable: true, get: function () { return stt_js_1.RTZRSTT; } });
|
|
186
184
|
Object.defineProperty(exports, "SarvamSTT", { enumerable: true, get: function () { return stt_js_1.SarvamSTT; } });
|
|
187
185
|
Object.defineProperty(exports, "SmallestAISTT", { enumerable: true, get: function () { return stt_js_1.SmallestAISTT; } });
|
|
188
186
|
Object.defineProperty(exports, "SpeechmaticsSTT", { enumerable: true, get: function () { return stt_js_1.SpeechmaticsSTT; } });
|
|
@@ -194,6 +192,8 @@ Object.defineProperty(exports, "CartesiaTTS", { enumerable: true, get: function
|
|
|
194
192
|
Object.defineProperty(exports, "DeepgramTTS", { enumerable: true, get: function () { return tts_js_1.DeepgramTTS; } });
|
|
195
193
|
Object.defineProperty(exports, "ElevenLabsTTS", { enumerable: true, get: function () { return tts_js_1.ElevenLabsTTS; } });
|
|
196
194
|
Object.defineProperty(exports, "FishAudioTTS", { enumerable: true, get: function () { return tts_js_1.FishAudioTTS; } });
|
|
195
|
+
Object.defineProperty(exports, "GeminiTTS", { enumerable: true, get: function () { return tts_js_1.GeminiTTS; } });
|
|
196
|
+
Object.defineProperty(exports, "GeminiTTSModels", { enumerable: true, get: function () { return tts_js_1.GeminiTTSModels; } });
|
|
197
197
|
Object.defineProperty(exports, "GenericTTS", { enumerable: true, get: function () { return tts_js_1.GenericTTS; } });
|
|
198
198
|
Object.defineProperty(exports, "GoogleTTS", { enumerable: true, get: function () { return tts_js_1.GoogleTTS; } });
|
|
199
199
|
Object.defineProperty(exports, "GradiumTTS", { enumerable: true, get: function () { return tts_js_1.GradiumTTS; } });
|
|
@@ -205,6 +205,7 @@ Object.defineProperty(exports, "MurfTTS", { enumerable: true, get: function () {
|
|
|
205
205
|
Object.defineProperty(exports, "OpenAITTS", { enumerable: true, get: function () { return tts_js_1.OpenAITTS; } });
|
|
206
206
|
Object.defineProperty(exports, "RimeTTS", { enumerable: true, get: function () { return tts_js_1.RimeTTS; } });
|
|
207
207
|
Object.defineProperty(exports, "SarvamTTS", { enumerable: true, get: function () { return tts_js_1.SarvamTTS; } });
|
|
208
|
+
Object.defineProperty(exports, "SarvamTTSLanguage", { enumerable: true, get: function () { return tts_js_1.SarvamTTSLanguage; } });
|
|
208
209
|
Object.defineProperty(exports, "SmallestAITTS", { enumerable: true, get: function () { return tts_js_1.SmallestAITTS; } });
|
|
209
210
|
Object.defineProperty(exports, "TypecastTTS", { enumerable: true, get: function () { return tts_js_1.TypecastTTS; } });
|
|
210
211
|
Object.defineProperty(exports, "XAiTTS", { enumerable: true, get: function () { return tts_js_1.XAiTTS; } });
|
|
@@ -93,10 +93,10 @@ function omitUndefinedKeys(value) {
|
|
|
93
93
|
return Object.keys(next).length > 0 ? next : undefined;
|
|
94
94
|
}
|
|
95
95
|
function inferAsrPreset(asr) {
|
|
96
|
-
var _a, _b, _c;
|
|
97
|
-
if (!asr || asr.vendor !== "deepgram" || ((_a = asr.params) === null || _a === void 0 ? void 0 : _a.key))
|
|
96
|
+
var _a, _b, _c, _d;
|
|
97
|
+
if (!asr || asr.vendor !== "deepgram" || ((_a = asr.params) === null || _a === void 0 ? void 0 : _a.api_key) || ((_b = asr.params) === null || _b === void 0 ? void 0 : _b.key))
|
|
98
98
|
return undefined;
|
|
99
|
-
const preset = deepgramModelToPreset[(
|
|
99
|
+
const preset = deepgramModelToPreset[(_d = normalizeModelName((_c = asr.params) === null || _c === void 0 ? void 0 : _c.model)) !== null && _d !== void 0 ? _d : ""];
|
|
100
100
|
if (!preset)
|
|
101
101
|
return undefined;
|
|
102
102
|
return {
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* and binds that session to the preview host while ordinary AgoraClient calls
|
|
8
8
|
* remain on the regional production endpoint.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Preview registrations are temporary. When a provider ships on the production
|
|
11
|
+
* gateway, remove its registration and move its class into the corresponding
|
|
12
|
+
* production vendor module, retaining historical imports as aliases.
|
|
13
13
|
*/
|
|
14
14
|
import type { AgoraClient } from "../../AgoraPoolClient.js";
|
|
15
15
|
import type * as Agora from "../../api/index.js";
|
|
@@ -31,7 +31,7 @@ export declare const PREVIEW_FEATURE_HEADER = "agora-feature";
|
|
|
31
31
|
* preview endpoint.
|
|
32
32
|
*/
|
|
33
33
|
export declare const PreviewFeatures: {
|
|
34
|
-
/**
|
|
34
|
+
/** @deprecated Gemini ASR, Live, and TTS now use the production endpoint. */
|
|
35
35
|
readonly GeminiLive: "gemini-live";
|
|
36
36
|
/** @deprecated GPT Live now uses the production endpoint. */
|
|
37
37
|
readonly LiveModels: "live-models";
|
|
@@ -52,7 +52,8 @@ export interface PreviewRoute {
|
|
|
52
52
|
export declare function previewRequestHeaders(features: readonly PreviewFeature[], headers?: Record<string, string>): Record<string, string>;
|
|
53
53
|
/** Build generated resource clients for one preview session. */
|
|
54
54
|
export declare function createPreviewRoute(client: AgoraClient, features: readonly PreviewFeature[]): PreviewRoute;
|
|
55
|
-
|
|
55
|
+
/** Compatibility helper; all formerly registered providers now use production. */
|
|
56
|
+
export declare function requiredPreviewFeatures(_properties: Agora.StartAgentsRequest.Properties): PreviewFeature[];
|
|
56
57
|
/**
|
|
57
58
|
* Normalizes the historical Gemini preview greeting field for production.
|
|
58
59
|
* Kept under its old name so callers importing this compatibility helper do
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* and binds that session to the preview host while ordinary AgoraClient calls
|
|
9
9
|
* remain on the regional production endpoint.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Preview registrations are temporary. When a provider ships on the production
|
|
12
|
+
* gateway, remove its registration and move its class into the corresponding
|
|
13
|
+
* production vendor module, retaining historical imports as aliases.
|
|
14
14
|
*/
|
|
15
15
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
16
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -45,7 +45,7 @@ exports.PREVIEW_FEATURE_HEADER = "agora-feature";
|
|
|
45
45
|
* preview endpoint.
|
|
46
46
|
*/
|
|
47
47
|
exports.PreviewFeatures = {
|
|
48
|
-
/**
|
|
48
|
+
/** @deprecated Gemini ASR, Live, and TTS now use the production endpoint. */
|
|
49
49
|
GeminiLive: "gemini-live",
|
|
50
50
|
/** @deprecated GPT Live now uses the production endpoint. */
|
|
51
51
|
LiveModels: "live-models",
|
|
@@ -74,9 +74,9 @@ function createPreviewRoute(client, features) {
|
|
|
74
74
|
features: [...features],
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return
|
|
77
|
+
/** Compatibility helper; all formerly registered providers now use production. */
|
|
78
|
+
function requiredPreviewFeatures(_properties) {
|
|
79
|
+
return [];
|
|
80
80
|
}
|
|
81
81
|
const PRODUCTION_GEMINI_MLLM_MODELS = new Set([
|
|
82
82
|
"models/gemini-3.8-live",
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
readonly Flash38: "gemini-3.8-flash-tts";
|
|
5
|
-
};
|
|
6
|
-
export type GeminiTTSModel = (typeof GeminiTTSModels)[keyof typeof GeminiTTSModels] | (string & {});
|
|
7
|
-
export interface GeminiTTSOptions {
|
|
8
|
-
apiKey: string;
|
|
9
|
-
/** Sent verbatim; defaults to Gemini 3.8 Flash TTS. */
|
|
10
|
-
model?: GeminiTTSModel;
|
|
11
|
-
/** Defaults to Puck. */
|
|
12
|
-
voice?: string;
|
|
13
|
-
/** Natural-language speaking instructions. Omitted unless supplied. */
|
|
14
|
-
style?: string;
|
|
15
|
-
}
|
|
16
|
-
/** Preview wire shape, kept separate from the generated production schema. */
|
|
17
|
-
export interface GeminiTTSConfig {
|
|
18
|
-
vendor: "gemini";
|
|
19
|
-
params: {
|
|
20
|
-
api_key: string;
|
|
21
|
-
model: string;
|
|
22
|
-
voice: string;
|
|
23
|
-
style?: string;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/** Preview-only TTS. AgentSession selects the gemini-live gate automatically. */
|
|
27
|
-
export declare class GeminiTTS extends BaseTTS {
|
|
28
|
-
private readonly options;
|
|
29
|
-
constructor(options: GeminiTTSOptions);
|
|
30
|
-
toConfig(): GeminiTTSConfig;
|
|
31
|
-
}
|
|
1
|
+
/** Legacy preview import aliases for the production Gemini TTS implementation. */
|
|
2
|
+
export type { GeminiTTSConfig, GeminiTTSModel, GeminiTTSOptions } from "../vendors/tts.js";
|
|
3
|
+
export { GeminiTTS, GeminiTTSModels } from "../vendors/tts.js";
|
|
@@ -1,32 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.GeminiTTSModels
|
|
7
|
-
Flash38: "gemini-3.8-flash-tts",
|
|
8
|
-
};
|
|
9
|
-
/** Preview-only TTS. AgentSession selects the gemini-live gate automatically. */
|
|
10
|
-
class GeminiTTS extends base_js_1.BaseTTS {
|
|
11
|
-
constructor(options) {
|
|
12
|
-
super();
|
|
13
|
-
for (const field of ["apiKey", "model", "voice"]) {
|
|
14
|
-
const value = options[field];
|
|
15
|
-
if ((field === "apiKey" || value !== undefined) && (typeof value !== "string" || !value.trim())) {
|
|
16
|
-
throw new Error(`GeminiTTS requires ${field}`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
if (options.style !== undefined && typeof options.style !== "string") {
|
|
20
|
-
throw new Error("GeminiTTS style must be a string");
|
|
21
|
-
}
|
|
22
|
-
this.options = Object.assign({}, options);
|
|
23
|
-
}
|
|
24
|
-
toConfig() {
|
|
25
|
-
const { apiKey, model = exports.GeminiTTSModels.Flash38, voice = "Puck", style } = this.options;
|
|
26
|
-
return {
|
|
27
|
-
vendor: "gemini",
|
|
28
|
-
params: Object.assign({ api_key: apiKey, model, voice }, (style !== undefined && { style })),
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.GeminiTTS = GeminiTTS;
|
|
3
|
+
exports.GeminiTTSModels = exports.GeminiTTS = void 0;
|
|
4
|
+
var tts_js_1 = require("../vendors/tts.js");
|
|
5
|
+
Object.defineProperty(exports, "GeminiTTS", { enumerable: true, get: function () { return tts_js_1.GeminiTTS; } });
|
|
6
|
+
Object.defineProperty(exports, "GeminiTTSModels", { enumerable: true, get: function () { return tts_js_1.GeminiTTSModels; } });
|
|
@@ -8,9 +8,9 @@ export type { OpenAIGPTLiveOptions } from "../vendors/mllm.js";
|
|
|
8
8
|
export { OpenAIGPTLive } from "../vendors/mllm.js";
|
|
9
9
|
export type { GeminiSTTModel, GeminiSTTOptions } from "../vendors/stt.js";
|
|
10
10
|
export { GeminiSTT, GeminiSTTModels, GeminiTranscriptionMode } from "../vendors/stt.js";
|
|
11
|
+
export type { GeminiTTSConfig, GeminiTTSModel, GeminiTTSOptions } from "../vendors/tts.js";
|
|
12
|
+
export { GeminiTTS, GeminiTTSModels } from "../vendors/tts.js";
|
|
11
13
|
export type { PreviewFeature, PreviewRoute } from "./client.js";
|
|
12
14
|
export { applyPreviewShape, createPreviewRoute, PREVIEW_API_BASE_URL, PREVIEW_FEATURE_HEADER, PreviewFeatures, previewRequestHeaders, requiredPreviewFeatures, } from "./client.js";
|
|
13
|
-
export type { GeminiTTSConfig, GeminiTTSModel, GeminiTTSOptions } from "./gemini-tts.js";
|
|
14
|
-
export { GeminiTTS, GeminiTTSModels } from "./gemini-tts.js";
|
|
15
15
|
export type { GeminiLiveModel, GeminiLiveVoice, GeminiPreviewVoice, GeminiThinkingLevel, } from "./vendors.js";
|
|
16
16
|
export { GEMINI_MLLM_DEFAULT_MODEL, GEMINI_MLLM_URL, GEMINI_PREVIEW_MLLM_URL, GeminiLiveModels, GeminiThinkingLevels, } from "./vendors.js";
|
|
@@ -6,13 +6,16 @@
|
|
|
6
6
|
* the production vendor modules independently.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.GeminiThinkingLevels = exports.GeminiLiveModels = exports.GEMINI_PREVIEW_MLLM_URL = exports.GEMINI_MLLM_URL = exports.GEMINI_MLLM_DEFAULT_MODEL = exports.
|
|
9
|
+
exports.GeminiThinkingLevels = exports.GeminiLiveModels = exports.GEMINI_PREVIEW_MLLM_URL = exports.GEMINI_MLLM_URL = exports.GEMINI_MLLM_DEFAULT_MODEL = exports.requiredPreviewFeatures = exports.previewRequestHeaders = exports.PreviewFeatures = exports.PREVIEW_FEATURE_HEADER = exports.PREVIEW_API_BASE_URL = exports.createPreviewRoute = exports.applyPreviewShape = exports.GeminiTTSModels = exports.GeminiTTS = exports.GeminiTranscriptionMode = exports.GeminiSTTModels = exports.GeminiSTT = exports.OpenAIGPTLive = void 0;
|
|
10
10
|
var mllm_js_1 = require("../vendors/mllm.js");
|
|
11
11
|
Object.defineProperty(exports, "OpenAIGPTLive", { enumerable: true, get: function () { return mllm_js_1.OpenAIGPTLive; } });
|
|
12
12
|
var stt_js_1 = require("../vendors/stt.js");
|
|
13
13
|
Object.defineProperty(exports, "GeminiSTT", { enumerable: true, get: function () { return stt_js_1.GeminiSTT; } });
|
|
14
14
|
Object.defineProperty(exports, "GeminiSTTModels", { enumerable: true, get: function () { return stt_js_1.GeminiSTTModels; } });
|
|
15
15
|
Object.defineProperty(exports, "GeminiTranscriptionMode", { enumerable: true, get: function () { return stt_js_1.GeminiTranscriptionMode; } });
|
|
16
|
+
var tts_js_1 = require("../vendors/tts.js");
|
|
17
|
+
Object.defineProperty(exports, "GeminiTTS", { enumerable: true, get: function () { return tts_js_1.GeminiTTS; } });
|
|
18
|
+
Object.defineProperty(exports, "GeminiTTSModels", { enumerable: true, get: function () { return tts_js_1.GeminiTTSModels; } });
|
|
16
19
|
var client_js_1 = require("./client.js");
|
|
17
20
|
Object.defineProperty(exports, "applyPreviewShape", { enumerable: true, get: function () { return client_js_1.applyPreviewShape; } });
|
|
18
21
|
Object.defineProperty(exports, "createPreviewRoute", { enumerable: true, get: function () { return client_js_1.createPreviewRoute; } });
|
|
@@ -21,9 +24,6 @@ Object.defineProperty(exports, "PREVIEW_FEATURE_HEADER", { enumerable: true, get
|
|
|
21
24
|
Object.defineProperty(exports, "PreviewFeatures", { enumerable: true, get: function () { return client_js_1.PreviewFeatures; } });
|
|
22
25
|
Object.defineProperty(exports, "previewRequestHeaders", { enumerable: true, get: function () { return client_js_1.previewRequestHeaders; } });
|
|
23
26
|
Object.defineProperty(exports, "requiredPreviewFeatures", { enumerable: true, get: function () { return client_js_1.requiredPreviewFeatures; } });
|
|
24
|
-
var gemini_tts_js_1 = require("./gemini-tts.js");
|
|
25
|
-
Object.defineProperty(exports, "GeminiTTS", { enumerable: true, get: function () { return gemini_tts_js_1.GeminiTTS; } });
|
|
26
|
-
Object.defineProperty(exports, "GeminiTTSModels", { enumerable: true, get: function () { return gemini_tts_js_1.GeminiTTSModels; } });
|
|
27
27
|
var vendors_js_1 = require("./vendors.js");
|
|
28
28
|
Object.defineProperty(exports, "GEMINI_MLLM_DEFAULT_MODEL", { enumerable: true, get: function () { return vendors_js_1.GEMINI_MLLM_DEFAULT_MODEL; } });
|
|
29
29
|
Object.defineProperty(exports, "GEMINI_MLLM_URL", { enumerable: true, get: function () { return vendors_js_1.GEMINI_MLLM_URL; } });
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* - RTC tokens authenticate a specific (appId, channel, uid) combination with
|
|
5
5
|
* the Agora RTC network.
|
|
6
|
-
* - ConvoAI tokens are
|
|
7
|
-
* REST API calls via `Authorization: agora token=<token>`.
|
|
6
|
+
* - ConvoAI tokens are RTC + RTM + ConvoAI tokens used to authenticate
|
|
7
|
+
* ConvoAI REST API calls via `Authorization: agora token=<token>`.
|
|
8
8
|
*
|
|
9
|
-
* The `agora-token` library handles the
|
|
9
|
+
* The `agora-token` library handles the AccessToken2 signing.
|
|
10
10
|
*/
|
|
11
11
|
export declare const MAX_EXPIRY_SECONDS = 86400;
|
|
12
12
|
/**
|
|
@@ -79,18 +79,20 @@ export interface GenerateConvoAITokenOptions {
|
|
|
79
79
|
/** Seconds until the token expires (default: 86400) */
|
|
80
80
|
tokenExpire?: number;
|
|
81
81
|
/**
|
|
82
|
-
* Seconds until privileges expire. Defaults to
|
|
82
|
+
* Seconds until RTC privileges expire. Defaults to `tokenExpire`.
|
|
83
|
+
* RTM login retains the token lifetime; ConvoAI carries no privilege map.
|
|
83
84
|
* Per Agora docs, setting this to 0 would expire privileges immediately — the SDK
|
|
84
85
|
* always substitutes `tokenExpire` when this is 0 or omitted.
|
|
85
86
|
*/
|
|
86
87
|
privilegeExpire?: number;
|
|
87
88
|
}
|
|
88
89
|
/**
|
|
89
|
-
* Builds a
|
|
90
|
+
* Builds a ConvoAI token carrying RTC, RTM, and ConvoAI services for REST API authentication.
|
|
90
91
|
*
|
|
91
92
|
* The resulting token is used as: `Authorization: agora token=<token>`
|
|
92
93
|
*
|
|
93
|
-
* Uses `
|
|
94
|
-
*
|
|
94
|
+
* Uses `ConvoAITokenBuilder.buildTokenWithPrivilege`, which adds the ConvoAI service marker
|
|
95
|
+
* required by the ConvoAI REST API alongside RTC channel access and RTM login
|
|
96
|
+
* privileges in a single AccessToken2 token.
|
|
95
97
|
*/
|
|
96
98
|
export declare function generateConvoAIToken(opts: GenerateConvoAITokenOptions): string;
|