@h-ai/ai 0.1.0-alpha.35 → 0.1.0-alpha.36

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 CHANGED
@@ -115,6 +115,8 @@ const temp = await ai.llm.chat({
115
115
  ### 工具调用
116
116
 
117
117
  ```ts
118
+ import { z } from 'zod'
119
+
118
120
  const registry = ai.tools.createRegistry()
119
121
  registry.register(ai.tools.define({
120
122
  name: 'get_weather',
@@ -130,6 +132,7 @@ const chat = await ai.llm.chat({ messages, tools: registry.getDefinitions() })
130
132
 
131
133
  ```ts
132
134
  import { createMcpServer, StreamableHTTPServerTransport } from '@h-ai/ai'
135
+ import { z } from 'zod'
133
136
 
134
137
  const server = createMcpServer({ name: 'my-server', version: '1.0.0' })
135
138
  server.registerTool('search', {
@@ -165,8 +168,8 @@ if (setup.success) {
165
168
  await ai.init({
166
169
  audio: {
167
170
  models: [
168
- { id: 'asr', provider: 'qwen', model: 'qwen3-asr-flash-realtime' },
169
- { id: 'tts', provider: 'qwen', model: 'qwen3-tts-flash-realtime' },
171
+ { id: 'asr', provider: 'qwen', model: 'qwen3-asr-flash-realtime', operations: ['transcribe'] },
172
+ { id: 'tts', provider: 'qwen', model: 'qwen3-tts-flash-realtime', operations: ['synthesize'] },
170
173
  ],
171
174
  transcribeModel: 'asr',
172
175
  synthesizeModel: 'tts',
@@ -189,13 +192,27 @@ for await (const event of ai.audio.transcribeStream({
189
192
  updateTranscript(event.text, event.final)
190
193
  }
191
194
 
192
- // 流式合成:可带自然语言风格指令,并直接连接 LLM 文本流边生成边合成;signal 可随时打断
195
+ // 流式合成:调用方为文本段分配稳定 ID,事件可精确关联文本与音频;signal 可随时打断
193
196
  const controller = new AbortController()
194
- for await (const audio of ai.audio.synthesizeStream({ text: ai.llm.askStream(question), voice: 'Cherry', instruction: '用轻快的语气', signal: controller.signal })) {
195
- await player.write(audio)
197
+ for await (const event of ai.audio.synthesizeStream({
198
+ text: { id: 'answer-1', text: '欢迎参加访谈。' },
199
+ voice: 'Cherry',
200
+ instruction: '用轻快的语气',
201
+ signal: controller.signal,
202
+ })) {
203
+ if (event.type === 'audio')
204
+ await player.write(event.data)
205
+ else if (event.type === 'segment_done')
206
+ markSegmentReadyToCommit(event.segmentId)
196
207
  }
208
+
209
+ // 实时会话启动前按操作校验模型能力
210
+ const caps = ai.audio.getCapabilities({ operation: 'synthesize', model: 'tts' })
211
+ if (caps.success && caps.data.synthesize?.streamingAudioOutput) { /* 可实时 TTS */ }
197
212
  ```
198
213
 
214
+ > `synthesizeStream` 严格按 `segment_started → audio* → segment_done` 产出事件。播放器只有在对应音频真正播放完成后才应把该段文本计入 `spokenText`;播放状态仍由应用管理。
215
+
199
216
  取消/超时/连接错误统一为领域错误:`AbortSignal` 触发 → `AUDIO_CANCELLED`(超时 → `AUDIO_TIMEOUT`),连接失败 → `AUDIO_CONNECTION_FAILED`。实时连接时长受 `audio.maxStreamDurationMs`(默认 5 分钟)限制。
200
217
 
201
218
  浏览器 / 移动端通过 `@h-ai/serv` 暴露的统一语音 WebSocket 入口访问,`@h-ai/ai/client` 提供与 Node 端一致的 `audio.*` API(传输细节内部隐藏)。
@@ -218,21 +235,27 @@ if (manager.success) {
218
235
 
219
236
  默认(`turnCommit: 'auto'`)下,`chat` / `chatStream` 会把**模型生成的完整文本**写入上下文。但在「模型生成 → TTS 合成 → 实际播放」链路中,AI 可能说到一半就被打断——此时进入下一轮所有参与者可见的对话状态,应当是**实际播放出去的部分**,而非模型本想说完的全文。
220
237
 
221
- 设置 `turnCommit: 'manual'` 后,生成结果不会自动写入上下文,而是返回一个 `turnId`;由调用方在确定「实际发生了什么」后显式提交真实文本:
238
+ 设置 `turnCommit: 'manual'` 后,生成结果不会自动写入上下文,而是返回一个 `turnId`;由调用方在确定「实际发生了什么」后显式提交真实文本。
239
+
240
+ `chatStream` 在**调用上游模型前**就登记轮次并产出 `turn_started`(事件序列 `turn_started → delta* → done`,中途取消时 `turn_started → delta* → cancelled`)。因此即使生成到一半被 `AbortSignal` 取消,也能拿到 `turnId` 与已生成文本,用真实内容提交:
222
241
 
223
242
  ```ts
224
243
  const m = ai.context.createManager({ turnCommit: 'manual' /* ... */ }).data
244
+ const controller = new AbortController()
225
245
 
226
- for await (const ev of m.chatStream('请展开讲讲')) {
227
- if (ev.type === 'delta') {
228
- feedTts(ev.text)
229
- } // 边生成边合成播放
230
- else if (ev.type === 'done') {
246
+ for await (const ev of m.chatStream('请展开讲讲', { signal: controller.signal })) {
247
+ if (ev.type === 'turn_started') {
231
248
  m.markTurnSpeaking(ev.turnId) // 可选:标记进入播放
232
- if (interrupted)
233
- await m.interruptTurn(ev.turnId, { text: actuallySpokenText }) // 只提交播放出去的部分
234
- else
235
- await m.commitTurn(ev.turnId) // 完整提交
249
+ }
250
+ else if (ev.type === 'delta') {
251
+ feedTts(ev.text) // 边生成边合成播放
252
+ }
253
+ else if (ev.type === 'done') {
254
+ await m.commitTurn(ev.turnId) // 完整提交
255
+ }
256
+ else if (ev.type === 'cancelled') {
257
+ // 生成被 controller.abort() 取消:轮次保留,只提交实际播放出去的部分
258
+ await m.interruptTurn(ev.turnId, { text: actuallySpokenText })
236
259
  }
237
260
  }
238
261
 
@@ -335,7 +358,7 @@ memory:
335
358
  - **`native`(默认,推荐)**:HAI 原生引擎,复用同一套 vecdb(向量库)、reldb(关系库)、LLM 与 Embedding。`extract` 采用 **Mem0 式批量合并**——一次 LLM 调用对整批抽取事实与相关既有记忆做 ADD / UPDATE / DELETE / NONE 决策,实现增量更新、跨条去重与矛盾删除,并支持 `category` 主题标签。`maxEntriesPerObject`、`maxEntriesGlobal`、`recencyDecay`、`embeddingEnabled`、`writebackRelatedTopK` 均作用于此后端;淘汰按 `objectId` 分区触发,不会因某一主体写入过多而淘汰其他主体的记忆。native 后端的 `scope` 过滤:候选集已被 `objectId` 索引收窄(≤ `maxEntriesPerObject`),PostgreSQL 上还会把 scope 下推为 `data @> '{"scope":...}'::jsonb` 包含查询并命中 JSONB **GIN 索引**(SQLite / MySQL 退回内存匹配,结果一致)。
336
359
  - **`mem0`(真·mem0ai/oss)**:直接使用 `mem0ai/oss` 的 `Memory` 引擎(嵌入式,无云服务)。LLM / Embedder 从 `llm` 配置提取(OpenAI 兼容,走 `baseUrl` / `apiKey` / 场景模型);向量库从底层 vecdb 后端提取——`qdrant` / `pgvector` 直接复用同一后端,`lancedb` / `chroma`(mem0 TS 不支持)则退回 mem0 自带的 in-memory 存储。历史记录默认禁用。需安装 `mem0ai`(已内置为依赖);复用 qdrant/pgvector 时需对应客户端。
337
360
 
338
- 两个 Provider 对外 `ai.memory.*` API 完全一致(`extract` / `recall` / `injectMemories` / `add` / `update` / `get` / `remove` / `list` / `listPage` / `clear`),均支持 `objectId`(主体隔离)与 `scope`(业务作用域 key-value 过滤,如 `{ topicId, personaId }`)。`recall` / `list` / `listPage` / `clear` 均按 `scope` 严格过滤,`clear` 在传入 `types` / `scope` 时仅删除同时匹配项(避免误删)。一个差异:mem0 后端在 `update` 涉及 type/importance/metadata 时会重建记忆并重新分配 `id`(native 后端保持 id 稳定)。
361
+ 两个 Provider 对外 `ai.memory.*` API 完全一致(`extract` / `recall` / `injectMemories` / `add` / `update` / `get` / `remove` / `list` / `listPage` / `clear`),均支持 `objectId`(主体隔离)与 `scope`(业务作用域 key-value 过滤,如 `{ topicId, personaId }`)。`recall` / `list` / `listPage` / `clear` 均按 `scope` 严格过滤,`clear` 在传入 `types` / `scope` 时仅删除同时匹配项(避免误删)。mem0 后端的 `extract` 在框架层用统一提取器完成分类与打分(honor `types` / `model` / `minImportance` / `systemPrompt`)后以 `infer:false` 写入,保留 `hai_type` / `hai_importance`;`recall` 同样支持 `types` 过滤与 `recencyWeight` 时间衰减——二者行为与 native 一致。一个差异:mem0 后端在 `update` 涉及 type/importance/metadata 时会重建记忆并重新分配 `id`(native 后端保持 id 稳定)。
339
362
 
340
363
  **候选池与 scope 漏召回**:`scope` 过滤在内存中完成,若先按 `topK` 截断再过滤,同一主体下相关度较高的其它主题/角色记忆会把目标 scope 的记忆挤出候选池,导致「明明有却召回 0 条」。为此 `recall` / `injectMemories` 先取回 `topK × candidateMultiplier`(默认 5)条候选,过滤后再截取 `topK`。scope 隔离越细(如按 `topicId` + `personaId`),可将 `candidateMultiplier` 调大:
341
364
 
@@ -350,6 +373,13 @@ const memories = await ai.memory.recall('经济发展', {
350
373
 
351
374
  `ai.config` 返回脱敏后的配置快照;`apiKey`、`privateKey`、URL 内嵌凭证等敏感字段不会原样暴露。
352
375
 
376
+ ## 安全边界
377
+
378
+ - Prompt、检索文档和模型输出都按不可信输入处理;不要把用户内容拼进不可覆盖的系统规则。
379
+ - Zod 只校验工具参数形状,不代表调用者有权限。高权限工具必须在 handler 内再次校验身份、租户、资源归属与配额,并只把允许自动执行的工具注册给模型。
380
+ - `callRemoteAgent()` 是独立客户端能力,只依赖 `ai.init()`,不要求配置 Agent Card 或注册本地 executor。它拒绝非 HTTP(S) 和 URL 内嵌凭据,但应用仍必须对远端 origin 配置白名单,并在出口代理处限制 DNS 重绑定、重定向到私网和云元数据地址。
381
+ - 不记录完整 Prompt、工具参数、A2A headers、临时模型凭据或带 query 的远端 URL;确需审计时仅保存脱敏摘要。
382
+
353
383
  ## 错误处理
354
384
 
355
385
  ```ts
@@ -373,7 +403,8 @@ if (!result.success) {
373
403
  - `hai:ai:300-302`:Embedding。
374
404
  - `hai:ai:600-701`:Retrieval/RAG。
375
405
  - `hai:ai:800-805`:Knowledge。
376
- - `hai:ai:900-904`:Memory。
406
+ - `hai:ai:050-059`:Audio。
407
+ - `hai:ai:900-905`:Memory。
377
408
  - `hai:ai:980-984`:A2A。
378
409
 
379
410
  ## 测试
@@ -1,6 +1,6 @@
1
1
  import * as _h_ai_core from '@h-ai/core';
2
2
  import { HaiResult } from '@h-ai/core';
3
- import { aC as ChatMessage, aN as InteractionScope, J as MemoryType, bk as RagOptions, bo as ReasoningOptions, bR as ToolRegistryOperations, b6 as MemoryEntry, bB as SessionInfo, b3 as LLMOperations, bc as MemoryOperations, bj as RagOperations, bn as ReasoningOperations, c as AIConfig, d as AIConfigInput, ar as AIStoreProvider, bS as ToolsOperations, bF as StreamOperations, bu as RetrievalOperations, aZ as KnowledgeOperations, al as A2AOperations, o as AudioOperations, k as AudioFormat } from './ai-reasoning-types-BGf-x2Qj.js';
3
+ import { aF as ChatMessage, aQ as InteractionScope, O as MemoryType, bo as RagOptions, bs as ReasoningOptions, bV as ToolRegistryOperations, ba as MemoryEntry, bF as SessionInfo, b6 as LLMOperations, bg as MemoryOperations, bn as RagOperations, br as ReasoningOperations, c as AIConfig, d as AIConfigInput, au as AIStoreProvider, bW as ToolsOperations, bJ as StreamOperations, by as RetrievalOperations, b0 as KnowledgeOperations, ao as A2AOperations, q as AudioOperations, l as AudioFormat } from './ai-reasoning-types-DLLzpn6T.js';
4
4
  import { z } from 'zod';
5
5
  import { Buffer } from 'node:buffer';
6
6
 
@@ -358,7 +358,7 @@ interface ContextChatOptions {
358
358
  /**
359
359
  * 请求取消信号
360
360
  *
361
- * 透传给底层 LLM 调用;主持人打断、用户切换等场景可 `abortController.abort()`
361
+ * 透传给底层 LLM 调用;打断、用户切换等场景可 `abortController.abort()`
362
362
  * 立即停止上游生成与计费。
363
363
  */
364
364
  signal?: AbortSignal;
@@ -387,8 +387,15 @@ interface ContextChatResult {
387
387
  }
388
388
  /**
389
389
  * chatStream() 产出的事件
390
+ *
391
+ * 事件序列:`turn_started` → `delta`* → `done`;中途取消(AbortSignal)时为
392
+ * `turn_started` → `delta`* → `cancelled`。`cancelled` 保留 turnId 与已生成文本,
393
+ * 调用方可用真实内容调用 `commitTurn` / `interruptTurn` 提交。
390
394
  */
391
395
  type ContextStreamEvent = {
396
+ type: 'turn_started';
397
+ turnId: string;
398
+ } | {
392
399
  type: 'delta';
393
400
  text: string;
394
401
  } | {
@@ -410,6 +417,10 @@ type ContextStreamEvent = {
410
417
  completion_tokens: number;
411
418
  total_tokens: number;
412
419
  };
420
+ } | {
421
+ type: 'cancelled';
422
+ turnId: string;
423
+ generated: string;
413
424
  };
414
425
  /**
415
426
  * 有状态上下文管理器接口
@@ -563,7 +574,7 @@ interface ContextManager {
563
574
  /**
564
575
  * 流式发送消息并获取回复(需 deps.llm 可用)
565
576
  *
566
- * 产出事件序列:delta* → done
577
+ * 产出事件序列:turn_started → delta* → done(中途取消时 → cancelled)
567
578
  *
568
579
  * @param message - 用户消息文本
569
580
  * @param options - 单次请求覆盖选项
@@ -622,18 +633,18 @@ interface ContextOperations {
622
633
  /**
623
634
  * 重命名会话
624
635
  *
625
- * @param sessionId - 会话 ID
636
+ * @param scope - 交互作用域(objectId + sessionId,用于多租户隔离)
626
637
  * @param title - 新标题
627
638
  * @returns 成功返回 ok(undefined)
628
639
  */
629
- renameSession: (sessionId: string, title: string) => Promise<HaiResult<void>>;
640
+ renameSession: (scope: InteractionScope, title: string) => Promise<HaiResult<void>>;
630
641
  /**
631
642
  * 删除会话(删除会话元数据和对应的上下文数据)
632
643
  *
633
- * @param sessionId - 会话 ID
644
+ * @param scope - 交互作用域(objectId + sessionId,用于多租户隔离)
634
645
  * @returns 成功返回 ok(undefined)
635
646
  */
636
- removeSession: (sessionId: string) => Promise<HaiResult<void>>;
647
+ removeSession: (scope: InteractionScope) => Promise<HaiResult<void>>;
637
648
  }
638
649
 
639
650
  /**
@@ -1507,6 +1518,8 @@ interface AudioWsStartMessage {
1507
1518
  /** 文本输入帧(合成操作时携带待合成文本) */
1508
1519
  interface AudioWsTextMessage {
1509
1520
  type: 'text';
1521
+ /** 调用方分配的稳定文本段 ID */
1522
+ segmentId: string;
1510
1523
  /** 待合成文本片段 */
1511
1524
  text: string;
1512
1525
  }
@@ -1528,6 +1541,17 @@ interface AudioWsTranscriptMessage {
1528
1541
  /** 是否为该语句的最终结果 */
1529
1542
  final: boolean;
1530
1543
  }
1544
+ /** 合成文本段开始;后续二进制帧均属于该段,直到收到对应的 `segment_done`。 */
1545
+ interface AudioWsSegmentStartedMessage {
1546
+ type: 'segment_started';
1547
+ segmentId: string;
1548
+ text: string;
1549
+ }
1550
+ /** 合成文本段的音频已全部发送。 */
1551
+ interface AudioWsSegmentDoneMessage {
1552
+ type: 'segment_done';
1553
+ segmentId: string;
1554
+ }
1531
1555
  /** 错误帧(领域语义错误码,不暴露厂商协议细节) */
1532
1556
  interface AudioWsErrorMessage {
1533
1557
  type: 'error';
@@ -1541,6 +1565,6 @@ interface AudioWsEndMessage {
1541
1565
  type: 'end';
1542
1566
  }
1543
1567
  /** 服务端 JSON 消息(合成音频以二进制帧返回,不走 JSON) */
1544
- type AudioWsServerMessage = AudioWsSpeechMessage | AudioWsTranscriptMessage | AudioWsErrorMessage | AudioWsEndMessage;
1568
+ type AudioWsServerMessage = AudioWsSpeechMessage | AudioWsTranscriptMessage | AudioWsSegmentStartedMessage | AudioWsSegmentDoneMessage | AudioWsErrorMessage | AudioWsEndMessage;
1545
1569
 
1546
- export { type OutputFormat as $, type AIFunctions as A, type ConversationTurn as B, type CompressionStrategy as C, type ConversationTurnStatus as D, type EmbeddingItem as E, type EmbeddingOperations as F, type EmbeddingProvider as G, HaiAIError as H, type EmbeddingRequest as I, type EmbeddingResponse as J, type FileOperations as K, type FileParseMethod as L, type FileParseOptions as M, type FileParseRequest as N, type FileParseResult as O, type MCPContext as P, type MCPOperations as Q, type MCPPrompt as R, type MCPPromptArgument as S, type MCPPromptContent as T, type MCPPromptMessage as U, type MCPProvider as V, type MCPResource as W, type MCPResourceContent as X, type MCPToolDefinition as Y, type MCPToolHandler as Z, type McpServerOptions as _, type AIInitOptions as a, type PersonaOperations as a0, type PersonaProfile as a1, type PersonaProfileInput as a2, type PersonaProfileUpdate as a3, type PersonaScopeOptions as a4, type RerankDocument as a5, type RerankItem as a6, type RerankOperations as a7, type RerankRequest as a8, type RerankResponse as a9, type SummaryOperations as aa, type SummaryOptions as ab, type SummaryResult as ac, type TokenOperations as ad, AUDIO_WS_PATH as b, type AudioWsClientMessage as c, type AudioWsDoneMessage as d, type AudioWsEndMessage as e, type AudioWsErrorMessage as f, type AudioWsServerMessage as g, type AudioWsSpeechMessage as h, type AudioWsStartMessage as i, type AudioWsTextMessage as j, type AudioWsTranscriptMessage as k, CompressionStrategySchema as l, type AIMCPFunctionsDeps as m, type CommitTurnInput as n, type CompressOperations as o, type CompressOptions as p, type CompressResult as q, type ConsolidateOptions as r, type ConsolidateResult as s, type ContextChatOptions as t, type ContextChatResult as u, type ContextDeps as v, type ContextManager as w, type ContextManagerOptions as x, type ContextOperations as y, type ContextStreamEvent as z };
1570
+ export { type MCPToolDefinition as $, type AIFunctions as A, type ContextOperations as B, type CompressionStrategy as C, type ContextStreamEvent as D, type ConversationTurn as E, type ConversationTurnStatus as F, type EmbeddingItem as G, HaiAIError as H, type EmbeddingOperations as I, type EmbeddingProvider as J, type EmbeddingRequest as K, type EmbeddingResponse as L, type McpServerOptions as M, type FileOperations as N, type FileParseMethod as O, type FileParseOptions as P, type FileParseRequest as Q, type FileParseResult as R, type MCPContext as S, type MCPOperations as T, type MCPPrompt as U, type MCPPromptArgument as V, type MCPPromptContent as W, type MCPPromptMessage as X, type MCPProvider as Y, type MCPResource as Z, type MCPResourceContent as _, type AIInitOptions as a, type MCPToolHandler as a0, type OutputFormat as a1, type PersonaOperations as a2, type PersonaProfile as a3, type PersonaProfileInput as a4, type PersonaProfileUpdate as a5, type PersonaScopeOptions as a6, type RerankDocument as a7, type RerankItem as a8, type RerankOperations as a9, type RerankRequest as aa, type RerankResponse as ab, type SummaryOperations as ac, type SummaryOptions as ad, type SummaryResult as ae, type TokenOperations as af, AUDIO_WS_PATH as b, type AudioWsClientMessage as c, type AudioWsDoneMessage as d, type AudioWsEndMessage as e, type AudioWsErrorMessage as f, type AudioWsSegmentDoneMessage as g, type AudioWsSegmentStartedMessage as h, type AudioWsServerMessage as i, type AudioWsSpeechMessage as j, type AudioWsStartMessage as k, type AudioWsTextMessage as l, type AudioWsTranscriptMessage as m, CompressionStrategySchema as n, type AIMCPFunctionsDeps as o, type CommitTurnInput as p, type CompressOperations as q, type CompressOptions as r, type CompressResult as s, type ConsolidateOptions as t, type ConsolidateResult as u, type ContextChatOptions as v, type ContextChatResult as w, type ContextDeps as x, type ContextManager as y, type ContextManagerOptions as z };
@@ -430,11 +430,7 @@ interface AIVectorBackend {
430
430
  *
431
431
  * @example
432
432
  * ```ts
433
- * // 使用默认 reldb+vecdb provider
434
- * ai.init({ store: { type: 'db' } })
435
- *
436
- * // 使用自定义 provider
437
- * ai.init({ store: { type: 'custom', provider: myProvider } })
433
+ * await ai.init(config, { storeProvider: myProvider })
438
434
  * ```
439
435
  */
440
436
  interface AIStoreProvider {
@@ -499,27 +495,6 @@ interface A2AMessageRecord {
499
495
  /** 创建时间戳(毫秒) */
500
496
  createdAt: number;
501
497
  }
502
- /** A2A 客户端调用记录(作为客户端调用远端 Agent 时的日志) */
503
- interface A2AClientCallRecord {
504
- /** 记录 ID */
505
- id: string;
506
- /** 远端 Agent URL */
507
- remoteUrl: string;
508
- /** 远端 Agent 名称 */
509
- remoteName?: string;
510
- /** 请求消息 Part[] */
511
- requestParts: unknown[];
512
- /** 响应消息 Part[](可选,流式时可能为空) */
513
- responseParts?: unknown[];
514
- /** A2A Task ID(远端返回的) */
515
- taskId?: string;
516
- /** 任务最终状态 */
517
- taskState?: string;
518
- /** 调用耗时(毫秒) */
519
- duration?: number;
520
- /** 创建时间戳 */
521
- createdAt: number;
522
- }
523
498
  /** A2A 上下文信息(对话/会话级别) */
524
499
  interface A2AContextInfo {
525
500
  /** 上下文 ID(对应 SDK 的 contextId) */
@@ -607,6 +582,8 @@ interface A2AOperations {
607
582
  /**
608
583
  * 作为客户端调用远端 Agent
609
584
  *
585
+ * remoteUrl 只应来自受信配置。框架校验协议和内嵌凭据,应用仍须按部署环境实施来源白名单与出口策略。
586
+ *
610
587
  * @param remoteUrl - 远端 Agent 的 A2A 端点 URL
611
588
  * @param message - 发送的消息文本
612
589
  * @param options - 调用选项
@@ -657,7 +634,7 @@ interface A2AHandleResult {
657
634
  }
658
635
  /** 远端调用选项 */
659
636
  interface A2ACallOptions {
660
- /** 请求超时(毫秒) */
637
+ /** 超时时间(毫秒),默认 60 秒。 */
661
638
  timeout?: number;
662
639
  /** 额外请求头 */
663
640
  headers?: Record<string, string>;
@@ -1945,6 +1922,19 @@ interface MemoryUpdateInput {
1945
1922
  * const response = await ai.llm.chat({ messages: enriched.value })
1946
1923
  * ```
1947
1924
  */
1925
+ /**
1926
+ * 按 ID 访问单条记忆(get / update / remove)时的归属校验作用域。
1927
+ *
1928
+ * 传入后,Provider 先读取记忆再校验:`entry.objectId` 必须等于 `objectId`,且 `entry.scope`
1929
+ * 包含 `scope` 的全部 key-value;不匹配时统一返回 `MEMORY_NOT_FOUND`(避免通过错误差异
1930
+ * 枚举其他主体的记忆)。不传时不做归属校验(向后兼容);处理不可信输入的 memoryId 时必须传入。
1931
+ */
1932
+ interface MemoryAccessScope {
1933
+ /** 归属主体 ID(必须与记忆 entry.objectId 一致) */
1934
+ objectId: string;
1935
+ /** 业务作用域(entry.scope 必须包含这些 key-value) */
1936
+ scope?: Record<string, unknown>;
1937
+ }
1948
1938
  interface MemoryOperations {
1949
1939
  /**
1950
1940
  * 从对话消息中自动提取记忆条目
@@ -1998,25 +1988,28 @@ interface MemoryOperations {
1998
1988
  *
1999
1989
  * @param memoryId - 记忆 ID
2000
1990
  * @param updates - 需要更新的字段
1991
+ * @param accessScope - 可选归属校验(不匹配返回 MEMORY_NOT_FOUND)
2001
1992
  * @returns 更新后的完整记忆条目
2002
1993
  */
2003
- update: (memoryId: string, updates: MemoryUpdateInput) => Promise<HaiResult<MemoryEntry>>;
1994
+ update: (memoryId: string, updates: MemoryUpdateInput, accessScope?: MemoryAccessScope) => Promise<HaiResult<MemoryEntry>>;
2004
1995
  /**
2005
1996
  * 按 ID 获取单条记忆
2006
1997
  *
2007
1998
  * @param memoryId - 记忆 ID
1999
+ * @param accessScope - 可选归属校验(不匹配返回 MEMORY_NOT_FOUND)
2008
2000
  * @returns 记忆条目,不存在时返回 MEMORY_NOT_FOUND
2009
2001
  */
2010
- get: (memoryId: string) => Promise<HaiResult<MemoryEntry>>;
2002
+ get: (memoryId: string, accessScope?: MemoryAccessScope) => Promise<HaiResult<MemoryEntry>>;
2011
2003
  /**
2012
2004
  * 删除单条记忆
2013
2005
  *
2014
2006
  * 同时从 Store 中移除持久化数据。
2015
2007
  *
2016
2008
  * @param memoryId - 记忆 ID
2009
+ * @param accessScope - 可选归属校验(不匹配返回 MEMORY_NOT_FOUND)
2017
2010
  * @returns 成功返回 ok(undefined)
2018
2011
  */
2019
- remove: (memoryId: string) => Promise<HaiResult<void>>;
2012
+ remove: (memoryId: string, accessScope?: MemoryAccessScope) => Promise<HaiResult<void>>;
2020
2013
  /**
2021
2014
  * 获取记忆列表
2022
2015
  *
@@ -2607,7 +2600,7 @@ type AudioProviderName = z.infer<typeof AudioProviderSchema>;
2607
2600
  *
2608
2601
  * @example
2609
2602
  * ```ts
2610
- * const model = { id: 'asr', provider: 'qwen', model: 'qwen3-asr-flash-realtime' }
2603
+ * const model = { id: 'asr', provider: 'qwen', model: 'qwen3-asr-flash-realtime', operations: ['transcribe'] }
2611
2604
  * ```
2612
2605
  */
2613
2606
  declare const AudioModelEntrySchema: z.ZodObject<{
@@ -2619,6 +2612,7 @@ declare const AudioModelEntrySchema: z.ZodObject<{
2619
2612
  doubao: "doubao";
2620
2613
  }>;
2621
2614
  model: z.ZodString;
2615
+ operations: z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"transcribe">], null>, z.ZodTuple<[z.ZodLiteral<"synthesize">], null>, z.ZodTuple<[z.ZodLiteral<"transcribe">, z.ZodLiteral<"synthesize">], null>]>;
2622
2616
  apiKey: z.ZodOptional<z.ZodString>;
2623
2617
  baseUrl: z.ZodOptional<z.ZodString>;
2624
2618
  appKey: z.ZodOptional<z.ZodString>;
@@ -2639,8 +2633,8 @@ type AudioModelEntry = z.infer<typeof AudioModelEntrySchema>;
2639
2633
  * ai.init({
2640
2634
  * audio: {
2641
2635
  * models: [
2642
- * { id: 'asr', provider: 'qwen', model: 'qwen3-asr-flash-realtime' },
2643
- * { id: 'tts', provider: 'qwen', model: 'qwen3-tts-flash-realtime' },
2636
+ * { id: 'asr', provider: 'qwen', model: 'qwen3-asr-flash-realtime', operations: ['transcribe'] },
2637
+ * { id: 'tts', provider: 'qwen', model: 'qwen3-tts-flash-realtime', operations: ['synthesize'] },
2644
2638
  * ],
2645
2639
  * transcribeModel: 'asr',
2646
2640
  * synthesizeModel: 'tts',
@@ -2658,6 +2652,7 @@ declare const AudioConfigSchema: z.ZodObject<{
2658
2652
  doubao: "doubao";
2659
2653
  }>;
2660
2654
  model: z.ZodString;
2655
+ operations: z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"transcribe">], null>, z.ZodTuple<[z.ZodLiteral<"synthesize">], null>, z.ZodTuple<[z.ZodLiteral<"transcribe">, z.ZodLiteral<"synthesize">], null>]>;
2661
2656
  apiKey: z.ZodOptional<z.ZodString>;
2662
2657
  baseUrl: z.ZodOptional<z.ZodString>;
2663
2658
  appKey: z.ZodOptional<z.ZodString>;
@@ -2922,6 +2917,7 @@ declare const AIConfigSchema: z.ZodObject<{
2922
2917
  doubao: "doubao";
2923
2918
  }>;
2924
2919
  model: z.ZodString;
2920
+ operations: z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"transcribe">], null>, z.ZodTuple<[z.ZodLiteral<"synthesize">], null>, z.ZodTuple<[z.ZodLiteral<"transcribe">, z.ZodLiteral<"synthesize">], null>]>;
2925
2921
  apiKey: z.ZodOptional<z.ZodString>;
2926
2922
  baseUrl: z.ZodOptional<z.ZodString>;
2927
2923
  appKey: z.ZodOptional<z.ZodString>;
@@ -3032,9 +3028,10 @@ interface TranscriptionResult {
3032
3028
  /**
3033
3029
  * 流式语音识别领域事件
3034
3030
  *
3035
- * 统一的语音领域事件(非厂商协议)。支持服务端 VAD 的平台(Qwen / 豆包)会在检测到语音
3036
- * 起止时额外产出 `speech_started` / `speech_stopped`,使调用方可在「开始说话」的瞬间做出反应
3037
- * (如取消当前上游生成),而无需自行运行 VAD;不支持 VAD 的平台仅产出 `transcript`。
3031
+ * 统一的语音领域事件(非厂商协议)。支持服务端 VAD 的平台(如 Qwen 实时识别)会在检测到
3032
+ * 语音起止时额外产出 `speech_started` / `speech_stopped`,使调用方可在「开始说话」的瞬间做出
3033
+ * 反应(如取消当前上游生成),而无需自行运行 VAD;不产出 VAD 事件的平台(如豆包)仅产出
3034
+ * `transcript`,此时是否需要 VAD 由调用方自行决定。
3038
3035
  *
3039
3036
  * `transcript.text` 表示当前语句的完整识别文本(非字符增量),实时 ASR 会修订前一次临时结果,
3040
3037
  * 调用方可直接用 `text` 覆盖当前临时文本。
@@ -3069,10 +3066,17 @@ interface SynthesisRequest {
3069
3066
  /** 取消信号 */
3070
3067
  signal?: AbortSignal;
3071
3068
  }
3072
- /** 流式语音合成请求(支持完整文本或持续文本输入) */
3069
+ /** 带稳定 ID 的合成文本段 */
3070
+ interface SynthesisTextSegment {
3071
+ /** 调用方分配的稳定 ID,用于关联文本、音频与播放完成状态 */
3072
+ id: string;
3073
+ /** 本段待合成文本 */
3074
+ text: string;
3075
+ }
3076
+ /** 流式语音合成请求(支持单段或持续文本段输入) */
3073
3077
  interface SynthesisStreamRequest {
3074
- /** 完整文本,或持续到达的文本流(可直接连接 LLM 文本流实现边生成边合成) */
3075
- text: string | AsyncIterable<string>;
3078
+ /** 单个文本段,或持续到达的文本段流 */
3079
+ text: SynthesisTextSegment | AsyncIterable<SynthesisTextSegment>;
3076
3080
  /** 音色(厂商音色名,不传时使用模型默认音色) */
3077
3081
  voice?: string;
3078
3082
  /**
@@ -3093,6 +3097,54 @@ interface SynthesisStreamRequest {
3093
3097
  /** 完整语音合成结果 */
3094
3098
  interface SynthesisResult extends AudioContent {
3095
3099
  }
3100
+ /**
3101
+ * 流式语音合成领域事件
3102
+ *
3103
+ * 每个文本段严格按 `segment_started → audio* → segment_done` 顺序产出,调用方可在
3104
+ * 对应音频真正播放完成后提交该段文本,不需要按字节数反推文本边界。
3105
+ */
3106
+ type SynthesisEvent = {
3107
+ type: 'segment_started';
3108
+ segmentId: string;
3109
+ text: string;
3110
+ } | {
3111
+ type: 'audio';
3112
+ segmentId: string;
3113
+ data: Uint8Array;
3114
+ } | {
3115
+ type: 'segment_done';
3116
+ segmentId: string;
3117
+ };
3118
+ /**
3119
+ * 语音模型的实时能力声明
3120
+ *
3121
+ * 由 `ai.audio.getCapabilities({ operation, model })` 返回,供实时会话在启动前校验:不同平台对「持续音频输入 /
3122
+ * 服务端 VAD / 增量文本输入 / 流式输出」的原生支持不同,同一方法签名在不同平台下的实时语义并不一致。
3123
+ * 调用方应据此选择模型或调整策略(如实时 ASR 要求 `realtimeAudioInput` 与 `speechBoundaryEvents`,
3124
+ * 实时 TTS 要求 `streamingAudioOutput`)。
3125
+ */
3126
+ interface AudioModelCapabilities {
3127
+ /** 语音识别能力;模型未声明识别操作时不返回 */
3128
+ transcribe?: {
3129
+ supported: boolean;
3130
+ realtimeAudioInput: boolean;
3131
+ speechBoundaryEvents: boolean;
3132
+ streamingTranscriptOutput: boolean;
3133
+ };
3134
+ /** 语音合成能力;模型未声明合成操作时不返回 */
3135
+ synthesize?: {
3136
+ supported: boolean;
3137
+ incrementalTextInput: boolean;
3138
+ streamingAudioOutput: boolean;
3139
+ };
3140
+ }
3141
+ /** 查询语音模型能力的参数 */
3142
+ interface AudioCapabilitiesRequest {
3143
+ /** 要查询的操作,决定默认模型和返回的能力分支 */
3144
+ operation: 'transcribe' | 'synthesize';
3145
+ /** 模型 ID;不传时使用该操作配置的默认模型 */
3146
+ model?: string;
3147
+ }
3096
3148
  /**
3097
3149
  * Audio 操作接口(通过 `ai.audio` 访问)
3098
3150
  *
@@ -3106,8 +3158,15 @@ interface AudioOperations {
3106
3158
  transcribeStream: (request: TranscriptionStreamRequest) => AsyncIterable<TranscriptionEvent>;
3107
3159
  /** 将完整文本合成为完整音频 */
3108
3160
  synthesize: (request: SynthesisRequest) => Promise<HaiResult<SynthesisResult>>;
3109
- /** 持续输入文本或增量输出音频 */
3110
- synthesizeStream: (request: SynthesisStreamRequest) => AsyncIterable<Uint8Array>;
3161
+ /** 持续输入文本段并按段输出结构化音频事件 */
3162
+ synthesizeStream: (request: SynthesisStreamRequest) => AsyncIterable<SynthesisEvent>;
3163
+ /**
3164
+ * 查询指定模型的实时能力声明
3165
+ *
3166
+ * @param request - 操作类型与可选模型 ID
3167
+ * @returns 该模型对应操作的能力;模型不存在或操作不匹配时返回失败结果
3168
+ */
3169
+ getCapabilities: (request: AudioCapabilitiesRequest) => HaiResult<AudioModelCapabilities>;
3111
3170
  }
3112
3171
 
3113
3172
  /**
@@ -3403,4 +3462,4 @@ interface ReasoningOperations {
3403
3462
  runStream: (query: string, options?: ReasoningOptions) => AsyncIterable<ReasoningStreamEvent>;
3404
3463
  }
3405
3464
 
3406
- export { type SynthesisRequest as $, type A2AConfig as A, MCPServerCapabilitiesSchema as B, type CompressConfig as C, type MCPServerConfig as D, type EmbeddingConfig as E, type FileConfig as F, MCPServerConfigSchema as G, type MemoryConfig as H, MemoryConfigSchema as I, type MemoryType as J, type KnowledgeConfig as K, type LLMConfig as L, type MCPConfig as M, MemoryTypeSchema as N, type ModelEntry as O, ModelEntrySchema as P, type ModelScenario as Q, ModelScenarioSchema as R, type ResolveRequiredModelEntryOptions as S, type ResolvedAudioModel as T, type ResolvedModelConfig as U, type RetrievalConfig as V, RetrievalConfigSchema as W, type RetrievalSourceConfig as X, RetrievalSourceSchema as Y, type SummaryConfig as Z, SummaryConfigSchema as _, A2AConfigSchema as a, type KnowledgeRetrieveOptions as a$, type SynthesisResult as a0, type SynthesisStreamRequest as a1, type TokenConfig as a2, TokenConfigSchema as a3, type TranscriptionEvent as a4, type TranscriptionRequest as a5, type TranscriptionResult as a6, type TranscriptionStreamRequest as a7, resolveAudioModel as a8, resolveModelApi as a9, type ChatCompletionResponse as aA, type ChatHistoryOptions as aB, type ChatMessage as aC, type ChatRecord as aD, type Citation as aE, type DefineToolOptions as aF, type DeveloperMessage as aG, type EntityDocumentRelation as aH, type EntityDocumentResult as aI, type EntityListOptions as aJ, type EntityQueryOptions as aK, type GenerateObjectRequest as aL, type ImageContent as aM, type InteractionScope as aN, type KnowledgeAskOptions as aO, type KnowledgeAskResult as aP, type KnowledgeDocumentInfo as aQ, type KnowledgeDocumentListOptions as aR, type KnowledgeDocumentRemoveOptions as aS, type KnowledgeEntity as aT, type KnowledgeIngestBatchProgress as aU, type KnowledgeIngestBatchResult as aV, type KnowledgeIngestFileInput as aW, type KnowledgeIngestInput as aX, type KnowledgeIngestResult as aY, type KnowledgeOperations as aZ, type KnowledgeRetrieveItem as a_, resolveModelEntry as aa, type A2AAgentCardConfig as ab, type A2AApiKeySecurity as ac, type A2AAuthenticator as ad, type A2ACallOptions as ae, type A2ACallResult as af, type A2ACallerIdentity as ag, type A2AClientCallRecord as ah, type A2AContextInfo as ai, type A2AHandleResult as aj, type A2AMessageRecord as ak, type A2AOperations as al, type A2ASecurityConfig as am, type A2ATaskFilter as an, type AILLMFunctionsDeps as ao, type AIRelStore as ap, type AIRelStoreOptions as aq, type AIStoreProvider as ar, type AIVectorBackend as as, type AIVectorStore as at, type AskOptions as au, type AssistantMessage as av, type ChatCompletionChoice as aw, type ChatCompletionChunk as ax, type ChatCompletionDelta as ay, type ChatCompletionRequest as az, A2ASkillConfigSchema as b, type KnowledgeRetrieveResult as b0, type KnowledgeSetupOptions as b1, type KnowledgeStore as b2, type LLMOperations as b3, type LLMProvider as b4, type MemoryClearOptions as b5, type MemoryEntry as b6, type MemoryEntryInput as b7, type MemoryExtractOptions as b8, type MemoryInjectionOptions as b9, type SSEEvent as bA, type SessionInfo as bB, type StoreFilter as bC, type StorePage as bD, type StoreScope as bE, type StreamOperations as bF, type StreamProcessor as bG, type StreamResult as bH, type SystemMessage as bI, type TempModelConfig as bJ, type TextContent as bK, type TokenUsage as bL, type Tool as bM, type ToolCall as bN, type ToolDefinition as bO, type ToolErrorType as bP, type ToolMessage as bQ, type ToolRegistryOperations as bR, type ToolsOperations as bS, type UserMessage as bT, type WhereClause as bU, type WhereOperator as bV, type WhereValue as bW, type MemoryListOptions as ba, type MemoryListPageOptions as bb, type MemoryOperations as bc, type MemoryRecallOptions as bd, type MemoryUpdateInput as be, type MessageContent as bf, type MessageRole as bg, type ObjectRef as bh, type RagContextItem as bi, type RagOperations as bj, type RagOptions as bk, type RagResult as bl, type RagStreamEvent as bm, type ReasoningOperations as bn, type ReasoningOptions as bo, type ReasoningResult as bp, type ReasoningStep as bq, type ReasoningStepType as br, type ReasoningStrategy as bs, type ReasoningStreamEvent as bt, type RetrievalOperations as bu, type RetrievalRequest as bv, type RetrievalResult as bw, type RetrievalResultItem as bx, type RetrievalSource as by, type SSEDecoder as bz, type AIConfig as c, type AIConfigInput as d, AIConfigSchema as e, type ApiType as f, ApiTypeSchema as g, type AudioConfig as h, AudioConfigSchema as i, type AudioContent as j, type AudioFormat as k, type AudioInputStream as l, type AudioModelEntry as m, AudioModelEntrySchema as n, type AudioOperations as o, type AudioProviderName as p, AudioProviderSchema as q, CompressConfigSchema as r, EmbeddingConfigSchema as s, type EntityType as t, EntityTypeSchema as u, FileConfigSchema as v, KnowledgeConfigSchema as w, LLMConfigSchema as x, MCPConfigSchema as y, type MCPServerCapabilities as z };
3465
+ export { type SummaryConfig as $, type A2AConfig as A, MCPConfigSchema as B, type CompressConfig as C, type MCPServerCapabilities as D, type EmbeddingConfig as E, type FileConfig as F, MCPServerCapabilitiesSchema as G, type MCPServerConfig as H, MCPServerConfigSchema as I, type MemoryConfig as J, type KnowledgeConfig as K, type LLMConfig as L, type MCPConfig as M, MemoryConfigSchema as N, type MemoryType as O, MemoryTypeSchema as P, type ModelEntry as Q, ModelEntrySchema as R, type ModelScenario as S, ModelScenarioSchema as T, type ResolveRequiredModelEntryOptions as U, type ResolvedAudioModel as V, type ResolvedModelConfig as W, type RetrievalConfig as X, RetrievalConfigSchema as Y, type RetrievalSourceConfig as Z, RetrievalSourceSchema as _, A2AConfigSchema as a, type KnowledgeIngestResult as a$, SummaryConfigSchema as a0, type SynthesisEvent as a1, type SynthesisRequest as a2, type SynthesisResult as a3, type SynthesisStreamRequest as a4, type SynthesisTextSegment as a5, type TokenConfig as a6, TokenConfigSchema as a7, type TranscriptionEvent as a8, type TranscriptionRequest as a9, type ChatCompletionChunk as aA, type ChatCompletionDelta as aB, type ChatCompletionRequest as aC, type ChatCompletionResponse as aD, type ChatHistoryOptions as aE, type ChatMessage as aF, type ChatRecord as aG, type Citation as aH, type DefineToolOptions as aI, type DeveloperMessage as aJ, type EntityDocumentRelation as aK, type EntityDocumentResult as aL, type EntityListOptions as aM, type EntityQueryOptions as aN, type GenerateObjectRequest as aO, type ImageContent as aP, type InteractionScope as aQ, type KnowledgeAskOptions as aR, type KnowledgeAskResult as aS, type KnowledgeDocumentInfo as aT, type KnowledgeDocumentListOptions as aU, type KnowledgeDocumentRemoveOptions as aV, type KnowledgeEntity as aW, type KnowledgeIngestBatchProgress as aX, type KnowledgeIngestBatchResult as aY, type KnowledgeIngestFileInput as aZ, type KnowledgeIngestInput as a_, type TranscriptionResult as aa, type TranscriptionStreamRequest as ab, resolveAudioModel as ac, resolveModelApi as ad, resolveModelEntry as ae, type A2AAgentCardConfig as af, type A2AApiKeySecurity as ag, type A2AAuthenticator as ah, type A2ACallOptions as ai, type A2ACallResult as aj, type A2ACallerIdentity as ak, type A2AContextInfo as al, type A2AHandleResult as am, type A2AMessageRecord as an, type A2AOperations as ao, type A2ASecurityConfig as ap, type A2ATaskFilter as aq, type AILLMFunctionsDeps as ar, type AIRelStore as as, type AIRelStoreOptions as at, type AIStoreProvider as au, type AIVectorBackend as av, type AIVectorStore as aw, type AskOptions as ax, type AssistantMessage as ay, type ChatCompletionChoice as az, A2ASkillConfigSchema as b, type KnowledgeOperations as b0, type KnowledgeRetrieveItem as b1, type KnowledgeRetrieveOptions as b2, type KnowledgeRetrieveResult as b3, type KnowledgeSetupOptions as b4, type KnowledgeStore as b5, type LLMOperations as b6, type LLMProvider as b7, type MemoryAccessScope as b8, type MemoryClearOptions as b9, type RetrievalResult as bA, type RetrievalResultItem as bB, type RetrievalSource as bC, type SSEDecoder as bD, type SSEEvent as bE, type SessionInfo as bF, type StoreFilter as bG, type StorePage as bH, type StoreScope as bI, type StreamOperations as bJ, type StreamProcessor as bK, type StreamResult as bL, type SystemMessage as bM, type TempModelConfig as bN, type TextContent as bO, type TokenUsage as bP, type Tool as bQ, type ToolCall as bR, type ToolDefinition as bS, type ToolErrorType as bT, type ToolMessage as bU, type ToolRegistryOperations as bV, type ToolsOperations as bW, type UserMessage as bX, type WhereClause as bY, type WhereOperator as bZ, type WhereValue as b_, type MemoryEntry as ba, type MemoryEntryInput as bb, type MemoryExtractOptions as bc, type MemoryInjectionOptions as bd, type MemoryListOptions as be, type MemoryListPageOptions as bf, type MemoryOperations as bg, type MemoryRecallOptions as bh, type MemoryUpdateInput as bi, type MessageContent as bj, type MessageRole as bk, type ObjectRef as bl, type RagContextItem as bm, type RagOperations as bn, type RagOptions as bo, type RagResult as bp, type RagStreamEvent as bq, type ReasoningOperations as br, type ReasoningOptions as bs, type ReasoningResult as bt, type ReasoningStep as bu, type ReasoningStepType as bv, type ReasoningStrategy as bw, type ReasoningStreamEvent as bx, type RetrievalOperations as by, type RetrievalRequest as bz, type AIConfig as c, type AIConfigInput as d, AIConfigSchema as e, type ApiType as f, ApiTypeSchema as g, type AudioCapabilitiesRequest as h, type AudioConfig as i, AudioConfigSchema as j, type AudioContent as k, type AudioFormat as l, type AudioInputStream as m, type AudioModelCapabilities as n, type AudioModelEntry as o, AudioModelEntrySchema as p, type AudioOperations as q, type AudioProviderName as r, AudioProviderSchema as s, CompressConfigSchema as t, EmbeddingConfigSchema as u, type EntityType as v, EntityTypeSchema as w, FileConfigSchema as x, KnowledgeConfigSchema as y, LLMConfigSchema as z };
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { A as A2AConfig, a as A2AConfigSchema, b as A2ASkillConfigSchema, c as AIConfig, d as AIConfigInput, e as AIConfigSchema, f as ApiType, g as ApiTypeSchema, h as AudioConfig, i as AudioConfigSchema, j as AudioContent, k as AudioFormat, l as AudioInputStream, m as AudioModelEntry, n as AudioModelEntrySchema, o as AudioOperations, p as AudioProviderName, q as AudioProviderSchema, C as CompressConfig, r as CompressConfigSchema, E as EmbeddingConfig, s as EmbeddingConfigSchema, t as EntityType, u as EntityTypeSchema, F as FileConfig, v as FileConfigSchema, K as KnowledgeConfig, w as KnowledgeConfigSchema, L as LLMConfig, x as LLMConfigSchema, M as MCPConfig, y as MCPConfigSchema, z as MCPServerCapabilities, B as MCPServerCapabilitiesSchema, D as MCPServerConfig, G as MCPServerConfigSchema, H as MemoryConfig, I as MemoryConfigSchema, J as MemoryType, N as MemoryTypeSchema, O as ModelEntry, P as ModelEntrySchema, Q as ModelScenario, R as ModelScenarioSchema, S as ResolveRequiredModelEntryOptions, T as ResolvedAudioModel, U as ResolvedModelConfig, V as RetrievalConfig, W as RetrievalConfigSchema, X as RetrievalSourceConfig, Y as RetrievalSourceSchema, Z as SummaryConfig, _ as SummaryConfigSchema, $ as SynthesisRequest, a0 as SynthesisResult, a1 as SynthesisStreamRequest, a2 as TokenConfig, a3 as TokenConfigSchema, a4 as TranscriptionEvent, a5 as TranscriptionRequest, a6 as TranscriptionResult, a7 as TranscriptionStreamRequest, a8 as resolveAudioModel, a9 as resolveModelApi, aa as resolveModelEntry } from './ai-reasoning-types-BGf-x2Qj.js';
2
- export { A as AIFunctions, a as AIInitOptions, b as AUDIO_WS_PATH, c as AudioWsClientMessage, d as AudioWsDoneMessage, e as AudioWsEndMessage, f as AudioWsErrorMessage, g as AudioWsServerMessage, h as AudioWsSpeechMessage, i as AudioWsStartMessage, j as AudioWsTextMessage, k as AudioWsTranscriptMessage, C as CompressionStrategy, l as CompressionStrategySchema, H as HaiAIError } from './ai-audio-ws-protocol-C-V8N8YL.js';
1
+ export { A as A2AConfig, a as A2AConfigSchema, b as A2ASkillConfigSchema, c as AIConfig, d as AIConfigInput, e as AIConfigSchema, f as ApiType, g as ApiTypeSchema, h as AudioCapabilitiesRequest, i as AudioConfig, j as AudioConfigSchema, k as AudioContent, l as AudioFormat, m as AudioInputStream, n as AudioModelCapabilities, o as AudioModelEntry, p as AudioModelEntrySchema, q as AudioOperations, r as AudioProviderName, s as AudioProviderSchema, C as CompressConfig, t as CompressConfigSchema, E as EmbeddingConfig, u as EmbeddingConfigSchema, v as EntityType, w as EntityTypeSchema, F as FileConfig, x as FileConfigSchema, K as KnowledgeConfig, y as KnowledgeConfigSchema, L as LLMConfig, z as LLMConfigSchema, M as MCPConfig, B as MCPConfigSchema, D as MCPServerCapabilities, G as MCPServerCapabilitiesSchema, H as MCPServerConfig, I as MCPServerConfigSchema, J as MemoryConfig, N as MemoryConfigSchema, O as MemoryType, P as MemoryTypeSchema, Q as ModelEntry, R as ModelEntrySchema, S as ModelScenario, T as ModelScenarioSchema, U as ResolveRequiredModelEntryOptions, V as ResolvedAudioModel, W as ResolvedModelConfig, X as RetrievalConfig, Y as RetrievalConfigSchema, Z as RetrievalSourceConfig, _ as RetrievalSourceSchema, $ as SummaryConfig, a0 as SummaryConfigSchema, a1 as SynthesisEvent, a2 as SynthesisRequest, a3 as SynthesisResult, a4 as SynthesisStreamRequest, a5 as SynthesisTextSegment, a6 as TokenConfig, a7 as TokenConfigSchema, a8 as TranscriptionEvent, a9 as TranscriptionRequest, aa as TranscriptionResult, ab as TranscriptionStreamRequest, ac as resolveAudioModel, ad as resolveModelApi, ae as resolveModelEntry } from './ai-reasoning-types-DLLzpn6T.js';
2
+ export { A as AIFunctions, a as AIInitOptions, b as AUDIO_WS_PATH, c as AudioWsClientMessage, d as AudioWsDoneMessage, e as AudioWsEndMessage, f as AudioWsErrorMessage, g as AudioWsSegmentDoneMessage, h as AudioWsSegmentStartedMessage, i as AudioWsServerMessage, j as AudioWsSpeechMessage, k as AudioWsStartMessage, l as AudioWsTextMessage, m as AudioWsTranscriptMessage, C as CompressionStrategy, n as CompressionStrategySchema, H as HaiAIError } from './ai-audio-ws-protocol-CsmuWetO.js';
3
3
  export { A2AClientOperations, AIApiAdapter, AIClient, AIClientConfig, AudioClientConfig, AudioClientOperations, StreamOptions, StreamProgress, collectStreamContent, createA2AClient, createAIClient, createAudioClient, createUnconfiguredAudioClient, parseSSE } from './client/index.js';
4
4
  import '@a2a-js/sdk/server';
5
5
  import '@h-ai/core';
package/dist/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- export { A2AConfigSchema, A2ASkillConfigSchema, AIConfigSchema, AUDIO_WS_PATH, ApiTypeSchema, AudioConfigSchema, AudioModelEntrySchema, AudioProviderSchema, CompressConfigSchema, CompressionStrategySchema, EmbeddingConfigSchema, EntityTypeSchema, FileConfigSchema, HaiAIError, KnowledgeConfigSchema, LLMConfigSchema, MCPConfigSchema, MCPServerCapabilitiesSchema, MCPServerConfigSchema, MemoryConfigSchema, MemoryTypeSchema, ModelEntrySchema, ModelScenarioSchema, RetrievalConfigSchema, RetrievalSourceSchema, SummaryConfigSchema, TokenConfigSchema, resolveAudioModel, resolveModelApi, resolveModelEntry } from './chunk-URXCNMJW.js';
2
- export { collectStreamContent, createA2AClient, createAIClient, createAudioClient, createUnconfiguredAudioClient, parseSSE } from './chunk-AXIZBZMV.js';
1
+ export { A2AConfigSchema, A2ASkillConfigSchema, AIConfigSchema, AUDIO_WS_PATH, ApiTypeSchema, AudioConfigSchema, AudioModelEntrySchema, AudioProviderSchema, CompressConfigSchema, CompressionStrategySchema, EmbeddingConfigSchema, EntityTypeSchema, FileConfigSchema, HaiAIError, KnowledgeConfigSchema, LLMConfigSchema, MCPConfigSchema, MCPServerCapabilitiesSchema, MCPServerConfigSchema, MemoryConfigSchema, MemoryTypeSchema, ModelEntrySchema, ModelScenarioSchema, RetrievalConfigSchema, RetrievalSourceSchema, SummaryConfigSchema, TokenConfigSchema, resolveAudioModel, resolveModelApi, resolveModelEntry } from './chunk-UROBPUCF.js';
2
+ export { collectStreamContent, createA2AClient, createAIClient, createAudioClient, createUnconfiguredAudioClient, parseSSE } from './chunk-535CQURK.js';
3
3
  //# sourceMappingURL=browser.js.map
4
4
  //# sourceMappingURL=browser.js.map