agora-agents 3.0.0-alpha.2 → 3.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/README.md +4 -4
  2. package/dist/cjs/AgoraPoolClient.d.ts +16 -3
  3. package/dist/cjs/AgoraPoolClient.js +47 -16
  4. package/dist/cjs/agentkit/Agent.js +17 -7
  5. package/dist/cjs/agentkit/AgentSession.js +8 -10
  6. package/dist/cjs/agentkit/avatar-types.d.ts +6 -0
  7. package/dist/cjs/agentkit/index.d.ts +7 -9
  8. package/dist/cjs/agentkit/index.js +8 -6
  9. package/dist/cjs/agentkit/presets.js +3 -3
  10. package/dist/cjs/agentkit/preview/client.d.ts +6 -5
  11. package/dist/cjs/agentkit/preview/client.js +7 -7
  12. package/dist/cjs/agentkit/preview/gemini-tts.d.ts +3 -31
  13. package/dist/cjs/agentkit/preview/gemini-tts.js +4 -30
  14. package/dist/cjs/agentkit/preview/index.d.ts +2 -2
  15. package/dist/cjs/agentkit/preview/index.js +4 -4
  16. package/dist/cjs/agentkit/session-backend.d.ts +3 -1
  17. package/dist/cjs/agentkit/session-backend.js +32 -33
  18. package/dist/cjs/agentkit/token.d.ts +46 -9
  19. package/dist/cjs/agentkit/token.js +35 -7
  20. package/dist/cjs/agentkit/types.d.ts +12 -3
  21. package/dist/cjs/agentkit/v3.d.ts +7 -3
  22. package/dist/cjs/agentkit/v3.js +35 -21
  23. package/dist/cjs/agentkit/vendors/avatar.d.ts +6 -0
  24. package/dist/cjs/agentkit/vendors/avatar.js +14 -2
  25. package/dist/cjs/agentkit/vendors/stt.d.ts +35 -0
  26. package/dist/cjs/agentkit/vendors/stt.js +19 -2
  27. package/dist/cjs/agentkit/vendors/tts.d.ts +72 -18
  28. package/dist/cjs/agentkit/vendors/tts.js +60 -11
  29. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +13 -0
  30. package/dist/cjs/api/resources/agents/types/GetTurnsAgentsResponse.d.ts +3 -1
  31. package/dist/cjs/api/types/Asr.d.ts +4 -1
  32. package/dist/cjs/api/types/CartesiaTts.d.ts +10 -0
  33. package/dist/cjs/api/types/CartesiaTts.js +9 -0
  34. package/dist/cjs/api/types/CartesiaTtsParams.d.ts +1 -1
  35. package/dist/cjs/api/types/DeepgramAsrParams.d.ts +1 -1
  36. package/dist/cjs/api/types/FishAudioTts.d.ts +10 -0
  37. package/dist/cjs/api/types/FishAudioTts.js +9 -0
  38. package/dist/cjs/api/types/FishAudioTtsParams.d.ts +1 -1
  39. package/dist/cjs/api/types/GeminiTts.d.ts +9 -0
  40. package/dist/cjs/api/types/GeminiTts.js +3 -0
  41. package/dist/cjs/api/types/GeminiTtsParams.d.ts +15 -0
  42. package/dist/cjs/api/types/GeminiTtsParams.js +3 -0
  43. package/dist/cjs/api/types/RtzrAsr.d.ts +10 -0
  44. package/dist/cjs/api/types/RtzrAsr.js +3 -0
  45. package/dist/cjs/api/types/RtzrAsrParams.d.ts +31 -0
  46. package/dist/cjs/api/types/RtzrAsrParams.js +3 -0
  47. package/dist/cjs/api/types/SarvamTtsParams.d.ts +12 -8
  48. package/dist/cjs/api/types/SarvamTtsParams.js +1 -1
  49. package/dist/cjs/api/types/Tts.d.ts +4 -1
  50. package/dist/cjs/api/types/index.d.ts +4 -0
  51. package/dist/cjs/api/types/index.js +4 -0
  52. package/dist/cjs/core/auth/publicAuthorization.d.ts +3 -0
  53. package/dist/cjs/core/auth/publicAuthorization.js +37 -0
  54. package/dist/cjs/index.d.ts +6 -6
  55. package/dist/cjs/index.js +14 -6
  56. package/dist/cjs/v3/campaigns.js +5 -2
  57. package/dist/cjs/v3/errors.d.ts +103 -0
  58. package/dist/cjs/v3/errors.js +179 -0
  59. package/dist/cjs/v3/index.d.ts +2 -0
  60. package/dist/cjs/v3/index.js +9 -1
  61. package/dist/cjs/v3/resources.js +17 -8
  62. package/dist/cjs/v3/session-lifecycle.d.ts +2 -1
  63. package/dist/cjs/v3/session-lifecycle.js +22 -18
  64. package/dist/cjs/v3/transport.d.ts +1 -13
  65. package/dist/cjs/v3/transport.js +88 -42
  66. package/dist/cjs/version.d.ts +1 -1
  67. package/dist/cjs/version.js +1 -1
  68. package/dist/esm/AgoraPoolClient.d.mts +16 -3
  69. package/dist/esm/AgoraPoolClient.mjs +48 -17
  70. package/dist/esm/agentkit/Agent.mjs +17 -7
  71. package/dist/esm/agentkit/AgentSession.mjs +8 -10
  72. package/dist/esm/agentkit/avatar-types.d.mts +6 -0
  73. package/dist/esm/agentkit/index.d.mts +7 -9
  74. package/dist/esm/agentkit/index.mjs +3 -4
  75. package/dist/esm/agentkit/presets.mjs +3 -3
  76. package/dist/esm/agentkit/preview/client.d.mts +6 -5
  77. package/dist/esm/agentkit/preview/client.mjs +7 -7
  78. package/dist/esm/agentkit/preview/gemini-tts.d.mts +3 -31
  79. package/dist/esm/agentkit/preview/gemini-tts.mjs +1 -28
  80. package/dist/esm/agentkit/preview/index.d.mts +2 -2
  81. package/dist/esm/agentkit/preview/index.mjs +1 -1
  82. package/dist/esm/agentkit/session-backend.d.mts +3 -1
  83. package/dist/esm/agentkit/session-backend.mjs +33 -34
  84. package/dist/esm/agentkit/token.d.mts +46 -9
  85. package/dist/esm/agentkit/token.mjs +34 -7
  86. package/dist/esm/agentkit/types.d.mts +12 -3
  87. package/dist/esm/agentkit/v3.d.mts +7 -3
  88. package/dist/esm/agentkit/v3.mjs +34 -20
  89. package/dist/esm/agentkit/vendors/avatar.d.mts +6 -0
  90. package/dist/esm/agentkit/vendors/avatar.mjs +14 -2
  91. package/dist/esm/agentkit/vendors/stt.d.mts +35 -0
  92. package/dist/esm/agentkit/vendors/stt.mjs +17 -1
  93. package/dist/esm/agentkit/vendors/tts.d.mts +72 -18
  94. package/dist/esm/agentkit/vendors/tts.mjs +58 -10
  95. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +13 -0
  96. package/dist/esm/api/resources/agents/types/GetTurnsAgentsResponse.d.mts +3 -1
  97. package/dist/esm/api/types/Asr.d.mts +4 -1
  98. package/dist/esm/api/types/CartesiaTts.d.mts +10 -0
  99. package/dist/esm/api/types/CartesiaTts.mjs +8 -1
  100. package/dist/esm/api/types/CartesiaTtsParams.d.mts +1 -1
  101. package/dist/esm/api/types/DeepgramAsrParams.d.mts +1 -1
  102. package/dist/esm/api/types/FishAudioTts.d.mts +10 -0
  103. package/dist/esm/api/types/FishAudioTts.mjs +8 -1
  104. package/dist/esm/api/types/FishAudioTtsParams.d.mts +1 -1
  105. package/dist/esm/api/types/GeminiTts.d.mts +9 -0
  106. package/dist/esm/api/types/GeminiTts.mjs +2 -0
  107. package/dist/esm/api/types/GeminiTtsParams.d.mts +15 -0
  108. package/dist/esm/api/types/GeminiTtsParams.mjs +2 -0
  109. package/dist/esm/api/types/RtzrAsr.d.mts +10 -0
  110. package/dist/esm/api/types/RtzrAsr.mjs +2 -0
  111. package/dist/esm/api/types/RtzrAsrParams.d.mts +31 -0
  112. package/dist/esm/api/types/RtzrAsrParams.mjs +2 -0
  113. package/dist/esm/api/types/SarvamTtsParams.d.mts +12 -8
  114. package/dist/esm/api/types/SarvamTtsParams.mjs +1 -1
  115. package/dist/esm/api/types/Tts.d.mts +4 -1
  116. package/dist/esm/api/types/index.d.mts +4 -0
  117. package/dist/esm/api/types/index.mjs +4 -0
  118. package/dist/esm/core/auth/publicAuthorization.d.mts +3 -0
  119. package/dist/esm/core/auth/publicAuthorization.mjs +33 -0
  120. package/dist/esm/index.d.mts +6 -6
  121. package/dist/esm/index.mjs +4 -4
  122. package/dist/esm/v3/campaigns.mjs +5 -2
  123. package/dist/esm/v3/errors.d.mts +103 -0
  124. package/dist/esm/v3/errors.mjs +167 -0
  125. package/dist/esm/v3/index.d.mts +2 -0
  126. package/dist/esm/v3/index.mjs +1 -0
  127. package/dist/esm/v3/resources.mjs +17 -8
  128. package/dist/esm/v3/session-lifecycle.d.mts +2 -1
  129. package/dist/esm/v3/session-lifecycle.mjs +22 -18
  130. package/dist/esm/v3/transport.d.mts +1 -13
  131. package/dist/esm/v3/transport.mjs +85 -39
  132. package/dist/esm/version.d.mts +1 -1
  133. package/dist/esm/version.mjs +1 -1
  134. package/openapi.yaml +13 -5
  135. 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.2`.** 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.
14
+ **Saving agents and project provisioning are part of SDK preview `3.0.0-alpha.4`.** 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 uses token authentication and 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.
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.2
21
+ npm install agora-agents@3.0.0-alpha.4
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.2`. 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).
286
+ The v3 alpha preview is distributed separately from stable 2.x packages. This checkout targets `3.0.0-alpha.4`. 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
- * Two authentication modes are supported:
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
- * Two authentication modes are supported:
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,42 +122,54 @@ 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 authToken`);
125
+ throw new index_js_1.V3ConfigurationError(`${key} is not supported; use appId/appCertificate, authToken, or customerId/customerSecret`);
121
126
  }
122
127
  }
123
- const authMode = options.authToken !== undefined ? "token" : "app-credentials";
124
- const { authToken, appId, appCertificate } = options, rest = __rest(options, ["authToken", "appId", "appCertificate"]);
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 index_js_1.V3ConfigurationError("customerId/customerSecret cannot be combined with authToken");
132
+ if (basic)
133
+ asConfiguration(() => (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 authToken is required");
127
- const authorization = () => authMode === "token"
128
- ? `agora token=${authToken}`
129
- : `agora token=${(0, token_js_1.generateConvoAIToken)({ appId, appCertificate: appCertificate, channelName: "", uid: 0 })}`;
136
+ throw new index_js_1.V3ConfigurationError("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 tokenOnlyFetch = (input, init) => __awaiter(this, void 0, void 0, function* () {
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 && !/^agora token=\S+$/i.test(auth))
136
- throw new Error("Only Agora token authorization is supported");
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: tokenOnlyFetch, username: "", password: "", authorization, baseUrl: () => pool.getCurrentURL() }));
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;
146
160
  this.authMode = authMode;
147
161
  this.area = options.area;
148
- const v3Base = (_c = (_b = options.v3) === null || _b === void 0 ? void 0 : _b.baseUrl) !== null && _c !== void 0 ? _c : process.env.AGORA_AGENTS_V3_BASE_URL;
162
+ // A blank option or environment value (e.g. `AGORA_AGENTS_V3_BASE_URL=` in
163
+ // a .env file) means "unset" and surrounding whitespace is ignored,
164
+ // matching the Go and Python SDKs.
165
+ const v3Base = (_c = nonBlank((_b = options.v3) === null || _b === void 0 ? void 0 : _b.baseUrl)) !== null && _c !== void 0 ? _c : nonBlank(process.env.AGORA_AGENTS_V3_BASE_URL);
149
166
  if (v3Base !== undefined) {
150
167
  let origin;
151
168
  try {
152
169
  origin = new URL(v3Base);
153
170
  }
154
- catch (_e) {
155
- throw new Error("v3.baseUrl must be an HTTP(S) origin");
171
+ catch (error) {
172
+ throw new index_js_1.V3ConfigurationError("v3.baseUrl must be an HTTP(S) origin", { cause: error });
156
173
  }
157
174
  if (!["http:", "https:"].includes(origin.protocol) ||
158
175
  origin.username ||
@@ -162,7 +179,7 @@ class AgoraClient extends Client_js_1.AgoraClient {
162
179
  origin.hash ||
163
180
  v3Base.includes("?") ||
164
181
  v3Base.includes("#"))
165
- throw new Error("v3.baseUrl must be an HTTP(S) origin without credentials, path, query or fragment");
182
+ throw new index_js_1.V3ConfigurationError("v3.baseUrl must be an HTTP(S) origin without credentials, path, query or fragment");
166
183
  }
167
184
  this.v3 = new index_js_1.V3Client(new index_js_1.V3Transport(this._options, this.appId, () => v3Base !== null && v3Base !== void 0 ? v3Base : "https://preview.ai.agora.io", authorization, (_d = options.v3) === null || _d === void 0 ? void 0 : _d.headers));
168
185
  }
@@ -237,3 +254,17 @@ class AgoraClient extends Client_js_1.AgoraClient {
237
254
  }
238
255
  }
239
256
  exports.AgoraClient = AgoraClient;
257
+ function asConfiguration(run) {
258
+ try {
259
+ run();
260
+ }
261
+ catch (error) {
262
+ if (error instanceof Error)
263
+ throw new index_js_1.V3ConfigurationError(error.message, { cause: error });
264
+ throw error;
265
+ }
266
+ }
267
+ function nonBlank(value) {
268
+ const trimmed = value === null || value === void 0 ? void 0 : value.trim();
269
+ return trimmed ? trimmed : undefined;
270
+ }
@@ -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
- // Use buildTokenWithRtm (RTC + RTM) so the token works whether or not
718
- // the caller enables advanced_features.enable_rtm. The account string
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
- const language = (_d = (_c = (_b = (_a = this._turnDetection) === null || _a === void 0 ? void 0 : _a.language) !== null && _b !== void 0 ? _b : config.language) !== null && _c !== void 0 ? _c : params === null || params === void 0 ? void 0 : params.language) !== null && _d !== void 0 ? _d : (["ares", "fengming"].includes(config.vendor) ? DEFAULT_TURN_DETECTION_LANGUAGE : undefined);
851
- return Object.assign(Object.assign({}, config), (typeof language === "string" ? { language } : {}));
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;
@@ -28,7 +28,7 @@ var __rest = (this && this.__rest) || function (s, e) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.AgentSession = void 0;
30
30
  const index_js_1 = require("../errors/index.js");
31
- const transport_js_1 = require("../v3/transport.js");
31
+ const errors_js_1 = require("../v3/errors.js");
32
32
  const avatar_types_js_1 = require("./avatar-types.js");
33
33
  const debug_js_1 = require("./debug.js");
34
34
  const presets_js_1 = require("./presets.js");
@@ -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
- // sample_rate may not exist on all TTS vendor params, so we check dynamically
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 ? ttsParams.sample_rate : undefined;
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);
@@ -563,13 +567,7 @@ class AgentSession {
563
567
  this._emit("stopped", Object.assign({ agentId: this._agentId }, (this._backend ? { sessionId: this._agentId } : {})));
564
568
  return; // Don't throw - agent is already stopped
565
569
  }
566
- const reason = error instanceof transport_js_1.V3Error &&
567
- error.statusCode === 409 &&
568
- error.body !== null &&
569
- typeof error.body === "object" &&
570
- "reason" in error.body
571
- ? error.body.reason
572
- : undefined;
570
+ const reason = error instanceof errors_js_1.V3Error && error.statusCode === 409 ? error.reason : undefined;
573
571
  this._status =
574
572
  this._backend && reason === "TaskNotRunning"
575
573
  ? "stopped"
@@ -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
- export type { GenerateConvoAITokenOptions, GenerateTokenOptions, } from "./token.js";
39
- 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";
36
+ export type { GenerateClientTokenOptions, GenerateConvoAITokenOptions, GenerateTokenOptions, } from "./token.js";
37
+ export { ExpiresIn, generateClientToken, generateConvoAIToken, generateRtcToken, MAX_EXPIRY_SECONDS, } from "./token.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.GeminiTTSModels = exports.GeminiTTS = exports.requiredPreviewFeatures = exports.previewRequestHeaders = exports.PreviewFeatures = void 0;
25
- exports.MistralTTS = exports.MiniMaxTTS = exports.MicrosoftTTS = exports.HumeAITTS = exports.GradiumTTS = exports.GoogleTTS = exports.GenericTTS = exports.FishAudioTTS = exports.ElevenLabsTTS = exports.DeepgramTTS = exports.CartesiaTTS = exports.AmazonTTS = exports.XAiSTT = exports.SpeechmaticsSTT = exports.SmallestAISTT = exports.SarvamSTT = 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 = exports.XfyunDialectSTT = exports.XfyunBigModelSTT = void 0;
26
- exports.XAiTTS = exports.TypecastTTS = exports.SmallestAITTS = exports.SarvamTTS = exports.RimeTTS = exports.OpenAITTS = exports.MurfTTS = void 0;
24
+ 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.generateClientToken = exports.ExpiresIn = exports.UnsupportedSessionOperationError = exports.requiredPreviewFeatures = exports.previewRequestHeaders = exports.PreviewFeatures = void 0;
25
+ 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 = exports.XfyunDialectSTT = void 0;
26
+ exports.XAiTTS = exports.TypecastTTS = exports.SmallestAITTS = exports.SarvamTTSLanguage = exports.SarvamTTS = exports.RimeTTS = exports.OpenAITTS = exports.MurfTTS = exports.MistralTTS = exports.MiniMaxTTS = 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,14 +86,12 @@ 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
95
92
  var token_js_1 = require("./token.js");
96
93
  Object.defineProperty(exports, "ExpiresIn", { enumerable: true, get: function () { return token_js_1.ExpiresIn; } });
94
+ Object.defineProperty(exports, "generateClientToken", { enumerable: true, get: function () { return token_js_1.generateClientToken; } });
97
95
  Object.defineProperty(exports, "generateConvoAIToken", { enumerable: true, get: function () { return token_js_1.generateConvoAIToken; } });
98
96
  Object.defineProperty(exports, "generateRtcToken", { enumerable: true, get: function () { return token_js_1.generateRtcToken; } });
99
97
  Object.defineProperty(exports, "MAX_EXPIRY_SECONDS", { enumerable: true, get: function () { return token_js_1.MAX_EXPIRY_SECONDS; } });
@@ -183,6 +181,7 @@ Object.defineProperty(exports, "GeminiTranscriptionMode", { enumerable: true, ge
183
181
  Object.defineProperty(exports, "GoogleSTT", { enumerable: true, get: function () { return stt_js_1.GoogleSTT; } });
184
182
  Object.defineProperty(exports, "MicrosoftSTT", { enumerable: true, get: function () { return stt_js_1.MicrosoftSTT; } });
185
183
  Object.defineProperty(exports, "OpenAISTT", { enumerable: true, get: function () { return stt_js_1.OpenAISTT; } });
184
+ Object.defineProperty(exports, "RTZRSTT", { enumerable: true, get: function () { return stt_js_1.RTZRSTT; } });
186
185
  Object.defineProperty(exports, "SarvamSTT", { enumerable: true, get: function () { return stt_js_1.SarvamSTT; } });
187
186
  Object.defineProperty(exports, "SmallestAISTT", { enumerable: true, get: function () { return stt_js_1.SmallestAISTT; } });
188
187
  Object.defineProperty(exports, "SpeechmaticsSTT", { enumerable: true, get: function () { return stt_js_1.SpeechmaticsSTT; } });
@@ -194,6 +193,8 @@ Object.defineProperty(exports, "CartesiaTTS", { enumerable: true, get: function
194
193
  Object.defineProperty(exports, "DeepgramTTS", { enumerable: true, get: function () { return tts_js_1.DeepgramTTS; } });
195
194
  Object.defineProperty(exports, "ElevenLabsTTS", { enumerable: true, get: function () { return tts_js_1.ElevenLabsTTS; } });
196
195
  Object.defineProperty(exports, "FishAudioTTS", { enumerable: true, get: function () { return tts_js_1.FishAudioTTS; } });
196
+ Object.defineProperty(exports, "GeminiTTS", { enumerable: true, get: function () { return tts_js_1.GeminiTTS; } });
197
+ Object.defineProperty(exports, "GeminiTTSModels", { enumerable: true, get: function () { return tts_js_1.GeminiTTSModels; } });
197
198
  Object.defineProperty(exports, "GenericTTS", { enumerable: true, get: function () { return tts_js_1.GenericTTS; } });
198
199
  Object.defineProperty(exports, "GoogleTTS", { enumerable: true, get: function () { return tts_js_1.GoogleTTS; } });
199
200
  Object.defineProperty(exports, "GradiumTTS", { enumerable: true, get: function () { return tts_js_1.GradiumTTS; } });
@@ -205,6 +206,7 @@ Object.defineProperty(exports, "MurfTTS", { enumerable: true, get: function () {
205
206
  Object.defineProperty(exports, "OpenAITTS", { enumerable: true, get: function () { return tts_js_1.OpenAITTS; } });
206
207
  Object.defineProperty(exports, "RimeTTS", { enumerable: true, get: function () { return tts_js_1.RimeTTS; } });
207
208
  Object.defineProperty(exports, "SarvamTTS", { enumerable: true, get: function () { return tts_js_1.SarvamTTS; } });
209
+ Object.defineProperty(exports, "SarvamTTSLanguage", { enumerable: true, get: function () { return tts_js_1.SarvamTTSLanguage; } });
208
210
  Object.defineProperty(exports, "SmallestAITTS", { enumerable: true, get: function () { return tts_js_1.SmallestAITTS; } });
209
211
  Object.defineProperty(exports, "TypecastTTS", { enumerable: true, get: function () { return tts_js_1.TypecastTTS; } });
210
212
  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[(_c = normalizeModelName((_b = asr.params) === null || _b === void 0 ? void 0 : _b.model)) !== null && _c !== void 0 ? _c : ""];
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
- * Everything under `agentkit/preview/` is temporary. When a provider ships on
11
- * the production gateway, remove its preview registration and move its class
12
- * into the corresponding production vendor module.
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
- /** Gemini TTS preview gate; Gemini ASR and Live use production. */
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
- export declare function requiredPreviewFeatures(properties: Agora.StartAgentsRequest.Properties): PreviewFeature[];
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
- * Everything under `agentkit/preview/` is temporary. When a provider ships on
12
- * the production gateway, remove its preview registration and move its class
13
- * into the corresponding production vendor module.
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
- /** Gemini TTS preview gate; Gemini ASR and Live use production. */
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
- function requiredPreviewFeatures(properties) {
78
- var _a;
79
- return ((_a = properties.tts) === null || _a === void 0 ? void 0 : _a.vendor) === "gemini" ? [exports.PreviewFeatures.GeminiLive] : [];
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 { BaseTTS } from "../vendors/base.js";
2
- /** Gemini 3.8 Flash TTS preview model. */
3
- export declare const GeminiTTSModels: {
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.GeminiTTS = exports.GeminiTTSModels = void 0;
4
- const base_js_1 = require("../vendors/base.js");
5
- /** Gemini 3.8 Flash TTS preview model. */
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";