agora-agents 2.6.1 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/agentkit/Agent.js +9 -0
- package/dist/cjs/agentkit/AgentSession.d.ts +27 -0
- package/dist/cjs/agentkit/AgentSession.js +95 -23
- package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.js +2 -2
- package/dist/cjs/agentkit/__tests__/preview-types.test.d.ts +7 -0
- package/dist/cjs/agentkit/__tests__/preview-types.test.js +57 -0
- package/dist/cjs/agentkit/__tests__/readme-examples.test.js +3 -3
- package/dist/cjs/agentkit/__tests__/type-safety.test.js +1 -1
- package/dist/cjs/agentkit/debug.d.ts +33 -0
- package/dist/cjs/agentkit/debug.js +134 -0
- package/dist/cjs/agentkit/index.d.ts +4 -1
- package/dist/cjs/agentkit/index.js +16 -3
- package/dist/cjs/agentkit/preview/client.d.ts +58 -0
- package/dist/cjs/agentkit/preview/client.js +89 -0
- package/dist/cjs/agentkit/preview/index.d.ts +11 -0
- package/dist/cjs/agentkit/preview/index.js +20 -0
- package/dist/cjs/agentkit/preview/vendors.d.ts +72 -0
- package/dist/cjs/agentkit/preview/vendors.js +53 -0
- package/dist/cjs/agentkit/token.js +32 -3
- package/dist/cjs/agentkit/types.d.ts +39 -0
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +13 -3
- package/dist/esm/agentkit/Agent.mjs +9 -0
- package/dist/esm/agentkit/AgentSession.d.mts +27 -0
- package/dist/esm/agentkit/AgentSession.mjs +95 -23
- package/dist/esm/agentkit/__tests__/area-aware-vendors.test.mjs +2 -2
- package/dist/esm/agentkit/__tests__/preview-types.test.d.mts +7 -0
- package/dist/esm/agentkit/__tests__/preview-types.test.mjs +55 -0
- package/dist/esm/agentkit/__tests__/readme-examples.test.mjs +3 -3
- package/dist/esm/agentkit/__tests__/type-safety.test.mjs +1 -1
- package/dist/esm/agentkit/debug.d.mts +33 -0
- package/dist/esm/agentkit/debug.mjs +129 -0
- package/dist/esm/agentkit/index.d.mts +4 -1
- package/dist/esm/agentkit/index.mjs +2 -0
- package/dist/esm/agentkit/preview/client.d.mts +58 -0
- package/dist/esm/agentkit/preview/client.mjs +83 -0
- package/dist/esm/agentkit/preview/index.d.mts +11 -0
- package/dist/esm/agentkit/preview/index.mjs +9 -0
- package/dist/esm/agentkit/preview/vendors.d.mts +72 -0
- package/dist/esm/agentkit/preview/vendors.mjs +49 -0
- package/dist/esm/agentkit/token.mjs +32 -3
- package/dist/esm/agentkit/types.d.mts +39 -0
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +3 -3
- package/package.json +1 -1
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
* parts that need manual updates when adding new sugar.
|
|
21
21
|
*/
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.XAiTTS = exports.TypecastTTS = exports.SarvamTTS = exports.RimeTTS = exports.OpenAITTS = exports.MurfTTS = 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.SarvamSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.GoogleSTT = exports.DeepgramSTT = void 0;
|
|
23
|
+
exports.GeminiSTTModels = exports.GeminiSTT = 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.Groq = exports.Gemini = exports.Dify = exports.CustomLLM = exports.AzureOpenAI = exports.Anthropic = exports.AmazonBedrock = exports.XfyunSTT = 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.LiveAvatarAvatar = exports.HeyGenAvatar = exports.GenericAvatar = exports.AnamAvatar = exports.AkoolAvatar = exports.MAX_EXPIRY_SECONDS = exports.generateRtcToken = exports.generateConvoAIToken = exports.ExpiresIn = exports.requiredPreviewFeatures = exports.previewRequestHeaders = exports.PreviewFeatures = exports.PREVIEW_FEATURE_HEADER = exports.PREVIEW_API_BASE_URL = void 0;
|
|
25
|
+
exports.XAiTTS = exports.TypecastTTS = exports.SarvamTTS = exports.RimeTTS = exports.OpenAITTS = exports.MurfTTS = 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.SarvamSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.GoogleSTT = exports.DeepgramSTT = exports.AssemblyAISTT = exports.AresSTT = exports.AmazonSTT = exports.XaiGrok = exports.VertexAI = exports.QwenOmni = exports.OpenAIRealtime = exports.GeminiLive = exports.AzureOpenAIRealtime = exports.VertexAILLM = exports.OpenAI = void 0;
|
|
26
26
|
// Core classes
|
|
27
27
|
var Agent_js_1 = require("./Agent.js");
|
|
28
28
|
Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return Agent_js_1.Agent; } });
|
|
@@ -71,9 +71,22 @@ Object.defineProperty(exports, "ThinkOnSpeakingActionInterrupt", { enumerable: t
|
|
|
71
71
|
Object.defineProperty(exports, "ThinkOnThinkingActionIgnore", { enumerable: true, get: function () { return constants_js_1.ThinkOnThinkingActionIgnore; } });
|
|
72
72
|
Object.defineProperty(exports, "ThinkOnThinkingActionInterrupt", { enumerable: true, get: function () { return constants_js_1.ThinkOnThinkingActionInterrupt; } });
|
|
73
73
|
Object.defineProperty(exports, "TurnDetectionTypeValues", { enumerable: true, get: function () { return constants_js_1.TurnDetectionTypeValues; } });
|
|
74
|
+
var debug_js_1 = require("./debug.js");
|
|
75
|
+
Object.defineProperty(exports, "REDACTED", { enumerable: true, get: function () { return debug_js_1.REDACTED; } });
|
|
76
|
+
Object.defineProperty(exports, "redactHeadersForDebug", { enumerable: true, get: function () { return debug_js_1.redactHeadersForDebug; } });
|
|
77
|
+
Object.defineProperty(exports, "redactSecrets", { enumerable: true, get: function () { return debug_js_1.redactSecrets; } });
|
|
74
78
|
var presets_js_1 = require("./presets.js");
|
|
75
79
|
Object.defineProperty(exports, "AgentPresets", { enumerable: true, get: function () { return presets_js_1.AgentPresets; } });
|
|
76
80
|
Object.defineProperty(exports, "normalizePresetInput", { enumerable: true, get: function () { return presets_js_1.normalizePresetInput; } });
|
|
81
|
+
var index_js_1 = require("./preview/index.js");
|
|
82
|
+
Object.defineProperty(exports, "createPreviewRoute", { enumerable: true, get: function () { return index_js_1.createPreviewRoute; } });
|
|
83
|
+
Object.defineProperty(exports, "GeminiSTT", { enumerable: true, get: function () { return index_js_1.GeminiSTT; } });
|
|
84
|
+
Object.defineProperty(exports, "GeminiSTTModels", { enumerable: true, get: function () { return index_js_1.GeminiSTTModels; } });
|
|
85
|
+
Object.defineProperty(exports, "PREVIEW_API_BASE_URL", { enumerable: true, get: function () { return index_js_1.PREVIEW_API_BASE_URL; } });
|
|
86
|
+
Object.defineProperty(exports, "PREVIEW_FEATURE_HEADER", { enumerable: true, get: function () { return index_js_1.PREVIEW_FEATURE_HEADER; } });
|
|
87
|
+
Object.defineProperty(exports, "PreviewFeatures", { enumerable: true, get: function () { return index_js_1.PreviewFeatures; } });
|
|
88
|
+
Object.defineProperty(exports, "previewRequestHeaders", { enumerable: true, get: function () { return index_js_1.previewRequestHeaders; } });
|
|
89
|
+
Object.defineProperty(exports, "requiredPreviewFeatures", { enumerable: true, get: function () { return index_js_1.requiredPreviewFeatures; } });
|
|
77
90
|
// Token generation
|
|
78
91
|
var token_js_1 = require("./token.js");
|
|
79
92
|
Object.defineProperty(exports, "ExpiresIn", { enumerable: true, get: function () { return token_js_1.ExpiresIn; } });
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preview endpoint routing.
|
|
3
|
+
*
|
|
4
|
+
* Preview providers are not served by the production Conversational AI gateway.
|
|
5
|
+
* They live behind a single partner host and are gated by an `agora-feature`
|
|
6
|
+
* header. AgentSession detects preview providers from its resolved request body
|
|
7
|
+
* and binds that session to the preview host while ordinary AgoraClient calls
|
|
8
|
+
* remain on the regional production endpoint.
|
|
9
|
+
*
|
|
10
|
+
* Everything under `agentkit/preview/` is temporary. When these providers ship
|
|
11
|
+
* on the production gateway, delete this directory and move the vendor classes
|
|
12
|
+
* into `vendors/stt.ts`.
|
|
13
|
+
*/
|
|
14
|
+
import type { AgoraClient } from "../../AgoraPoolClient.js";
|
|
15
|
+
import type * as Agora from "../../api/index.js";
|
|
16
|
+
import { AgentManagementClient } from "../../api/resources/agentManagement/client/Client.js";
|
|
17
|
+
import { AgentsClient } from "../../api/resources/agents/client/Client.js";
|
|
18
|
+
/** Base URL that serves the preview providers. */
|
|
19
|
+
export declare const PREVIEW_API_BASE_URL = "https://partner.ai.agora.io/preview/api/conversational-ai-agent";
|
|
20
|
+
/**
|
|
21
|
+
* Request header that opts a request into a preview provider family.
|
|
22
|
+
*
|
|
23
|
+
* This is the header the preview gateway routes on. A request that reaches the
|
|
24
|
+
* gateway without it is not rejected — it is routed to the production
|
|
25
|
+
* environment, where the preview providers do not exist.
|
|
26
|
+
*/
|
|
27
|
+
export declare const PREVIEW_FEATURE_HEADER = "agora-feature";
|
|
28
|
+
/**
|
|
29
|
+
* Preview provider families. Each value is one entry in the
|
|
30
|
+
* {@link PREVIEW_FEATURE_HEADER} header and gates a set of vendors on the
|
|
31
|
+
* preview endpoint.
|
|
32
|
+
*/
|
|
33
|
+
export declare const PreviewFeatures: {
|
|
34
|
+
/** Gemini 3.5 Transcribe ASR. */
|
|
35
|
+
readonly GeminiLive: "gemini-live";
|
|
36
|
+
};
|
|
37
|
+
/** A preview provider family (`"gemini-live"`). */
|
|
38
|
+
export type PreviewFeature = (typeof PreviewFeatures)[keyof typeof PreviewFeatures];
|
|
39
|
+
/** Session-scoped clients bound to one resolved route. */
|
|
40
|
+
export interface PreviewRoute {
|
|
41
|
+
readonly agents: AgentsClient;
|
|
42
|
+
readonly agentManagement: AgentManagementClient;
|
|
43
|
+
readonly baseUrl: string;
|
|
44
|
+
readonly features: readonly PreviewFeature[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Pins the gate after any caller headers. This is also used for per-call auth
|
|
48
|
+
* headers so a custom `agora-feature` value can never blank the session gate.
|
|
49
|
+
*/
|
|
50
|
+
export declare function previewRequestHeaders(features: readonly PreviewFeature[], headers?: Record<string, string>): Record<string, string>;
|
|
51
|
+
/** Build generated resource clients for one preview session. */
|
|
52
|
+
export declare function createPreviewRoute(client: AgoraClient, features: readonly PreviewFeature[]): PreviewRoute;
|
|
53
|
+
/**
|
|
54
|
+
* Returns the preview features a start request needs, derived from the request
|
|
55
|
+
* body rather than from the vendor classes — so hand-written configs are
|
|
56
|
+
* covered too.
|
|
57
|
+
*/
|
|
58
|
+
export declare function requiredPreviewFeatures(properties: Agora.StartAgentsRequest.Properties): PreviewFeature[];
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Preview endpoint routing.
|
|
4
|
+
*
|
|
5
|
+
* Preview providers are not served by the production Conversational AI gateway.
|
|
6
|
+
* They live behind a single partner host and are gated by an `agora-feature`
|
|
7
|
+
* header. AgentSession detects preview providers from its resolved request body
|
|
8
|
+
* and binds that session to the preview host while ordinary AgoraClient calls
|
|
9
|
+
* remain on the regional production endpoint.
|
|
10
|
+
*
|
|
11
|
+
* Everything under `agentkit/preview/` is temporary. When these providers ship
|
|
12
|
+
* on the production gateway, delete this directory and move the vendor classes
|
|
13
|
+
* into `vendors/stt.ts`.
|
|
14
|
+
*/
|
|
15
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
17
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
19
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
20
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
21
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.PreviewFeatures = exports.PREVIEW_FEATURE_HEADER = exports.PREVIEW_API_BASE_URL = void 0;
|
|
26
|
+
exports.previewRequestHeaders = previewRequestHeaders;
|
|
27
|
+
exports.createPreviewRoute = createPreviewRoute;
|
|
28
|
+
exports.requiredPreviewFeatures = requiredPreviewFeatures;
|
|
29
|
+
const Client_js_1 = require("../../api/resources/agentManagement/client/Client.js");
|
|
30
|
+
const Client_js_2 = require("../../api/resources/agents/client/Client.js");
|
|
31
|
+
/** Base URL that serves the preview providers. */
|
|
32
|
+
exports.PREVIEW_API_BASE_URL = "https://partner.ai.agora.io/preview/api/conversational-ai-agent";
|
|
33
|
+
/**
|
|
34
|
+
* Request header that opts a request into a preview provider family.
|
|
35
|
+
*
|
|
36
|
+
* This is the header the preview gateway routes on. A request that reaches the
|
|
37
|
+
* gateway without it is not rejected — it is routed to the production
|
|
38
|
+
* environment, where the preview providers do not exist.
|
|
39
|
+
*/
|
|
40
|
+
exports.PREVIEW_FEATURE_HEADER = "agora-feature";
|
|
41
|
+
/**
|
|
42
|
+
* Preview provider families. Each value is one entry in the
|
|
43
|
+
* {@link PREVIEW_FEATURE_HEADER} header and gates a set of vendors on the
|
|
44
|
+
* preview endpoint.
|
|
45
|
+
*/
|
|
46
|
+
exports.PreviewFeatures = {
|
|
47
|
+
/** Gemini 3.5 Transcribe ASR. */
|
|
48
|
+
GeminiLive: "gemini-live",
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Pins the gate after any caller headers. This is also used for per-call auth
|
|
52
|
+
* headers so a custom `agora-feature` value can never blank the session gate.
|
|
53
|
+
*/
|
|
54
|
+
function previewRequestHeaders(features, headers) {
|
|
55
|
+
return Object.assign(Object.assign({}, headers), { [exports.PREVIEW_FEATURE_HEADER]: features.join(",") });
|
|
56
|
+
}
|
|
57
|
+
/** Build generated resource clients for one preview session. */
|
|
58
|
+
function createPreviewRoute(client, features) {
|
|
59
|
+
var _a;
|
|
60
|
+
const clientOptions = client._options;
|
|
61
|
+
const fetchFn = (_a = clientOptions.fetch) !== null && _a !== void 0 ? _a : globalThis.fetch;
|
|
62
|
+
const options = Object.assign(Object.assign({}, clientOptions), { baseUrl: exports.PREVIEW_API_BASE_URL, headers: previewRequestHeaders(features, clientOptions.headers), fetch: (input, init) => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
|
|
64
|
+
headers.set(exports.PREVIEW_FEATURE_HEADER, features.join(","));
|
|
65
|
+
return fetchFn(input, Object.assign(Object.assign({}, init), { headers }));
|
|
66
|
+
}) });
|
|
67
|
+
return {
|
|
68
|
+
agents: new Client_js_2.AgentsClient(options),
|
|
69
|
+
agentManagement: new Client_js_1.AgentManagementClient(options),
|
|
70
|
+
baseUrl: exports.PREVIEW_API_BASE_URL,
|
|
71
|
+
features: [...features],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** ASR vendor served only by the preview endpoint. */
|
|
75
|
+
const PREVIEW_ASR_VENDORS = new Set(["gemini"]);
|
|
76
|
+
/**
|
|
77
|
+
* Returns the preview features a start request needs, derived from the request
|
|
78
|
+
* body rather than from the vendor classes — so hand-written configs are
|
|
79
|
+
* covered too.
|
|
80
|
+
*/
|
|
81
|
+
function requiredPreviewFeatures(properties) {
|
|
82
|
+
var _a;
|
|
83
|
+
const features = new Set();
|
|
84
|
+
const asrVendor = (_a = properties.asr) === null || _a === void 0 ? void 0 : _a.vendor;
|
|
85
|
+
if (asrVendor !== undefined && PREVIEW_ASR_VENDORS.has(asrVendor)) {
|
|
86
|
+
features.add(exports.PreviewFeatures.GeminiLive);
|
|
87
|
+
}
|
|
88
|
+
return [...features];
|
|
89
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preview provider surface.
|
|
3
|
+
*
|
|
4
|
+
* Self-contained on purpose: when these providers ship on the production
|
|
5
|
+
* gateway, this directory is deleted and the vendor classes move into
|
|
6
|
+
* `vendors/stt.ts`.
|
|
7
|
+
*/
|
|
8
|
+
export type { PreviewFeature, PreviewRoute } from "./client.js";
|
|
9
|
+
export { createPreviewRoute, PREVIEW_API_BASE_URL, PREVIEW_FEATURE_HEADER, PreviewFeatures, previewRequestHeaders, requiredPreviewFeatures, } from "./client.js";
|
|
10
|
+
export type { GeminiSTTModel, GeminiSTTOptions } from "./vendors.js";
|
|
11
|
+
export { GeminiSTT, GeminiSTTModels } from "./vendors.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Preview provider surface.
|
|
4
|
+
*
|
|
5
|
+
* Self-contained on purpose: when these providers ship on the production
|
|
6
|
+
* gateway, this directory is deleted and the vendor classes move into
|
|
7
|
+
* `vendors/stt.ts`.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.GeminiSTTModels = exports.GeminiSTT = exports.requiredPreviewFeatures = exports.previewRequestHeaders = exports.PreviewFeatures = exports.PREVIEW_FEATURE_HEADER = exports.PREVIEW_API_BASE_URL = exports.createPreviewRoute = void 0;
|
|
11
|
+
var client_js_1 = require("./client.js");
|
|
12
|
+
Object.defineProperty(exports, "createPreviewRoute", { enumerable: true, get: function () { return client_js_1.createPreviewRoute; } });
|
|
13
|
+
Object.defineProperty(exports, "PREVIEW_API_BASE_URL", { enumerable: true, get: function () { return client_js_1.PREVIEW_API_BASE_URL; } });
|
|
14
|
+
Object.defineProperty(exports, "PREVIEW_FEATURE_HEADER", { enumerable: true, get: function () { return client_js_1.PREVIEW_FEATURE_HEADER; } });
|
|
15
|
+
Object.defineProperty(exports, "PreviewFeatures", { enumerable: true, get: function () { return client_js_1.PreviewFeatures; } });
|
|
16
|
+
Object.defineProperty(exports, "previewRequestHeaders", { enumerable: true, get: function () { return client_js_1.previewRequestHeaders; } });
|
|
17
|
+
Object.defineProperty(exports, "requiredPreviewFeatures", { enumerable: true, get: function () { return client_js_1.requiredPreviewFeatures; } });
|
|
18
|
+
var vendors_js_1 = require("./vendors.js");
|
|
19
|
+
Object.defineProperty(exports, "GeminiSTT", { enumerable: true, get: function () { return vendors_js_1.GeminiSTT; } });
|
|
20
|
+
Object.defineProperty(exports, "GeminiSTTModels", { enumerable: true, get: function () { return vendors_js_1.GeminiSTTModels; } });
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preview provider vendor classes.
|
|
3
|
+
*
|
|
4
|
+
* These follow the same shape as the GA vendor classes in `vendors/` —
|
|
5
|
+
* camelCase constructor options in, snake_case wire config out — so they drop
|
|
6
|
+
* into `agent.withStt()` unchanged. They only work against the preview
|
|
7
|
+
* endpoint; AgentSession routes it automatically.
|
|
8
|
+
*/
|
|
9
|
+
import type { SttConfig, TurnDetectionLanguage } from "../types.js";
|
|
10
|
+
import type { SampleRate } from "../vendors/base.js";
|
|
11
|
+
import { BaseSTT } from "../vendors/base.js";
|
|
12
|
+
/** Gemini preview transcription models. */
|
|
13
|
+
export declare const GeminiSTTModels: {
|
|
14
|
+
readonly Transcribe35Live: "gemini-3.5-transcribe-live";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A Gemini preview transcription model. Known model names autocomplete; any
|
|
18
|
+
* string is accepted so a newly published preview model can be used before this
|
|
19
|
+
* SDK is updated.
|
|
20
|
+
*/
|
|
21
|
+
export type GeminiSTTModel = (typeof GeminiSTTModels)[keyof typeof GeminiSTTModels] | (string & {});
|
|
22
|
+
/** Constructor options for {@link GeminiSTT}. */
|
|
23
|
+
export interface GeminiSTTOptions {
|
|
24
|
+
/** Google API key. */
|
|
25
|
+
apiKey: string;
|
|
26
|
+
/** Model name. Defaults to `gemini-3.5-transcribe-live`. */
|
|
27
|
+
model?: GeminiSTTModel;
|
|
28
|
+
/**
|
|
29
|
+
* Languages the model should transcribe, sent as `params.language_codes`.
|
|
30
|
+
*
|
|
31
|
+
* Omitted from the request when unset, which is how the provider spells
|
|
32
|
+
* auto-detect — the SDK does not pin a language the caller never asked for.
|
|
33
|
+
* Pass one code to commit to a language, several to let the model choose
|
|
34
|
+
* between them, or an explicit empty array to request auto-detect
|
|
35
|
+
* outright.
|
|
36
|
+
*
|
|
37
|
+
* This is the only language setting on this vendor. The top-level
|
|
38
|
+
* `asr.language` is supplied by `Agent` from `turnDetection.language`, as
|
|
39
|
+
* it is for every STT vendor.
|
|
40
|
+
*/
|
|
41
|
+
languageCodes?: readonly TurnDetectionLanguage[];
|
|
42
|
+
/**
|
|
43
|
+
* Words and phrases to bias recognition toward — product names, jargon,
|
|
44
|
+
* proper nouns the model would otherwise mis-hear.
|
|
45
|
+
*/
|
|
46
|
+
customVocabulary?: readonly string[];
|
|
47
|
+
/** Audio sample rate in Hz. Defaults to 16000. */
|
|
48
|
+
sampleRate?: SampleRate;
|
|
49
|
+
/**
|
|
50
|
+
* Emit per-word timestamps in transcription results. Omitted unless
|
|
51
|
+
* explicitly set; cannot be `true` when `customVocabulary` is set.
|
|
52
|
+
*/
|
|
53
|
+
wordTimestamp?: boolean;
|
|
54
|
+
/** Additional vendor-specific parameters. */
|
|
55
|
+
additionalParams?: Record<string, unknown>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Gemini 3.5 Transcribe ASR vendor (preview).
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const agent = new Agent({ client }).withStt(new GeminiSTT({
|
|
63
|
+
* apiKey: process.env.GOOGLE_API_KEY!,
|
|
64
|
+
* languageCodes: ['en-US'],
|
|
65
|
+
* }));
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare class GeminiSTT extends BaseSTT {
|
|
69
|
+
private readonly options;
|
|
70
|
+
constructor(options: GeminiSTTOptions);
|
|
71
|
+
toConfig(): SttConfig;
|
|
72
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Preview provider vendor classes.
|
|
4
|
+
*
|
|
5
|
+
* These follow the same shape as the GA vendor classes in `vendors/` —
|
|
6
|
+
* camelCase constructor options in, snake_case wire config out — so they drop
|
|
7
|
+
* into `agent.withStt()` unchanged. They only work against the preview
|
|
8
|
+
* endpoint; AgentSession routes it automatically.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.GeminiSTT = exports.GeminiSTTModels = void 0;
|
|
12
|
+
const base_js_1 = require("../vendors/base.js");
|
|
13
|
+
// =============================================================================
|
|
14
|
+
// Gemini 3.5 Transcribe (ASR)
|
|
15
|
+
// =============================================================================
|
|
16
|
+
/** Gemini preview transcription models. */
|
|
17
|
+
exports.GeminiSTTModels = {
|
|
18
|
+
Transcribe35Live: "gemini-3.5-transcribe-live",
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Gemini 3.5 Transcribe ASR vendor (preview).
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const agent = new Agent({ client }).withStt(new GeminiSTT({
|
|
26
|
+
* apiKey: process.env.GOOGLE_API_KEY!,
|
|
27
|
+
* languageCodes: ['en-US'],
|
|
28
|
+
* }));
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
class GeminiSTT extends base_js_1.BaseSTT {
|
|
32
|
+
constructor(options) {
|
|
33
|
+
super();
|
|
34
|
+
if (!options.apiKey) {
|
|
35
|
+
throw new Error("GeminiSTT requires apiKey");
|
|
36
|
+
}
|
|
37
|
+
this.options = options;
|
|
38
|
+
}
|
|
39
|
+
toConfig() {
|
|
40
|
+
const { apiKey, model = exports.GeminiSTTModels.Transcribe35Live, languageCodes, customVocabulary, sampleRate = 16000, wordTimestamp, additionalParams, } = this.options;
|
|
41
|
+
const params = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, model, sample_rate: sampleRate }), (languageCodes && { language_codes: [...languageCodes] })), (customVocabulary && { custom_vocabulary: [...customVocabulary] })), (wordTimestamp !== undefined && { word_timestamp: wordTimestamp }));
|
|
42
|
+
if ("custom_vocabulary" in params && params.word_timestamp === true) {
|
|
43
|
+
throw new Error("customVocabulary cannot be used with wordTimestamp=true");
|
|
44
|
+
}
|
|
45
|
+
// No top-level `language`: `Agent` sets it from `turnDetection.language`,
|
|
46
|
+
// the same as every other STT vendor.
|
|
47
|
+
return {
|
|
48
|
+
vendor: "gemini",
|
|
49
|
+
params,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.GeminiSTT = GeminiSTT;
|
|
@@ -20,6 +20,35 @@ exports.generateConvoAIToken = generateConvoAIToken;
|
|
|
20
20
|
const agora_token_1 = __importDefault(require("agora-token"));
|
|
21
21
|
const DEFAULT_EXPIRY_SECONDS = 86400;
|
|
22
22
|
exports.MAX_EXPIRY_SECONDS = 86400;
|
|
23
|
+
/**
|
|
24
|
+
* Length `agora-token` requires of both the app ID and the app certificate.
|
|
25
|
+
* Either one being a different length yields an empty token.
|
|
26
|
+
*/
|
|
27
|
+
const AGORA_CREDENTIAL_LENGTH = 32;
|
|
28
|
+
/**
|
|
29
|
+
* Rejects the empty string `agora-token` returns for a malformed credential.
|
|
30
|
+
*
|
|
31
|
+
* The builders validate nothing and never throw — they hand back `""` whenever
|
|
32
|
+
* `appId` or `appCertificate` is not exactly {@link AGORA_CREDENTIAL_LENGTH}
|
|
33
|
+
* characters. That empty token is then sent as `token: ""`, and the failure
|
|
34
|
+
* surfaces as an opaque gateway auth error naming neither field. A value pasted
|
|
35
|
+
* with a trailing newline or a stray space is enough to trigger it, so fail
|
|
36
|
+
* here, where the cause is still visible.
|
|
37
|
+
*
|
|
38
|
+
* Credential values are never included in the message — only their lengths.
|
|
39
|
+
*/
|
|
40
|
+
function _requireBuiltToken(token, appId, appCertificate) {
|
|
41
|
+
if (token) {
|
|
42
|
+
return token;
|
|
43
|
+
}
|
|
44
|
+
const wrong = [["appId", appId], ["appCertificate", appCertificate]].filter(([, value]) => value.length !== AGORA_CREDENTIAL_LENGTH);
|
|
45
|
+
const detail = wrong.length > 0
|
|
46
|
+
? wrong.map(([name, value]) => `${name} is ${value.length} characters`).join(" and ")
|
|
47
|
+
: "both are the right length, so the values themselves were rejected";
|
|
48
|
+
throw new Error(`Failed to build an Agora token: appId and appCertificate must each be exactly ` +
|
|
49
|
+
`${AGORA_CREDENTIAL_LENGTH} characters (${detail}). ` +
|
|
50
|
+
"Check the values for stray whitespace or a truncated paste.");
|
|
51
|
+
}
|
|
23
52
|
/**
|
|
24
53
|
* Convenience helpers for specifying token expiry durations.
|
|
25
54
|
*
|
|
@@ -91,7 +120,7 @@ function _validateExpiresIn(secs) {
|
|
|
91
120
|
function generateRtcToken(opts) {
|
|
92
121
|
var _a, _b;
|
|
93
122
|
const expiry = (_a = opts.expirySeconds) !== null && _a !== void 0 ? _a : DEFAULT_EXPIRY_SECONDS;
|
|
94
|
-
return agora_token_1.default.RtcTokenBuilder.buildTokenWithUid(opts.appId, opts.appCertificate, opts.channel, opts.uid, (_b = opts.role) !== null && _b !== void 0 ? _b : agora_token_1.default.RtcRole.PUBLISHER, expiry, expiry);
|
|
123
|
+
return _requireBuiltToken(agora_token_1.default.RtcTokenBuilder.buildTokenWithUid(opts.appId, opts.appCertificate, opts.channel, opts.uid, (_b = opts.role) !== null && _b !== void 0 ? _b : agora_token_1.default.RtcRole.PUBLISHER, expiry, expiry), opts.appId, opts.appCertificate);
|
|
95
124
|
}
|
|
96
125
|
/**
|
|
97
126
|
* Builds a short-lived RTC token for a string UID (user account).
|
|
@@ -105,7 +134,7 @@ function generateRtcToken(opts) {
|
|
|
105
134
|
function generateRtcTokenWithAccount(opts) {
|
|
106
135
|
var _a, _b;
|
|
107
136
|
const expiry = (_a = opts.expirySeconds) !== null && _a !== void 0 ? _a : DEFAULT_EXPIRY_SECONDS;
|
|
108
|
-
return agora_token_1.default.RtcTokenBuilder.buildTokenWithUserAccount(opts.appId, opts.appCertificate, opts.channel, opts.account, (_b = opts.role) !== null && _b !== void 0 ? _b : agora_token_1.default.RtcRole.PUBLISHER, expiry, expiry);
|
|
137
|
+
return _requireBuiltToken(agora_token_1.default.RtcTokenBuilder.buildTokenWithUserAccount(opts.appId, opts.appCertificate, opts.channel, opts.account, (_b = opts.role) !== null && _b !== void 0 ? _b : agora_token_1.default.RtcRole.PUBLISHER, expiry, expiry), opts.appId, opts.appCertificate);
|
|
109
138
|
}
|
|
110
139
|
/**
|
|
111
140
|
* Builds a combined RTC + RTM token for ConvoAI REST API authentication.
|
|
@@ -123,7 +152,7 @@ function generateConvoAIToken(opts) {
|
|
|
123
152
|
const configuredPrivilegeExpire = (_b = opts.privilegeExpire) !== null && _b !== void 0 ? _b : 0;
|
|
124
153
|
const privilegeExpire = configuredPrivilegeExpire === 0 ? tokenExpire : configuredPrivilegeExpire;
|
|
125
154
|
const account = _uidToAccount(opts.uid);
|
|
126
|
-
return agora_token_1.default.RtcTokenBuilder.buildTokenWithRtm(opts.appId, opts.appCertificate, opts.channelName, account, agora_token_1.default.RtcRole.PUBLISHER, tokenExpire, privilegeExpire);
|
|
155
|
+
return _requireBuiltToken(agora_token_1.default.RtcTokenBuilder.buildTokenWithRtm(opts.appId, opts.appCertificate, opts.channelName, account, agora_token_1.default.RtcRole.PUBLISHER, tokenExpire, privilegeExpire), opts.appId, opts.appCertificate);
|
|
127
156
|
}
|
|
128
157
|
function _uidToAccount(uid) {
|
|
129
158
|
if (!Number.isInteger(uid)) {
|
|
@@ -72,6 +72,10 @@ export type SttConfig = {
|
|
|
72
72
|
vendor: "xai";
|
|
73
73
|
language?: TurnDetectionLanguage;
|
|
74
74
|
params: XAiAsrParams;
|
|
75
|
+
} | {
|
|
76
|
+
vendor: "gemini";
|
|
77
|
+
language?: TurnDetectionLanguage;
|
|
78
|
+
params: GeminiAsrParams;
|
|
75
79
|
} | Asr;
|
|
76
80
|
/** ASR configuration — alias for {@link SttConfig} (wire field: `asr`). */
|
|
77
81
|
export type AsrConfig = SttConfig;
|
|
@@ -542,6 +546,41 @@ export interface SarvamAsrParams {
|
|
|
542
546
|
*/
|
|
543
547
|
export type XAiAsr = XAiAsrType;
|
|
544
548
|
export type XAiAsrParams = XAiAsrParamsType;
|
|
549
|
+
/**
|
|
550
|
+
* Gemini STT parameters (preview).
|
|
551
|
+
*
|
|
552
|
+
* Served only by the preview endpoint and routed automatically by AgentSession.
|
|
553
|
+
* Not part of the generated `Asr` union, so the variant
|
|
554
|
+
* is declared here until the provider ships on the production gateway.
|
|
555
|
+
*/
|
|
556
|
+
export interface GeminiAsrParams {
|
|
557
|
+
/** Google API key */
|
|
558
|
+
api_key: string;
|
|
559
|
+
/** Model name (e.g., 'gemini-3.5-transcribe-live') */
|
|
560
|
+
model: string;
|
|
561
|
+
/** Audio sample rate in Hz */
|
|
562
|
+
sample_rate?: number;
|
|
563
|
+
/**
|
|
564
|
+
* Languages to transcribe (e.g., `['en-US']`).
|
|
565
|
+
*
|
|
566
|
+
* Omit the field or send `[]` to let the model auto-detect. Note this is
|
|
567
|
+
* `language_codes` — an array — not the singular `language` other ASR
|
|
568
|
+
* vendors take.
|
|
569
|
+
*/
|
|
570
|
+
language_codes?: string[];
|
|
571
|
+
/**
|
|
572
|
+
* Words and phrases to bias recognition toward (e.g., product names,
|
|
573
|
+
* jargon). Optional.
|
|
574
|
+
*/
|
|
575
|
+
custom_vocabulary?: string[];
|
|
576
|
+
/**
|
|
577
|
+
* Emit per-word timestamps in transcription results. Cannot be `true`
|
|
578
|
+
* when `custom_vocabulary` is set.
|
|
579
|
+
*/
|
|
580
|
+
word_timestamp?: boolean;
|
|
581
|
+
/** Additional Gemini-specific parameters */
|
|
582
|
+
[key: string]: unknown;
|
|
583
|
+
}
|
|
545
584
|
export type MicrosoftTts = MicrosoftTtsType;
|
|
546
585
|
export type MicrosoftTtsParams = MicrosoftTtsParamsType;
|
|
547
586
|
export type ElevenLabsTts = ElevenLabsTtsType;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export type { AgoraAuthMode } from "./AgoraPoolClient.js";
|
|
2
2
|
export { AgoraClient } from "./AgoraPoolClient.js";
|
|
3
3
|
export type { AgoraArea, AreaScope, GlobalArea } from "./agentkit/area.js";
|
|
4
|
-
export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AgentOptions, AgentPreset, AgentSessionEvent, AgentSessionEventHandler, AgentSessionOptions, AgentsClient, AkoolAvatarConfig, AkoolAvatarOptions, AkoolSampleRate, AliyunLLMOptions, AmazonBedrockOptions, AmazonSTTOptions, AmazonTTSOptions, AmazonTts, AmazonTtsParams, AnamAvatarConfig, AnamAvatarOptions, AnthropicOptions, AresSTTOptions, AsrConfig, AsrPreset, AsrVendorName, AssemblyAISTTOptions, AvatarConfig, AvatarVendor, AvatarWireVendor, AzureOpenAIOptions, AzureOpenAIRealtimeOptions, AzureOpenAIRealtimeParams, BytedanceDuplexTTSOptions, BytedanceLLMOptions, BytedanceTTSOptions, CartesiaSampleRate, CartesiaTTSOptions, CartesiaTts, CartesiaTtsParams, CNAvatarVendor, CNLlmVendor, CNMllmVendor, CNSttVendor, CNTtsVendor, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, CustomLLMOptions, DeepgramSTTOptions, DeepgramTTSOptions, DeepSeekLLMOptions, DifyOptions, Eagerness, ElevenLabsSampleRate, ElevenLabsTTSOptions, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FengmingSTTOptions, FillerWordsConfig, FillerWordsContent, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTTSOptions, FishAudioTts, FishAudioTtsParams, GeminiLiveOptions, GeminiOptions, GenerateConvoAITokenOptions, GenerateTokenOptions, GenericAvatarConfig, GenericAvatarOptions, GenericTTSOptions, GenericTts, GenericTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GlobalAvatarVendor, GlobalLlmVendor, GlobalMllmVendor, GlobalSttVendor, GlobalTtsVendor, GoogleSTTOptions, GoogleTTSOptions, GoogleTts, GoogleTtsParams, GradiumTTSOptions, GradiumTts, GradiumTtsParams, GroqOptions, HeyGenAvatarConfig, HeyGenAvatarOptions, HeyGenSampleRate, HumeAITTSOptions, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LiveAvatarAvatarConfig, LiveAvatarAvatarOptions, LiveAvatarSampleRate, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmPreset, LlmStyle, LlmVendor, McpServersItem, MicrosoftCNSampleRate, MicrosoftCNSTTOptions, MicrosoftCNTTSOptions, MicrosoftSampleRate, MicrosoftSTTOptions, MicrosoftTTSOptions, MicrosoftTts, MicrosoftTtsParams, MiniMaxCNTTSOptions, MiniMaxTTSOptions, MinimaxTts, MinimaxTtsParams, MistralTTSOptions, MistralTts, MistralTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTTSOptions, MurfTts, MurfTtsParams, OpenAIOptions, OpenAIRealtimeOptions, OpenAISTTOptions, OpenAITTSOptions, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, PresetCategory, PresetInput, QwenOmniOptions, RimeTTSOptions, RimeTts, RimeTtsParams, RtcConfig, SalConfig, SalMode, SampleRate, SarvamSTTOptions, SarvamTTSOptions, SarvamTts, SarvamTtsParams, SayOptions, SensetimeAvatarConfig, SensetimeAvatarOptions, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SpatiusAvatarConfig, SpatiusAvatarOptions, SpatiusAvatarParams, SpeakPriority, SpeechmaticsSTTOptions, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, StepFunTTSOptions, StrictAvatarConfig, SttConfig, SttVendor, TencentLLMOptions, TencentSTTOptions, TencentTTSOptions, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TtsPreset, TtsVendor, TurnDetectionConfig, TurnDetectionLanguage, TurnDetectionNestedConfig, TurnDetectionType, TypecastTTSOptions, TypecastTts, TypecastTtsParams, VertexAILLMOptions, VertexAIOptions, XAiAsr, XAiAsrParams, XAiSTTOptions, XAiTTSOptions, XAiTts, XAiTtsParams, XaiGrokOptions, XfyunBigModelSTTOptions, XfyunDialectSTTOptions, XfyunSTTOptions, } from "./agentkit/index.js";
|
|
5
|
-
export { Agent, AgentPresets, AgentSession, AkoolAvatar, AliyunLLM, AmazonBedrock, AmazonSTT, AmazonTTS, AnamAvatar, Anthropic, AresSTT, AssemblyAISTT, AudioScenario, AzureOpenAI, AzureOpenAIRealtime, BaseAvatar, BaseCNAvatar, BaseCNLLM, BaseCNMLLM, BaseCNSTT, BaseCNTTS, BaseLLM, BaseMLLM, BaseSTT, BaseTTS, BytedanceDuplexTTS, BytedanceLLM, BytedanceTTS, CartesiaTTS, CosyVoiceTTS, CredentialMode, CustomLLM, DataChannel, DeepgramSTT, DeepgramTTS, DeepSeekLLM, Dify, ElevenLabsTTS, ExpiresIn, FengmingSTT, FillerWordsSelectionRule, FishAudioTTS, Gemini, GeminiLive, GenericAvatar, GenericTTS, Geofence, GoogleSTT, GoogleTTS, GradiumTTS, Groq, generateConvoAIToken, generateRtcToken, HeyGenAvatar, HumeAITTS, InterruptionDisabledStrategy, InterruptionDisabledStrategyAppend, InterruptionDisabledStrategyIgnore, InterruptionModeKeywords, InterruptionModeStartOfSpeech, InterruptionModeValues, isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, isSensetimeAvatar, isSpatiusAvatar, LiveAvatarAvatar, MAX_EXPIRY_SECONDS, MicrosoftCNSTT, MicrosoftCNTTS, MicrosoftSTT, MicrosoftTTS, MiniMaxCNTTS, MiniMaxTTS, MistralTTS, MllmTurnDetectionModeAgoraVad, MllmTurnDetectionModeSemanticVad, MllmTurnDetectionModeServerVad, MllmTurnDetectionModeValues, MurfTTS, normalizePresetInput, OpenAI, OpenAIRealtime, OpenAISTT, OpenAITTS, QwenOmni, RimeTTS, SalModeValues, SarvamSTT, SarvamTTS, SensetimeAvatar, SilenceActionValues, SpatiusAvatar, SpeakPriorityAppend, SpeakPriorityIgnore, SpeakPriorityInterrupt, SpeakPriorityValues, SpeechmaticsSTT, StepFunTTS, TencentLLM, TencentSTT, TencentTTS, ThinkOnListeningActionIgnore, ThinkOnListeningActionInject, ThinkOnListeningActionInterrupt, ThinkOnSpeakingActionIgnore, ThinkOnSpeakingActionInterrupt, ThinkOnThinkingActionIgnore, ThinkOnThinkingActionInterrupt, TurnDetectionTypeValues, TypecastTTS, toBaseAvatarConfig, VertexAI, VertexAILLM, validateAvatarConfig, validateTtsSampleRate, XAiSTT, XAiTTS, XaiGrok, XfyunBigModelSTT, XfyunDialectSTT, XfyunSTT, } from "./agentkit/index.js";
|
|
4
|
+
export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AgentOptions, AgentPreset, AgentSessionEvent, AgentSessionEventHandler, AgentSessionOptions, AgentsClient, AkoolAvatarConfig, AkoolAvatarOptions, AkoolSampleRate, AliyunLLMOptions, AmazonBedrockOptions, AmazonSTTOptions, AmazonTTSOptions, AmazonTts, AmazonTtsParams, AnamAvatarConfig, AnamAvatarOptions, AnthropicOptions, AresSTTOptions, AsrConfig, AsrPreset, AsrVendorName, AssemblyAISTTOptions, AvatarConfig, AvatarVendor, AvatarWireVendor, AzureOpenAIOptions, AzureOpenAIRealtimeOptions, AzureOpenAIRealtimeParams, BytedanceDuplexTTSOptions, BytedanceLLMOptions, BytedanceTTSOptions, CartesiaSampleRate, CartesiaTTSOptions, CartesiaTts, CartesiaTtsParams, CNAvatarVendor, CNLlmVendor, CNMllmVendor, CNSttVendor, CNTtsVendor, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, CustomLLMOptions, DeepgramSTTOptions, DeepgramTTSOptions, DeepSeekLLMOptions, DifyOptions, Eagerness, ElevenLabsSampleRate, ElevenLabsTTSOptions, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FengmingSTTOptions, FillerWordsConfig, FillerWordsContent, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTTSOptions, FishAudioTts, FishAudioTtsParams, GeminiAsrParams, GeminiLiveOptions, GeminiOptions, GeminiSTTModel, GeminiSTTOptions, GenerateConvoAITokenOptions, GenerateTokenOptions, GenericAvatarConfig, GenericAvatarOptions, GenericTTSOptions, GenericTts, GenericTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GlobalAvatarVendor, GlobalLlmVendor, GlobalMllmVendor, GlobalSttVendor, GlobalTtsVendor, GoogleSTTOptions, GoogleTTSOptions, GoogleTts, GoogleTtsParams, GradiumTTSOptions, GradiumTts, GradiumTtsParams, GroqOptions, HeyGenAvatarConfig, HeyGenAvatarOptions, HeyGenSampleRate, HumeAITTSOptions, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LiveAvatarAvatarConfig, LiveAvatarAvatarOptions, LiveAvatarSampleRate, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmPreset, LlmStyle, LlmVendor, McpServersItem, MicrosoftCNSampleRate, MicrosoftCNSTTOptions, MicrosoftCNTTSOptions, MicrosoftSampleRate, MicrosoftSTTOptions, MicrosoftTTSOptions, MicrosoftTts, MicrosoftTtsParams, MiniMaxCNTTSOptions, MiniMaxTTSOptions, MinimaxTts, MinimaxTtsParams, MistralTTSOptions, MistralTts, MistralTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTTSOptions, MurfTts, MurfTtsParams, OpenAIOptions, OpenAIRealtimeOptions, OpenAISTTOptions, OpenAITTSOptions, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, PresetCategory, PresetInput, PreviewFeature, PreviewRoute, QwenOmniOptions, RimeTTSOptions, RimeTts, RimeTtsParams, RtcConfig, SalConfig, SalMode, SampleRate, SarvamSTTOptions, SarvamTTSOptions, SarvamTts, SarvamTtsParams, SayOptions, SensetimeAvatarConfig, SensetimeAvatarOptions, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SpatiusAvatarConfig, SpatiusAvatarOptions, SpatiusAvatarParams, SpeakPriority, SpeechmaticsSTTOptions, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, StepFunTTSOptions, StrictAvatarConfig, SttConfig, SttVendor, TencentLLMOptions, TencentSTTOptions, TencentTTSOptions, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TtsPreset, TtsVendor, TurnDetectionConfig, TurnDetectionLanguage, TurnDetectionNestedConfig, TurnDetectionType, TypecastTTSOptions, TypecastTts, TypecastTtsParams, VertexAILLMOptions, VertexAIOptions, XAiAsr, XAiAsrParams, XAiSTTOptions, XAiTTSOptions, XAiTts, XAiTtsParams, XaiGrokOptions, XfyunBigModelSTTOptions, XfyunDialectSTTOptions, XfyunSTTOptions, } from "./agentkit/index.js";
|
|
5
|
+
export { Agent, AgentPresets, AgentSession, AkoolAvatar, AliyunLLM, AmazonBedrock, AmazonSTT, AmazonTTS, AnamAvatar, Anthropic, AresSTT, AssemblyAISTT, AudioScenario, AzureOpenAI, AzureOpenAIRealtime, BaseAvatar, BaseCNAvatar, BaseCNLLM, BaseCNMLLM, BaseCNSTT, BaseCNTTS, BaseLLM, BaseMLLM, BaseSTT, BaseTTS, BytedanceDuplexTTS, BytedanceLLM, BytedanceTTS, CartesiaTTS, CosyVoiceTTS, CredentialMode, CustomLLM, createPreviewRoute, DataChannel, DeepgramSTT, DeepgramTTS, DeepSeekLLM, Dify, ElevenLabsTTS, ExpiresIn, FengmingSTT, FillerWordsSelectionRule, FishAudioTTS, Gemini, GeminiLive, GeminiSTT, GeminiSTTModels, GenericAvatar, GenericTTS, Geofence, GoogleSTT, GoogleTTS, GradiumTTS, Groq, generateConvoAIToken, generateRtcToken, HeyGenAvatar, HumeAITTS, InterruptionDisabledStrategy, InterruptionDisabledStrategyAppend, InterruptionDisabledStrategyIgnore, InterruptionModeKeywords, InterruptionModeStartOfSpeech, InterruptionModeValues, isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, isSensetimeAvatar, isSpatiusAvatar, LiveAvatarAvatar, MAX_EXPIRY_SECONDS, MicrosoftCNSTT, MicrosoftCNTTS, MicrosoftSTT, MicrosoftTTS, MiniMaxCNTTS, MiniMaxTTS, MistralTTS, MllmTurnDetectionModeAgoraVad, MllmTurnDetectionModeSemanticVad, MllmTurnDetectionModeServerVad, MllmTurnDetectionModeValues, MurfTTS, normalizePresetInput, OpenAI, OpenAIRealtime, OpenAISTT, OpenAITTS, PREVIEW_API_BASE_URL, PREVIEW_FEATURE_HEADER, PreviewFeatures, previewRequestHeaders, QwenOmni, REDACTED, RimeTTS, redactHeadersForDebug, redactSecrets, SalModeValues, SarvamSTT, SarvamTTS, SensetimeAvatar, SilenceActionValues, SpatiusAvatar, SpeakPriorityAppend, SpeakPriorityIgnore, SpeakPriorityInterrupt, SpeakPriorityValues, SpeechmaticsSTT, StepFunTTS, TencentLLM, TencentSTT, TencentTTS, ThinkOnListeningActionIgnore, ThinkOnListeningActionInject, ThinkOnListeningActionInterrupt, ThinkOnSpeakingActionIgnore, ThinkOnSpeakingActionInterrupt, ThinkOnThinkingActionIgnore, ThinkOnThinkingActionInterrupt, TurnDetectionTypeValues, TypecastTTS, toBaseAvatarConfig, VertexAI, VertexAILLM, validateAvatarConfig, validateTtsSampleRate, XAiSTT, XAiTTS, XaiGrok, XfyunBigModelSTT, XfyunDialectSTT, XfyunSTT, } from "./agentkit/index.js";
|
|
6
6
|
export * as Agora from "./api/index.js";
|
|
7
7
|
export type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
8
8
|
export { Area } from "./core/domain/index.js";
|
package/dist/cjs/index.js
CHANGED
|
@@ -36,9 +36,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.AgoraTimeoutError = exports.AgoraError = exports.AgoraEnvironment = exports.Area = exports.Agora = exports.XfyunSTT = exports.XfyunDialectSTT = exports.XfyunBigModelSTT = exports.XaiGrok = exports.XAiTTS = exports.XAiSTT = exports.validateTtsSampleRate = exports.validateAvatarConfig = exports.VertexAILLM = exports.VertexAI = exports.toBaseAvatarConfig = exports.TypecastTTS = exports.TurnDetectionTypeValues = exports.ThinkOnThinkingActionInterrupt = exports.ThinkOnThinkingActionIgnore = exports.ThinkOnSpeakingActionInterrupt = exports.ThinkOnSpeakingActionIgnore = exports.ThinkOnListeningActionInterrupt = exports.ThinkOnListeningActionInject = exports.ThinkOnListeningActionIgnore = exports.TencentTTS = exports.TencentSTT = exports.TencentLLM = exports.StepFunTTS = exports.SpeechmaticsSTT = exports.SpeakPriorityValues = void 0;
|
|
39
|
+
exports.GenericTTS = exports.GenericAvatar = exports.GeminiSTTModels = exports.GeminiSTT = exports.GeminiLive = exports.Gemini = exports.FishAudioTTS = exports.FillerWordsSelectionRule = exports.FengmingSTT = exports.ExpiresIn = exports.ElevenLabsTTS = exports.Dify = exports.DeepSeekLLM = exports.DeepgramTTS = exports.DeepgramSTT = exports.DataChannel = exports.createPreviewRoute = exports.CustomLLM = exports.CredentialMode = exports.CosyVoiceTTS = exports.CartesiaTTS = exports.BytedanceTTS = exports.BytedanceLLM = exports.BytedanceDuplexTTS = exports.BaseTTS = exports.BaseSTT = exports.BaseMLLM = exports.BaseLLM = exports.BaseCNTTS = exports.BaseCNSTT = exports.BaseCNMLLM = exports.BaseCNLLM = exports.BaseCNAvatar = exports.BaseAvatar = exports.AzureOpenAIRealtime = exports.AzureOpenAI = exports.AudioScenario = exports.AssemblyAISTT = exports.AresSTT = exports.Anthropic = exports.AnamAvatar = exports.AmazonTTS = exports.AmazonSTT = exports.AmazonBedrock = exports.AliyunLLM = exports.AkoolAvatar = exports.AgentSession = exports.AgentPresets = exports.Agent = exports.AgoraClient = void 0;
|
|
40
|
+
exports.redactHeadersForDebug = exports.RimeTTS = exports.REDACTED = exports.QwenOmni = exports.previewRequestHeaders = exports.PreviewFeatures = exports.PREVIEW_FEATURE_HEADER = exports.PREVIEW_API_BASE_URL = exports.OpenAITTS = exports.OpenAISTT = exports.OpenAIRealtime = exports.OpenAI = exports.normalizePresetInput = exports.MurfTTS = exports.MllmTurnDetectionModeValues = exports.MllmTurnDetectionModeServerVad = exports.MllmTurnDetectionModeSemanticVad = exports.MllmTurnDetectionModeAgoraVad = exports.MistralTTS = exports.MiniMaxTTS = exports.MiniMaxCNTTS = exports.MicrosoftTTS = exports.MicrosoftSTT = exports.MicrosoftCNTTS = exports.MicrosoftCNSTT = exports.MAX_EXPIRY_SECONDS = exports.LiveAvatarAvatar = exports.isSpatiusAvatar = exports.isSensetimeAvatar = exports.isLiveAvatarAvatar = exports.isHeyGenAvatar = exports.isGenericAvatar = exports.isAvatarTokenManaged = exports.isAnamAvatar = exports.isAkoolAvatar = exports.InterruptionModeValues = exports.InterruptionModeStartOfSpeech = exports.InterruptionModeKeywords = exports.InterruptionDisabledStrategyIgnore = exports.InterruptionDisabledStrategyAppend = exports.InterruptionDisabledStrategy = exports.HumeAITTS = exports.HeyGenAvatar = exports.generateRtcToken = exports.generateConvoAIToken = exports.Groq = exports.GradiumTTS = exports.GoogleTTS = exports.GoogleSTT = exports.Geofence = void 0;
|
|
41
|
+
exports.AgoraTimeoutError = exports.AgoraError = exports.AgoraEnvironment = exports.Area = exports.Agora = exports.XfyunSTT = exports.XfyunDialectSTT = exports.XfyunBigModelSTT = exports.XaiGrok = exports.XAiTTS = exports.XAiSTT = exports.validateTtsSampleRate = exports.validateAvatarConfig = exports.VertexAILLM = exports.VertexAI = exports.toBaseAvatarConfig = exports.TypecastTTS = exports.TurnDetectionTypeValues = exports.ThinkOnThinkingActionInterrupt = exports.ThinkOnThinkingActionIgnore = exports.ThinkOnSpeakingActionInterrupt = exports.ThinkOnSpeakingActionIgnore = exports.ThinkOnListeningActionInterrupt = exports.ThinkOnListeningActionInject = exports.ThinkOnListeningActionIgnore = exports.TencentTTS = exports.TencentSTT = exports.TencentLLM = exports.StepFunTTS = exports.SpeechmaticsSTT = exports.SpeakPriorityValues = exports.SpeakPriorityInterrupt = exports.SpeakPriorityIgnore = exports.SpeakPriorityAppend = exports.SpatiusAvatar = exports.SilenceActionValues = exports.SensetimeAvatar = exports.SarvamTTS = exports.SarvamSTT = exports.SalModeValues = exports.redactSecrets = void 0;
|
|
42
42
|
var AgoraPoolClient_js_1 = require("./AgoraPoolClient.js");
|
|
43
43
|
Object.defineProperty(exports, "AgoraClient", { enumerable: true, get: function () { return AgoraPoolClient_js_1.AgoraClient; } });
|
|
44
44
|
// Agentkit layer exports - clean, ergonomic API
|
|
@@ -76,6 +76,7 @@ Object.defineProperty(exports, "CartesiaTTS", { enumerable: true, get: function
|
|
|
76
76
|
Object.defineProperty(exports, "CosyVoiceTTS", { enumerable: true, get: function () { return index_js_1.CosyVoiceTTS; } });
|
|
77
77
|
Object.defineProperty(exports, "CredentialMode", { enumerable: true, get: function () { return index_js_1.CredentialMode; } });
|
|
78
78
|
Object.defineProperty(exports, "CustomLLM", { enumerable: true, get: function () { return index_js_1.CustomLLM; } });
|
|
79
|
+
Object.defineProperty(exports, "createPreviewRoute", { enumerable: true, get: function () { return index_js_1.createPreviewRoute; } });
|
|
79
80
|
Object.defineProperty(exports, "DataChannel", { enumerable: true, get: function () { return index_js_1.DataChannel; } });
|
|
80
81
|
Object.defineProperty(exports, "DeepgramSTT", { enumerable: true, get: function () { return index_js_1.DeepgramSTT; } });
|
|
81
82
|
Object.defineProperty(exports, "DeepgramTTS", { enumerable: true, get: function () { return index_js_1.DeepgramTTS; } });
|
|
@@ -89,6 +90,8 @@ Object.defineProperty(exports, "FillerWordsSelectionRule", { enumerable: true, g
|
|
|
89
90
|
Object.defineProperty(exports, "FishAudioTTS", { enumerable: true, get: function () { return index_js_1.FishAudioTTS; } });
|
|
90
91
|
Object.defineProperty(exports, "Gemini", { enumerable: true, get: function () { return index_js_1.Gemini; } });
|
|
91
92
|
Object.defineProperty(exports, "GeminiLive", { enumerable: true, get: function () { return index_js_1.GeminiLive; } });
|
|
93
|
+
Object.defineProperty(exports, "GeminiSTT", { enumerable: true, get: function () { return index_js_1.GeminiSTT; } });
|
|
94
|
+
Object.defineProperty(exports, "GeminiSTTModels", { enumerable: true, get: function () { return index_js_1.GeminiSTTModels; } });
|
|
92
95
|
Object.defineProperty(exports, "GenericAvatar", { enumerable: true, get: function () { return index_js_1.GenericAvatar; } });
|
|
93
96
|
Object.defineProperty(exports, "GenericTTS", { enumerable: true, get: function () { return index_js_1.GenericTTS; } });
|
|
94
97
|
Object.defineProperty(exports, "Geofence", { enumerable: true, get: function () { return index_js_1.Geofence; } });
|
|
@@ -136,8 +139,15 @@ Object.defineProperty(exports, "OpenAI", { enumerable: true, get: function () {
|
|
|
136
139
|
Object.defineProperty(exports, "OpenAIRealtime", { enumerable: true, get: function () { return index_js_1.OpenAIRealtime; } });
|
|
137
140
|
Object.defineProperty(exports, "OpenAISTT", { enumerable: true, get: function () { return index_js_1.OpenAISTT; } });
|
|
138
141
|
Object.defineProperty(exports, "OpenAITTS", { enumerable: true, get: function () { return index_js_1.OpenAITTS; } });
|
|
142
|
+
Object.defineProperty(exports, "PREVIEW_API_BASE_URL", { enumerable: true, get: function () { return index_js_1.PREVIEW_API_BASE_URL; } });
|
|
143
|
+
Object.defineProperty(exports, "PREVIEW_FEATURE_HEADER", { enumerable: true, get: function () { return index_js_1.PREVIEW_FEATURE_HEADER; } });
|
|
144
|
+
Object.defineProperty(exports, "PreviewFeatures", { enumerable: true, get: function () { return index_js_1.PreviewFeatures; } });
|
|
145
|
+
Object.defineProperty(exports, "previewRequestHeaders", { enumerable: true, get: function () { return index_js_1.previewRequestHeaders; } });
|
|
139
146
|
Object.defineProperty(exports, "QwenOmni", { enumerable: true, get: function () { return index_js_1.QwenOmni; } });
|
|
147
|
+
Object.defineProperty(exports, "REDACTED", { enumerable: true, get: function () { return index_js_1.REDACTED; } });
|
|
140
148
|
Object.defineProperty(exports, "RimeTTS", { enumerable: true, get: function () { return index_js_1.RimeTTS; } });
|
|
149
|
+
Object.defineProperty(exports, "redactHeadersForDebug", { enumerable: true, get: function () { return index_js_1.redactHeadersForDebug; } });
|
|
150
|
+
Object.defineProperty(exports, "redactSecrets", { enumerable: true, get: function () { return index_js_1.redactSecrets; } });
|
|
141
151
|
Object.defineProperty(exports, "SalModeValues", { enumerable: true, get: function () { return index_js_1.SalModeValues; } });
|
|
142
152
|
Object.defineProperty(exports, "SarvamSTT", { enumerable: true, get: function () { return index_js_1.SarvamSTT; } });
|
|
143
153
|
Object.defineProperty(exports, "SarvamTTS", { enumerable: true, get: function () { return index_js_1.SarvamTTS; } });
|
|
@@ -640,6 +640,11 @@ export class Agent {
|
|
|
640
640
|
if (mllmConfig) {
|
|
641
641
|
// Vendor config wins: only apply agent-level values when the vendor hasn't already set them.
|
|
642
642
|
// Consistent with Python (setdefault) and Go (!exists) semantics.
|
|
643
|
+
//
|
|
644
|
+
// These are production wire spellings. A route that spells one of them
|
|
645
|
+
// differently needs a rename entry in `preview/client.ts`, or the value
|
|
646
|
+
// lands in a field the provider ignores and fails silently. See
|
|
647
|
+
// docs/guides/preview-endpoint.md#the-vendor-class-is-not-the-whole-wire-shape.
|
|
643
648
|
const c = mllmConfig;
|
|
644
649
|
if (this._greeting !== undefined && c.greeting_message === undefined) {
|
|
645
650
|
c.greeting_message = this._greeting;
|
|
@@ -721,6 +726,10 @@ export class Agent {
|
|
|
721
726
|
: {
|
|
722
727
|
vendor: this._client.area === Area.CN ? "fengming" : "ares",
|
|
723
728
|
};
|
|
729
|
+
// Unconditional: turn detection is the single source of truth for the
|
|
730
|
+
// interaction language, so a vendor-level `language` would be silently
|
|
731
|
+
// discarded here. Do not add one to a vendor class — see
|
|
732
|
+
// docs/guides/preview-endpoint.md#the-vendor-class-is-not-the-whole-wire-shape.
|
|
724
733
|
asrConfig.language = turnDetectionConfig.language;
|
|
725
734
|
return Object.keys(asrConfig).length > 0 ? asrConfig : undefined;
|
|
726
735
|
}
|