@h-ai/ai 1.0.0-beta.34 → 1.0.0-beta.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.
@@ -1,17 +1,23 @@
1
+ import { McpServer as McpServer$2 } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { SSEServerTransport as SSEServerTransport$1 } from '@modelcontextprotocol/sdk/server/sse.js';
3
+ import { StdioServerTransport as StdioServerTransport$1 } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { StreamableHTTPServerTransport as StreamableHTTPServerTransport$1 } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
5
+ import * as _a2a_js_sdk_server from '@a2a-js/sdk/server';
6
+ import { AgentExecutor, AgentEvent } from '@a2a-js/sdk/server';
7
+ import * as _a2a_js_sdk from '@a2a-js/sdk';
8
+ import { TaskState, Message as Message$1, Part as Part$1, SendMessageRequest as SendMessageRequest$1, Task as Task$1, TaskArtifactUpdateEvent as TaskArtifactUpdateEvent$1, TaskStatus as TaskStatus$1, TaskStatusUpdateEvent as TaskStatusUpdateEvent$1 } from '@a2a-js/sdk';
1
9
  import * as _h_ai_core from '@h-ai/core';
2
10
  import { HaiResult, HaiError } from '@h-ai/core';
11
+ import { a as AudioContent, P as PlayableAudio, e as AudioOperations, b as AudioFormat } from './ai-audio-types-C4n15IHq.js';
3
12
  import * as _h_ai_runner from '@h-ai/runner';
4
13
  import { RunnerJson, RunnerScope, RunnerFunctions } from '@h-ai/runner';
5
- import { TaskState } from '@a2a-js/sdk';
6
- import { AgentExecutor } from '@a2a-js/sdk/server';
7
14
  import * as zod from 'zod';
8
15
  import { z, ZodType } from 'zod';
9
- import { F as FileOperations } from './ai-file-types-BN7l67hR.js';
16
+ import { F as FileOperations } from './ai-file-types-BMfnQU4W.js';
10
17
  import { CleanOptionsInput, ChunkOptionsInput } from '@h-ai/datapipe';
11
- import { e as AudioOperations, a as AudioContent, P as PlayableAudio, b as AudioFormat } from './ai-audio-types-4R5yUAVl.js';
12
18
  import * as zod_v4_core from 'zod/v4/core';
13
19
  import * as _agentclientprotocol_sdk from '@agentclientprotocol/sdk';
14
- import { McpServer, ContentBlock, RequestPermissionRequest, SessionNotification, ClientRequestHandlersByMethod, ClientCapabilities } from '@agentclientprotocol/sdk';
20
+ import { McpServer as McpServer$1, ContentBlock, RequestPermissionRequest, SessionNotification, ClientRequestHandlersByMethod, ClientCapabilities } from '@agentclientprotocol/sdk';
15
21
  import { ToolDefinition as ToolDefinition$1, ToolRegistryOperations as ToolRegistryOperations$1, ToolExecutionOptions } from '@h-ai/tools';
16
22
  import OpenAI from 'openai';
17
23
  import { ToolServiceContext, ToolSet, ToolArtifactAccess, ToolSubmitRequest, ToolService, ToolArtifact, ToolArtifactReference } from '@h-ai/tools/server';
@@ -1382,7 +1388,7 @@ interface AIVectorBackend {
1382
1388
  *
1383
1389
  * @example
1384
1390
  * ```ts
1385
- * import { ai, type AIStoreProvider, type AIConfigInput } from '@h-ai/ai'
1391
+ * import { type AIStoreProvider, type AIConfigInput, ai } from '@h-ai/ai'
1386
1392
  * // provider 的 shared 声明必须由真实共享后端支撑;AI 关闭时调用其 close。
1387
1393
  * async function start(config: AIConfigInput, provider: AIStoreProvider) {
1388
1394
  * const result = await ai.init(config, { storeProvider: provider })
@@ -1435,7 +1441,7 @@ interface AIStoreProvider {
1435
1441
  *
1436
1442
  * @example
1437
1443
  * ```ts
1438
- * import { ai, type MCPToolDefinition } from '@h-ai/ai'
1444
+ * import { type MCPToolDefinition, ai } from '@h-ai/ai'
1439
1445
  * // 应用启动已成功初始化 ai;echo 为无外部副作用的示例工具。
1440
1446
  * const definition: MCPToolDefinition = { name: 'echo', description: '返回输入', inputSchema: { type: 'object', properties: { text: { type: 'string' } }, required: ['text'], additionalProperties: false } }
1441
1447
  * const registered = ai.mcp.registerTool(definition, (input: { text: string }) => ({ text: input.text }))
@@ -1586,9 +1592,9 @@ type MCPPromptContent = PromptMessage['content'];
1586
1592
  *
1587
1593
  * @example
1588
1594
  * ```ts
1589
- * import { createMcpServer, type McpServerOptions } from '@h-ai/ai'
1595
+ * import { type McpServerOptions, ai } from '@h-ai/ai'
1590
1596
  * const options: McpServerOptions = { name: 'public-tools', version: '1.0.0' }
1591
- * const server = createMcpServer(options)
1597
+ * const server = ai.createMcpServer(options)
1592
1598
  * // 应用停止接入请求后关闭 SDK server。
1593
1599
  * await server.close()
1594
1600
  * ```
@@ -1606,7 +1612,7 @@ interface McpServerOptions {
1606
1612
  *
1607
1613
  * @example
1608
1614
  * ```ts
1609
- * import { ai, type MCPOperations } from '@h-ai/ai'
1615
+ * import { type MCPOperations, ai } from '@h-ai/ai'
1610
1616
  * // 应用启动已成功初始化 ai。
1611
1617
  * const mcp: MCPOperations = ai.mcp
1612
1618
  * const registered = mcp.registerTool({ name: 'echo', description: '返回输入', inputSchema: { type: 'string' } }, (input: string) => input)
@@ -1687,9 +1693,9 @@ interface MCPJobFileContext {
1687
1693
  * 应用提供对象 ACL 与存储接入。文件内容只在作业节点暂存,队列仅保存对象 ID。
1688
1694
  * @example
1689
1695
  * ```ts
1690
- * import { err, type HaiResult } from '@h-ai/core'
1696
+ * import { type HaiResult, core } from '@h-ai/core'
1691
1697
  * import { HaiAIError, type MCPJobFiles } from '@h-ai/ai'
1692
- * function denied<T>(): HaiResult<T> { return err(HaiAIError.MCP_TOOL_FORBIDDEN, 'File is not authorized') }
1698
+ * function denied<T>(): HaiResult<T> { return core.err(HaiAIError.MCP_TOOL_FORBIDDEN, 'File is not authorized') }
1693
1699
  * const files: MCPJobFiles = { read: async () => denied(), publish: async () => denied() }
1694
1700
  * ```
1695
1701
  */
@@ -1713,7 +1719,7 @@ interface MCPJobFiles {
1713
1719
  * 通过现有合并目录调用受控的第三方 Streamable HTTP 工具。
1714
1720
  * @example
1715
1721
  * ```ts
1716
- * import { ai, type MCPServiceAuthorization } from '@h-ai/ai'
1722
+ * import { type MCPServiceAuthorization, ai } from '@h-ai/ai'
1717
1723
  * async function search(context: MCPServiceAuthorization) {
1718
1724
  * const result = await ai.mcp.services.invoke({ serviceId: 'docs', tool: 'search', arguments: { query: 'manual' } }, context)
1719
1725
  * if (!result.success) return result
@@ -1783,7 +1789,7 @@ interface MCPServiceBindingRequest {
1783
1789
  */
1784
1790
  interface MCPServiceBinding {
1785
1791
  /** 仅传给当前 Agent,含短期 Bearer。 */
1786
- servers: Array<Extract<McpServer, {
1792
+ servers: Array<Extract<McpServer$1, {
1787
1793
  type: 'http';
1788
1794
  }>>;
1789
1795
  revoke: () => void;
@@ -2289,6 +2295,33 @@ interface SSEDecoder {
2289
2295
  /** 清空所有缓冲区及连接级元数据;不会派发残余的不完整事件。 */
2290
2296
  reset: () => void;
2291
2297
  }
2298
+ /**
2299
+ * 流式 JSON 文本预览的字符上限,均以 UTF-16 单元计。
2300
+ * @example
2301
+ * ```ts
2302
+ * import type { JsonFieldPreviewOptions } from '@h-ai/ai'
2303
+ * const options: JsonFieldPreviewOptions = { maxLength: 1000, maxInputLength: 20000 }
2304
+ * ```
2305
+ */
2306
+ interface JsonFieldPreviewOptions {
2307
+ /** 预览字段的上限,默认 12000。 */
2308
+ maxLength?: number;
2309
+ /** 累计输入的上限,默认 1000000。 */
2310
+ maxInputLength?: number;
2311
+ }
2312
+ /**
2313
+ * 针对一次模型回复的预览器。只预览指定的顶层字符串字段,最终结果仍需校验完整 JSON。
2314
+ * @example
2315
+ * ```ts
2316
+ * import { ai } from '@h-ai/ai'
2317
+ * const preview = ai.stream.createJsonFieldPreview('text')
2318
+ * const prefix = preview.push('{"text":"已记录')
2319
+ * ```
2320
+ */
2321
+ interface JsonFieldPreview {
2322
+ /** 输入下一段 JSON。返回累计前缀,未变时返回 undefined。累计输入超限时抛出 RangeError。 */
2323
+ push: (fragment: string) => string | undefined;
2324
+ }
2292
2325
  /**
2293
2326
  * 流处理操作接口(通过 `ai.stream` 访问,纯函数,无需初始化)
2294
2327
  *
@@ -2302,6 +2335,8 @@ interface SSEDecoder {
2302
2335
  * ```
2303
2336
  */
2304
2337
  interface StreamOperations {
2338
+ /** 创建顶层字符串字段的增量预览器。字段名或上限无效时抛出 RangeError。 */
2339
+ createJsonFieldPreview: (field: string, options?: JsonFieldPreviewOptions) => JsonFieldPreview;
2305
2340
  /** 创建新的流处理器实例 */
2306
2341
  createProcessor: () => StreamProcessor;
2307
2342
  /** 完整消费流并返回累积结果 */
@@ -2478,6 +2513,13 @@ interface GenerateObjectRequest<T> {
2478
2513
  responseFormat?: 'json_schema' | 'json_object';
2479
2514
  /** 解析失败时的修复重试次数(默认 1) */
2480
2515
  maxRepairs?: number;
2516
+ /** 单次生成的最大输出 token 数。 */
2517
+ maxTokens?: number;
2518
+ /** 选用流式调用,预览只包含指定顶层字段。失败尝试的内容经空串清除。 */
2519
+ preview?: JsonFieldPreviewOptions & {
2520
+ field: string;
2521
+ onPrefix: (text: string) => void | Promise<void>;
2522
+ };
2481
2523
  /** 取消信号 */
2482
2524
  signal?: AbortSignal;
2483
2525
  }
@@ -2579,7 +2621,7 @@ type CompressionStrategy = z.infer<typeof CompressionStrategySchema>;
2579
2621
  *
2580
2622
  * @example
2581
2623
  * ```ts
2582
- * import { ai, type CompressOptions } from '@h-ai/ai'
2624
+ * import { type CompressOptions, ai } from '@h-ai/ai'
2583
2625
  * // 应用启动已成功初始化 ai。
2584
2626
  * async function run(options: CompressOptions) {
2585
2627
  * const result = await ai.compress.tryCompress([{ role: 'user', content: '你好' }], options)
@@ -2632,7 +2674,7 @@ interface CompressResult {
2632
2674
  *
2633
2675
  * @example
2634
2676
  * ```ts
2635
- * import { ai, type CompressOperations } from '@h-ai/ai'
2677
+ * import { type CompressOperations, ai } from '@h-ai/ai'
2636
2678
  * // 应用启动已成功初始化 ai。
2637
2679
  * const operations: CompressOperations = ai.compress
2638
2680
  * const result = await operations.tryCompress([{ role: 'user', content: '你好' }], { strategy: 'sliding-window', maxTokens: 100 })
@@ -2693,7 +2735,7 @@ interface Citation {
2693
2735
  *
2694
2736
  * @example
2695
2737
  * ```ts
2696
- * import { ai, type RetrievalSource } from '@h-ai/ai'
2738
+ * import { type RetrievalSource, ai } from '@h-ai/ai'
2697
2739
  * // 应用启动已成功初始化 ai,且目标知识集合已 setup。
2698
2740
  * async function run(options: RetrievalSource) {
2699
2741
  * const result = await ai.retrieval.addSource(options)
@@ -2723,7 +2765,7 @@ interface RetrievalSource {
2723
2765
  *
2724
2766
  * @example
2725
2767
  * ```ts
2726
- * import { ai, type RetrievalRequest } from '@h-ai/ai'
2768
+ * import { type RetrievalRequest, ai } from '@h-ai/ai'
2727
2769
  * // 应用启动已成功初始化 ai,且目标知识集合已 setup。
2728
2770
  * async function run(options: RetrievalRequest) {
2729
2771
  * const result = await ai.retrieval.retrieve(options)
@@ -2793,7 +2835,7 @@ interface RetrievalResult {
2793
2835
  *
2794
2836
  * @example
2795
2837
  * ```ts
2796
- * import { ai, type RetrievalOperations } from '@h-ai/ai'
2838
+ * import { type RetrievalOperations, ai } from '@h-ai/ai'
2797
2839
  * // 应用启动已成功初始化 ai,docs 为已注册检索源。
2798
2840
  * const operations: RetrievalOperations = ai.retrieval
2799
2841
  * const result = await operations.retrieve({ query: '部署要求', sources: ['docs'], topK: 3 })
@@ -2929,7 +2971,7 @@ interface EntityDocumentRelation {
2929
2971
  *
2930
2972
  * @example
2931
2973
  * ```ts
2932
- * import { ai, type KnowledgeSetupOptions } from '@h-ai/ai'
2974
+ * import { type KnowledgeSetupOptions, ai } from '@h-ai/ai'
2933
2975
  * // 应用启动已成功初始化 ai,且目标知识集合已 setup。
2934
2976
  * async function run(options: KnowledgeSetupOptions) {
2935
2977
  * const result = await ai.knowledge.setup(options)
@@ -2949,7 +2991,7 @@ interface KnowledgeSetupOptions {
2949
2991
  *
2950
2992
  * @example
2951
2993
  * ```ts
2952
- * import { ai, type KnowledgeIngestInput } from '@h-ai/ai'
2994
+ * import { type KnowledgeIngestInput, ai } from '@h-ai/ai'
2953
2995
  * // 应用启动已成功初始化 ai,且目标知识集合已 setup。
2954
2996
  * async function run(options: KnowledgeIngestInput) {
2955
2997
  * const result = await ai.knowledge.ingest(options)
@@ -2976,8 +3018,8 @@ interface KnowledgeIngestInput {
2976
3018
  /**
2977
3019
  * 文本清洗选项(可选,覆盖全局配置默认值)
2978
3020
  *
2979
- * 字段含义与 @h-ai/datapipe CleanOptionsInput 完全一致,
2980
- * 支持 removeHtml、removeUrls、normalizeWhitespace、customReplacements 等。
3021
+ * 字段含义与 @h-ai/datapipe CleanOptionsInput 一致。
3022
+ * 知识库默认关闭 normalizeWhitespace 和 trim,调用时可以显式开启。
2981
3023
  */
2982
3024
  cleanOptions?: CleanOptionsInput;
2983
3025
  /**
@@ -3026,7 +3068,7 @@ interface KnowledgeIngestResult {
3026
3068
  *
3027
3069
  * @example
3028
3070
  * ```ts
3029
- * import { ai, type KnowledgeRepairOptions } from '@h-ai/ai'
3071
+ * import { type KnowledgeRepairOptions, ai } from '@h-ai/ai'
3030
3072
  * // 应用启动已成功初始化 ai,且目标知识集合已 setup。
3031
3073
  * async function run(options: KnowledgeRepairOptions) {
3032
3074
  * const result = await ai.knowledge.repair(options)
@@ -3064,7 +3106,7 @@ interface KnowledgeRepairResult {
3064
3106
  *
3065
3107
  * @example
3066
3108
  * ```ts
3067
- * import { ai, type KnowledgeRetrieveOptions } from '@h-ai/ai'
3109
+ * import { type KnowledgeRetrieveOptions, ai } from '@h-ai/ai'
3068
3110
  * // 应用启动已成功初始化 ai,且目标知识集合已 setup。
3069
3111
  * async function run(options: KnowledgeRetrieveOptions) {
3070
3112
  * const result = await ai.knowledge.retrieve('部署要求', options)
@@ -3137,7 +3179,7 @@ interface KnowledgeRetrieveResult {
3137
3179
  *
3138
3180
  * @example
3139
3181
  * ```ts
3140
- * import { ai, type KnowledgeAskOptions } from '@h-ai/ai'
3182
+ * import { type KnowledgeAskOptions, ai } from '@h-ai/ai'
3141
3183
  * // 应用启动已成功初始化 ai,且目标知识集合已 setup。
3142
3184
  * async function run(options: KnowledgeAskOptions) {
3143
3185
  * const result = await ai.knowledge.ask('如何部署?', options)
@@ -3189,7 +3231,7 @@ interface KnowledgeAskResult {
3189
3231
  *
3190
3232
  * @example
3191
3233
  * ```ts
3192
- * import { ai, type EntityQueryOptions } from '@h-ai/ai'
3234
+ * import { type EntityQueryOptions, ai } from '@h-ai/ai'
3193
3235
  * // 应用启动已成功初始化 ai,且目标知识集合已 setup。
3194
3236
  * async function run(options: EntityQueryOptions) {
3195
3237
  * const result = await ai.knowledge.findByEntity('HAI', options)
@@ -3231,7 +3273,7 @@ interface EntityDocumentResult {
3231
3273
  *
3232
3274
  * @example
3233
3275
  * ```ts
3234
- * import { ai, type EntityListOptions } from '@h-ai/ai'
3276
+ * import { type EntityListOptions, ai } from '@h-ai/ai'
3235
3277
  * // 应用启动已成功初始化 ai,且目标知识集合已 setup。
3236
3278
  * async function run(options: EntityListOptions) {
3237
3279
  * const result = await ai.knowledge.listEntities(options)
@@ -3257,7 +3299,7 @@ interface EntityListOptions {
3257
3299
  *
3258
3300
  * @example
3259
3301
  * ```ts
3260
- * import { ai, type KnowledgeIngestFileInput } from '@h-ai/ai'
3302
+ * import { type KnowledgeIngestFileInput, ai } from '@h-ai/ai'
3261
3303
  * // 应用启动已成功初始化 ai,且目标知识集合已 setup。
3262
3304
  * async function run(options: KnowledgeIngestFileInput) {
3263
3305
  * const result = await ai.knowledge.ingestFile(options)
@@ -3317,7 +3359,7 @@ interface KnowledgeDocumentInfo {
3317
3359
  *
3318
3360
  * @example
3319
3361
  * ```ts
3320
- * import { ai, type KnowledgeDocumentListOptions } from '@h-ai/ai'
3362
+ * import { type KnowledgeDocumentListOptions, ai } from '@h-ai/ai'
3321
3363
  * // 应用启动已成功初始化 ai,且目标知识集合已 setup。
3322
3364
  * async function run(options: KnowledgeDocumentListOptions) {
3323
3365
  * const result = await ai.knowledge.listDocuments(options)
@@ -3339,7 +3381,7 @@ interface KnowledgeDocumentListOptions {
3339
3381
  *
3340
3382
  * @example
3341
3383
  * ```ts
3342
- * import { ai, type KnowledgeDocumentRemoveOptions } from '@h-ai/ai'
3384
+ * import { type KnowledgeDocumentRemoveOptions, ai } from '@h-ai/ai'
3343
3385
  * // 应用启动已成功初始化 ai,且目标知识集合已 setup。
3344
3386
  * async function run(options: KnowledgeDocumentRemoveOptions) {
3345
3387
  * const result = await ai.knowledge.removeDocument('guide', options)
@@ -3441,6 +3483,7 @@ interface KnowledgeOperations {
3441
3483
  * 导入文档
3442
3484
  *
3443
3485
  * 执行流程:clean → chunk → embed/实体准备 → 持久暂存 → 写入向量 → CAS 发布完整版本。
3486
+ * 清洗或分块失败时返回 KNOWLEDGE_INGEST_FAILED,保留原始错误,不继续生成向量或发布。
3444
3487
  * 成功包含 revision 与 cleanupPending;旧数据清理失败时检查标志并安排 repair。
3445
3488
  *
3446
3489
  * @param input - 文档导入输入
@@ -3579,7 +3622,7 @@ type MemoryType = z.infer<typeof MemoryTypeSchema>;
3579
3622
  *
3580
3623
  * @example
3581
3624
  * ```ts
3582
- * import { ai, type MemoryEntryInput } from '@h-ai/ai'
3625
+ * import { type MemoryEntryInput, ai } from '@h-ai/ai'
3583
3626
  * // 应用启动已成功初始化 ai。
3584
3627
  * async function run(options: MemoryEntryInput) {
3585
3628
  * const result = await ai.memory.add(options)
@@ -3641,7 +3684,7 @@ interface MemoryEntry {
3641
3684
  *
3642
3685
  * @example
3643
3686
  * ```ts
3644
- * import { ai, type MemoryExtractOptions } from '@h-ai/ai'
3687
+ * import { type MemoryExtractOptions, ai } from '@h-ai/ai'
3645
3688
  * // 应用启动已成功初始化 ai。
3646
3689
  * async function run(options: MemoryExtractOptions) {
3647
3690
  * const result = await ai.memory.extract([{ role: 'user', content: '以后请用中文' }], options)
@@ -3678,7 +3721,7 @@ interface MemoryExtractOptions {
3678
3721
  *
3679
3722
  * @example
3680
3723
  * ```ts
3681
- * import { ai, type MemoryRecallOptions } from '@h-ai/ai'
3724
+ * import { type MemoryRecallOptions, ai } from '@h-ai/ai'
3682
3725
  * // 应用启动已成功初始化 ai。
3683
3726
  * async function run(options: MemoryRecallOptions) {
3684
3727
  * const result = await ai.memory.recall('语言偏好', options)
@@ -3715,7 +3758,7 @@ interface MemoryRecallOptions {
3715
3758
  *
3716
3759
  * @example
3717
3760
  * ```ts
3718
- * import { ai, type MemoryInjectionOptions } from '@h-ai/ai'
3761
+ * import { type MemoryInjectionOptions, ai } from '@h-ai/ai'
3719
3762
  * // 应用启动已成功初始化 ai。
3720
3763
  * async function run(options: MemoryInjectionOptions) {
3721
3764
  * const result = await ai.memory.injectMemories([{ role: 'user', content: '你好' }], options)
@@ -3751,7 +3794,7 @@ interface MemoryInjectionOptions {
3751
3794
  *
3752
3795
  * @example
3753
3796
  * ```ts
3754
- * import { ai, type MemoryListOptions } from '@h-ai/ai'
3797
+ * import { type MemoryListOptions, ai } from '@h-ai/ai'
3755
3798
  * // 应用启动已成功初始化 ai。
3756
3799
  * async function run(options: MemoryListOptions) {
3757
3800
  * const result = await ai.memory.list(options)
@@ -3775,7 +3818,7 @@ interface MemoryListOptions {
3775
3818
  *
3776
3819
  * @example
3777
3820
  * ```ts
3778
- * import { ai, type MemoryListPageOptions } from '@h-ai/ai'
3821
+ * import { type MemoryListPageOptions, ai } from '@h-ai/ai'
3779
3822
  * // 应用启动已成功初始化 ai。
3780
3823
  * async function run(options: MemoryListPageOptions) {
3781
3824
  * const result = await ai.memory.listPage(options)
@@ -3804,7 +3847,7 @@ interface MemoryListPageOptions {
3804
3847
  *
3805
3848
  * @example
3806
3849
  * ```ts
3807
- * import { ai, type MemoryClearOptions } from '@h-ai/ai'
3850
+ * import { type MemoryClearOptions, ai } from '@h-ai/ai'
3808
3851
  * // 应用启动已成功初始化 ai。
3809
3852
  * async function run(options: MemoryClearOptions) {
3810
3853
  * const result = await ai.memory.clear(options)
@@ -3828,7 +3871,7 @@ interface MemoryClearOptions {
3828
3871
  *
3829
3872
  * @example
3830
3873
  * ```ts
3831
- * import { ai, type MemoryUpdateInput } from '@h-ai/ai'
3874
+ * import { type MemoryUpdateInput, ai } from '@h-ai/ai'
3832
3875
  * async function updateOwnedMemory(memoryId: string, userId: string) {
3833
3876
  * const input: MemoryUpdateInput = { importance: 0.9, metadata: { source: 'confirmed' } }
3834
3877
  * const result = await ai.memory.update(memoryId, input, { objectId: userId })
@@ -3856,7 +3899,7 @@ interface MemoryUpdateInput {
3856
3899
  *
3857
3900
  * @example
3858
3901
  * ```ts
3859
- * import { ai, type MemoryAccessScope } from '@h-ai/ai'
3902
+ * import { type MemoryAccessScope, ai } from '@h-ai/ai'
3860
3903
  * async function readOwnedMemory(memoryId: string, trustedUserId: string) {
3861
3904
  * const scope: MemoryAccessScope = { objectId: trustedUserId, scope: { topicId: 'profile' } }
3862
3905
  * const result = await ai.memory.get(memoryId, scope)
@@ -3879,7 +3922,7 @@ interface MemoryAccessScope {
3879
3922
  *
3880
3923
  * @example
3881
3924
  * ```ts
3882
- * import { ai, type ScopedMemoryBinding } from '@h-ai/ai'
3925
+ * import { type ScopedMemoryBinding, ai } from '@h-ai/ai'
3883
3926
  * const binding: ScopedMemoryBinding = { objectId: 'user-1', scope: { topicId: 'profile' } }
3884
3927
  * const memory = ai.memory.scoped(binding)
3885
3928
  * const result = await memory.list({ limit: 10 })
@@ -4060,7 +4103,7 @@ interface MemoryCoreOperations {
4060
4103
  *
4061
4104
  * @example
4062
4105
  * ```ts
4063
- * import { ai, type ScopedMemoryOperations } from '@h-ai/ai'
4106
+ * import { type ScopedMemoryOperations, ai } from '@h-ai/ai'
4064
4107
  * const memory: ScopedMemoryOperations = ai.memory.scoped({ objectId: 'user-1', scope: { topicId: 'profile' } })
4065
4108
  * const result = await memory.add({ content: '偏好中文', type: 'preference' })
4066
4109
  * if (!result.success) throw new Error(result.error.message)
@@ -4098,7 +4141,7 @@ interface ScopedMemoryOperations {
4098
4141
  *
4099
4142
  * @example
4100
4143
  * ```ts
4101
- * import { ai, type MemoryOperations } from '@h-ai/ai'
4144
+ * import { type MemoryOperations, ai } from '@h-ai/ai'
4102
4145
  * const operations: MemoryOperations = ai.memory
4103
4146
  * const result = await operations.scoped({ objectId: 'user-1' }).recall('语言偏好', { topK: 3 })
4104
4147
  * if (!result.success) throw new Error(result.error.message)
@@ -4118,6 +4161,13 @@ interface MemoryOperations extends MemoryCoreOperations {
4118
4161
  admin: MemoryAdminOperations;
4119
4162
  }
4120
4163
 
4164
+ /**
4165
+ * @h-ai/ai — 错误码 + 配置 Schema
4166
+ *
4167
+ * 定义 AI 模块的错误码常量、Zod Schema 和配置类型。
4168
+ * @module ai-config
4169
+ */
4170
+
4121
4171
  /**
4122
4172
  * 可选密钥 Schema。
4123
4173
  *
@@ -4484,10 +4534,10 @@ interface ResolveRequiredModelEntryOptions {
4484
4534
  *
4485
4535
  * @example
4486
4536
  * ```ts
4487
- * import { LLMConfigSchema, resolveModelEntry } from '@h-ai/ai'
4537
+ * import { LLMConfigSchema, ai } from '@h-ai/ai'
4488
4538
  *
4489
4539
  * const config = LLMConfigSchema.parse({ apiKey: process.env.HAI_AI_LLM_APIKEY, models: [{ id: 'fast', model: 'gpt-4o-mini' }], scenarios: { summary: 'fast' } })
4490
- * const result = resolveModelEntry(config, 'summary')
4540
+ * const result = ai.resolveModelEntry(config, 'summary')
4491
4541
  * if (result.success) {
4492
4542
  * const modelName = result.data.model
4493
4543
  * }
@@ -4507,10 +4557,10 @@ declare function resolveModelEntry(llmConfig: LLMConfig, scenario: ModelScenario
4507
4557
  *
4508
4558
  * @example
4509
4559
  * ```ts
4510
- * import { LLMConfigSchema, resolveModelApi } from '@h-ai/ai'
4560
+ * import { LLMConfigSchema, ai } from '@h-ai/ai'
4511
4561
  *
4512
4562
  * const config = LLMConfigSchema.parse({ models: [{ id: 'claude', model: 'claude-sonnet-4', protocol: 'anthropic' }] })
4513
- * const protocol = resolveModelApi(config, 'claude')
4563
+ * const protocol = ai.resolveModelApi(config, 'claude')
4514
4564
  * ```
4515
4565
  */
4516
4566
  declare function resolveModelApi(llmConfig: LLMConfig, explicitModel?: string, tempApi?: ApiType): ApiType;
@@ -4753,12 +4803,12 @@ declare const KnowledgeConfigSchema: z.ZodObject<{
4753
4803
  removeHtml: z.ZodDefault<z.ZodBoolean>;
4754
4804
  removeUrls: z.ZodDefault<z.ZodBoolean>;
4755
4805
  removeEmails: z.ZodDefault<z.ZodBoolean>;
4756
- normalizeWhitespace: z.ZodDefault<z.ZodBoolean>;
4757
- trim: z.ZodDefault<z.ZodBoolean>;
4758
4806
  customReplacements: z.ZodOptional<z.ZodArray<z.ZodObject<{
4759
4807
  pattern: z.ZodString;
4760
4808
  replacement: z.ZodString;
4761
4809
  }, z.core.$strip>>>;
4810
+ normalizeWhitespace: z.ZodDefault<z.ZodBoolean>;
4811
+ trim: z.ZodDefault<z.ZodBoolean>;
4762
4812
  }, z.core.$strip>>;
4763
4813
  chunkOptions: z.ZodDefault<z.ZodObject<{
4764
4814
  mode: z.ZodEnum<{
@@ -5408,10 +5458,10 @@ interface ResolvedAudioModel {
5408
5458
  *
5409
5459
  * @example
5410
5460
  * ```ts
5411
- * import { AudioConfigSchema, resolveAudioModel } from '@h-ai/ai'
5461
+ * import { AudioConfigSchema, ai } from '@h-ai/ai'
5412
5462
  *
5413
5463
  * const config = AudioConfigSchema.parse({ models: [{ id: 'tts', provider: 'indextts', model: 'indextts2', operations: ['synthesize'], baseUrl: 'http://127.0.0.1:8000' }], synthesizeModel: 'tts' })
5414
- * const result = resolveAudioModel(config, 'synthesize')
5464
+ * const result = ai.resolveAudioModel(config, 'synthesize')
5415
5465
  * if (result.success) {
5416
5466
  * const endpoint = result.data.baseUrl
5417
5467
  * }
@@ -5430,12 +5480,12 @@ declare function resolveAudioModel(audioConfig: AudioConfig, operation: 'transcr
5430
5480
  *
5431
5481
  * @example
5432
5482
  * ```ts
5433
- * import { AudioConfigSchema, ensureAudioCredential, resolveAudioModel } from '@h-ai/ai'
5483
+ * import { AudioConfigSchema, ai } from '@h-ai/ai'
5434
5484
  *
5435
5485
  * const config = AudioConfigSchema.parse({ models: [{ id: 'asr', provider: 'openai', model: 'whisper-1', operations: ['transcribe'] }], transcribeModel: 'asr' })
5436
- * const result = resolveAudioModel(config, 'transcribe')
5486
+ * const result = ai.resolveAudioModel(config, 'transcribe')
5437
5487
  * if (result.success) {
5438
- * const missingCredential = ensureAudioCredential(result.data)
5488
+ * const missingCredential = ai.ensureAudioCredential(result.data)
5439
5489
  * if (missingCredential) {
5440
5490
  * const code = missingCredential.code
5441
5491
  * }
@@ -5605,10 +5655,10 @@ interface ResolvedImageModel {
5605
5655
  *
5606
5656
  * @example
5607
5657
  * ```ts
5608
- * import { ImageConfigSchema, resolveImageModel } from '@h-ai/ai'
5658
+ * import { ImageConfigSchema, ai } from '@h-ai/ai'
5609
5659
  *
5610
5660
  * const config = ImageConfigSchema.parse({ models: [{ id: 'image', provider: 'openai', model: 'gpt-image-1', apiKey: process.env.HAI_AI_IMAGE_OPENAI_APIKEY }], generateModel: 'image' })
5611
- * const result = resolveImageModel(config)
5661
+ * const result = ai.resolveImageModel(config)
5612
5662
  * if (result.success) {
5613
5663
  * const modelName = result.data.model
5614
5664
  * }
@@ -6056,12 +6106,12 @@ declare const AIConfigSchema: z.ZodObject<{
6056
6106
  removeHtml: z.ZodDefault<z.ZodBoolean>;
6057
6107
  removeUrls: z.ZodDefault<z.ZodBoolean>;
6058
6108
  removeEmails: z.ZodDefault<z.ZodBoolean>;
6059
- normalizeWhitespace: z.ZodDefault<z.ZodBoolean>;
6060
- trim: z.ZodDefault<z.ZodBoolean>;
6061
6109
  customReplacements: z.ZodOptional<z.ZodArray<z.ZodObject<{
6062
6110
  pattern: z.ZodString;
6063
6111
  replacement: z.ZodString;
6064
6112
  }, z.core.$strip>>>;
6113
+ normalizeWhitespace: z.ZodDefault<z.ZodBoolean>;
6114
+ trim: z.ZodDefault<z.ZodBoolean>;
6065
6115
  }, z.core.$strip>>;
6066
6116
  chunkOptions: z.ZodDefault<z.ZodObject<{
6067
6117
  mode: z.ZodEnum<{
@@ -6299,6 +6349,31 @@ declare function publishSnapshot(input: ACPPublishSnapshot, signal?: AbortSignal
6299
6349
  commit: string;
6300
6350
  }>;
6301
6351
 
6352
+ /**
6353
+ * @h-ai/ai — MCP Server 创建与传输层
6354
+ *
6355
+ * 基于 `@modelcontextprotocol/sdk` 封装,提供便捷的 MCP 服务器创建。
6356
+ * @module ai-mcp-server
6357
+ */
6358
+
6359
+ /**
6360
+ * 创建 MCP 服务器
6361
+ *
6362
+ * @param options - 服务器选项(名称、版本)
6363
+ * @returns McpServer 实例
6364
+ *
6365
+ * @example
6366
+ * ```ts
6367
+ * import { ai } from '@h-ai/ai'
6368
+ *
6369
+ * const server = ai.createMcpServer({ name: 'my-server', version: '1.0.0' })
6370
+ * // 注册工具 / 资源 ...
6371
+ * const transport = new ai.StdioServerTransport()
6372
+ * await server.connect(transport)
6373
+ * ```
6374
+ */
6375
+ declare function createMcpServer(options: McpServerOptions): McpServer$2;
6376
+
6302
6377
  /**
6303
6378
  * @h-ai/ai — A2A(Agent-to-Agent)子功能类型
6304
6379
  *
@@ -6446,8 +6521,8 @@ interface A2AAuthenticator {
6446
6521
  *
6447
6522
  * @example
6448
6523
  * ```ts
6449
- * import { ai } from '@h-ai/ai'
6450
- * import type { A2ATaskFilter } from '@h-ai/ai'
6524
+ * import { type A2ATaskFilter, ai } from '@h-ai/ai'
6525
+ *
6451
6526
  * const filter: A2ATaskFilter = { callerId: 'agent-1', contextId: 'context-1', status: 'user', limit: 20 }
6452
6527
  * const result = await ai.a2a.listMessages(filter)
6453
6528
  * if (result.success) {
@@ -6476,8 +6551,8 @@ interface A2ATaskFilter {
6476
6551
  *
6477
6552
  * @example
6478
6553
  * ```ts
6479
- * import { ai } from '@h-ai/ai'
6480
- * import type { AgentExecutor } from '@h-ai/ai'
6554
+ * import { type AgentExecutor, ai } from '@h-ai/ai'
6555
+ *
6481
6556
  * function register(executor: AgentExecutor) {
6482
6557
  * const registered = ai.a2a.registerExecutor(executor)
6483
6558
  * if (!registered.success) return registered
@@ -6624,8 +6699,8 @@ interface A2AHandleResult {
6624
6699
  *
6625
6700
  * @example
6626
6701
  * ```ts
6627
- * import { ai } from '@h-ai/ai'
6628
- * import type { A2ACallOptions } from '@h-ai/ai'
6702
+ * import { type A2ACallOptions, ai } from '@h-ai/ai'
6703
+ *
6629
6704
  * const options: A2ACallOptions = { timeout: 30_000 }
6630
6705
  * const result = await ai.a2a.callRemoteAgent('https://trusted-agent.example.com/a2a', '项目介绍', options)
6631
6706
  * if (result.success) {
@@ -6796,7 +6871,7 @@ interface ACPPlatformPolicy {
6796
6871
  allowTools?: (scope: RunnerScope, agentId: string, toolIds: readonly string[]) => boolean | Promise<boolean>;
6797
6872
  /** 创建应用控制的 HTTP MCP 入口。传入 Worker 生命周期,返回 signal 通知绑定到期或撤销。 */
6798
6873
  bindTools?: (scope: RunnerScope, sessionId: string, toolIds: readonly string[], signal: AbortSignal) => Promise<{
6799
- servers: McpServer[];
6874
+ servers: McpServer$1[];
6800
6875
  revoke: () => void | Promise<void>;
6801
6876
  signal?: AbortSignal;
6802
6877
  }>;
@@ -6918,6 +6993,25 @@ type ACPTurnOptions = ACPRunObserver & Pick<ACPPlatformRequest, 'context' | 'lim
6918
6993
  */
6919
6994
  type ACPSubmitTurn = z.input<typeof submitTurnSchema>;
6920
6995
 
6996
+ /** @h-ai/ai — 音频播放负载序列化 */
6997
+
6998
+ /**
6999
+ * 将标准音频内容转换为浏览器可直接播放的 Base64 负载。
7000
+ *
7001
+ * `synthesize` 只负责统一供应商输出的字节与格式;裸 PCM 没有容器头,
7002
+ * 因此这里负责补齐 WAV 头。MP3/WAV 则只进行 Base64 编码,不重新封装。
7003
+ *
7004
+ * @example
7005
+ * ```ts
7006
+ * import { ai } from '@h-ai/ai'
7007
+ * const result = ai.serializePlayableAudio({ data: new Uint8Array(320), format: 'pcm16', sampleRate: 16000, channels: 1 })
7008
+ * if (result.success) {
7009
+ * const source = 'data:' + result.data.mimeType + ';base64,' + result.data.audioBase64
7010
+ * }
7011
+ * ```
7012
+ */
7013
+ declare function serializePlayableAudio(audio: AudioContent): HaiResult<PlayableAudio>;
7014
+
6921
7015
  /**
6922
7016
  * @h-ai/ai — RAG(Retrieval-Augmented Generation)子功能类型
6923
7017
  *
@@ -6930,7 +7024,7 @@ type ACPSubmitTurn = z.input<typeof submitTurnSchema>;
6930
7024
  *
6931
7025
  * @example
6932
7026
  * ```ts
6933
- * import { ai, type RagOptions } from '@h-ai/ai'
7027
+ * import { type RagOptions, ai } from '@h-ai/ai'
6934
7028
  * // 应用启动已成功初始化 ai。
6935
7029
  * async function run(options: RagOptions) {
6936
7030
  * const result = await ai.rag.query('如何部署?', options)
@@ -7057,7 +7151,7 @@ type RagStreamEvent = {
7057
7151
  *
7058
7152
  * @example
7059
7153
  * ```ts
7060
- * import { ai, type RagOperations } from '@h-ai/ai'
7154
+ * import { type RagOperations, ai } from '@h-ai/ai'
7061
7155
  * // 应用启动已成功初始化 ai,并注册 docs 检索源。
7062
7156
  * const operations: RagOperations = ai.rag
7063
7157
  * const result = await operations.query('如何部署?', { objectId: 'user-1', sources: ['docs'], topK: 3 })
@@ -7119,7 +7213,7 @@ type ReasoningStrategy = 'react' | 'cot' | 'plan-execute';
7119
7213
  *
7120
7214
  * @example
7121
7215
  * ```ts
7122
- * import { ai, type ReasoningOptions } from '@h-ai/ai'
7216
+ * import { type ReasoningOptions, ai } from '@h-ai/ai'
7123
7217
  * // 应用启动已成功初始化 ai。
7124
7218
  * async function run(options: ReasoningOptions) {
7125
7219
  * const result = await ai.reasoning.run('解释这项设计的权衡', options)
@@ -7263,7 +7357,7 @@ type ReasoningStreamEvent = {
7263
7357
  *
7264
7358
  * @example
7265
7359
  * ```ts
7266
- * import { ai, type ReasoningOperations } from '@h-ai/ai'
7360
+ * import { type ReasoningOperations, ai } from '@h-ai/ai'
7267
7361
  * // 应用启动已成功初始化 ai。
7268
7362
  * const operations: ReasoningOperations = ai.reasoning
7269
7363
  * const result = await operations.run('解释为何需要共享状态', { strategy: 'cot', maxRounds: 3 })
@@ -7508,7 +7602,7 @@ interface CommitTurnInput {
7508
7602
  *
7509
7603
  * @example
7510
7604
  * ```ts
7511
- * import { ai, type ContextManagerOptions } from '@h-ai/ai'
7605
+ * import { type ContextManagerOptions, ai } from '@h-ai/ai'
7512
7606
  * // 应用启动已成功初始化 ai;身份来自可信认证会话。
7513
7607
  * const options: ContextManagerOptions = { scope: { objectId: 'user-1', sessionId: 'session-1' }, turnCommit: 'manual', concurrency: 'reject' }
7514
7608
  * const result = ai.context.createManager(options)
@@ -7931,7 +8025,7 @@ interface ContextManager {
7931
8025
  *
7932
8026
  * @example
7933
8027
  * ```ts
7934
- * import { ai, type ContextOperations } from '@h-ai/ai'
8028
+ * import { type ContextOperations, ai } from '@h-ai/ai'
7935
8029
  * // 应用启动已成功初始化 ai;跨节点读取使用 restore/reload。
7936
8030
  * const operations: ContextOperations = ai.context
7937
8031
  * const restored = await operations.restoreManager({ objectId: 'user-1', sessionId: 'session-1' })
@@ -8716,8 +8810,8 @@ interface TokenOperations {
8716
8810
  * @example
8717
8811
  * ```ts
8718
8812
  * import { HaiAIError } from '@h-ai/ai'
8719
- * import { err } from '@h-ai/core'
8720
- * const result = err(HaiAIError.NOT_INITIALIZED, 'AI is not initialized')
8813
+ * import { core } from '@h-ai/core'
8814
+ * const result = core.err(HaiAIError.NOT_INITIALIZED, 'AI is not initialized')
8721
8815
  * if (!result.success) {
8722
8816
  * const status = result.error.httpStatus
8723
8817
  * const code = result.error.code
@@ -8792,6 +8886,9 @@ declare const HaiAIError: {
8792
8886
  readonly FILE_UNSUPPORTED_FORMAT: _h_ai_core.HaiErrorDef;
8793
8887
  readonly FILE_OCR_FAILED: _h_ai_core.HaiErrorDef;
8794
8888
  readonly FILE_INVALID_CONTENT: _h_ai_core.HaiErrorDef;
8889
+ readonly FILE_LOCAL_BUSY: _h_ai_core.HaiErrorDef;
8890
+ readonly FILE_LOCAL_CANCELLED: _h_ai_core.HaiErrorDef;
8891
+ readonly FILE_LOCAL_TIMEOUT: _h_ai_core.HaiErrorDef;
8795
8892
  readonly AUDIO_INVALID_REQUEST: _h_ai_core.HaiErrorDef;
8796
8893
  readonly AUDIO_MODEL_NOT_FOUND: _h_ai_core.HaiErrorDef;
8797
8894
  readonly AUDIO_PROVIDER_NOT_FOUND: _h_ai_core.HaiErrorDef;
@@ -8841,7 +8938,7 @@ declare const HaiAIError: {
8841
8938
  *
8842
8939
  * @example
8843
8940
  * ```ts
8844
- * import { ai, type AIConfigInput, type AIInitOptions, type AIStoreProvider } from '@h-ai/ai'
8941
+ * import { type AIConfigInput, type AIInitOptions, type AIStoreProvider, ai } from '@h-ai/ai'
8845
8942
  * async function start(config: AIConfigInput, storeProvider: AIStoreProvider) {
8846
8943
  * const options: AIInitOptions = { storeProvider }
8847
8944
  * const result = await ai.init(config, options)
@@ -8874,7 +8971,7 @@ interface AIInitOptions {
8874
8971
  *
8875
8972
  * @example
8876
8973
  * ```ts
8877
- * import { ai, type AIConfigInput, type AIInitOptions } from '@h-ai/ai'
8974
+ * import { type AIConfigInput, type AIInitOptions, ai } from '@h-ai/ai'
8878
8975
  * // 一次性脚本示例;服务应用在启动阶段 init,在停止接入请求后 close。
8879
8976
  * async function run(config: AIConfigInput, options: AIInitOptions) {
8880
8977
  * const ready = await ai.init(config, options)
@@ -8891,6 +8988,44 @@ interface AIInitOptions {
8891
8988
  * ```
8892
8989
  */
8893
8990
  interface AIFunctions {
8991
+ /** A2A 协议对象构建器;无需初始化。 */
8992
+ AgentEvent: typeof AgentEvent;
8993
+ /** A2A 消息构建器;无需初始化。 */
8994
+ Message: typeof Message$1;
8995
+ /** A2A 消息部分构建器;无需初始化。 */
8996
+ Part: typeof Part$1;
8997
+ /** A2A 发送请求构建器;无需初始化。 */
8998
+ SendMessageRequest: typeof SendMessageRequest$1;
8999
+ /** A2A 任务构建器;无需初始化。 */
9000
+ Task: typeof Task$1;
9001
+ /** A2A 任务产物事件构建器;无需初始化。 */
9002
+ TaskArtifactUpdateEvent: typeof TaskArtifactUpdateEvent$1;
9003
+ /** A2A 任务状态构建器;无需初始化。 */
9004
+ TaskStatus: typeof TaskStatus$1;
9005
+ /** A2A 任务状态事件构建器;无需初始化。 */
9006
+ TaskStatusUpdateEvent: typeof TaskStatusUpdateEvent$1;
9007
+ /** MCP SDK 扩展构造器;无需初始化。 */
9008
+ McpServer: typeof McpServer$2;
9009
+ /** MCP SDK 扩展构造器;无需初始化。 */
9010
+ SSEServerTransport: typeof SSEServerTransport$1;
9011
+ /** MCP SDK 扩展构造器;无需初始化。 */
9012
+ StdioServerTransport: typeof StdioServerTransport$1;
9013
+ /** MCP SDK 扩展构造器;无需初始化。 */
9014
+ StreamableHTTPServerTransport: typeof StreamableHTTPServerTransport$1;
9015
+ /** resolveModelEntry 的公开工具入口;按原签名执行。 */
9016
+ resolveModelEntry: typeof resolveModelEntry;
9017
+ /** resolveModelApi 的公开工具入口;按原签名执行。 */
9018
+ resolveModelApi: typeof resolveModelApi;
9019
+ /** resolveAudioModel 的公开工具入口;按原签名执行。 */
9020
+ resolveAudioModel: typeof resolveAudioModel;
9021
+ /** ensureAudioCredential 的公开工具入口;按原签名执行。 */
9022
+ ensureAudioCredential: typeof ensureAudioCredential;
9023
+ /** resolveImageModel 的公开工具入口;按原签名执行。 */
9024
+ resolveImageModel: typeof resolveImageModel;
9025
+ /** serializePlayableAudio 的公开工具入口;按原签名执行。 */
9026
+ serializePlayableAudio: typeof serializePlayableAudio;
9027
+ /** createMcpServer 的公开工具入口;按原签名执行。 */
9028
+ createMcpServer: typeof createMcpServer;
8894
9029
  /**
8895
9030
  * 初始化 AI 服务
8896
9031
  *
@@ -8957,24 +9092,27 @@ interface AIFunctions {
8957
9092
  readonly image: ManagedImageOperations;
8958
9093
  }
8959
9094
 
8960
- /** @h-ai/ai — 音频播放负载序列化 */
8961
-
8962
9095
  /**
8963
- * 将标准音频内容转换为浏览器可直接播放的 Base64 负载。
8964
- *
8965
- * `synthesize` 只负责统一供应商输出的字节与格式;裸 PCM 没有容器头,
8966
- * 因此这里负责补齐 WAV 头。MP3/WAV 则只进行 Base64 编码,不重新封装。
9096
+ * AI 服务对象,统一的 AI 访问入口
8967
9097
  *
8968
9098
  * @example
8969
9099
  * ```ts
8970
- * import { serializePlayableAudio } from '@h-ai/ai'
8971
- * const result = serializePlayableAudio({ data: new Uint8Array(320), format: 'pcm16', sampleRate: 16000, channels: 1 })
8972
- * if (result.success) {
8973
- * const source = 'data:' + result.data.mimeType + ';base64,' + result.data.audioBase64
9100
+ * import { type AIConfigInput, type AIInitOptions, ai } from '@h-ai/ai'
9101
+ *
9102
+ * async function run(config: AIConfigInput, options: AIInitOptions) {
9103
+ * // 默认 Store 所需 reldb/vecdb 已由应用初始化;显式测试 Store 通过 options 注入。
9104
+ * const initialized = await ai.init(config, options)
9105
+ * if (!initialized.success) return initialized
9106
+ * try {
9107
+ * const result = await ai.llm.chat({ messages: [{ role: 'user', content: '你好' }] })
9108
+ * if (!result.success) return result
9109
+ * return result.data.choices[0]?.message.content
9110
+ * }
9111
+ * finally { await ai.close() }
8974
9112
  * }
8975
9113
  * ```
8976
9114
  */
8977
- declare function serializePlayableAudio(audio: AudioContent): HaiResult<PlayableAudio>;
9115
+ declare const ai: AIFunctions;
8978
9116
 
8979
9117
  /**
8980
9118
  * 统一语音入口的默认路径(相对 API 前缀)
@@ -9310,6 +9448,124 @@ interface AudioWsEndMessage {
9310
9448
  */
9311
9449
  type AudioWsServerMessage = AudioWsSpeechMessage | AudioWsTranscriptMessage | AudioWsSegmentStartedMessage | AudioWsSegmentDoneMessage | AudioWsErrorMessage | AudioWsEndMessage;
9312
9450
 
9451
+ /**
9452
+ * A2A 消息。
9453
+ * @example
9454
+ * ```ts
9455
+ * import { type Message, ai } from '@h-ai/ai'
9456
+ * const message: Message = ai.Message.fromJSON({ role: 'ROLE_USER', messageId: 'message-1', parts: [{ text: '你好' }] })
9457
+ * ```
9458
+ */
9459
+ type Message = _a2a_js_sdk.Message;
9460
+ /**
9461
+ * A2A 消息里的文本、文件或结构化数据。
9462
+ * @example
9463
+ * ```ts
9464
+ * import { type Part, ai } from '@h-ai/ai'
9465
+ * const part: Part = ai.Part.fromJSON({ text: '你好' })
9466
+ * ```
9467
+ */
9468
+ type Part = _a2a_js_sdk.Part;
9469
+ /**
9470
+ * A2A 发送消息请求。
9471
+ * @example
9472
+ * ```ts
9473
+ * import type { SendMessageRequest } from '@h-ai/ai'
9474
+ * function messageFrom(request: SendMessageRequest) { return request.message }
9475
+ * ```
9476
+ */
9477
+ type SendMessageRequest = _a2a_js_sdk.SendMessageRequest;
9478
+ /**
9479
+ * A2A 任务及其状态。
9480
+ * @example
9481
+ * ```ts
9482
+ * import type { Task } from '@h-ai/ai'
9483
+ * function stateOf(task: Task) { return task.status?.state }
9484
+ * ```
9485
+ */
9486
+ type Task = _a2a_js_sdk.Task;
9487
+ /**
9488
+ * A2A 任务产物更新事件。
9489
+ * @example
9490
+ * ```ts
9491
+ * import type { TaskArtifactUpdateEvent } from '@h-ai/ai'
9492
+ * function artifactOf(event: TaskArtifactUpdateEvent) { return event.artifact }
9493
+ * ```
9494
+ */
9495
+ type TaskArtifactUpdateEvent = _a2a_js_sdk.TaskArtifactUpdateEvent;
9496
+ /**
9497
+ * A2A 任务状态。
9498
+ * @example
9499
+ * ```ts
9500
+ * import type { TaskStatus } from '@h-ai/ai'
9501
+ * function stateOf(status: TaskStatus) { return status.state }
9502
+ * ```
9503
+ */
9504
+ type TaskStatus = _a2a_js_sdk.TaskStatus;
9505
+ /**
9506
+ * A2A 任务状态更新事件。
9507
+ * @example
9508
+ * ```ts
9509
+ * import type { TaskStatusUpdateEvent } from '@h-ai/ai'
9510
+ * function statusOf(event: TaskStatusUpdateEvent) { return event.status }
9511
+ * ```
9512
+ */
9513
+ type TaskStatusUpdateEvent = _a2a_js_sdk.TaskStatusUpdateEvent;
9514
+ /**
9515
+ * A2A 执行器收到的请求上下文。
9516
+ * @example
9517
+ * ```ts
9518
+ * import type { RequestContext } from '@h-ai/ai'
9519
+ * function taskIdOf(context: RequestContext) { return context.taskId }
9520
+ * ```
9521
+ */
9522
+ type RequestContext = _a2a_js_sdk_server.RequestContext;
9523
+ /**
9524
+ * A2A 服务端的调用上下文。
9525
+ * @example
9526
+ * ```ts
9527
+ * import type { ServerCallContext } from '@h-ai/ai'
9528
+ * function tenantOf(context: ServerCallContext) { return context.tenant }
9529
+ * ```
9530
+ */
9531
+ type ServerCallContext = _a2a_js_sdk_server.ServerCallContext;
9532
+ /**
9533
+ * MCP SDK 服务器实例。
9534
+ * @example
9535
+ * ```ts
9536
+ * import { type McpServer, ai } from '@h-ai/ai'
9537
+ * const server: McpServer = ai.createMcpServer({ name: 'example', version: '1.0.0' })
9538
+ * ```
9539
+ */
9540
+ type McpServer = McpServer$2;
9541
+ /**
9542
+ * MCP SSE 服务端传输实例。
9543
+ * @example
9544
+ * ```ts
9545
+ * import type { SSEServerTransport } from '@h-ai/ai'
9546
+ * async function shutdown(transport: SSEServerTransport) { await transport.close() }
9547
+ * ```
9548
+ */
9549
+ type SSEServerTransport = SSEServerTransport$1;
9550
+ /**
9551
+ * MCP 标准输入输出传输实例。
9552
+ * @example
9553
+ * ```ts
9554
+ * import { type StdioServerTransport, ai } from '@h-ai/ai'
9555
+ * const transport: StdioServerTransport = new ai.StdioServerTransport()
9556
+ * ```
9557
+ */
9558
+ type StdioServerTransport = StdioServerTransport$1;
9559
+ /**
9560
+ * MCP 流式 HTTP 服务端传输实例。
9561
+ * @example
9562
+ * ```ts
9563
+ * import { type StreamableHTTPServerTransport, ai } from '@h-ai/ai'
9564
+ * const transport: StreamableHTTPServerTransport = new ai.StreamableHTTPServerTransport({ sessionIdGenerator: undefined })
9565
+ * ```
9566
+ */
9567
+ type StreamableHTTPServerTransport = StreamableHTTPServerTransport$1;
9568
+
9313
9569
  /**
9314
9570
  * ACP 子系统;资源占用通过 CAS 持久化,不以超时推断失联进程已停止。
9315
9571
  * @param provider - 与 AI 模块共享的持久存储;工厂创建表后由调用方统一初始化。
@@ -9324,7 +9580,7 @@ type AudioWsServerMessage = AudioWsSpeechMessage | AudioWsTranscriptMessage | Au
9324
9580
  * async function assemble(provider: AIStoreProvider, config: AIConfig) { const acp = createACPOperations(provider, config); await provider.initialize(); return acp }
9325
9581
  * ```
9326
9582
  */
9327
- declare function createACPOperations(provider: AIStoreProvider, config: AIConfig, extensions?: Record<string, ACPAgentAdapter>, modelConfig?: () => Promise<AIConfig>, mcpLookup?: (ids: string[]) => Promise<McpServer[]>, runner?: RunnerFunctions, policy?: ACPPlatformPolicy): {
9583
+ declare function createACPOperations(provider: AIStoreProvider, config: AIConfig, extensions?: Record<string, ACPAgentAdapter>, modelConfig?: () => Promise<AIConfig>, mcpLookup?: (ids: string[]) => Promise<McpServer$1[]>, runner?: RunnerFunctions, policy?: ACPPlatformPolicy): {
9328
9584
  scoped: (rawScope: _h_ai_runner.RunnerScope) => {
9329
9585
  plan: (request: ACPPlatformRequest) => Promise<HaiResult<{
9330
9586
  readonly image: string;
@@ -11566,7 +11822,7 @@ declare function createACPOperations(provider: AIStoreProvider, config: AIConfig
11566
11822
  * const result = await connection.createSession('/srv/project', [])
11567
11823
  * ```
11568
11824
  */
11569
- createSession: (cwd: string, mcpServers?: McpServer[]) => Promise<{
11825
+ createSession: (cwd: string, mcpServers?: McpServer$1[]) => Promise<{
11570
11826
  success: false;
11571
11827
  error: _h_ai_core.HaiError;
11572
11828
  } | {
@@ -11864,7 +12120,7 @@ interface ACPSessionInfo {
11864
12120
  /** 创建会话时的智能体定义快照。 */
11865
12121
  agent: z.infer<typeof ACPAgentSchema>;
11866
12122
  /** 直接绑定的原生 MCP 参数;可能含凭据,仅供可信服务端管理。 */
11867
- mcpServers: McpServer[];
12123
+ mcpServers: McpServer$1[];
11868
12124
  /** 从 MCP 合并清单选择的服务 ID;凭据在启动时解析。 */
11869
12125
  mcpServerIds?: string[];
11870
12126
  /** 当前拥有的容器;关闭后清空,volume 内容仍保留。 */
@@ -11899,7 +12155,7 @@ interface ACPCreateSessionOptions extends ACPClientOptions {
11899
12155
  /** 本次会话的模型 ID,必须在智能体 modelIds 内。 */
11900
12156
  modelId?: string;
11901
12157
  /** 直接传给智能体的 MCP 定义;与 mcpServerIds 合并。 */
11902
- mcpServers?: McpServer[];
12158
+ mcpServers?: McpServer$1[];
11903
12159
  /** 从 ai.mcp.servers 选择的登记服务。 */
11904
12160
  mcpServerIds?: string[];
11905
12161
  }
@@ -11933,5 +12189,5 @@ interface ACPGitReport {
11933
12189
  */
11934
12190
  type ACPOperations = ReturnType<typeof createACPOperations>;
11935
12191
 
11936
- export { AudioFormatSchema as $, ACPPublishSchema as B, ACPRepositorySchema as C, ACPWorkspaceSchema as F, AIConfigSchema as I, AUDIO_WS_PATH as U, ApiTypeSchema as W, AudioConfigSchema as _, AudioModelEntrySchema as a1, AudioOperationSchema as a3, AudioOperationsSchema as a4, AudioProviderSchema as a6, AudioWsClientMessageSchema as a8, CompressionStrategySchema as aC, EmbeddingConfigSchema as aQ, EntityTypeSchema as a_, AudioWsDoneMessageSchema as aa, AudioWsStartMessageSchema as ai, AudioWsTextMessageSchema as ak, CompressConfigSchema as ax, FileConfigSchema as b0, HaiAIError as b5, ImageConfigSchema as b7, LLMConfigSchema as bF, MCPConfigSchema as bI, MCPExternalServerSchema as bL, MCPServerCapabilitiesSchema as bU, MCPServerConfigSchema as bW, ImageModelEntrySchema as ba, ImageProviderSchema as bd, KnowledgeConfigSchema as bj, MemoryConfigSchema as c8, RetrievalConfigSchema as cW, MemoryTypeSchema as cj, ModelCapabilitiesSchema as cn, ModelEntrySchema as cp, ModelScenarioSchema as cr, OptionalSecretSchema as ct, RetrievalSourceSchema as d1, resolveAudioModel as dA, resolveImageModel as dB, resolveModelApi as dC, resolveModelEntry as dD, serializePlayableAudio as dE, SummaryConfigSchema as de, TokenConfigSchema as dm, ensureAudioCredential as dz, A2AConfigSchema as h, A2ASkillConfigSchema as n, ACPAgentSchema as s, ACPConfigSchema as w };
11937
- export type { A2AAgentCardConfig as A, ACPSessionInfo as D, ACPTransport as E, AIConfig as G, AIConfigInput as H, AIFunctions as J, AIInitOptions as K, AIRelStore as L, AIRelStoreCompareAndSwap as M, AIRelStoreOptions as N, AIResourceEntry as O, AIResourceRegistry as P, AIStoreProvider as Q, AIVectorBackend as R, AIVectorStore as S, AIVersionedRecord as T, ApiType as V, AskOptions as X, AssistantMessage as Y, AudioConfig as Z, A2AAgentCardDocument as a, FileConfig as a$, AudioModelEntry as a0, AudioOperation as a2, AudioProviderName as a5, AudioWsClientMessage as a7, AudioWsDoneMessage as a9, CompressResult as aA, CompressionStrategy as aB, ConsolidateOptions as aD, ConsolidateResult as aE, ContextChatOptions as aF, ContextChatResult as aG, ContextManager as aH, ContextManagerOptions as aI, ContextOperations as aJ, ContextResetOptions as aK, ContextStreamEvent as aL, ConversationTurn as aM, ConversationTurnStatus as aN, DeveloperMessage as aO, EmbeddingConfig as aP, EmbeddingItem as aR, EmbeddingOperations as aS, EmbeddingRequest as aT, EmbeddingResponse as aU, EntityDocumentRelation as aV, EntityDocumentResult as aW, EntityListOptions as aX, EntityQueryOptions as aY, EntityType as aZ, AudioWsEndMessage as ab, AudioWsErrorMessage as ac, AudioWsSegmentDoneMessage as ad, AudioWsSegmentStartedMessage as ae, AudioWsServerMessage as af, AudioWsSpeechMessage as ag, AudioWsStartMessage as ah, AudioWsTextMessage as aj, AudioWsTranscriptMessage as al, ChatCompletionChoice as am, ChatCompletionChunk as an, ChatCompletionDelta as ao, ChatCompletionRequest as ap, ChatCompletionResponse as aq, ChatHistoryOptions as ar, ChatMessage as as, ChatRecord as at, Citation as au, CommitTurnInput as av, CompressConfig as aw, CompressOperations as ay, CompressOptions as az, A2AApiKeySecurity as b, ManagedLLMOperations as b$, GenerateImageRequest as b1, GenerateImageResult as b2, GenerateObjectRequest as b3, GeneratedImage as b4, ImageConfig as b6, ImageContent as b8, ImageModelEntry as b9, KnowledgeRetrieveOptions as bA, KnowledgeRetrieveResult as bB, KnowledgeSetupOptions as bC, KnowledgeStore as bD, LLMConfig as bE, LLMOperations as bG, MCPConfig as bH, MCPContext as bJ, MCPExternalServer as bK, MCPOperations as bM, MCPPrompt as bN, MCPPromptArgument as bO, MCPPromptContent as bP, MCPPromptMessage as bQ, MCPResource as bR, MCPResourceContent as bS, MCPServerCapabilities as bT, MCPServerConfig as bV, MCPToolDefinition as bX, MCPToolHandler as bY, ManagedAudioOperations as bZ, ManagedImageOperations as b_, ImageOperations as bb, ImageProviderName as bc, ImageSize as be, InteractionScope as bf, KnowledgeAskOptions as bg, KnowledgeAskResult as bh, KnowledgeConfig as bi, KnowledgeDocumentInfo as bk, KnowledgeDocumentListOptions as bl, KnowledgeDocumentMetadata as bm, KnowledgeDocumentRemoveOptions as bn, KnowledgeDocumentRevision as bo, KnowledgeEntity as bp, KnowledgeIngestBatchProgress as bq, KnowledgeIngestBatchResult as br, KnowledgeIngestFileInput as bs, KnowledgeIngestInput as bt, KnowledgeIngestResult as bu, KnowledgeOperations as bv, KnowledgeRepairOptions as bw, KnowledgeRepairProgress as bx, KnowledgeRepairResult as by, KnowledgeRetrieveItem as bz, A2AAuthenticator as c, RetrievalSource as c$, ManagedMCPOperations as c0, ManagedRetrievalOperations as c1, McpServerOptions as c2, MemoryAccessScope as c3, MemoryAdminOperations as c4, MemoryClearAllOptions as c5, MemoryClearOptions as c6, MemoryConfig as c7, MemoryCoreOperations as c9, RagOperations as cA, RagOptions as cB, RagResult as cC, RagStreamEvent as cD, ReasoningOperations as cE, ReasoningOptions as cF, ReasoningResult as cG, ReasoningStep as cH, ReasoningStepType as cI, ReasoningStrategy as cJ, ReasoningStreamEvent as cK, ReferenceImage as cL, RerankDocument as cM, RerankItem as cN, RerankOperations as cO, RerankRequest as cP, RerankResponse as cQ, ResolveRequiredModelEntryOptions as cR, ResolvedAudioModel as cS, ResolvedImageModel as cT, ResolvedModelConfig as cU, RetrievalConfig as cV, RetrievalOperations as cX, RetrievalRequest as cY, RetrievalResult as cZ, RetrievalResultItem as c_, MemoryEntry as ca, MemoryEntryInput as cb, MemoryExtractOptions as cc, MemoryInjectionOptions as cd, MemoryListOptions as ce, MemoryListPageOptions as cf, MemoryOperations as cg, MemoryRecallOptions as ch, MemoryType as ci, MemoryUpdateInput as ck, MessageContent as cl, MessageRole as cm, ModelEntry as co, ModelScenario as cq, ObjectRef as cs, PersonaOperations as cu, PersonaProfile as cv, PersonaProfileInput as cw, PersonaProfileUpdate as cx, PersonaScopeOptions as cy, RagContextItem as cz, A2ACallOptions as d, MCPServiceAuthorization as d$, RetrievalSourceConfig as d0, SSEDecoder as d2, SSEEvent as d3, ScopedMemoryBinding as d4, ScopedMemoryOperations as d5, SessionInfo as d6, StoreFilter as d7, StorePage as d8, StoreScope as d9, ACPApprovalDecision as dF, ACPCitation as dG, ACPPlatformPolicy as dH, ACPPlatformRequest as dI, ACPProjectChanges as dJ, ACPProjectSnapshot as dK, ACPPublishSnapshot as dL, ACPRunObserver as dM, ACPRunRequest as dN, ACPSessionWorkspace as dO, ACPSubmitTurn as dP, ACPTurnOptions as dQ, BuiltinArtifact as dR, BuiltinArtifactAccess as dS, BuiltinArtifactReference as dT, BuiltinToolBinding as dU, BuiltinToolBroker as dV, BuiltinToolBrokerOptions as dW, BuiltinToolOptions as dX, CreateBuiltinTools as dY, MCPJobFileContext as dZ, MCPJobFiles as d_, StreamOperations as da, StreamProcessor as db, StreamResult as dc, SummaryConfig as dd, SummaryOperations as df, SummaryOptions as dg, SummaryResult as dh, SystemMessage as di, TempModelConfig as dj, TextContent as dk, TokenConfig as dl, TokenOperations as dn, TokenUsage as dp, ToolCall as dq, ToolDefinition as dr, ToolMessage as ds, ToolRegistryOperations as dt, ToolsOperations as du, UserMessage as dv, WhereClause as dw, WhereOperator as dx, WhereValue as dy, A2ACallResult as e, MCPServiceBinding as e0, MCPServiceBindingRequest as e1, MCPServiceBroker as e2, MCPServiceBrokerOptions as e3, MCPServiceOperations as e4, MCPServiceRequest as e5, McpToolOptions as e6, A2ACallerIdentity as f, A2AConfig as g, A2AContextInfo as i, A2AHandleResult as j, A2AMessageRecord as k, A2AOperations as l, A2ASecurityConfig as m, A2ATaskFilter as o, ACPAgentAdapter as p, ACPAgentAdapterInput as q, ACPAgentLaunch as r, ACPClientOptions as t, ACPConfig as u, ACPConfigInput as v, ACPCreateSessionOptions as x, ACPGitReport as y, ACPOperations as z };
12192
+ export { ACPConfigSchema as D, ACPPublishSchema as H, ACPRepositorySchema as I, ACPWorkspaceSchema as L, AIConfigSchema as O, AUDIO_WS_PATH as _, resolveModelApi as a, ApiTypeSchema as a0, AudioConfigSchema as a4, AudioFormatSchema as a5, AudioModelEntrySchema as a7, AudioOperationSchema as a9, CompressConfigSchema as aD, CompressionStrategySchema as aI, EmbeddingConfigSchema as aW, AudioOperationsSchema as aa, AudioProviderSchema as ac, AudioWsClientMessageSchema as ae, AudioWsDoneMessageSchema as ag, AudioWsStartMessageSchema as ao, AudioWsTextMessageSchema as aq, resolveAudioModel as b, EntityTypeSchema as b4, FileConfigSchema as b6, LLMConfigSchema as bL, MCPConfigSchema as bO, MCPExternalServerSchema as bR, MCPServerCapabilitiesSchema as b_, HaiAIError as bb, ImageConfigSchema as bd, ImageModelEntrySchema as bg, ImageProviderSchema as bj, KnowledgeConfigSchema as bp, resolveImageModel as c, MCPServerConfigSchema as c0, OptionalSecretSchema as cA, MemoryConfigSchema as ce, MemoryTypeSchema as cp, ModelCapabilitiesSchema as cu, ModelEntrySchema as cw, ModelScenarioSchema as cy, RetrievalConfigSchema as d2, RetrievalSourceSchema as d9, TokenConfigSchema as dA, SummaryConfigSchema as dn, ensureAudioCredential as e, ai as em, A2AConfigSchema as l, resolveModelEntry as r, serializePlayableAudio as s, A2ASkillConfigSchema as t, ACPAgentSchema as y };
12193
+ export type { ApiType as $, A2AAgentCardConfig as A, ACPConfig as B, ACPConfigInput as C, ACPCreateSessionOptions as E, ACPGitReport as F, ACPOperations as G, ACPSessionInfo as J, ACPTransport as K, AIConfig as M, AIConfigInput as N, AIFunctions as P, AIInitOptions as Q, AIRelStore as R, AIRelStoreCompareAndSwap as S, AIRelStoreOptions as T, AIResourceEntry as U, AIResourceRegistry as V, AIStoreProvider as W, AIVectorBackend as X, AIVectorStore as Y, AIVersionedRecord as Z, EntityDocumentRelation as a$, AskOptions as a1, AssistantMessage as a2, AudioConfig as a3, AudioModelEntry as a6, AudioOperation as a8, Citation as aA, CommitTurnInput as aB, CompressConfig as aC, CompressOperations as aE, CompressOptions as aF, CompressResult as aG, CompressionStrategy as aH, ConsolidateOptions as aJ, ConsolidateResult as aK, ContextChatOptions as aL, ContextChatResult as aM, ContextManager as aN, ContextManagerOptions as aO, ContextOperations as aP, ContextResetOptions as aQ, ContextStreamEvent as aR, ConversationTurn as aS, ConversationTurnStatus as aT, DeveloperMessage as aU, EmbeddingConfig as aV, EmbeddingItem as aX, EmbeddingOperations as aY, EmbeddingRequest as aZ, EmbeddingResponse as a_, AudioProviderName as ab, AudioWsClientMessage as ad, AudioWsDoneMessage as af, AudioWsEndMessage as ah, AudioWsErrorMessage as ai, AudioWsSegmentDoneMessage as aj, AudioWsSegmentStartedMessage as ak, AudioWsServerMessage as al, AudioWsSpeechMessage as am, AudioWsStartMessage as an, AudioWsTextMessage as ap, AudioWsTranscriptMessage as ar, ChatCompletionChoice as as, ChatCompletionChunk as at, ChatCompletionDelta as au, ChatCompletionRequest as av, ChatCompletionResponse as aw, ChatHistoryOptions as ax, ChatMessage as ay, ChatRecord as az, MCPServerConfig as b$, EntityDocumentResult as b0, EntityListOptions as b1, EntityQueryOptions as b2, EntityType as b3, FileConfig as b5, GenerateImageRequest as b7, GenerateImageResult as b8, GenerateObjectRequest as b9, KnowledgeIngestResult as bA, KnowledgeOperations as bB, KnowledgeRepairOptions as bC, KnowledgeRepairProgress as bD, KnowledgeRepairResult as bE, KnowledgeRetrieveItem as bF, KnowledgeRetrieveOptions as bG, KnowledgeRetrieveResult as bH, KnowledgeSetupOptions as bI, KnowledgeStore as bJ, LLMConfig as bK, LLMOperations as bM, MCPConfig as bN, MCPContext as bP, MCPExternalServer as bQ, MCPOperations as bS, MCPPrompt as bT, MCPPromptArgument as bU, MCPPromptContent as bV, MCPPromptMessage as bW, MCPResource as bX, MCPResourceContent as bY, MCPServerCapabilities as bZ, GeneratedImage as ba, ImageConfig as bc, ImageContent as be, ImageModelEntry as bf, ImageOperations as bh, ImageProviderName as bi, ImageSize as bk, InteractionScope as bl, KnowledgeAskOptions as bm, KnowledgeAskResult as bn, KnowledgeConfig as bo, KnowledgeDocumentInfo as bq, KnowledgeDocumentListOptions as br, KnowledgeDocumentMetadata as bs, KnowledgeDocumentRemoveOptions as bt, KnowledgeDocumentRevision as bu, KnowledgeEntity as bv, KnowledgeIngestBatchProgress as bw, KnowledgeIngestBatchResult as bx, KnowledgeIngestFileInput as by, KnowledgeIngestInput as bz, ResolvedImageModel as c$, MCPToolDefinition as c1, MCPToolHandler as c2, ManagedAudioOperations as c3, ManagedImageOperations as c4, ManagedLLMOperations as c5, ManagedMCPOperations as c6, ManagedRetrievalOperations as c7, McpServerOptions as c8, MemoryAccessScope as c9, Part as cB, PersonaOperations as cC, PersonaProfile as cD, PersonaProfileInput as cE, PersonaProfileUpdate as cF, PersonaScopeOptions as cG, RagContextItem as cH, RagOperations as cI, RagOptions as cJ, RagResult as cK, RagStreamEvent as cL, ReasoningOperations as cM, ReasoningOptions as cN, ReasoningResult as cO, ReasoningStep as cP, ReasoningStepType as cQ, ReasoningStrategy as cR, ReasoningStreamEvent as cS, ReferenceImage as cT, RerankDocument as cU, RerankItem as cV, RerankOperations as cW, RerankRequest as cX, RerankResponse as cY, ResolveRequiredModelEntryOptions as cZ, ResolvedAudioModel as c_, MemoryAdminOperations as ca, MemoryClearAllOptions as cb, MemoryClearOptions as cc, MemoryConfig as cd, MemoryCoreOperations as cf, MemoryEntry as cg, MemoryEntryInput as ch, MemoryExtractOptions as ci, MemoryInjectionOptions as cj, MemoryListOptions as ck, MemoryListPageOptions as cl, MemoryOperations as cm, MemoryRecallOptions as cn, MemoryType as co, MemoryUpdateInput as cq, Message as cr, MessageContent as cs, MessageRole as ct, ModelEntry as cv, ModelScenario as cx, ObjectRef as cz, A2AAgentCardDocument as d, BuiltinToolBinding as d$, ResolvedModelConfig as d0, RetrievalConfig as d1, RetrievalOperations as d3, RetrievalRequest as d4, RetrievalResult as d5, RetrievalResultItem as d6, RetrievalSource as d7, RetrievalSourceConfig as d8, TokenOperations as dB, TokenUsage as dC, ToolCall as dD, ToolDefinition as dE, ToolMessage as dF, ToolRegistryOperations as dG, ToolsOperations as dH, UserMessage as dI, WhereClause as dJ, WhereOperator as dK, WhereValue as dL, ACPApprovalDecision as dM, ACPCitation as dN, ACPPlatformPolicy as dO, ACPPlatformRequest as dP, ACPProjectChanges as dQ, ACPProjectSnapshot as dR, ACPPublishSnapshot as dS, ACPRunObserver as dT, ACPRunRequest as dU, ACPSessionWorkspace as dV, ACPSubmitTurn as dW, ACPTurnOptions as dX, BuiltinArtifact as dY, BuiltinArtifactAccess as dZ, BuiltinArtifactReference as d_, SSEDecoder as da, SSEEvent as db, ScopedMemoryBinding as dc, ScopedMemoryOperations as dd, SendMessageRequest as de, SessionInfo as df, StoreFilter as dg, StorePage as dh, StoreScope as di, StreamOperations as dj, StreamProcessor as dk, StreamResult as dl, SummaryConfig as dm, SummaryOperations as dp, SummaryOptions as dq, SummaryResult as dr, SystemMessage as ds, Task as dt, TaskArtifactUpdateEvent as du, TaskStatus as dv, TaskStatusUpdateEvent as dw, TempModelConfig as dx, TextContent as dy, TokenConfig as dz, BuiltinToolBroker as e0, BuiltinToolBrokerOptions as e1, BuiltinToolOptions as e2, CreateBuiltinTools as e3, JsonFieldPreview as e4, JsonFieldPreviewOptions as e5, MCPJobFileContext as e6, MCPJobFiles as e7, MCPServiceAuthorization as e8, MCPServiceBinding as e9, MCPServiceBindingRequest as ea, MCPServiceBroker as eb, MCPServiceBrokerOptions as ec, MCPServiceOperations as ed, MCPServiceRequest as ee, McpServer as ef, McpToolOptions as eg, RequestContext as eh, SSEServerTransport as ei, ServerCallContext as ej, StdioServerTransport as ek, StreamableHTTPServerTransport as el, A2AApiKeySecurity as f, A2AAuthenticator as g, A2ACallOptions as h, A2ACallResult as i, A2ACallerIdentity as j, A2AConfig as k, A2AContextInfo as m, A2AHandleResult as n, A2AMessageRecord as o, A2AOperations as p, A2ASecurityConfig as q, A2ATaskFilter as u, ACPAgentAdapter as v, ACPAgentAdapterInput as w, ACPAgentLaunch as x, ACPClientOptions as z };