agora-agents 3.0.0-alpha.1 → 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 +11 -5
- package/dist/cjs/AgoraPoolClient.d.ts +19 -6
- package/dist/cjs/AgoraPoolClient.js +27 -11
- package/dist/cjs/agentkit/Agent.d.ts +7 -1
- package/dist/cjs/agentkit/Agent.js +83 -50
- 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/session-backend.d.ts +5 -3
- package/dist/cjs/agentkit/session-backend.js +69 -8
- package/dist/cjs/agentkit/token.d.ts +9 -7
- package/dist/cjs/agentkit/token.js +8 -7
- package/dist/cjs/agentkit/types.d.ts +20 -5
- package/dist/cjs/agentkit/v3.d.ts +5 -1
- package/dist/cjs/agentkit/v3.js +65 -17
- package/dist/cjs/agentkit/vendors/avatar.d.ts +30 -12
- package/dist/cjs/agentkit/vendors/avatar.js +62 -5
- package/dist/cjs/agentkit/vendors/llm.d.ts +7 -7
- package/dist/cjs/agentkit/vendors/llm.js +26 -22
- 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 +92 -18
- package/dist/cjs/agentkit/vendors/tts.js +65 -13
- 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/contract.js +113 -4
- package/dist/cjs/v3/resources.js +0 -1
- package/dist/cjs/v3/transport.js +4 -3
- package/dist/cjs/v3/types.d.ts +13 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/AgoraPoolClient.d.mts +19 -6
- package/dist/esm/AgoraPoolClient.mjs +27 -11
- package/dist/esm/agentkit/Agent.d.mts +7 -1
- package/dist/esm/agentkit/Agent.mjs +84 -51
- 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/session-backend.d.mts +5 -3
- package/dist/esm/agentkit/session-backend.mjs +68 -8
- package/dist/esm/agentkit/token.d.mts +9 -7
- package/dist/esm/agentkit/token.mjs +8 -7
- package/dist/esm/agentkit/types.d.mts +20 -5
- package/dist/esm/agentkit/v3.d.mts +5 -1
- package/dist/esm/agentkit/v3.mjs +66 -18
- package/dist/esm/agentkit/vendors/avatar.d.mts +30 -12
- package/dist/esm/agentkit/vendors/avatar.mjs +59 -8
- package/dist/esm/agentkit/vendors/llm.d.mts +7 -7
- package/dist/esm/agentkit/vendors/llm.mjs +26 -22
- 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 +92 -18
- package/dist/esm/agentkit/vendors/tts.mjs +63 -12
- 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/contract.mjs +113 -4
- package/dist/esm/v3/resources.mjs +0 -1
- package/dist/esm/v3/transport.mjs +4 -3
- package/dist/esm/v3/types.d.mts +13 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/openapi.yaml +86 -9
- package/package.json +6 -4
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
|
|
@@ -260,9 +260,9 @@ See the [MLLM Flow guide](./docs/guides/mllm-flow.md) for full examples with Gem
|
|
|
260
260
|
|
|
261
261
|
## Avatars
|
|
262
262
|
|
|
263
|
-
AgentKit supports LiveAvatar, Generic Avatar, Anam, Akool, SenseTime (CN), and deprecated HeyGen. Avatar `agoraToken` is optional: when omitted, `session.start()` generates a token using the same ConvoAI token format as the agent token, scoped to the avatar `agoraUid`. Avatars require the cascading ASR + LLM + TTS pipeline (not MLLM).
|
|
263
|
+
AgentKit supports LiveAvatar, Generic Avatar (including Tavus, Protoface, and LemonSlice), Anam, Akool, SenseTime (CN), and deprecated HeyGen. Avatar `agoraToken` is optional: when omitted, `session.start()` generates a token using the same ConvoAI token format as the agent token, scoped to the avatar `agoraUid`. Avatars require the cascading ASR + LLM + TTS pipeline (not MLLM).
|
|
264
264
|
|
|
265
|
-
See the [Avatar Integration guide](./docs/guides/avatars.md) for sample-rate requirements and Generic Avatar setup.
|
|
265
|
+
See the [Avatar Integration guide](./docs/guides/avatars.md) for sample-rate requirements, provider URL defaults, LemonSlice image/agent selectors and aspect ratios, and Generic Avatar setup.
|
|
266
266
|
|
|
267
267
|
## Documentation
|
|
268
268
|
|
|
@@ -280,3 +280,9 @@ See the [Avatar Integration guide](./docs/guides/avatars.md) for sample-rate req
|
|
|
280
280
|
|
|
281
281
|
- [SDK Reference](./reference.md)
|
|
282
282
|
- [Agora Conversational AI Docs](https://docs.agora.io/en/conversational-ai/overview)
|
|
283
|
+
|
|
284
|
+
### Installing a preview checkout
|
|
285
|
+
|
|
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
|
+
|
|
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"> {
|
|
@@ -19,11 +20,19 @@ export declare namespace AgoraClient {
|
|
|
19
20
|
v3?: V3Options;
|
|
20
21
|
/** Agora App ID — used as the `appid` path parameter and for RTC token generation */
|
|
21
22
|
appId: string;
|
|
22
|
-
|
|
23
|
-
|
|
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;
|
|
24
30
|
}
|
|
25
31
|
/** Use a pre-built Agora token for REST API authentication. Pass the raw token; the SDK sets `Authorization: agora token=<authToken>` automatically. */
|
|
26
32
|
interface TokenAuthOptions {
|
|
33
|
+
customerId?: never;
|
|
34
|
+
customerSecret?: never;
|
|
35
|
+
appCertificate?: string;
|
|
27
36
|
authToken: string;
|
|
28
37
|
}
|
|
29
38
|
/**
|
|
@@ -31,9 +40,12 @@ export declare namespace AgoraClient {
|
|
|
31
40
|
* ConvoAI token per API call — no Customer Secret required.
|
|
32
41
|
*/
|
|
33
42
|
interface AppCredentialsOptions {
|
|
43
|
+
customerId?: never;
|
|
44
|
+
customerSecret?: never;
|
|
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:
|
|
@@ -75,7 +88,7 @@ export declare class AgoraClient<TArea extends AgoraArea = AgoraArea> extends Ba
|
|
|
75
88
|
/** Agora App ID */
|
|
76
89
|
readonly appId: string;
|
|
77
90
|
/** Agora App Certificate (used for RTC token signing) */
|
|
78
|
-
readonly appCertificate: string;
|
|
91
|
+
readonly appCertificate: string | undefined;
|
|
79
92
|
/** The active authentication mode */
|
|
80
93
|
readonly authMode: AgoraAuthMode;
|
|
81
94
|
/** The configured routing area */
|
|
@@ -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,27 +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
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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";
|
|
135
|
+
if (authMode === "app-credentials" && !appCertificate)
|
|
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
|
+
};
|
|
128
144
|
const originalFetch = (_a = options.fetch) !== null && _a !== void 0 ? _a : globalThis.fetch;
|
|
129
|
-
const
|
|
145
|
+
const authenticatedFetch = (input, init) => __awaiter(this, void 0, void 0, function* () {
|
|
130
146
|
const finalHeaders = new Headers(input instanceof Request ? input.headers : undefined);
|
|
131
147
|
new Headers(init === null || init === void 0 ? void 0 : init.headers).forEach((value, key) => finalHeaders.set(key, value));
|
|
132
148
|
const auth = finalHeaders.get("authorization");
|
|
133
|
-
if (auth !== null
|
|
134
|
-
|
|
149
|
+
if (auth !== null)
|
|
150
|
+
(0, publicAuthorization_js_1.validatePublicAuthorization)(auth);
|
|
135
151
|
for (const name of finalHeaders.keys())
|
|
136
152
|
if ((0, publicHeaders_js_1.isInternalHeader)(name))
|
|
137
153
|
throw new Error(`${name} is an internal header and is not supported`);
|
|
138
154
|
return originalFetch(input, init);
|
|
139
155
|
});
|
|
140
|
-
super(Object.assign(Object.assign({}, rest), { fetch:
|
|
156
|
+
super(Object.assign(Object.assign({}, rest), { fetch: authenticatedFetch, username: "", password: "", authorization, baseUrl: () => pool.getCurrentURL() }));
|
|
141
157
|
this._pool = pool;
|
|
142
158
|
this.appId = appId;
|
|
143
159
|
this.appCertificate = appCertificate;
|
|
@@ -11,7 +11,7 @@ import type * as Agora from "../api/index.js";
|
|
|
11
11
|
import { AgentSession } from "./AgentSession.js";
|
|
12
12
|
import type { AgoraArea } from "./area.js";
|
|
13
13
|
import type { AvatarVendor, CNMllmVendor, GlobalMllmVendor, LlmVendor, SttVendor, TtsVendor } from "./region-vendors.js";
|
|
14
|
-
import type { AdvancedFeatures, AvatarConfig, FillerWordsConfig, GeofenceConfig, InterruptionConfig, Labels, LlmConfig, LlmGreetingConfigs, MllmConfig, ParametersAudioScenario, RtcConfig, SalConfig, SessionOptions, SessionParamsInput, SttConfig, TtsConfig, TurnDetectionConfig } from "./types.js";
|
|
14
|
+
import type { AdvancedFeatures, AvatarConfig, CallOptions, FillerWordsConfig, GeofenceConfig, InterruptionConfig, Labels, LlmConfig, LlmGreetingConfigs, MllmConfig, ParametersAudioScenario, RtcConfig, SalConfig, SessionOptions, SessionParamsInput, SttConfig, TtsConfig, TurnDetectionConfig } from "./types.js";
|
|
15
15
|
/**
|
|
16
16
|
* Configuration options for creating an Agent.
|
|
17
17
|
*
|
|
@@ -420,6 +420,11 @@ export declare class Agent<TTSSampleRate extends number = number, TArea extends
|
|
|
420
420
|
/** Compatibility alias for save(). */
|
|
421
421
|
deploy(options?: DeployOptions): Promise<DeployedAgent>;
|
|
422
422
|
createSession(options: SessionOptions): AgentSession;
|
|
423
|
+
/** Start an unsaved configuration explicitly through the Platform API. */
|
|
424
|
+
createEphemeralSession(options: SessionOptions): AgentSession;
|
|
425
|
+
/** Create an outbound phone-call session from this unsaved configuration. */
|
|
426
|
+
call(options: CallOptions): AgentSession;
|
|
427
|
+
private _createPlatformSession;
|
|
423
428
|
/**
|
|
424
429
|
* Converts the Agent configuration to the Fern request properties format.
|
|
425
430
|
*
|
|
@@ -463,6 +468,7 @@ export declare class Agent<TTSSampleRate extends number = number, TArea extends
|
|
|
463
468
|
* If a new private field is added to Agent, it MUST also be added here.
|
|
464
469
|
*/
|
|
465
470
|
private _clone;
|
|
471
|
+
private _resolvePlatformAsrConfig;
|
|
466
472
|
private _resolveAsrConfig;
|
|
467
473
|
private _resolveTurnDetectionConfig;
|
|
468
474
|
}
|
|
@@ -591,8 +591,8 @@ class Agent {
|
|
|
591
591
|
var _a, _b;
|
|
592
592
|
const config = this.config;
|
|
593
593
|
if (config.mllm === undefined && (config.stt !== undefined || ((_a = config.turnDetection) === null || _a === void 0 ? void 0 : _a.language) !== undefined)) {
|
|
594
|
-
//
|
|
595
|
-
config.stt = this.
|
|
594
|
+
// Keep Platform language precedence separate from legacy interaction defaults.
|
|
595
|
+
config.stt = this._resolvePlatformAsrConfig();
|
|
596
596
|
}
|
|
597
597
|
return (0, v3_js_1.deployAgent)(this._client, (0, v3_js_1.buildV3Agent)(config, this._variables, (_b = options.name) !== null && _b !== void 0 ? _b : `agent-${Date.now()}`), options);
|
|
598
598
|
}
|
|
@@ -601,10 +601,10 @@ class Agent {
|
|
|
601
601
|
return this.save(options);
|
|
602
602
|
}
|
|
603
603
|
createSession(options) {
|
|
604
|
-
var _a, _b
|
|
604
|
+
var _a, _b;
|
|
605
605
|
if ("clientReference" in options || "client_reference" in options)
|
|
606
606
|
throw new Error("client_reference is being removed; use the returned session ID for correlation");
|
|
607
|
-
const
|
|
607
|
+
const _c = this.config, { client: _client } = _c, config = __rest(_c, ["client"]);
|
|
608
608
|
let requiresStoredSession = Object.keys(this._variables).length > 0 ||
|
|
609
609
|
options.values !== undefined ||
|
|
610
610
|
options.idempotencyKey !== undefined ||
|
|
@@ -624,50 +624,66 @@ class Agent {
|
|
|
624
624
|
else
|
|
625
625
|
throw error;
|
|
626
626
|
}
|
|
627
|
-
if (requiresStoredSession)
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
627
|
+
if (requiresStoredSession)
|
|
628
|
+
return this.createEphemeralSession(options);
|
|
629
|
+
const name = (_a = options.name) !== null && _a !== void 0 ? _a : `agent-${Date.now()}`;
|
|
630
|
+
return new AgentSession_js_1.AgentSession(Object.assign(Object.assign({ client: this._client, agent: this, appId: this._client.appId, appCertificate: this._client.appCertificate }, options), { agentUid: (_b = options.agentUid) !== null && _b !== void 0 ? _b : "0", name }));
|
|
631
|
+
}
|
|
632
|
+
/** Start an unsaved configuration explicitly through the Platform API. */
|
|
633
|
+
createEphemeralSession(options) {
|
|
634
|
+
return this._createPlatformSession(options);
|
|
635
|
+
}
|
|
636
|
+
/** Create an outbound phone-call session from this unsaved configuration. */
|
|
637
|
+
call(options) {
|
|
638
|
+
return this._createPlatformSession((0, session_backend_js_1.callSessionOptions)(options), {
|
|
639
|
+
type: "telephony",
|
|
640
|
+
from: options.from,
|
|
641
|
+
to: options.to,
|
|
642
|
+
call_policy: options.callPolicy,
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
_createPlatformSession(options, transport) {
|
|
646
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
647
|
+
const normalized = this.config;
|
|
648
|
+
const sessionOptions = Object.assign({}, options);
|
|
649
|
+
if (normalized.geofence !== undefined) {
|
|
650
|
+
(_a = sessionOptions.geofence) !== null && _a !== void 0 ? _a : (sessionOptions.geofence = Object.assign({ area: normalized.geofence.area.toLowerCase() }, (normalized.geofence.exclude_area === undefined
|
|
651
|
+
? {}
|
|
652
|
+
: {
|
|
653
|
+
exclude_area: normalized.geofence.exclude_area.toLowerCase(),
|
|
654
|
+
})));
|
|
655
|
+
normalized.geofence = undefined;
|
|
656
|
+
}
|
|
657
|
+
const params = Object.assign({}, normalized.parameters);
|
|
658
|
+
if (params.opt_out !== undefined) {
|
|
659
|
+
(_b = sessionOptions.dataPolicy) !== null && _b !== void 0 ? _b : (sessionOptions.dataPolicy = { retention: params.opt_out ? "none" : "30_days" });
|
|
660
|
+
delete params.opt_out;
|
|
661
|
+
}
|
|
662
|
+
if (params.farewell_config !== undefined) {
|
|
663
|
+
const farewell = params.farewell_config;
|
|
664
|
+
(_c = sessionOptions.gracefulStop) !== null && _c !== void 0 ? _c : (sessionOptions.gracefulStop = {
|
|
665
|
+
enabled: farewell.graceful_enabled,
|
|
666
|
+
timeout_ms: farewell.graceful_timeout_seconds === undefined
|
|
667
|
+
? undefined
|
|
668
|
+
: farewell.graceful_timeout_seconds * 1000,
|
|
669
|
+
});
|
|
670
|
+
delete params.farewell_config;
|
|
668
671
|
}
|
|
669
|
-
|
|
670
|
-
|
|
672
|
+
if (params.audio_scenario !== undefined) {
|
|
673
|
+
(_d = sessionOptions.audioScenario) !== null && _d !== void 0 ? _d : (sessionOptions.audioScenario = params.audio_scenario === "default" ? "aiserver" : params.audio_scenario);
|
|
674
|
+
delete params.audio_scenario;
|
|
675
|
+
}
|
|
676
|
+
normalized.parameters = Object.keys(params).length ? params : undefined;
|
|
677
|
+
if (normalized.labels !== undefined) {
|
|
678
|
+
(_e = sessionOptions.labels) !== null && _e !== void 0 ? _e : (sessionOptions.labels = normalized.labels);
|
|
679
|
+
normalized.labels = undefined;
|
|
680
|
+
}
|
|
681
|
+
if (normalized.mllm === undefined &&
|
|
682
|
+
(normalized.stt !== undefined || ((_f = normalized.turnDetection) === null || _f === void 0 ? void 0 : _f.language) !== undefined)) {
|
|
683
|
+
normalized.stt = this._resolvePlatformAsrConfig();
|
|
684
|
+
}
|
|
685
|
+
const _h = (0, v3_js_1.buildV3Agent)(normalized, this._variables, (_g = options.name) !== null && _g !== void 0 ? _g : "ephemeral"), { agent_name: _name } = _h, agent = __rest(_h, ["agent_name"]);
|
|
686
|
+
return (0, session_backend_js_1.createStoredSession)(this._client, sessionOptions, { agent }, this, transport);
|
|
671
687
|
}
|
|
672
688
|
/**
|
|
673
689
|
* Converts the Agent configuration to the Fern request properties format.
|
|
@@ -698,9 +714,8 @@ class Agent {
|
|
|
698
714
|
else {
|
|
699
715
|
// opts is narrowed to the appId/appCertificate branch here
|
|
700
716
|
const { appId, appCertificate, expiresIn } = opts;
|
|
701
|
-
//
|
|
702
|
-
//
|
|
703
|
-
// 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.
|
|
704
719
|
token = (0, token_js_1.generateConvoAIToken)({
|
|
705
720
|
appId,
|
|
706
721
|
appCertificate,
|
|
@@ -827,6 +842,16 @@ class Agent {
|
|
|
827
842
|
newAgent._greetingConfigs = this._greetingConfigs;
|
|
828
843
|
return newAgent;
|
|
829
844
|
}
|
|
845
|
+
_resolvePlatformAsrConfig() {
|
|
846
|
+
var _a, _b, _c, _d, _e;
|
|
847
|
+
const config = this._stt ? Object.assign({}, this._stt) : { vendor: this._client.area === index_js_1.Area.CN ? "fengming" : "ares" };
|
|
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 } : {}));
|
|
854
|
+
}
|
|
830
855
|
_resolveAsrConfig(turnDetectionConfig) {
|
|
831
856
|
const asrConfig = this._stt !== undefined
|
|
832
857
|
? Object.assign({}, this._stt)
|
|
@@ -841,6 +866,14 @@ class Agent {
|
|
|
841
866
|
delete params.language_codes;
|
|
842
867
|
asrConfig.params = params;
|
|
843
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
|
+
}
|
|
844
877
|
// Turn detection is the single source of truth for the top-level
|
|
845
878
|
// interaction language. Provider-specific languages remain in params.
|
|
846
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, 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
|