agora-agents 2.6.0 → 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.
Files changed (99) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/agentkit/Agent.d.ts +2 -2
  3. package/dist/cjs/agentkit/Agent.js +11 -2
  4. package/dist/cjs/agentkit/AgentSession.d.ts +27 -0
  5. package/dist/cjs/agentkit/AgentSession.js +95 -23
  6. package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.js +2 -2
  7. package/dist/cjs/agentkit/__tests__/preview-types.test.d.ts +7 -0
  8. package/dist/cjs/agentkit/__tests__/preview-types.test.js +57 -0
  9. package/dist/cjs/agentkit/__tests__/readme-examples.test.js +3 -3
  10. package/dist/cjs/agentkit/__tests__/type-safety.test.js +1 -1
  11. package/dist/cjs/agentkit/debug.d.ts +33 -0
  12. package/dist/cjs/agentkit/debug.js +134 -0
  13. package/dist/cjs/agentkit/index.d.ts +4 -1
  14. package/dist/cjs/agentkit/index.js +16 -3
  15. package/dist/cjs/agentkit/preview/client.d.ts +58 -0
  16. package/dist/cjs/agentkit/preview/client.js +89 -0
  17. package/dist/cjs/agentkit/preview/index.d.ts +11 -0
  18. package/dist/cjs/agentkit/preview/index.js +20 -0
  19. package/dist/cjs/agentkit/preview/vendors.d.ts +72 -0
  20. package/dist/cjs/agentkit/preview/vendors.js +53 -0
  21. package/dist/cjs/agentkit/token.js +32 -3
  22. package/dist/cjs/agentkit/types.d.ts +42 -1
  23. package/dist/cjs/agentkit/vendors/stt.d.ts +12 -4
  24. package/dist/cjs/agentkit/vendors/stt.js +7 -3
  25. package/dist/cjs/api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.d.ts +9 -0
  26. package/dist/cjs/api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.js +6 -0
  27. package/dist/cjs/api/resources/agents/client/Client.js +17 -1
  28. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +49 -4
  29. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +9 -0
  30. package/dist/cjs/api/types/AresAsr.d.ts +2 -0
  31. package/dist/cjs/api/types/AresAsrParams.d.ts +1 -6
  32. package/dist/cjs/api/types/FengmingAsr.d.ts +2 -0
  33. package/dist/cjs/api/types/FengmingAsrParams.d.ts +1 -6
  34. package/dist/cjs/api/types/Llm.d.ts +12 -0
  35. package/dist/cjs/api/types/LlmTool.d.ts +14 -0
  36. package/dist/cjs/api/types/LlmTool.js +3 -0
  37. package/dist/cjs/api/types/LlmToolExecution.d.ts +9 -0
  38. package/dist/cjs/api/types/LlmToolExecution.js +3 -0
  39. package/dist/cjs/api/types/LlmToolFunction.d.ts +28 -0
  40. package/dist/cjs/api/types/LlmToolFunction.js +3 -0
  41. package/dist/cjs/api/types/LlmToolServer.d.ts +42 -0
  42. package/dist/cjs/api/types/LlmToolServer.js +12 -0
  43. package/dist/cjs/api/types/SpeechmaticsAsrParams.d.ts +12 -3
  44. package/dist/cjs/api/types/index.d.ts +4 -0
  45. package/dist/cjs/api/types/index.js +4 -0
  46. package/dist/cjs/index.d.ts +2 -2
  47. package/dist/cjs/index.js +13 -3
  48. package/dist/cjs/version.d.ts +1 -1
  49. package/dist/cjs/version.js +1 -1
  50. package/dist/esm/BaseClient.mjs +2 -2
  51. package/dist/esm/agentkit/Agent.d.mts +2 -2
  52. package/dist/esm/agentkit/Agent.mjs +11 -2
  53. package/dist/esm/agentkit/AgentSession.d.mts +27 -0
  54. package/dist/esm/agentkit/AgentSession.mjs +95 -23
  55. package/dist/esm/agentkit/__tests__/area-aware-vendors.test.mjs +2 -2
  56. package/dist/esm/agentkit/__tests__/preview-types.test.d.mts +7 -0
  57. package/dist/esm/agentkit/__tests__/preview-types.test.mjs +55 -0
  58. package/dist/esm/agentkit/__tests__/readme-examples.test.mjs +3 -3
  59. package/dist/esm/agentkit/__tests__/type-safety.test.mjs +1 -1
  60. package/dist/esm/agentkit/debug.d.mts +33 -0
  61. package/dist/esm/agentkit/debug.mjs +129 -0
  62. package/dist/esm/agentkit/index.d.mts +4 -1
  63. package/dist/esm/agentkit/index.mjs +2 -0
  64. package/dist/esm/agentkit/preview/client.d.mts +58 -0
  65. package/dist/esm/agentkit/preview/client.mjs +83 -0
  66. package/dist/esm/agentkit/preview/index.d.mts +11 -0
  67. package/dist/esm/agentkit/preview/index.mjs +9 -0
  68. package/dist/esm/agentkit/preview/vendors.d.mts +72 -0
  69. package/dist/esm/agentkit/preview/vendors.mjs +49 -0
  70. package/dist/esm/agentkit/token.mjs +32 -3
  71. package/dist/esm/agentkit/types.d.mts +42 -1
  72. package/dist/esm/agentkit/vendors/stt.d.mts +12 -4
  73. package/dist/esm/agentkit/vendors/stt.mjs +7 -3
  74. package/dist/esm/api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.d.mts +9 -0
  75. package/dist/esm/api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.mjs +6 -0
  76. package/dist/esm/api/resources/agents/client/Client.mjs +17 -1
  77. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +49 -4
  78. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +9 -0
  79. package/dist/esm/api/types/AresAsr.d.mts +2 -0
  80. package/dist/esm/api/types/AresAsrParams.d.mts +1 -6
  81. package/dist/esm/api/types/FengmingAsr.d.mts +2 -0
  82. package/dist/esm/api/types/FengmingAsrParams.d.mts +1 -6
  83. package/dist/esm/api/types/Llm.d.mts +12 -0
  84. package/dist/esm/api/types/LlmTool.d.mts +14 -0
  85. package/dist/esm/api/types/LlmTool.mjs +2 -0
  86. package/dist/esm/api/types/LlmToolExecution.d.mts +9 -0
  87. package/dist/esm/api/types/LlmToolExecution.mjs +2 -0
  88. package/dist/esm/api/types/LlmToolFunction.d.mts +28 -0
  89. package/dist/esm/api/types/LlmToolFunction.mjs +2 -0
  90. package/dist/esm/api/types/LlmToolServer.d.mts +42 -0
  91. package/dist/esm/api/types/LlmToolServer.mjs +9 -0
  92. package/dist/esm/api/types/SpeechmaticsAsrParams.d.mts +12 -3
  93. package/dist/esm/api/types/index.d.mts +4 -0
  94. package/dist/esm/api/types/index.mjs +4 -0
  95. package/dist/esm/index.d.mts +2 -2
  96. package/dist/esm/index.mjs +3 -3
  97. package/dist/esm/version.d.mts +1 -1
  98. package/dist/esm/version.mjs +1 -1
  99. package/package.json +1 -1
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ /**
3
+ * Redaction for `debug: true` session logging.
4
+ *
5
+ * The debug dump is routinely pasted into issues and chat threads, so it must
6
+ * never carry a usable credential. The generated fetcher redacts headers, query
7
+ * params, and URLs, but nothing redacts the request body — which is where
8
+ * vendor API keys and RTC tokens live.
9
+ *
10
+ * Uses the same `[REDACTED]` marker as `core/fetcher/Fetcher.ts` for
11
+ * consistency, but is deliberately independent of it: that file is generated by
12
+ * Fern and its helpers are module-local.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.REDACTED = void 0;
16
+ exports.redactSecrets = redactSecrets;
17
+ exports.redactHeadersForDebug = redactHeadersForDebug;
18
+ /** Marker substituted for a redacted value. Matches the generated fetcher. */
19
+ exports.REDACTED = "[REDACTED]";
20
+ /**
21
+ * Body fields whose values are credentials or account identifiers.
22
+ *
23
+ * Compared case-insensitively, and matched on both snake_case and camelCase
24
+ * spellings so this keeps working if a caller hand-builds a config.
25
+ */
26
+ const SENSITIVE_BODY_KEYS = new Set([
27
+ // Vendor credentials
28
+ "api_key",
29
+ "apikey",
30
+ "key",
31
+ "secret",
32
+ "api_secret",
33
+ "apisecret",
34
+ "password",
35
+ "access_key_id",
36
+ "accesskeyid",
37
+ "secret_access_key",
38
+ "secretaccesskey",
39
+ "adc_credentials_string",
40
+ "adccredentialsstring",
41
+ "credentials",
42
+ "subscription_key",
43
+ "subscriptionkey",
44
+ // Agora credentials and account identifiers
45
+ "token",
46
+ "agora_token",
47
+ "agoratoken",
48
+ "authorization",
49
+ "appid",
50
+ "app_id",
51
+ "agora_appid",
52
+ "agoraappid",
53
+ "app_certificate",
54
+ "appcertificate",
55
+ "customer_secret",
56
+ "customersecret",
57
+ ]);
58
+ function isSensitiveKey(key) {
59
+ return SENSITIVE_BODY_KEYS.has(key.toLowerCase());
60
+ }
61
+ function redactQueryKeys(value) {
62
+ let parsed;
63
+ try {
64
+ parsed = new URL(value);
65
+ }
66
+ catch (_a) {
67
+ return value;
68
+ }
69
+ let changed = false;
70
+ for (const key of [...parsed.searchParams.keys()]) {
71
+ if (key.toLowerCase() !== "key") {
72
+ continue;
73
+ }
74
+ const current = parsed.searchParams.getAll(key);
75
+ if (current.some((item) => item.length > 0)) {
76
+ parsed.searchParams.delete(key);
77
+ for (const item of current) {
78
+ parsed.searchParams.append(key, item.length > 0 ? exports.REDACTED : item);
79
+ }
80
+ changed = true;
81
+ }
82
+ }
83
+ return changed ? parsed.toString() : value;
84
+ }
85
+ /**
86
+ * Deep-copies `value`, replacing credential fields with {@link REDACTED}.
87
+ *
88
+ * Empty strings are left visible on purpose: `""` is the signature of an unset
89
+ * environment variable, and hiding it behind `[REDACTED]` would disguise the
90
+ * exact misconfiguration the debug output exists to surface.
91
+ *
92
+ * Never mutates the input — the request that goes on the wire is untouched.
93
+ */
94
+ function redactSecrets(value) {
95
+ if (Array.isArray(value)) {
96
+ return value.map((item) => redactSecrets(item));
97
+ }
98
+ if (value === null || typeof value !== "object") {
99
+ return value;
100
+ }
101
+ const result = {};
102
+ for (const [key, item] of Object.entries(value)) {
103
+ if (isSensitiveKey(key) && typeof item === "string" && item.length > 0) {
104
+ result[key] = exports.REDACTED;
105
+ }
106
+ else if (typeof item === "string") {
107
+ result[key] = redactQueryKeys(item);
108
+ }
109
+ else {
110
+ result[key] = redactSecrets(item);
111
+ }
112
+ }
113
+ return result;
114
+ }
115
+ /**
116
+ * Redacts request headers for debug logging.
117
+ *
118
+ * `agora-feature` and the SDK identification headers are kept — they are what
119
+ * makes a preview request identifiable, and no header carries a secret except
120
+ * the authorization scheme's credential, whose scheme name is preserved so the
121
+ * active auth mode stays visible.
122
+ */
123
+ function redactHeadersForDebug(headers) {
124
+ const result = {};
125
+ for (const [key, value] of Object.entries(headers)) {
126
+ if (key.toLowerCase() !== "authorization") {
127
+ result[key] = value;
128
+ continue;
129
+ }
130
+ const scheme = value.split(/[\s=]/, 1)[0];
131
+ result[key] = scheme && scheme !== value ? `${scheme} ${exports.REDACTED}` : exports.REDACTED;
132
+ }
133
+ return result;
134
+ }
@@ -26,12 +26,15 @@ export { AgentSession } from "./AgentSession.js";
26
26
  export type { AkoolAvatarConfig, AnamAvatarConfig, GenericAvatarConfig, HeyGenAvatarConfig, LiveAvatarAvatarConfig, SensetimeAvatarConfig, SpatiusAvatarConfig, StrictAvatarConfig, } from "./avatar-types.js";
27
27
  export { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, isSensetimeAvatar, isSpatiusAvatar, toBaseAvatarConfig, validateAvatarConfig, validateTtsSampleRate, } from "./avatar-types.js";
28
28
  export { AudioScenario, CredentialMode, DataChannel, FillerWordsSelectionRule, Geofence, InterruptionDisabledStrategy, InterruptionDisabledStrategyAppend, InterruptionDisabledStrategyIgnore, InterruptionModeKeywords, InterruptionModeStartOfSpeech, InterruptionModeValues, MllmTurnDetectionModeAgoraVad, MllmTurnDetectionModeSemanticVad, MllmTurnDetectionModeServerVad, MllmTurnDetectionModeValues, SalModeValues, SilenceActionValues, SpeakPriorityAppend, SpeakPriorityIgnore, SpeakPriorityInterrupt, SpeakPriorityValues, ThinkOnListeningActionIgnore, ThinkOnListeningActionInject, ThinkOnListeningActionInterrupt, ThinkOnSpeakingActionIgnore, ThinkOnSpeakingActionInterrupt, ThinkOnThinkingActionIgnore, ThinkOnThinkingActionInterrupt, TurnDetectionTypeValues, } from "./constants.js";
29
+ export { REDACTED, redactHeadersForDebug, redactSecrets } from "./debug.js";
29
30
  export type { AgentPreset, AsrPreset, DeepgramPresetModel, LlmPreset, MiniMaxPresetModel, OpenAIPresetModel, OpenAITtsPresetModel, PresetCategory, PresetInput, TtsPreset, } from "./presets.js";
30
31
  export { AgentPresets, normalizePresetInput } from "./presets.js";
32
+ export type { GeminiSTTModel, GeminiSTTOptions, PreviewFeature, PreviewRoute, } from "./preview/index.js";
33
+ export { createPreviewRoute, GeminiSTT, GeminiSTTModels, PREVIEW_API_BASE_URL, PREVIEW_FEATURE_HEADER, PreviewFeatures, previewRequestHeaders, requiredPreviewFeatures, } from "./preview/index.js";
31
34
  export type { AvatarVendor, CNAvatarVendor, CNLlmVendor, CNMllmVendor, CNSttVendor, CNTtsVendor, GlobalAvatarVendor, GlobalLlmVendor, GlobalMllmVendor, GlobalSttVendor, GlobalTtsVendor, LlmVendor, SttVendor, TtsVendor, } from "./region-vendors.js";
32
35
  export type { GenerateConvoAITokenOptions, GenerateTokenOptions, } from "./token.js";
33
36
  export { ExpiresIn, generateConvoAIToken, generateRtcToken, MAX_EXPIRY_SECONDS, } from "./token.js";
34
- export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AsrVendorName, AvatarConfig, AvatarWireVendor, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GenericTts, GenericTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, GradiumTts, GradiumTtsParams, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmStyle, 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, 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";
37
+ export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AsrVendorName, AvatarConfig, AvatarWireVendor, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, 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, 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, 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";
35
38
  export type { AkoolAvatarOptions, AnamAvatarOptions, GenericAvatarOptions, HeyGenAvatarOptions, LiveAvatarAvatarOptions, } from "./vendors/avatar.js";
36
39
  export { AkoolAvatar, AnamAvatar, GenericAvatar, HeyGenAvatar, LiveAvatarAvatar, } from "./vendors/avatar.js";
37
40
  export type { AkoolSampleRate, CartesiaSampleRate, ElevenLabsSampleRate, HeyGenSampleRate, LiveAvatarSampleRate, MicrosoftSampleRate, SampleRate, } from "./vendors/base.js";
@@ -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.AnamAvatar = exports.AkoolAvatar = exports.MAX_EXPIRY_SECONDS = exports.generateRtcToken = exports.generateConvoAIToken = exports.ExpiresIn = exports.normalizePresetInput = exports.AgentPresets = 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.AssemblyAISTT = exports.AresSTT = exports.AmazonSTT = exports.XaiGrok = exports.VertexAI = exports.QwenOmni = exports.OpenAIRealtime = exports.GeminiLive = 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 = 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 = 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 = 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;
@@ -409,7 +413,9 @@ export type LlmConfig = (BaseLlmConfig & {
409
413
  */
410
414
  export interface SpeechmaticsParams {
411
415
  /** Speechmatics API key for authentication (required) */
412
- api_key: string;
416
+ key: string;
417
+ /** @deprecated The REST API expects `key`; use `key` instead. */
418
+ api_key?: string;
413
419
  /** Language code for transcription (e.g., 'en', 'es', 'fr') (required) */
414
420
  language: string;
415
421
  /** Speechmatics streaming WebSocket URL */
@@ -540,6 +546,41 @@ export interface SarvamAsrParams {
540
546
  */
541
547
  export type XAiAsr = XAiAsrType;
542
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
+ }
543
584
  export type MicrosoftTts = MicrosoftTtsType;
544
585
  export type MicrosoftTtsParams = MicrosoftTtsParamsType;
545
586
  export type ElevenLabsTts = ElevenLabsTtsType;