@autoark-ai/eva-client-sdk-ts 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -209
- package/dist/browser.d.ts +20 -11
- package/dist/browser.js +23 -12
- package/dist/index.d.ts +96 -61
- package/dist/index.js +4 -4
- package/dist/spi.d.ts +5 -4
- package/package.json +20 -4
package/dist/index.d.ts
CHANGED
|
@@ -56,49 +56,49 @@ export declare class EvaSdkError extends Error implements StructuredError {
|
|
|
56
56
|
constructor(message: string, options?: EvaSdkErrorOptions);
|
|
57
57
|
}
|
|
58
58
|
interface CommandParameterBase {
|
|
59
|
-
/** Stable argument name exposed to the model and handler. */
|
|
59
|
+
/** 暴露给 model 和 handler 的稳定非空参数名;同一 definition 内必须唯一。 English: Stable non-empty argument name exposed to the model and handler; names must be unique within a definition. */
|
|
60
60
|
readonly name: string;
|
|
61
|
-
/**
|
|
61
|
+
/** 面向 model 的非空参数说明,会进入 tool schema。 English: Non-empty model-facing argument description included in the tool schema. */
|
|
62
62
|
readonly description: string;
|
|
63
|
-
/** Whether the argument
|
|
63
|
+
/** 参数是否必填;省略等同 `false`。 English: Whether the argument is required; omission is equivalent to `false`. */
|
|
64
64
|
readonly required?: boolean;
|
|
65
65
|
}
|
|
66
66
|
/** String-valued command parameter with optional same-type examples and enum values. */
|
|
67
67
|
export interface StringCommandParameter extends CommandParameterBase {
|
|
68
|
-
/**
|
|
68
|
+
/** string 参数判别值,供 runtime 校验和 tool schema 使用。 English: String-parameter discriminator used by runtime validation and the generated tool schema. */
|
|
69
69
|
readonly type: "string";
|
|
70
|
-
/** Optional closed set of accepted string values. */
|
|
70
|
+
/** 可选的 string 闭集;提供后只接受表内值。 English: Optional closed set of accepted string values. */
|
|
71
71
|
readonly enum?: readonly string[];
|
|
72
|
-
/** Optional model-facing example
|
|
72
|
+
/** 可选的 model-facing string 示例,不改变校验规则。 English: Optional model-facing string example; it does not change validation. */
|
|
73
73
|
readonly example?: string;
|
|
74
74
|
}
|
|
75
75
|
/** Number-valued command parameter with optional same-type examples and enum values. */
|
|
76
76
|
export interface NumberCommandParameter extends CommandParameterBase {
|
|
77
|
-
/**
|
|
77
|
+
/** number 参数判别值,供 runtime 校验和 tool schema 使用。 English: Number-parameter discriminator used by runtime validation and the generated tool schema. */
|
|
78
78
|
readonly type: "number";
|
|
79
|
-
/** Optional closed set of accepted
|
|
79
|
+
/** 可选的有限 number 闭集;提供后只接受表内值,NaN/Infinity 被拒绝。 English: Optional closed set of finite numbers; only listed values are accepted and NaN/Infinity are rejected. */
|
|
80
80
|
readonly enum?: readonly number[];
|
|
81
|
-
/** Optional
|
|
81
|
+
/** 可选的有限 number 示例,不改变范围。 English: Optional finite-number example; it does not define a range. */
|
|
82
82
|
readonly example?: number;
|
|
83
83
|
}
|
|
84
84
|
/** Boolean-valued command parameter with optional same-type examples and enum values. */
|
|
85
85
|
export interface BooleanCommandParameter extends CommandParameterBase {
|
|
86
|
-
/**
|
|
86
|
+
/** boolean 参数判别值,供 runtime 校验和 tool schema 使用。 English: Boolean-parameter discriminator used by runtime validation and the generated tool schema. */
|
|
87
87
|
readonly type: "boolean";
|
|
88
|
-
/** Optional closed set of accepted boolean values. */
|
|
88
|
+
/** 可选的 boolean 闭集;提供后只接受表内值。 English: Optional closed set of accepted boolean values. */
|
|
89
89
|
readonly enum?: readonly boolean[];
|
|
90
|
-
/** Optional
|
|
90
|
+
/** 可选的 boolean 示例,不改变校验规则。 English: Optional boolean example; it does not change validation. */
|
|
91
91
|
readonly example?: boolean;
|
|
92
92
|
}
|
|
93
93
|
/** Scalar command parameter supported by the v1 runtime. */
|
|
94
94
|
export type CommandParameter = StringCommandParameter | NumberCommandParameter | BooleanCommandParameter;
|
|
95
95
|
/** Pure model-facing command definition. Handlers are paired separately by registration. */
|
|
96
96
|
export interface CommandDefinition {
|
|
97
|
-
/** Stable command identity exposed to the model
|
|
97
|
+
/** 暴露给 model 的稳定非空 command 名;所有 registrations 中必须唯一。 English: Stable non-empty command identity exposed to the model; it must be unique across registrations. */
|
|
98
98
|
readonly name: string;
|
|
99
|
-
/**
|
|
99
|
+
/** 面向 model 的非空用途/触发时机说明,会进入 tool schema。 English: Non-empty model-facing description of purpose and usage, included in the tool schema. */
|
|
100
100
|
readonly description: string;
|
|
101
|
-
/** Optional v1 scalar parameters
|
|
101
|
+
/** 可选的 v1 scalar 参数,按声明顺序快照;同名参数在构造期被拒绝。 English: Optional v1 scalar parameters snapshotted in declaration order; duplicate names are rejected at construction. */
|
|
102
102
|
readonly parameters?: readonly CommandParameter[];
|
|
103
103
|
}
|
|
104
104
|
/** One resolved call passed to a registered handler. */
|
|
@@ -153,17 +153,18 @@ export type CommandResult = {
|
|
|
153
153
|
export type CommandHandler = (call: CommandCall, context: CommandContext) => CommandResult | Promise<CommandResult>;
|
|
154
154
|
/** One construction-time pair; command identity comes only from definition.name. */
|
|
155
155
|
export interface CommandRegistration {
|
|
156
|
-
/**
|
|
156
|
+
/** 投影到 model-facing tool schema 的纯 definition;构造时校验并冻结。 English: Pure definition projected to the model-facing tool schema, validated and frozen at construction. */
|
|
157
157
|
readonly definition: CommandDefinition;
|
|
158
|
-
/**
|
|
158
|
+
/** 与 definition 成对的 handler;同一 turn 内相同 call ID/content 至多调用一次,取消不能回滚已提交的外部副作用。 English: Handler paired with the definition; the same call ID/content is invoked at most once per turn, and cancellation cannot undo committed external side effects. */
|
|
159
159
|
readonly handler: CommandHandler;
|
|
160
160
|
}
|
|
161
161
|
/** Optional command runtime configuration supplied when the agent is constructed. */
|
|
162
162
|
export interface CommandsConfig {
|
|
163
|
-
/** Complete definition-handler pairs snapshotted before
|
|
163
|
+
/** 完整 definition-handler 配对列表;在 provider 创建前校验并快照,空数组等同禁用 command。 English: Complete definition-handler pairs validated and snapshotted before provider creation; an empty array disables commands. */
|
|
164
164
|
readonly registrations: readonly CommandRegistration[];
|
|
165
165
|
/**
|
|
166
|
-
*
|
|
166
|
+
* 单个 turn 接受的完整 raw tool-call 轮数上限;必须为有限正整数,越大允许更长 command 循环,也会增加延迟和调用成本。
|
|
167
|
+
* English: Maximum complete raw tool-call rounds per turn; it must be a finite positive integer, and larger values allow longer command loops with more latency and call cost.
|
|
167
168
|
* @defaultValue 3
|
|
168
169
|
*/
|
|
169
170
|
readonly maxCallsPerTurn?: number;
|
|
@@ -184,23 +185,24 @@ export declare const DEFAULT_EMOTION_CODES: readonly [
|
|
|
184
185
|
export type DefaultEmotionCode = (typeof DEFAULT_EMOTION_CODES)[number];
|
|
185
186
|
/** Controls whether and how the agent starts a greeting turn. */
|
|
186
187
|
export type GreetingConfig = {
|
|
187
|
-
/** Disables the automatic greeting turn. */
|
|
188
|
+
/** 禁用自动问候,且不会创建问候 turn。 English: Disables the automatic greeting turn. */
|
|
188
189
|
mode: "disabled";
|
|
189
190
|
} | {
|
|
190
|
-
/** Plays `text`
|
|
191
|
+
/** 直接播放 `text` 作为 assistant 问候,不调用 LLM。 English: Plays `text` as the assistant greeting without calling the LLM. */
|
|
191
192
|
mode: "static";
|
|
192
|
-
/**
|
|
193
|
+
/** 必填的非空问候文本;空白文本在构造期被拒绝。 English: Required non-empty assistant text; blank text is rejected during construction. */
|
|
193
194
|
text: string;
|
|
194
195
|
} | {
|
|
195
|
-
/** Calls the LLM to generate the
|
|
196
|
+
/** 调用 LLM 生成问候,会增加一次 LLM 请求及相应延迟。 English: Calls the LLM to generate the greeting, adding one LLM request and its latency. */
|
|
196
197
|
mode: "dynamic";
|
|
197
|
-
/**
|
|
198
|
+
/** 可选的问候指令;省略或空白时使用 SDK 稳定默认指令。 English: Optional greeting instruction; blank or omitted uses the stable SDK default. */
|
|
198
199
|
prompt?: string;
|
|
199
200
|
};
|
|
200
201
|
/** Bounded conversation history used as context for later LLM turns. */
|
|
201
202
|
export interface HistoryConfig {
|
|
202
203
|
/**
|
|
203
|
-
*
|
|
204
|
+
* 控制每次 LLM 请求最多携带多少个已完成的 user/assistant turn 对;必须为正整数,默认 10,越大上下文通常更完整,但请求 token、延迟和成本更高。
|
|
205
|
+
* English: Controls how many completed user/assistant turn pairs each LLM request may carry; it must be a positive integer, defaults to 10, and larger values usually improve context at the cost of tokens, latency, and cost.
|
|
204
206
|
* @defaultValue 10
|
|
205
207
|
* @remarks Must be a positive integer. History is enabled only when `history` is provided.
|
|
206
208
|
*/
|
|
@@ -209,7 +211,8 @@ export interface HistoryConfig {
|
|
|
209
211
|
/** Camera capture timing used by the managed dialogue runtime. */
|
|
210
212
|
export interface CameraConfig {
|
|
211
213
|
/**
|
|
212
|
-
*
|
|
214
|
+
* 单次静态图片采集的最长等待时间;值越大越能容忍慢设备,但会延后 LLM 请求和文字降级。
|
|
215
|
+
* English: Maximum still-image capture wait; larger values tolerate slower devices but delay the LLM request and text-only fallback.
|
|
213
216
|
* @defaultValue 1500
|
|
214
217
|
* @remarks Must be a finite positive integer in milliseconds. This is separate from the
|
|
215
218
|
* fixed internal cancellation-settlement deadline.
|
|
@@ -219,26 +222,30 @@ export interface CameraConfig {
|
|
|
219
222
|
/** Optional LLM-assisted emotion recognition for final user utterances. */
|
|
220
223
|
export interface EmotionConfig {
|
|
221
224
|
/**
|
|
222
|
-
*
|
|
225
|
+
* 是否启用每个合格 user turn 的情绪识别旁路;启用会增加一次 LLM 分类请求,但不阻塞 reply。
|
|
226
|
+
* English: Enables an emotion-classification side path for each eligible user turn; it adds one LLM request without blocking the reply.
|
|
223
227
|
* @defaultValue `false`
|
|
224
228
|
* @remarks This is a construction-time configuration option, not a runtime toggle.
|
|
225
229
|
*/
|
|
226
230
|
enabled?: boolean;
|
|
227
231
|
/**
|
|
228
|
-
*
|
|
232
|
+
* 替换 {@link DEFAULT_EMOTION_CODES} 的完整自定义情绪 code 目录。
|
|
233
|
+
* English: Complete custom emotion code catalog used instead of {@link DEFAULT_EMOTION_CODES}.
|
|
229
234
|
* @remarks Codes must match `^[a-z][a-z0-9_-]{0,63}$`. The array must be non-empty
|
|
230
235
|
* and contain no duplicates. The SDK appends the required `unknown` fallback when it
|
|
231
236
|
* is absent; one explicit `unknown` is accepted, while repeated `unknown` is rejected.
|
|
232
237
|
*/
|
|
233
238
|
labels?: readonly string[];
|
|
234
239
|
/**
|
|
235
|
-
*
|
|
240
|
+
* 插入 SDK 内置分类 prompt 的补充业务说明,不是完整 prompt。
|
|
241
|
+
* English: Supplemental business context inserted into the SDK's built-in classification prompt; it is not a complete prompt.
|
|
236
242
|
* @remarks This is not a complete prompt and cannot replace the SDK's fixed safety and
|
|
237
243
|
* output-format instructions. Example: `"这是儿童陪伴场景,重点区分害怕、难过和开心。"`.
|
|
238
244
|
*/
|
|
239
245
|
instructions?: string;
|
|
240
246
|
/**
|
|
241
|
-
*
|
|
247
|
+
* 送入情绪识别的 final utterance 最大长度,单位为 Unicode code points;值越大保留文本越多,但增加分类 token 成本。
|
|
248
|
+
* English: Maximum final-utterance length in Unicode code points; larger values retain more text but increase classification token cost.
|
|
242
249
|
* @defaultValue `2000`
|
|
243
250
|
* @remarks Must be a finite positive integer. This does not change the independent
|
|
244
251
|
* 100-code-point `EmotionDetectedEvent.textPreview` limit.
|
|
@@ -247,37 +254,44 @@ export interface EmotionConfig {
|
|
|
247
254
|
}
|
|
248
255
|
interface RuntimeConfig {
|
|
249
256
|
/**
|
|
250
|
-
*
|
|
257
|
+
* 添加到每次 LLM 请求的 system instruction,构造后不可热更新。
|
|
258
|
+
* English: System instruction prepended to each LLM request; it cannot be hot-reconfigured after construction.
|
|
251
259
|
* @defaultValue An empty string.
|
|
252
260
|
*/
|
|
253
261
|
systemPrompt?: string;
|
|
254
262
|
/**
|
|
255
|
-
*
|
|
263
|
+
* agent 启动时执行的可选问候策略;省略时不自动问候。
|
|
264
|
+
* English: Optional greeting behavior executed when the agent starts; omission disables automatic greeting.
|
|
256
265
|
* @defaultValue `{ mode: "disabled" }`
|
|
257
266
|
*/
|
|
258
267
|
greeting?: GreetingConfig;
|
|
259
268
|
/**
|
|
260
|
-
*
|
|
269
|
+
* 提供时启用有界多轮 LLM 上下文;省略时各 turn 相互独立。
|
|
270
|
+
* English: Enables bounded multi-turn LLM context when provided; omit it to keep turns independent.
|
|
261
271
|
* @remarks Omit this field to keep turns independent.
|
|
262
272
|
*/
|
|
263
273
|
history?: HistoryConfig;
|
|
264
274
|
/**
|
|
265
|
-
*
|
|
275
|
+
* 可选的 camera capture 时序配置,仅在构造时生效。
|
|
276
|
+
* English: Optional camera-capture timing configuration applied at construction.
|
|
266
277
|
* @remarks Camera remains disabled by default even when this field and `transports.camera`
|
|
267
278
|
* are present; call `setCameraCaptureEnabled(true)` to acquire the camera session.
|
|
268
279
|
*/
|
|
269
280
|
camera?: CameraConfig;
|
|
270
281
|
/**
|
|
271
|
-
*
|
|
282
|
+
* 非空语音和手动文本 turn 的可选情绪识别旁路;省略时关闭。
|
|
283
|
+
* English: Optional emotion-recognition side path for non-empty speech and manual-text turns; omission disables it.
|
|
272
284
|
* @remarks Omission keeps recognition disabled while retaining the documented defaults.
|
|
273
285
|
*/
|
|
274
286
|
emotion?: EmotionConfig;
|
|
275
287
|
/**
|
|
276
|
-
*
|
|
288
|
+
* dialogue runtime 拥有的可选 barge-in 构造配置。
|
|
289
|
+
* English: Optional construction-time barge-in behavior owned by the dialogue runtime.
|
|
277
290
|
*/
|
|
278
291
|
bargeIn?: {
|
|
279
292
|
/**
|
|
280
|
-
*
|
|
293
|
+
* 每段 audio input session 首次 playback 期间抑制 speech admission 的窗口,单位为毫秒;值越大越能屏蔽首播回声,但也会忽略更长时间内的真实近端发言。
|
|
294
|
+
* English: Duration in milliseconds (`ms`) for suppressing speech admission during the first playback
|
|
281
295
|
* window of each audio input session.
|
|
282
296
|
* @defaultValue `0`
|
|
283
297
|
* @remarks The unit is milliseconds (`ms`): `3000` means 3000 ms, or 3 seconds. The value must
|
|
@@ -287,17 +301,20 @@ interface RuntimeConfig {
|
|
|
287
301
|
initialPlaybackGuardMs?: number;
|
|
288
302
|
};
|
|
289
303
|
/**
|
|
290
|
-
*
|
|
304
|
+
* 可选的构造期 command registrations;构造后不可热注册。
|
|
305
|
+
* English: Optional construction-time command registrations; commands cannot be hot-registered later.
|
|
291
306
|
* @remarks Registrations are validated and snapshotted before any provider is created.
|
|
292
307
|
*/
|
|
293
308
|
commands?: CommandsConfig;
|
|
294
309
|
/**
|
|
295
|
-
*
|
|
310
|
+
* 完整的 audio input/output/AEC 和可选 camera 角色集合;构造后 lifecycle 由 runtime 独占。
|
|
311
|
+
* English: Complete audio input/output/AEC and optional camera role set whose lifecycle is runtime-owned after construction.
|
|
296
312
|
* @remarks Omit this field for a text-only agent. Do not drive these roles concurrently with the agent.
|
|
297
313
|
*/
|
|
298
314
|
transports?: MediaTransportsConfig;
|
|
299
315
|
/**
|
|
300
|
-
*
|
|
316
|
+
* 附加到 agent events 和 conversation messages 的 JSON-compatible metadata;构造时递归复制,非法或循环值会被拒绝。
|
|
317
|
+
* English: JSON-compatible metadata attached to agent events and conversation messages; it is deep-cloned at construction and rejects invalid or cyclic values.
|
|
301
318
|
* @defaultValue An empty object.
|
|
302
319
|
* @remarks The SDK clones this value at the public boundary.
|
|
303
320
|
*/
|
|
@@ -306,65 +323,76 @@ interface RuntimeConfig {
|
|
|
306
323
|
/** Public managed configuration for one EVA voice-dialogue agent instance. */
|
|
307
324
|
export interface EvaVoiceDialogueAgentConfig extends RuntimeConfig {
|
|
308
325
|
/**
|
|
309
|
-
*
|
|
326
|
+
* 内建 ASR/LLM/TTS stages 共用的 Gateway 凭证;必填,构造时注入且不会从事件、metadata 或 getter 回读。
|
|
327
|
+
* English: Required Gateway credential shared by built-in ASR/LLM/TTS stages; it is injected at construction and never exposed through events, metadata, or getters.
|
|
328
|
+
* 可在 EVA 控制台创建并获取形如 `ak-xxxxxxxx...` 的 API Key,也可按 README 中的 EVA Skill / CLI 指引获取并保存。
|
|
329
|
+
* English: Create an API Key such as `ak-xxxxxxxx...` in the EVA Console, or follow the EVA Skill / CLI guidance in the README to obtain and save one.
|
|
310
330
|
* @remarks The SDK does not expose this value through events, metadata, or configuration getters.
|
|
311
331
|
*/
|
|
312
332
|
apiKey: string;
|
|
313
|
-
/**
|
|
333
|
+
/** 控制语音转写使用的 ASR model 和目标 PCM 采样率;必填。 English: Controls the ASR model and target PCM sample rate used for transcription; required. */
|
|
314
334
|
asr: {
|
|
315
|
-
/**
|
|
335
|
+
/** 透传为 wire `model` 的非解释 ASR model ID;SDK 不维护可用目录,见 README 外部配置参考。 English: Opaque ASR model ID forwarded as wire `model`; the SDK does not own the catalog, so see the README external references. */
|
|
316
336
|
model: string;
|
|
317
337
|
/**
|
|
318
|
-
*
|
|
319
|
-
*
|
|
338
|
+
* 发送给 ASR model 的目标 PCM 采样率,单位 Hz;必须为有限正整数并与所选 ASR model 支持的采样率配套,越高通常保留更高频率信息但增加音频字节量。
|
|
339
|
+
* English: Target PCM sample rate in Hz; it must be a finite positive integer supported by the selected ASR model, and higher rates usually retain more high-frequency detail while increasing audio bytes.
|
|
340
|
+
* @remarks The SDK resamples at the ASR boundary but does not infer model compatibility; consult the README external configuration references when selecting the model and rate together.
|
|
320
341
|
*/
|
|
321
342
|
sampleRate: number;
|
|
322
343
|
};
|
|
323
|
-
/**
|
|
344
|
+
/** 控制语音合成使用的 TTS model、音色和合成参数;必填。 English: Controls the TTS model, voice, and synthesis parameters; required. */
|
|
324
345
|
tts: {
|
|
325
|
-
/**
|
|
346
|
+
/** 透传为 wire `model` 的非解释 TTS model ID;可用目录由模型平台决定,见 README 外部配置参考。 English: Opaque TTS model ID forwarded as wire `model`; availability is model-platform-owned, so see the README external references. */
|
|
326
347
|
model: string;
|
|
327
|
-
/** Optional model-specific voice
|
|
348
|
+
/** 可选的 model-specific 音色 ID;SDK 原样透传且不维护音色目录/试听入口,见 README 外部配置参考。 English: Optional model-specific voice ID forwarded unchanged; the SDK does not own the voice catalog or preview entrypoint. */
|
|
328
349
|
voice?: string;
|
|
329
|
-
/** Optional speaking
|
|
350
|
+
/** 可选语速值,原样透传为 Gateway `speed`;通常值越大语速越快,但准确范围、默认和方向由具体 model 决定,见 README。 English: Optional speaking-rate value forwarded as Gateway `speed`; larger commonly means faster speech, while the exact range/default/direction is model-specific. */
|
|
330
351
|
speakingRate?: number;
|
|
331
|
-
/** Optional pitch
|
|
352
|
+
/** 可选音高值,原样透传为 Gateway `pitch_rate`;通常值越大音高越高,但准确范围和默认由具体 model 决定,见 README。 English: Optional pitch value forwarded as Gateway `pitch_rate`; larger commonly means higher pitch, while the exact range and default are model-specific. */
|
|
332
353
|
pitch?: number;
|
|
333
354
|
/**
|
|
334
|
-
*
|
|
355
|
+
* 请求的 TTS PCM 采样率,单位 Hz;提供时必须为有限正整数并与所选 TTS model 兼容,越高通常音频字节更多,但不控制播放设备采样率。
|
|
356
|
+
* English: Requested TTS PCM sample rate in Hz; when provided it must be a finite positive integer supported by the selected TTS model, and higher rates usually increase audio bytes without controlling the playback device rate.
|
|
335
357
|
* @defaultValue 16000
|
|
336
|
-
* @remarks Must be a finite positive integer when provided. This controls synthesis output, not the playback device sample rate.
|
|
358
|
+
* @remarks Must be a finite positive integer supported by the selected model when provided. This controls synthesis output, not the playback device sample rate.
|
|
337
359
|
*/
|
|
338
360
|
sampleRate?: number;
|
|
339
361
|
};
|
|
340
|
-
/**
|
|
362
|
+
/** 控制回复生成使用的 LLM model 和生成参数;必填。 English: Controls the LLM model and generation parameters used for replies; required. */
|
|
341
363
|
llm: {
|
|
342
|
-
/**
|
|
364
|
+
/** 透传为 wire `model` 的非解释 LLM model ID;可用目录由模型平台决定,见 README 外部配置参考。 English: Opaque LLM model ID forwarded as wire `model`; availability is model-platform-owned, so see the README external references. */
|
|
343
365
|
model: string;
|
|
344
|
-
/** Optional sampling temperature forwarded
|
|
366
|
+
/** 可选 sampling temperature,原样透传;通常越大输出越随机,但准确范围/默认/方向由 model 决定,见 README。 English: Optional sampling temperature forwarded unchanged; larger commonly increases randomness, while exact range/default/semantics are model-specific. */
|
|
345
367
|
temperature?: number;
|
|
346
|
-
/**
|
|
368
|
+
/** 兼容旧调用的最终回答 token 上限,不包含思维链;原样透传为 `max_tokens`。新代码请使用 `maxCompletionTokens`;模型支持情况与值域见 README 外部配置参考的 Chat Completions 部分。 English: Compatibility field for maximum final-answer tokens excluding reasoning content, forwarded as `max_tokens`. New code should use `maxCompletionTokens`; see the Chat Completions section linked from README external configuration references for model support and ranges. */
|
|
347
369
|
maxTokens?: number;
|
|
370
|
+
/** 新代码首选的完整模型输出 token 上限,包含思维链与最终回答;原样透传为 `max_completion_tokens`,适用于思考和非思考 model,与 `maxTokens` 同时提供时本字段优先。模型支持情况与值域见 README 外部配置参考的 Chat Completions 部分。 English: Preferred token limit for new code, covering complete model output including reasoning and final answer; forwarded as `max_completion_tokens` for reasoning and non-reasoning models and takes precedence over `maxTokens`. See the Chat Completions section linked from README external configuration references for model support and ranges. */
|
|
371
|
+
maxCompletionTokens?: number;
|
|
348
372
|
/**
|
|
349
|
-
*
|
|
373
|
+
* 可选的 JSON-compatible model 参数,作为 Gateway 顶层字段透传;构造时复制并拒绝 SDK reserved keys,模型专属 key/范围见 README。
|
|
374
|
+
* English: Optional JSON-compatible model parameters forwarded as top-level Gateway fields; copied at construction with SDK reserved keys rejected, while model-specific keys/ranges belong in the README external references.
|
|
350
375
|
* @remarks The SDK snapshots this object during construction. SDK-owned request fields are
|
|
351
376
|
* reserved and cannot be supplied here.
|
|
352
377
|
*/
|
|
353
378
|
readonly extraParameters?: JsonObject;
|
|
354
379
|
};
|
|
355
380
|
/**
|
|
356
|
-
*
|
|
381
|
+
* 可选的本地 Silero VAD 调音;配置 audio input 时必需,且仅在构造时生效。
|
|
382
|
+
* English: Optional local Silero VAD tuning; required with audio input and applied only at construction.
|
|
357
383
|
* @remarks Required when `transports.input` is configured.
|
|
358
384
|
*/
|
|
359
385
|
vad?: {
|
|
360
386
|
/**
|
|
361
|
-
*
|
|
387
|
+
* 进入 speaking 状态的语音概率阈值,范围 `(0, 1]`;越大越不易把噪声判为语音,但更可能漏掉弱语音。
|
|
388
|
+
* English: Speech-probability threshold in `(0, 1]`; larger values reduce noise admissions but may miss quiet speech.
|
|
362
389
|
* @defaultValue 0.5
|
|
363
390
|
* @remarks Must be greater than 0 and less than or equal to 1.
|
|
364
391
|
*/
|
|
365
392
|
sensitivity?: number;
|
|
366
393
|
/**
|
|
367
|
-
*
|
|
394
|
+
* 判定 speech stopped 前所需的连续静音时长,单位毫秒;必须为有限正数,越大越不易过早截断,但结束延迟更高。
|
|
395
|
+
* English: Continuous silence in milliseconds before speech stops; it must be finite and positive, and larger values reduce early cutoff at the cost of end latency.
|
|
368
396
|
* @defaultValue 200
|
|
369
397
|
* @remarks Must be finite and greater than 0. The Silero stage rounds up to 32 ms frames.
|
|
370
398
|
*/
|
|
@@ -634,9 +662,11 @@ export type AgentEvent = SpeechStartedEvent | ImageCapturedEvent | SpeechStopped
|
|
|
634
662
|
export type AgentEventListener = (event: AgentEvent) => void;
|
|
635
663
|
/** Idempotent function that removes one event listener. */
|
|
636
664
|
export type Unsubscribe = () => void;
|
|
637
|
-
/** Optional identity and caller metadata for one manual-text turn. */
|
|
665
|
+
/** 一次手动文本 turn 的可选 identity 与 caller metadata。 English: Optional identity and caller metadata for one manual-text turn. */
|
|
638
666
|
export interface SubmitTextOptions {
|
|
667
|
+
/** 可选 turn ID;省略时由 SDK 生成,调用方应在自己的工作流内保持唯一。 English: Optional turn ID; the SDK generates one when omitted, and callers should keep supplied IDs unique within their workflow. */
|
|
639
668
|
readonly turnId?: string;
|
|
669
|
+
/** 当前 turn 的 JSON-compatible metadata;在 public boundary 递归复制,非法或循环值被拒绝。 English: JSON-compatible metadata for this turn; deep-cloned at the public boundary with invalid or cyclic values rejected. */
|
|
640
670
|
readonly metadata?: JsonObject;
|
|
641
671
|
}
|
|
642
672
|
/** Minimal public control and observation surface for one dialogue session. */
|
|
@@ -667,5 +697,10 @@ export interface EvaVoiceDialogueAgent {
|
|
|
667
697
|
onEvent(listener: AgentEventListener): Unsubscribe;
|
|
668
698
|
stop(): Promise<void>;
|
|
669
699
|
}
|
|
700
|
+
/**
|
|
701
|
+
* 以固定 Gateway stages 和构造期配置创建一个 EVA voice-dialogue agent;配置会在任何 provider 工作前校验并快照。
|
|
702
|
+
* English: Creates an EVA voice-dialogue agent with fixed Gateway stages; configuration is validated and snapshotted before provider work.
|
|
703
|
+
* @param config - 必填的公开托管配置;包括凭证、ASR/LLM/TTS 选择和运行级行为。 English: Required managed public configuration containing credentials, ASR/LLM/TTS selections, and runtime behavior.
|
|
704
|
+
*/
|
|
670
705
|
export declare function createEvaVoiceDialogueAgent(config: EvaVoiceDialogueAgentConfig): EvaVoiceDialogueAgent;
|
|
671
706
|
export {};
|