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

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.
@@ -426,15 +426,12 @@ interface AIVectorBackend {
426
426
  * AI 存储 Provider 接口
427
427
  *
428
428
  * 负责创建 AIRelStore / AIVectorStore 实例,并管理存储层生命周期。
429
- * 默认实现基于 reldb + vecdb;也可对接 SaaS API 或其他后端。
429
+ * reldb + vecdb 已初始化时默认使用持久化 DB 实现,否则使用进程内临时实现;
430
+ * 也可对接 SaaS API 或其他后端。
430
431
  *
431
432
  * @example
432
433
  * ```ts
433
- * // 使用默认 reldb+vecdb provider
434
- * ai.init({ store: { type: 'db' } })
435
- *
436
- * // 使用自定义 provider
437
- * ai.init({ store: { type: 'custom', provider: myProvider } })
434
+ * await ai.init(config, { storeProvider: myProvider })
438
435
  * ```
439
436
  */
440
437
  interface AIStoreProvider {
@@ -499,27 +496,6 @@ interface A2AMessageRecord {
499
496
  /** 创建时间戳(毫秒) */
500
497
  createdAt: number;
501
498
  }
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
499
  /** A2A 上下文信息(对话/会话级别) */
524
500
  interface A2AContextInfo {
525
501
  /** 上下文 ID(对应 SDK 的 contextId) */
@@ -607,6 +583,8 @@ interface A2AOperations {
607
583
  /**
608
584
  * 作为客户端调用远端 Agent
609
585
  *
586
+ * remoteUrl 只应来自受信配置。框架校验协议和内嵌凭据,应用仍须按部署环境实施来源白名单与出口策略。
587
+ *
610
588
  * @param remoteUrl - 远端 Agent 的 A2A 端点 URL
611
589
  * @param message - 发送的消息文本
612
590
  * @param options - 调用选项
@@ -657,7 +635,7 @@ interface A2AHandleResult {
657
635
  }
658
636
  /** 远端调用选项 */
659
637
  interface A2ACallOptions {
660
- /** 请求超时(毫秒) */
638
+ /** 超时时间(毫秒),默认 60 秒。 */
661
639
  timeout?: number;
662
640
  /** 额外请求头 */
663
641
  headers?: Record<string, string>;
@@ -841,7 +819,67 @@ interface StreamOperations {
841
819
  encodeSSE: (event: SSEEvent) => string;
842
820
  }
843
821
  /** 工具错误类型枚举 */
844
- type ToolErrorType = 'TOOL_NOT_FOUND' | 'VALIDATION_FAILED' | 'EXECUTION_FAILED' | 'TIMEOUT';
822
+ type ToolErrorType = 'TOOL_NOT_FOUND' | 'TOOL_ALREADY_REGISTERED' | 'VALIDATION_FAILED' | 'EXECUTION_FAILED' | 'FORBIDDEN' | 'TIMEOUT';
823
+ /**
824
+ * 工具执行上下文(传给 handler)
825
+ *
826
+ * 由框架在 `execute` / `executeAll` 时构造并透传给工具 handler,使工具能够:
827
+ * - 响应取消(主持人打断、上层 AbortSignal)提前中止耗时操作(DB 查询 / HTTP 请求);
828
+ * - 感知超时截止时间;
829
+ * - 获知当前交互主体 / 会话,做数据隔离或审计。
830
+ *
831
+ * `signal` 始终存在:即便调用方未传入信号,框架也会依据默认超时构造一个。
832
+ */
833
+ interface ToolExecutionContext {
834
+ /** 取消信号(始终存在;结合调用方信号与超时截止) */
835
+ signal: AbortSignal;
836
+ /** 交互主体 ID(透传自 Context / Reasoning 作用域) */
837
+ objectId?: string;
838
+ /** 会话 ID(透传自 Context / Reasoning 作用域) */
839
+ sessionId?: string;
840
+ /** 截止时间(Unix 毫秒;到期自动取消) */
841
+ deadline?: number;
842
+ }
843
+ /**
844
+ * 工具授权请求
845
+ *
846
+ * `input` 已通过工具的 Zod schema 校验;授权函数在 handler 执行前调用。
847
+ */
848
+ interface ToolAuthorizationRequest<TInput = unknown> {
849
+ /** 工具名称 */
850
+ toolName: string;
851
+ /** 已校验的工具输入 */
852
+ input: TInput;
853
+ /** 本次执行上下文 */
854
+ context: ToolExecutionContext;
855
+ }
856
+ /** 工具授权函数;返回 `false` 或抛出异常时均拒绝执行(fail-closed) */
857
+ type ToolAuthorizer = (request: ToolAuthorizationRequest) => Promise<boolean> | boolean;
858
+ /**
859
+ * 工具执行入参(调用方传给 `execute` / `executeAll`)
860
+ *
861
+ * 所有字段可选。框架据此解析出传给 handler 的 {@link ToolExecutionContext}:
862
+ * 组合调用方 `signal` 与超时信号,超时优先级 `deadline` > `timeoutMs` > 工具默认 > 全局默认。
863
+ */
864
+ interface ToolExecutionOptions {
865
+ /** 调用方取消信号(与超时信号组合) */
866
+ signal?: AbortSignal;
867
+ /** 交互主体 ID */
868
+ objectId?: string;
869
+ /** 会话 ID */
870
+ sessionId?: string;
871
+ /** 截止时间(Unix 毫秒;优先级高于 timeoutMs) */
872
+ deadline?: number;
873
+ /** 本次执行超时(毫秒;覆盖工具默认超时) */
874
+ timeoutMs?: number;
875
+ /**
876
+ * 本次执行授权函数
877
+ *
878
+ * 与 Registry 级授权同时存在时必须全部通过。授权异常不会进入 handler,统一返回
879
+ * `TOOL_FORBIDDEN`,避免因授权服务故障而放行高风险操作。
880
+ */
881
+ authorize?: ToolAuthorizer;
882
+ }
845
883
  /**
846
884
  * 工具定义选项(传给 `ai.tools.define()`)
847
885
  *
@@ -855,8 +893,15 @@ interface DefineToolOptions<TInput, TOutput> {
855
893
  description: string;
856
894
  /** Zod schema,用于参数校验和 JSON Schema 转换 */
857
895
  parameters: ZodType<TInput>;
858
- /** 执行函数,接收校验后的参数,支持同步/异步 */
859
- handler: (input: TInput) => Promise<TOutput> | TOutput;
896
+ /**
897
+ * 执行函数,接收校验后的参数与执行上下文,支持同步/异步
898
+ *
899
+ * `context.signal` 用于响应取消:长耗时操作应把它透传给 DB / HTTP 客户端,
900
+ * 以便打断或超时时提前中止。
901
+ */
902
+ handler: (input: TInput, context: ToolExecutionContext) => Promise<TOutput> | TOutput;
903
+ /** 本工具默认执行超时(毫秒;execute 未指定 deadline/timeoutMs 时生效) */
904
+ timeoutMs?: number;
860
905
  }
861
906
  /**
862
907
  * 工具实例(由 `ai.tools.define()` 创建)
@@ -871,21 +916,24 @@ interface Tool<TInput = unknown, TOutput = unknown> {
871
916
  description: string;
872
917
  /** Zod 参数 schema */
873
918
  parameters: ZodType<TInput>;
874
- /** 执行工具(自动校验参数),失败返回 ToolError */
875
- execute: (input: TInput) => Promise<HaiResult<TOutput>>;
919
+ /** 执行工具(自动校验参数),失败返回 ToolError;超时 / 取消返回 TOOL_TIMEOUT */
920
+ execute: (input: TInput, options?: ToolExecutionOptions) => Promise<HaiResult<TOutput>>;
876
921
  /** 转换为 OpenAI function calling 定义格式($schema 字段已移除) */
877
922
  toDefinition: () => ToolDefinition;
878
923
  }
879
924
  /**
880
925
  * 工具注册表接口(由 `ai.tools.createRegistry()` 创建)
881
926
  *
882
- * 管理一组工具的注册、查询与批量执行,支持链式调用。
927
+ * 管理一组工具的注册、查询与批量执行。注册方法返回 `HaiResult<void>`,
928
+ * 调用方应显式处理重名等配置错误。
883
929
  */
884
930
  interface ToolRegistryOperations {
885
- /** 注册工具(同名覆盖),返回 registry 自身以支持链式调用 */
886
- register: <TInput, TOutput>(tool: Tool<TInput, TOutput>) => ToolRegistryOperations;
887
- /** 批量注册工具,返回 registry 自身 */
888
- registerMany: (tools: Tool<unknown, unknown>[]) => ToolRegistryOperations;
931
+ /** 注册工具;同名工具已存在时返回 `TOOL_ALREADY_REGISTERED` */
932
+ register: <TInput, TOutput>(tool: Tool<TInput, TOutput>) => HaiResult<void>;
933
+ /** 原子批量注册;列表内或注册表内存在重名时不写入任何工具 */
934
+ registerMany: (tools: Tool<unknown, unknown>[]) => HaiResult<void>;
935
+ /** 显式替换已注册工具;目标不存在时返回 `TOOL_NOT_FOUND` */
936
+ replace: <TInput, TOutput>(tool: Tool<TInput, TOutput>) => HaiResult<void>;
889
937
  /** 注销指定名称的工具,成功返回 `true`,不存在返回 `false` */
890
938
  unregister: (name: string) => boolean;
891
939
  /** 按名称获取工具实例,不存在返回 `undefined` */
@@ -896,10 +944,10 @@ interface ToolRegistryOperations {
896
944
  getNames: () => string[];
897
945
  /** 获取所有工具的 OpenAI function calling 定义(用于传入 ChatCompletionRequest.tools) */
898
946
  getDefinitions: () => ToolDefinition[];
899
- /** 执行单个工具调用,自动解析 JSON 参数并校验;失败返回 ToolError */
900
- execute: (toolCall: ToolCall) => Promise<HaiResult<ToolMessage>>;
901
- /** 批量执行工具调用(默认并行),任一失败立即返回错误 */
902
- executeAll: (toolCalls: ToolCall[], options?: {
947
+ /** 执行单个工具调用,自动解析 JSON 参数并校验;失败返回 ToolError,超时 / 取消返回 TOOL_TIMEOUT */
948
+ execute: (toolCall: ToolCall, options?: ToolExecutionOptions) => Promise<HaiResult<ToolMessage>>;
949
+ /** 批量执行工具调用(默认串行),任一失败立即返回错误;仅显式 `parallel: true` 时并行 */
950
+ executeAll: (toolCalls: ToolCall[], options?: ToolExecutionOptions & {
903
951
  parallel?: boolean;
904
952
  }) => Promise<HaiResult<ToolMessage[]>>;
905
953
  /** 清空所有已注册的工具 */
@@ -907,12 +955,22 @@ interface ToolRegistryOperations {
907
955
  /** 当前已注册的工具数量 */
908
956
  readonly size: number;
909
957
  }
958
+ /** 工具注册表创建选项 */
959
+ interface ToolRegistryOptions {
960
+ /**
961
+ * Registry 级授权函数
962
+ *
963
+ * 适合统一执行租户、角色、资源归属和高风险操作确认。它不能替代 handler 内针对最终资源的
964
+ * 业务校验;两层校验应共同采用最小权限原则。
965
+ */
966
+ authorize?: ToolAuthorizer;
967
+ }
910
968
  /** 工具操作接口(通过 `ai.tools` 访问,纯函数,无需初始化) */
911
969
  interface ToolsOperations {
912
970
  /** 定义工具(Zod schema 类型推断 + 自动参数校验) */
913
971
  define: <TInput, TOutput>(options: DefineToolOptions<TInput, TOutput>) => Tool<TInput, TOutput>;
914
- /** 创建新的工具注册表实例 */
915
- createRegistry: () => ToolRegistryOperations;
972
+ /** 创建新的工具注册表实例,可注入统一授权函数 */
973
+ createRegistry: (options?: ToolRegistryOptions) => ToolRegistryOperations;
916
974
  }
917
975
  /** 对话记录查询选项 */
918
976
  interface ChatHistoryOptions {
@@ -1945,7 +2003,62 @@ interface MemoryUpdateInput {
1945
2003
  * const response = await ai.llm.chat({ messages: enriched.value })
1946
2004
  * ```
1947
2005
  */
1948
- interface MemoryOperations {
2006
+ /**
2007
+ * 按 ID 访问单条记忆(get / update / remove)时的归属校验作用域。
2008
+ *
2009
+ * 传入后,Provider 先读取记忆再校验:`entry.objectId` 必须等于 `objectId`,且 `entry.scope`
2010
+ * 包含 `scope` 的全部 key-value;不匹配时统一返回 `MEMORY_NOT_FOUND`(避免通过错误差异
2011
+ * 枚举其他主体的记忆)。不传时不做归属校验(向后兼容);处理不可信输入的 memoryId 时必须传入。
2012
+ */
2013
+ interface MemoryAccessScope {
2014
+ /** 归属主体 ID(必须与记忆 entry.objectId 一致) */
2015
+ objectId: string;
2016
+ /** 业务作用域(entry.scope 必须包含这些 key-value) */
2017
+ scope?: Record<string, unknown>;
2018
+ }
2019
+ /**
2020
+ * 记忆作用域绑定(`ai.memory.scoped()` 使用)
2021
+ *
2022
+ * 绑定后,所有操作自动携带 `objectId` 与 `scope`,无需每次手动传入,
2023
+ * 从根本上避免「忘记传 objectId 导致跨租户越权」的安全隐患。
2024
+ */
2025
+ interface ScopedMemoryBinding {
2026
+ /** 归属主体 ID(所有操作自动绑定) */
2027
+ objectId: string;
2028
+ /** 业务作用域(所有操作自动绑定并作为归属校验的一部分,如 `{ topicId, personaId }`) */
2029
+ scope?: Record<string, unknown>;
2030
+ }
2031
+ /**
2032
+ * 全局清空选项(`ai.memory.admin.clearAll()` 使用)
2033
+ *
2034
+ * 危险操作:清空整个记忆后端的全部数据。必须显式传入 `confirm: true`,
2035
+ * 防止误调用;普通 `clear()` 不再支持通过省略参数隐式清空全局。
2036
+ */
2037
+ interface MemoryClearAllOptions {
2038
+ /** 必须显式为 `true`,否则拒绝执行 */
2039
+ confirm: true;
2040
+ }
2041
+ /**
2042
+ * 记忆管理接口(`ai.memory.admin`)
2043
+ *
2044
+ * 承载危险的全局操作,与业务作用域操作明确分离。
2045
+ */
2046
+ interface MemoryAdminOperations {
2047
+ /**
2048
+ * 清空整个记忆后端的全部数据(跨所有主体 / 作用域)
2049
+ *
2050
+ * @param options - 必须传入 `{ confirm: true }`
2051
+ * @returns 成功返回 ok(undefined);未确认返回 MEMORY_STORE_FAILED
2052
+ */
2053
+ clearAll: (options: MemoryClearAllOptions) => Promise<HaiResult<void>>;
2054
+ }
2055
+ /**
2056
+ * 记忆核心操作(Provider 实现层)
2057
+ *
2058
+ * 各 Provider(native / mem0)实现这一组操作。公共入口 `ai.memory` 在其基础上
2059
+ * 叠加作用域绑定(`scoped`)与管理接口(`admin`),并对 `clear` 施加空过滤保护。
2060
+ */
2061
+ interface MemoryCoreOperations {
1949
2062
  /**
1950
2063
  * 从对话消息中自动提取记忆条目
1951
2064
  *
@@ -1998,25 +2111,28 @@ interface MemoryOperations {
1998
2111
  *
1999
2112
  * @param memoryId - 记忆 ID
2000
2113
  * @param updates - 需要更新的字段
2114
+ * @param accessScope - 可选归属校验(不匹配返回 MEMORY_NOT_FOUND)
2001
2115
  * @returns 更新后的完整记忆条目
2002
2116
  */
2003
- update: (memoryId: string, updates: MemoryUpdateInput) => Promise<HaiResult<MemoryEntry>>;
2117
+ update: (memoryId: string, updates: MemoryUpdateInput, accessScope?: MemoryAccessScope) => Promise<HaiResult<MemoryEntry>>;
2004
2118
  /**
2005
2119
  * 按 ID 获取单条记忆
2006
2120
  *
2007
2121
  * @param memoryId - 记忆 ID
2122
+ * @param accessScope - 可选归属校验(不匹配返回 MEMORY_NOT_FOUND)
2008
2123
  * @returns 记忆条目,不存在时返回 MEMORY_NOT_FOUND
2009
2124
  */
2010
- get: (memoryId: string) => Promise<HaiResult<MemoryEntry>>;
2125
+ get: (memoryId: string, accessScope?: MemoryAccessScope) => Promise<HaiResult<MemoryEntry>>;
2011
2126
  /**
2012
2127
  * 删除单条记忆
2013
2128
  *
2014
2129
  * 同时从 Store 中移除持久化数据。
2015
2130
  *
2016
2131
  * @param memoryId - 记忆 ID
2132
+ * @param accessScope - 可选归属校验(不匹配返回 MEMORY_NOT_FOUND)
2017
2133
  * @returns 成功返回 ok(undefined)
2018
2134
  */
2019
- remove: (memoryId: string) => Promise<HaiResult<void>>;
2135
+ remove: (memoryId: string, accessScope?: MemoryAccessScope) => Promise<HaiResult<void>>;
2020
2136
  /**
2021
2137
  * 获取记忆列表
2022
2138
  *
@@ -2040,6 +2156,54 @@ interface MemoryOperations {
2040
2156
  */
2041
2157
  clear: (options?: MemoryClearOptions) => Promise<HaiResult<void>>;
2042
2158
  }
2159
+ /**
2160
+ * 作用域绑定的记忆操作(`ai.memory.scoped()` 返回)
2161
+ *
2162
+ * 所有操作自动携带绑定的 `objectId` 与 `scope`,无需重复传入;`get` / `update` / `remove`
2163
+ * 自动施加归属校验(跨租户访问返回 `MEMORY_NOT_FOUND`);`clear` 仅清空绑定作用域内的记忆,
2164
+ * 永远不会误清全局。
2165
+ */
2166
+ interface ScopedMemoryOperations {
2167
+ /** 从对话中提取记忆(自动绑定 objectId / scope) */
2168
+ extract: (messages: ChatMessage[], options?: Omit<MemoryExtractOptions, 'objectId' | 'scope'>) => Promise<HaiResult<MemoryEntry[]>>;
2169
+ /** 检索相关记忆(自动绑定 objectId / scope) */
2170
+ recall: (query: string, options?: Omit<MemoryRecallOptions, 'objectId' | 'scope'>) => Promise<HaiResult<MemoryEntry[]>>;
2171
+ /** 注入相关记忆(自动绑定 objectId / scope) */
2172
+ injectMemories: (messages: ChatMessage[], options?: Omit<MemoryInjectionOptions, 'objectId' | 'scope'>) => Promise<HaiResult<ChatMessage[]>>;
2173
+ /** 添加记忆(自动绑定 objectId / scope) */
2174
+ add: (entry: Omit<MemoryEntryInput, 'objectId' | 'scope'>) => Promise<HaiResult<MemoryEntry>>;
2175
+ /** 更新记忆(自动施加归属校验) */
2176
+ update: (memoryId: string, updates: MemoryUpdateInput) => Promise<HaiResult<MemoryEntry>>;
2177
+ /** 按 ID 获取记忆(自动施加归属校验) */
2178
+ get: (memoryId: string) => Promise<HaiResult<MemoryEntry>>;
2179
+ /** 删除记忆(自动施加归属校验) */
2180
+ remove: (memoryId: string) => Promise<HaiResult<void>>;
2181
+ /** 列出记忆(自动绑定 objectId / scope) */
2182
+ list: (options?: Omit<MemoryListOptions, 'objectId' | 'scope'>) => Promise<HaiResult<MemoryEntry[]>>;
2183
+ /** 分页列出记忆(自动绑定 objectId / scope) */
2184
+ listPage: (options?: Omit<MemoryListPageOptions, 'objectId' | 'scope'>) => Promise<HaiResult<StorePage<MemoryEntry>>>;
2185
+ /** 清空绑定作用域内的记忆(自动绑定 objectId / scope,不会误清全局) */
2186
+ clear: (options?: Omit<MemoryClearOptions, 'objectId' | 'scope'>) => Promise<HaiResult<void>>;
2187
+ }
2188
+ /**
2189
+ * 公共记忆操作接口(通过 `ai.memory` 访问)
2190
+ *
2191
+ * 在核心操作基础上增加:
2192
+ * - `scoped(binding)`:返回自动绑定 objectId / scope 的安全实例(多租户推荐入口);
2193
+ * - `admin`:承载危险的全局操作(如 `clearAll`);
2194
+ * - `clear`:拒绝空过滤调用(无 objectId / types / scope 时返回错误),防止误清全局。
2195
+ */
2196
+ interface MemoryOperations extends MemoryCoreOperations {
2197
+ /**
2198
+ * 创建绑定作用域的记忆实例
2199
+ *
2200
+ * @param binding - 作用域绑定(objectId + 可选 scope)
2201
+ * @returns 所有操作自动携带该作用域的记忆实例
2202
+ */
2203
+ scoped: (binding: ScopedMemoryBinding) => ScopedMemoryOperations;
2204
+ /** 管理接口(危险的全局操作,需显式确认) */
2205
+ admin: MemoryAdminOperations;
2206
+ }
2043
2207
 
2044
2208
  /**
2045
2209
  * @h-ai/ai — 错误码 + 配置 Schema
@@ -2403,6 +2567,7 @@ declare const MemoryConfigSchema: z.ZodObject<{
2403
2567
  native: "native";
2404
2568
  mem0: "mem0";
2405
2569
  }>>;
2570
+ allowEphemeralFallback: z.ZodDefault<z.ZodBoolean>;
2406
2571
  maxEntriesPerObject: z.ZodDefault<z.ZodNumber>;
2407
2572
  maxEntriesGlobal: z.ZodDefault<z.ZodNumber>;
2408
2573
  systemPrompt: z.ZodOptional<z.ZodString>;
@@ -2607,7 +2772,7 @@ type AudioProviderName = z.infer<typeof AudioProviderSchema>;
2607
2772
  *
2608
2773
  * @example
2609
2774
  * ```ts
2610
- * const model = { id: 'asr', provider: 'qwen', model: 'qwen3-asr-flash-realtime' }
2775
+ * const model = { id: 'asr', provider: 'qwen', model: 'qwen3-asr-flash-realtime', operations: ['transcribe'] }
2611
2776
  * ```
2612
2777
  */
2613
2778
  declare const AudioModelEntrySchema: z.ZodObject<{
@@ -2619,6 +2784,7 @@ declare const AudioModelEntrySchema: z.ZodObject<{
2619
2784
  doubao: "doubao";
2620
2785
  }>;
2621
2786
  model: z.ZodString;
2787
+ 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
2788
  apiKey: z.ZodOptional<z.ZodString>;
2623
2789
  baseUrl: z.ZodOptional<z.ZodString>;
2624
2790
  appKey: z.ZodOptional<z.ZodString>;
@@ -2639,8 +2805,8 @@ type AudioModelEntry = z.infer<typeof AudioModelEntrySchema>;
2639
2805
  * ai.init({
2640
2806
  * audio: {
2641
2807
  * models: [
2642
- * { id: 'asr', provider: 'qwen', model: 'qwen3-asr-flash-realtime' },
2643
- * { id: 'tts', provider: 'qwen', model: 'qwen3-tts-flash-realtime' },
2808
+ * { id: 'asr', provider: 'qwen', model: 'qwen3-asr-flash-realtime', operations: ['transcribe'] },
2809
+ * { id: 'tts', provider: 'qwen', model: 'qwen3-tts-flash-realtime', operations: ['synthesize'] },
2644
2810
  * ],
2645
2811
  * transcribeModel: 'asr',
2646
2812
  * synthesizeModel: 'tts',
@@ -2658,6 +2824,7 @@ declare const AudioConfigSchema: z.ZodObject<{
2658
2824
  doubao: "doubao";
2659
2825
  }>;
2660
2826
  model: z.ZodString;
2827
+ 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
2828
  apiKey: z.ZodOptional<z.ZodString>;
2662
2829
  baseUrl: z.ZodOptional<z.ZodString>;
2663
2830
  appKey: z.ZodOptional<z.ZodString>;
@@ -2851,6 +3018,7 @@ declare const AIConfigSchema: z.ZodObject<{
2851
3018
  native: "native";
2852
3019
  mem0: "mem0";
2853
3020
  }>>;
3021
+ allowEphemeralFallback: z.ZodDefault<z.ZodBoolean>;
2854
3022
  maxEntriesPerObject: z.ZodDefault<z.ZodNumber>;
2855
3023
  maxEntriesGlobal: z.ZodDefault<z.ZodNumber>;
2856
3024
  systemPrompt: z.ZodOptional<z.ZodString>;
@@ -2922,6 +3090,7 @@ declare const AIConfigSchema: z.ZodObject<{
2922
3090
  doubao: "doubao";
2923
3091
  }>;
2924
3092
  model: z.ZodString;
3093
+ 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
3094
  apiKey: z.ZodOptional<z.ZodString>;
2926
3095
  baseUrl: z.ZodOptional<z.ZodString>;
2927
3096
  appKey: z.ZodOptional<z.ZodString>;
@@ -3032,9 +3201,10 @@ interface TranscriptionResult {
3032
3201
  /**
3033
3202
  * 流式语音识别领域事件
3034
3203
  *
3035
- * 统一的语音领域事件(非厂商协议)。支持服务端 VAD 的平台(Qwen / 豆包)会在检测到语音
3036
- * 起止时额外产出 `speech_started` / `speech_stopped`,使调用方可在「开始说话」的瞬间做出反应
3037
- * (如取消当前上游生成),而无需自行运行 VAD;不支持 VAD 的平台仅产出 `transcript`。
3204
+ * 统一的语音领域事件(非厂商协议)。支持服务端 VAD 的平台(如 Qwen 实时识别)会在检测到
3205
+ * 语音起止时额外产出 `speech_started` / `speech_stopped`,使调用方可在「开始说话」的瞬间做出
3206
+ * 反应(如取消当前上游生成),而无需自行运行 VAD;不产出 VAD 事件的平台(如豆包)仅产出
3207
+ * `transcript`,此时是否需要 VAD 由调用方自行决定。
3038
3208
  *
3039
3209
  * `transcript.text` 表示当前语句的完整识别文本(非字符增量),实时 ASR 会修订前一次临时结果,
3040
3210
  * 调用方可直接用 `text` 覆盖当前临时文本。
@@ -3069,10 +3239,17 @@ interface SynthesisRequest {
3069
3239
  /** 取消信号 */
3070
3240
  signal?: AbortSignal;
3071
3241
  }
3072
- /** 流式语音合成请求(支持完整文本或持续文本输入) */
3242
+ /** 带稳定 ID 的合成文本段 */
3243
+ interface SynthesisTextSegment {
3244
+ /** 调用方分配的稳定 ID,用于关联文本、音频与播放完成状态 */
3245
+ id: string;
3246
+ /** 本段待合成文本 */
3247
+ text: string;
3248
+ }
3249
+ /** 流式语音合成请求(支持单段或持续文本段输入) */
3073
3250
  interface SynthesisStreamRequest {
3074
- /** 完整文本,或持续到达的文本流(可直接连接 LLM 文本流实现边生成边合成) */
3075
- text: string | AsyncIterable<string>;
3251
+ /** 单个文本段,或持续到达的文本段流 */
3252
+ text: SynthesisTextSegment | AsyncIterable<SynthesisTextSegment>;
3076
3253
  /** 音色(厂商音色名,不传时使用模型默认音色) */
3077
3254
  voice?: string;
3078
3255
  /**
@@ -3093,6 +3270,60 @@ interface SynthesisStreamRequest {
3093
3270
  /** 完整语音合成结果 */
3094
3271
  interface SynthesisResult extends AudioContent {
3095
3272
  }
3273
+ /**
3274
+ * 流式语音合成领域事件
3275
+ *
3276
+ * 每个文本段严格按 `segment_started → audio* → segment_done` 顺序产出,调用方可在
3277
+ * 对应音频真正播放完成后提交该段文本,不需要按字节数反推文本边界。
3278
+ *
3279
+ * `segment_started` 携带服务端解析 Provider 后的**真实输出音频参数**(format / sampleRate / channels),
3280
+ * 调用方据此正确解码、设置 PCM 播放参数、选择保存扩展名,而非根据请求参数猜测。
3281
+ */
3282
+ type SynthesisEvent = {
3283
+ type: 'segment_started';
3284
+ segmentId: string;
3285
+ text: string;
3286
+ format: AudioFormat;
3287
+ sampleRate?: number;
3288
+ channels?: 1 | 2;
3289
+ } | {
3290
+ type: 'audio';
3291
+ segmentId: string;
3292
+ data: Uint8Array;
3293
+ } | {
3294
+ type: 'segment_done';
3295
+ segmentId: string;
3296
+ };
3297
+ /**
3298
+ * 语音模型的实时能力声明
3299
+ *
3300
+ * 由 `ai.audio.getCapabilities({ operation, model })` 返回,供实时会话在启动前校验:不同平台对「持续音频输入 /
3301
+ * 服务端 VAD / 增量文本输入 / 流式输出」的原生支持不同,同一方法签名在不同平台下的实时语义并不一致。
3302
+ * 调用方应据此选择模型或调整策略(如实时 ASR 要求 `realtimeAudioInput` 与 `speechBoundaryEvents`,
3303
+ * 实时 TTS 要求 `streamingAudioOutput`)。
3304
+ */
3305
+ interface AudioModelCapabilities {
3306
+ /** 语音识别能力;模型未声明识别操作时不返回 */
3307
+ transcribe?: {
3308
+ supported: boolean;
3309
+ realtimeAudioInput: boolean;
3310
+ speechBoundaryEvents: boolean;
3311
+ streamingTranscriptOutput: boolean;
3312
+ };
3313
+ /** 语音合成能力;模型未声明合成操作时不返回 */
3314
+ synthesize?: {
3315
+ supported: boolean;
3316
+ incrementalTextInput: boolean;
3317
+ streamingAudioOutput: boolean;
3318
+ };
3319
+ }
3320
+ /** 查询语音模型能力的参数 */
3321
+ interface AudioCapabilitiesRequest {
3322
+ /** 要查询的操作,决定默认模型和返回的能力分支 */
3323
+ operation: 'transcribe' | 'synthesize';
3324
+ /** 模型 ID;不传时使用该操作配置的默认模型 */
3325
+ model?: string;
3326
+ }
3096
3327
  /**
3097
3328
  * Audio 操作接口(通过 `ai.audio` 访问)
3098
3329
  *
@@ -3106,8 +3337,15 @@ interface AudioOperations {
3106
3337
  transcribeStream: (request: TranscriptionStreamRequest) => AsyncIterable<TranscriptionEvent>;
3107
3338
  /** 将完整文本合成为完整音频 */
3108
3339
  synthesize: (request: SynthesisRequest) => Promise<HaiResult<SynthesisResult>>;
3109
- /** 持续输入文本或增量输出音频 */
3110
- synthesizeStream: (request: SynthesisStreamRequest) => AsyncIterable<Uint8Array>;
3340
+ /** 持续输入文本段并按段输出结构化音频事件 */
3341
+ synthesizeStream: (request: SynthesisStreamRequest) => AsyncIterable<SynthesisEvent>;
3342
+ /**
3343
+ * 查询指定模型的实时能力声明
3344
+ *
3345
+ * @param request - 操作类型与可选模型 ID
3346
+ * @returns 该模型对应操作的能力;模型不存在或操作不匹配时返回失败结果
3347
+ */
3348
+ getCapabilities: (request: AudioCapabilitiesRequest) => HaiResult<AudioModelCapabilities>;
3111
3349
  }
3112
3350
 
3113
3351
  /**
@@ -3403,4 +3641,4 @@ interface ReasoningOperations {
3403
3641
  runStream: (query: string, options?: ReasoningOptions) => AsyncIterable<ReasoningStreamEvent>;
3404
3642
  }
3405
3643
 
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 };
3644
+ 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 ChatCompletionChoice as aA, type ChatCompletionChunk as aB, type ChatCompletionDelta as aC, type ChatCompletionRequest as aD, type ChatCompletionResponse as aE, type ChatHistoryOptions as aF, type ChatMessage as aG, type ChatRecord as aH, type Citation as aI, type DefineToolOptions as aJ, type DeveloperMessage as aK, type EntityDocumentRelation as aL, type EntityDocumentResult as aM, type EntityListOptions as aN, type EntityQueryOptions as aO, type GenerateObjectRequest as aP, type ImageContent 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 InteractionScope as af, type A2AAgentCardConfig as ag, type A2AApiKeySecurity as ah, type A2AAuthenticator as ai, type A2ACallOptions as aj, type A2ACallResult as ak, type A2ACallerIdentity as al, type A2AContextInfo as am, type A2AHandleResult as an, type A2AMessageRecord as ao, type A2AOperations as ap, type A2ASecurityConfig as aq, type A2ATaskFilter as ar, type AILLMFunctionsDeps as as, type AIRelStore as at, type AIRelStoreOptions as au, type AIStoreProvider as av, type AIVectorBackend as aw, type AIVectorStore as ax, type AskOptions as ay, type AssistantMessage as az, A2ASkillConfigSchema as b, type ToolExecutionContext 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 MemoryAdminOperations as b9, type ReasoningStreamEvent as bA, type RetrievalOperations as bB, type RetrievalRequest as bC, type RetrievalResult as bD, type RetrievalResultItem as bE, type RetrievalSource as bF, type SSEDecoder as bG, type SSEEvent as bH, type ScopedMemoryBinding as bI, type ScopedMemoryOperations as bJ, type SessionInfo as bK, type StoreFilter as bL, type StorePage as bM, type StoreScope as bN, type StreamOperations as bO, type StreamProcessor as bP, type StreamResult as bQ, type SystemMessage as bR, type TempModelConfig as bS, type TextContent as bT, type TokenUsage as bU, type Tool as bV, type ToolAuthorizationRequest as bW, type ToolAuthorizer as bX, type ToolCall as bY, type ToolDefinition as bZ, type ToolErrorType as b_, type MemoryClearAllOptions as ba, type MemoryClearOptions as bb, type MemoryCoreOperations as bc, type MemoryEntry as bd, type MemoryEntryInput as be, type MemoryExtractOptions as bf, type MemoryInjectionOptions as bg, type MemoryListOptions as bh, type MemoryListPageOptions as bi, type MemoryOperations as bj, type MemoryRecallOptions as bk, type MemoryUpdateInput as bl, type MessageContent as bm, type MessageRole as bn, type ObjectRef as bo, type RagContextItem as bp, type RagOperations as bq, type RagOptions as br, type RagResult as bs, type RagStreamEvent as bt, type ReasoningOperations as bu, type ReasoningOptions as bv, type ReasoningResult as bw, type ReasoningStep as bx, type ReasoningStepType as by, type ReasoningStrategy as bz, type AIConfig as c, type ToolExecutionOptions as c0, type ToolMessage as c1, type ToolRegistryOperations as c2, type ToolRegistryOptions as c3, type ToolsOperations as c4, type UserMessage as c5, type WhereClause as c6, type WhereOperator as c7, type WhereValue as c8, 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,9 +1,10 @@
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';
3
- export { A2AClientOperations, AIApiAdapter, AIClient, AIClientConfig, AudioClientConfig, AudioClientOperations, StreamOptions, StreamProgress, collectStreamContent, createA2AClient, createAIClient, createAudioClient, createUnconfiguredAudioClient, parseSSE } from './client/index.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-CslaY4xX.js';
2
+ export { A as AIFunctions, a as AIInitOptions, b as AUDIO_WS_PATH, c as AudioFormatSchema, d as AudioWsClientMessage, e as AudioWsClientMessageSchema, f as AudioWsDoneMessage, g as AudioWsDoneMessageSchema, h as AudioWsEndMessage, i as AudioWsErrorMessage, j as AudioWsSegmentDoneMessage, k as AudioWsSegmentStartedMessage, l as AudioWsServerMessage, m as AudioWsSpeechMessage, n as AudioWsStartMessage, o as AudioWsStartMessageSchema, p as AudioWsTextMessage, q as AudioWsTextMessageSchema, r as AudioWsTranscriptMessage, C as CompressionStrategy, s as CompressionStrategySchema, H as HaiAIError } from './ai-audio-ws-protocol-BK5753o1.js';
3
+ export { A2AClientOperations, AIApiAdapter, AIClient, AIClientConfig, AudioClientConfig, AudioClientOperations, AudioTicketRequest, 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';
6
6
  import '@h-ai/datapipe';
7
7
  import 'zod';
8
8
  import 'openai';
9
9
  import 'node:buffer';
10
+ import 'zod/v4/core';
package/dist/browser.js CHANGED
@@ -1,4 +1,5 @@
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, AudioFormatSchema, AudioModelEntrySchema, AudioProviderSchema, AudioWsClientMessageSchema, AudioWsDoneMessageSchema, AudioWsStartMessageSchema, AudioWsTextMessageSchema, CompressConfigSchema, CompressionStrategySchema, EmbeddingConfigSchema, EntityTypeSchema, FileConfigSchema, KnowledgeConfigSchema, LLMConfigSchema, MCPConfigSchema, MCPServerCapabilitiesSchema, MCPServerConfigSchema, MemoryConfigSchema, MemoryTypeSchema, ModelEntrySchema, ModelScenarioSchema, RetrievalConfigSchema, RetrievalSourceSchema, SummaryConfigSchema, TokenConfigSchema, resolveAudioModel, resolveModelApi, resolveModelEntry } from './chunk-5XL4QDIJ.js';
2
+ export { collectStreamContent, createA2AClient, createAIClient, createAudioClient, createUnconfiguredAudioClient, parseSSE } from './chunk-ELH2IPOE.js';
3
+ export { HaiAIError } from './chunk-P3GND76X.js';
3
4
  //# sourceMappingURL=browser.js.map
4
5
  //# sourceMappingURL=browser.js.map