@webskill/chatbot 0.0.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { AgentLoopConfig, ApprovalScope, BridgeCapabilities, ExternalSkillProvider, ExternalToolSource, FileSystemProvider, InteractionRequest, InteractionResponse, LlmClient, NetworkPolicy, RenderBlock, RenderResultRequest, RunSnapshot, RunSnapshot as RunSnapshot$1, RuntimePhase, ScriptExecutor, UiBridge, UiSurfaceActionRequest, UiSurfaceActionResponse, UiSurfaceDrafts, UiSurfaceEvent, UiSurfaceSnapshot } from "@webskill/sdk";
2
- import { SandboxMode } from "@webskill/sdk/browser";
3
- import { ReactBridgeState, SurfaceRegistry, UiSurfaceActionEvent } from "@webskill/sdk/ui-react";
4
- import "@webskill/sdk/ui";
1
+ import { AgentLoopConfig, ApprovalScope, BridgeCapabilities, ExternalSkillProvider, ExternalToolSource, FileSystemProvider, HookRunner, InteractionRequest, InteractionResponse, LifecycleEventInit, LlmClient, NetworkPolicy, Page, PageQuery, RenderBlock, RenderResultRequest, RunSnapshot, RunSnapshotListEntry, ScriptExecutor, SessionStore, SkillCatalogEntry, SkillIntegrityGuard, SkillOutcomeReporter, SkillStateGuard, UiBridge, UiSpecDrafts, UiSpecEvent, UiSpecSnapshot, UiSurfaceActionRequest, UiSurfaceActionResponse } from "@webskill/sdk";
2
+ import { SandboxMode, TypeScriptSupportOptions } from "@webskill/sdk/browser";
3
+ import { CustomSurfaceActionEvent, ReactBridgeState, SpecInteractionChannel, SurfaceRegistry, UiSurfaceActionEvent } from "@webskill/sdk/ui-react";
4
+ import { PagePerceptionPolicy, PerceptionRecord, SkillCandidateSink, TodoItem } from "@webskill/sdk/agent";
5
5
  import "react";
6
6
  import "react/jsx-runtime";
7
7
  //#region ../ui-kit/src/i18n/types.d.ts
8
+ /** @stable */
8
9
  type Locale = 'zh' | 'en';
9
10
  /** 单语言词条:key → 文案(支持 {name} 占位插值) */
10
11
  type LocaleMessages = Record<string, string>;
@@ -60,6 +61,12 @@ interface RuntimeInteractionConfig {
60
61
  approvalScope: ApprovalScope$1;
61
62
  }
62
63
  type RuntimeRouterStrategy = 'progressive' | 'full-disclosure';
64
+ /** 生命周期钩子执行策略(`HookRunnerOptions` 的可配置部分) */
65
+ interface RuntimeHooksConfig {
66
+ timeoutMs: number;
67
+ /** true 时钩子异常终止 run;缺省隔离为 warning */
68
+ failOnHookError: boolean;
69
+ }
63
70
  /** 浏览器宿主执行器档位;Node 宿主的 in-process/worker/process 由宿主侧扩展展示 */
64
71
  type RuntimeSandboxExecutor = 'auto' | 'blob-worker' | 'iframe-sandbox';
65
72
  interface RuntimeSandboxConfig {
@@ -70,26 +77,97 @@ interface RuntimeSandboxConfig {
70
77
  writeArtifact: CapabilityMode;
71
78
  confirm: CapabilityMode;
72
79
  };
80
+ /**
81
+ * 出站 URL 准入策略(`RemoteUrlPolicy` 的可配置部分):技能安装、MCP 端点连接
82
+ * 这类由宿主发起的取数都按它判定。两项都默认关,即 https-only 且拒绝内网/环回。
83
+ */
84
+ remoteUrl: RuntimeRemoteUrlConfig;
85
+ /** 浏览器沙箱的 TypeScript 支持;关闭时 `.ts` 脚本按 `TOOL_UNSUPPORTED` 拒绝 */
86
+ typescript: RuntimeTypeScriptConfig;
87
+ }
88
+ /**
89
+ * 只做类型擦除,不做类型检查。`esbuildUrl` 为绝对 http(s) 地址时按 `remoteUrl` 判定;
90
+ * 同源相对路径与打包器 specifier 不属于出站请求,不参与判定。
91
+ */
92
+ interface RuntimeTypeScriptConfig {
93
+ enabled: boolean;
94
+ /** esbuild-wasm 的 JS 入口地址;enabled 时必填 */
95
+ esbuildUrl?: string;
96
+ /** esbuild.wasm 二进制地址;缺省由 esbuild 自行推导 */
97
+ wasmUrl?: string;
98
+ }
99
+ /** 与 `@webskill/core` 的 `RemoteUrlPolicy` 同形,但两个字段都是必填(配置需要确定值) */
100
+ interface RuntimeRemoteUrlConfig {
101
+ allowHttp: boolean;
102
+ allowPrivateHosts: boolean;
73
103
  }
74
- type RuntimeLlmProvider = 'openai-compatible' | 'anthropic' | 'google';
75
- interface RuntimeLlmConfig {
104
+ /** `chrome-builtin` 走浏览器 Prompt API,无端点与密钥;其余三档是云端 HTTP 协议 */
105
+ type RuntimeLlmProvider = 'openai-compatible' | 'anthropic' | 'google' | 'chrome-builtin';
106
+ /**
107
+ * 单个模型条目。`id` 稳定,会话记录与消息归属存的是它,用户改名不影响历史;
108
+ * `label` 只用于展示——同一个 `model` 可能配了两个不同的 `baseUrl`(公司代理与直连),
109
+ * 光看 `model` 区分不出来。
110
+ */
111
+ interface RuntimeLlmEntry {
112
+ id: string;
113
+ label: string;
76
114
  provider: RuntimeLlmProvider;
77
115
  baseUrl?: string;
78
116
  apiKey?: string;
79
117
  model: string;
80
118
  requestTimeoutMs?: number;
81
119
  }
120
+ /** 模型列表 + 默认项。`defaultId` 由 `mergeRuntimeConfigDefaults` 归一到真实存在的条目 */
121
+ interface RuntimeLlmSelection {
122
+ entries: readonly RuntimeLlmEntry[];
123
+ defaultId?: string;
124
+ }
125
+ /**
126
+ * Agent 能力开关(0.5.0)。默认值逐项经需求评审确定,不适用「新能力一律默认关」的通则。
127
+ * `todo`:待办清单,默认**开启**——不引入新攻击面、提示词体积远小于生成式 UI catalog,
128
+ * 且关闭时多步任务体验明显更差。
129
+ * `skillGeneration`:技能自动生成,默认**关闭**——会把对话内容写进持久化的候选,
130
+ * 属于新增攻击面(AC-G7 判据一)。
131
+ * `generativeUi`:生成式 UI,默认**关闭**——catalog 描述约 14 KB 计入每次请求。
132
+ * `formAutofill`:跨会话表单自动填充,默认**关闭**(FR-5.10)——会把用户亲手填的内容
133
+ * (可能是手机号、地址)跨会话持久化,属新增攻击面。
134
+ * `uiPresets`:开放给模型的场景预设,默认全开——预设本体按需加载,
135
+ * 只有名字与一行摘要计入请求;置空列表等于完全关闭预设。
136
+ */
137
+ interface RuntimeAgentCapabilitiesConfig {
138
+ todo: boolean;
139
+ skillGeneration: boolean;
140
+ generativeUi: boolean;
141
+ formAutofill: boolean;
142
+ /** 串行委派(FR-11.8):默认关。一句话可能展开成多个子 run,调用量对用户不可预期 */
143
+ delegation: boolean;
144
+ uiPresets: string[];
145
+ }
146
+ /**
147
+ * 未签名技能的处置策略(与 core 的 `UnsignedPolicy` 同形,配置层独立命名)。
148
+ * 默认 `'warn'` 由需求评审定下(FR-1.2):`deny` 会让现存未签名技能立即不可用,
149
+ * 且默认信任库为空时接受集为空;`allow` 等于策略不存在。
150
+ */
151
+ type UnsignedSkillPolicy = 'allow' | 'warn' | 'deny';
152
+ interface RuntimeSecurityConfig {
153
+ unsignedSkills: UnsignedSkillPolicy;
154
+ }
155
+ /** @experimental */
82
156
  interface RuntimeConfig {
83
157
  loop: RuntimeLoopConfig;
84
158
  interaction: RuntimeInteractionConfig;
85
159
  router: {
86
160
  strategy: RuntimeRouterStrategy;
87
161
  };
162
+ hooks: RuntimeHooksConfig;
88
163
  streaming: boolean;
89
164
  renderResult: boolean;
90
165
  sandbox: RuntimeSandboxConfig;
91
- llm: RuntimeLlmConfig;
166
+ llm: RuntimeLlmSelection;
167
+ agentCapabilities: RuntimeAgentCapabilitiesConfig;
168
+ security: RuntimeSecurityConfig;
92
169
  }
170
+ /** @experimental */
93
171
  interface RuntimeConfigStore {
94
172
  /**
95
173
  * Loads the runtime configuration. Implementations SHOULD return a complete
@@ -102,20 +180,79 @@ interface RuntimeConfigStore {
102
180
  reset(): Promise<void>;
103
181
  }
104
182
  //#endregion
183
+ //#region ../ui-kit/src/runtime-config/preferences.d.ts
184
+ /** 导出结构的版本;导入时逐字校验,不做向前兼容猜测 */
185
+ declare const PREFERENCE_EXPORT_VERSION = 1;
186
+ /**
187
+ * 模型条目的可导出形态。`Omit<RuntimeLlmEntry, 'apiKey'>` 让**编译期**就放不进密钥——
188
+ * 靠「序列化时记得删」依赖开发者不忘记,靠类型则依赖编译器(FR-5.2)。
189
+ * @experimental
190
+ */
191
+ type PreferenceLlmEntry = Omit<RuntimeLlmEntry, 'apiKey'>;
192
+ /** 宿主自己持有的外观状态(不在 `RuntimeConfig` 里,由调用方传入) @experimental */
193
+ interface PreferenceAppearance {
194
+ theme?: string;
195
+ locale?: string;
196
+ renderer?: string;
197
+ }
198
+ /** @experimental */
199
+ interface PreferenceExport {
200
+ version: typeof PREFERENCE_EXPORT_VERSION;
201
+ exportedAt: string;
202
+ preferences: {
203
+ appearance?: PreferenceAppearance;
204
+ interaction?: {
205
+ missingParams?: string;
206
+ confirmations?: string;
207
+ };
208
+ models?: readonly PreferenceLlmEntry[];
209
+ agentCapabilities?: {
210
+ todo?: boolean;
211
+ skillGeneration?: boolean;
212
+ generativeUi?: boolean;
213
+ formAutofill?: boolean;
214
+ delegation?: boolean;
215
+ uiPresets?: string[];
216
+ };
217
+ };
218
+ }
219
+ //#endregion
105
220
  //#region src/core/types.d.ts
221
+ /**
222
+ * 治理 port 集合(F1):宿主把 `SkillStatePolicy` 的适配器交给 chatbot,
223
+ * 由它接到内部装配的 `WebSkillRuntime` 上。字段名与 `WebSkillRuntimeDeps` 逐个对齐,
224
+ * 不做重命名:中间多一层映射只会让宿主多记一套名字。
225
+ * @experimental
226
+ */
227
+ interface ChatbotGovernancePorts {
228
+ /** `SkillStatePolicy.toSkillStateGuard()`:read/activate/execute 三入口拦截 */
229
+ skillStateGuard?: SkillStateGuard;
230
+ /** `SkillStatePolicy.toSkillIntegrityGuard(verify)`:激活期验签,失败即隔离 */
231
+ skillIntegrityGuard?: SkillIntegrityGuard;
232
+ /** `SkillStatePolicy.toSkillOutcomeReporter()`:执行失败计数,达阈值即隔离 */
233
+ skillOutcomeReporter?: SkillOutcomeReporter;
234
+ /** `SkillStatePolicy.catalogFilter()`:非 active 技能不进路由候选集 */
235
+ catalogFilter?: (entries: SkillCatalogEntry[]) => SkillCatalogEntry[] | Promise<SkillCatalogEntry[]>;
236
+ }
237
+ /** 分配式交叉:直接写 `信封 & LifecycleEventInit` 会把联合压成一个对象,`phase` 的判别性就没了 */
238
+ type WithChatMeta<T> = T extends unknown ? {
239
+ type: 'lifecycle';
240
+ runId: string;
241
+ at: number;
242
+ } & T : never;
243
+ /**
244
+ * 生命周期步进事件:`data` 随 `phase` 判别,与 runtime 的 `LifecycleEvent` 同一套契约。
245
+ * 旧的 `Record<string, unknown>` 等于没有契约:消费方只能硬编码键名。
246
+ */
247
+ type LifecycleChatEvent = WithChatMeta<LifecycleEventInit>;
106
248
  /**
107
249
  * 交互渲染框架档位:native(React InteractionCard)/ a2ui(@a2ui/lit Lit 渲染)/
108
- * openui(@openuidev/react-lang Renderer,ui-kit Library)/ vercel(payload 预览档,
109
- * 展示 Vercel AI SDK 数据契约 JSON,非完整运行时)
250
+ * openui(@openuidev/react-lang Renderer,ui-kit Library)/ vercel(@json-render/react
251
+ * Registry 渲染 catalog 声明树)
252
+ * @experimental
110
253
  */
111
254
  type RendererKind = 'native' | 'a2ui' | 'openui' | 'vercel';
112
- /** OpenAI 兼容端点配置(全部缺省时使用内置演示 LLM) */
113
- interface LlmConfig {
114
- baseUrl?: string;
115
- apiKey?: string;
116
- model?: string;
117
- }
118
- /** assistant 消息所属 run 的一次工具调用(终态:completed/failed) */
255
+ /** assistant 消息所属 run 的一次工具调用(终态:completed/failed@stable */
119
256
  interface ChatToolCall {
120
257
  callId: string;
121
258
  name: string;
@@ -124,8 +261,15 @@ interface ChatToolCall {
124
261
  args?: string;
125
262
  /** 执行耗时(trace completed/failed 回填;live 由 started→终态计时) */
126
263
  durationMs?: number;
264
+ /**
265
+ * failed 时的结构化错误码(如 `TOOL_NOT_ALLOWED`)。
266
+ * 「被策略拒绝」与「执行失败」在 UI 上是两回事,靠错误码区分而不是解析文案。
267
+ */
268
+ errorCode?: string;
269
+ /** failed 时的错误说明(拒绝时即「被哪条策略拒绝」) */
270
+ errorMessage?: string;
127
271
  }
128
- /** 已落盘的待发送附件(composer 附件适配器产出) */
272
+ /** 已落盘的待发送附件(composer 附件适配器产出) @experimental */
129
273
  interface ChatAttachmentInput {
130
274
  id: string;
131
275
  name: string;
@@ -134,11 +278,12 @@ interface ChatAttachmentInput {
134
278
  path: string;
135
279
  size: number;
136
280
  }
137
- /** 随消息持久化的附件元数据 */
281
+ /** 随消息持久化的附件元数据 @experimental */
138
282
  interface ChatAttachmentMeta extends ChatAttachmentInput {
139
283
  /** 注入模型的内容形态;text 以外的类型当前不接收(runtime 只收纯文本 prompt) */
140
284
  kind: 'text';
141
285
  }
286
+ /** @stable */
142
287
  interface ChatMessage {
143
288
  id: string;
144
289
  role: 'user' | 'assistant';
@@ -158,8 +303,22 @@ interface ChatMessage {
158
303
  */
159
304
  blocks?: RenderBlock[];
160
305
  /** The completed generative UI surfaces emitted by this run, retained for history replay. */
161
- surfaces?: UiSurfaceSnapshot[];
306
+ surfaces?: UiSpecSnapshot[];
307
+ /** 该 run 的待办清单终态(历史消息重放;未产生清单时缺省) */
308
+ todos?: TodoItem[];
309
+ /**
310
+ * 该 run 内发生的页面只读感知(需求 10 FR-10.5)。
311
+ * 随消息持久化而不只在运行中闪现——事后仍能查到「那一次它读了哪些区域」。
312
+ * @experimental
313
+ */
314
+ perceptions?: PerceptionRecord[];
315
+ /**
316
+ * 发出本轮请求的模型条目 id(`RuntimeConfig.llm.entries[].id`)。
317
+ * 写在消息上而不是会话上:切换模型只对后续消息生效,已有消息的归属不能被改写。
318
+ */
319
+ model?: string;
162
320
  }
321
+ /** @stable */
163
322
  interface ChatSessionMeta {
164
323
  id: string;
165
324
  createdAt: string;
@@ -169,6 +328,7 @@ interface ChatSessionMeta {
169
328
  /** 用户已手动重命名:后续 send 不再用首条消息覆盖标题 */
170
329
  titleLocked?: boolean;
171
330
  }
331
+ /** @stable */
172
332
  type ChatEvent = {
173
333
  type: 'run-started';
174
334
  runId: string;
@@ -201,12 +361,21 @@ type ChatEvent = {
201
361
  callId: string;
202
362
  name: string;
203
363
  args?: string;
364
+ errorCode?: string;
204
365
  } | {
205
366
  type: 'run-completed';
206
367
  runId: string;
207
368
  status: 'completed' | 'failed' | 'cancelled';
208
369
  output: string;
209
370
  activeSkillNames: string[];
371
+ } | {
372
+ type: 'todo-changed';
373
+ runId: string;
374
+ items: readonly TodoItem[];
375
+ } | {
376
+ type: 'page-perceived';
377
+ runId: string;
378
+ record: PerceptionRecord;
210
379
  } | {
211
380
  type: 'interaction-requested';
212
381
  id: string;
@@ -216,13 +385,7 @@ type ChatEvent = {
216
385
  id: string;
217
386
  requestType: InteractionRequest['type'];
218
387
  cancelled?: boolean;
219
- } | {
220
- type: 'lifecycle';
221
- runId: string;
222
- phase: RuntimePhase;
223
- at: number;
224
- data?: Record<string, unknown>;
225
- } | {
388
+ } | LifecycleChatEvent | {
226
389
  type: 'session-updated';
227
390
  session: ChatSessionMeta;
228
391
  } | {
@@ -233,6 +396,7 @@ type ChatEvent = {
233
396
  message: string;
234
397
  code?: string;
235
398
  };
399
+ /** @stable */
236
400
  interface ChatbotConfig {
237
401
  /** header 标题,默认 'WebSkill Chat' */
238
402
  title?: string;
@@ -240,7 +404,7 @@ interface ChatbotConfig {
240
404
  placeholder?: string;
241
405
  /** 会话/trace/artifact 存储根,默认 '/chat' */
242
406
  chatRoot?: string;
243
- /** 覆盖 LLM(缺省走 adapter.llmConfig → 内置演示 LLM 的选择链) */
407
+ /** 覆盖 LLM(缺省走 `RuntimeConfig.llm` → 内置演示 LLM 的选择链) */
244
408
  llm?: LlmClient;
245
409
  /** AgentLoop 调参(maxTurns、超时等) */
246
410
  loopConfig?: AgentLoopConfig;
@@ -254,23 +418,36 @@ interface ChatbotConfig {
254
418
  /**
255
419
  * 开启后模型多一个 `render_ui` 工具,可面向 AI Component Catalog 直接生成声明式 UI。
256
420
  * 默认关:工具描述 + 入参 schema 约 14 KB,会计入每一次请求。
421
+ *
422
+ * 接了 `runtimeConfig` 时以 `RuntimeConfig.agentCapabilities.generativeUi` 为准
423
+ * (设置抽屉里的开关就是它),本字段只在未接配置存储的宿主上生效。
257
424
  */
258
425
  generativeUi?: boolean;
426
+ /** 宿主注册好钩子的 `HookRunner`;执行策略(超时/严格模式)按 `RuntimeConfig.hooks` 应用 */
427
+ hooks?: HookRunner;
428
+ /**
429
+ * 治理 port 注入(F1):透传给 `ChatEngineOptions.governance`。
430
+ * 不注入即完全关闭,行为与 0.0.2 一致。
431
+ */
432
+ governance?: ChatbotGovernancePorts;
433
+ /**
434
+ * 技能自动生成的候选收货端(需求 9):透传给 `ChatEngineOptions.skillCandidates`。
435
+ * 开关只决定工具进不进列表,候选往哪存由宙主注入;不注入时工具返回
436
+ * `SKILL_GENERATION_DISABLED`,不弹确认框、不产生候选。
437
+ */
438
+ skillCandidates?: SkillCandidateSink;
259
439
  }
260
440
  //#endregion
261
441
  //#region src/core/hostAdapter.d.ts
262
442
  /**
263
443
  * 宿主装配口:chatbot 不感知环境(浏览器/Node),全部能力经此注入。
264
444
  * 页面动态技能来源同时是外部工具来源与外部技能提供者(同一对象两个 port)。
445
+ * LLM 配置不在这里——它统一由 `RuntimeConfigStore` 承载(0.5.0 起)。
446
+ * @stable
265
447
  */
266
448
  interface ChatbotHostAdapter {
267
449
  storage: FileSystemProvider;
268
450
  skillRoots: string[];
269
- llmConfig: {
270
- load(): Promise<LlmConfig | undefined>;
271
- save(config: LlmConfig): Promise<void>;
272
- clear(): Promise<void>;
273
- };
274
451
  pageSkillSource?: ExternalToolSource & ExternalSkillProvider;
275
452
  navigation: {
276
453
  openConsole(): void;
@@ -279,94 +456,17 @@ interface ChatbotHostAdapter {
279
456
  };
280
457
  /** 缺省 BrowserWorkerScriptExecutor(@webskill/browser);Node 宿主可注入自己的执行器 */
281
458
  executor?: ScriptExecutor;
282
- }
283
- //#endregion
284
- //#region src/core/interactionBridge.d.ts
285
- /**
286
- * 探测 A2UI Lit 渲染器是否可用(@a2ui/lit 为 optional peer,未安装时 import 失败)。
287
- * Appearance/设置区据此对 A2UI 档置灰;仅动态 import,不强依赖。
288
- */
289
- declare function probeA2uiAvailability(): Promise<boolean>;
290
- /**
291
- * 为 A2UI 挂载容器配置 Markdown 渲染(@a2ui/markdown-it,optional peer):
292
- * 经 @lit/context 向 surface 子树注入 renderMarkdown(markdown-it + dompurify),
293
- * 消除 "[MarkdownDirective] can't render markdown" 降级。
294
- * 未安装时返回 false(宿主可据此保留产品化限制说明)。
295
- */
296
- declare function configureA2uiMarkdown(mount: HTMLElement): Promise<boolean>;
297
- /**
298
- * 探测 OpenUI 渲染器是否可用(@openuidev/react-lang 为 optional peer)。
299
- * Appearance/设置区据此对 OpenUI 档置灰;仅动态 import,不强依赖。
300
- */
301
- declare function probeOpenUiAvailability(): Promise<boolean>;
302
- /** openui 档一次待决交互(lang 文本由 react 层交给 @openuidev/react-lang Renderer 渲染) */
303
- interface OpenUiSession {
304
- request: InteractionRequest;
305
- lang: string;
306
- }
307
- /**
308
- * OpenUI 交互通道(core 层,不 import react):
309
- * - request() 把 InteractionRequest 转成 openui-lang 文本并挂起,react 层
310
- * (OpenUiInteraction)订阅 current 后动态加载 @openuidev/react-lang 渲染;
311
- * - 动作事件经 handleAction → fromOpenUiAction(含 authorize Allow/Deny 语义)回传;
312
- * - react 层初始化失败调 fail():挂起请求 reject(桥据此粘性降级 native)并记录原因;
313
- * - attach/detach 标记渲染视图是否挂载(未挂载时桥直接降级 native,不悬挂请求)。
314
- */
315
- declare class OpenUiChannel {
316
- #private;
317
- /** React useSyncExternalStore 兼容订阅 */
318
- subscribe: (listener: () => void) => (() => void);
319
- get current(): OpenUiSession | undefined;
320
- get isAttached(): boolean;
321
- /** react 层初始化失败原因(未安装 @openuidev/react-lang 等);记录后粘性生效 */
322
- get failure(): string | undefined;
323
- attach(): void;
324
- detach(): void;
325
- request(input: InteractionRequest): Promise<InteractionResponse>;
326
- /** runtime 交互超时/取消:以 cancelled resolve 挂起的 request(防悬挂 + 残留) */
327
- cancel(id: string): void;
328
- /** react 层 OpenUI 动作回传(fromOpenUiAction:Allow → value:true;Deny/Cancel → cancelled:true) */
329
- handleAction(action: unknown): void;
330
- /** react 层初始化失败:挂起请求 reject 并记录原因(桥读取后降级 native) */
331
- fail(message: string): void;
332
- }
333
- interface CompositeUiBridgeDeps {
334
- /** native 档交互 + streamingText/renderResult 数据源(始终生效;vercel 预览档也走它) */
335
- reactBridge: ReactBridgeState;
336
- getRenderer(): RendererKind;
337
- /** a2ui 档交互容器(Chatbot ref 回调注入;未挂载时 a2ui 请求降级 native) */
338
- getInteractionMount(): HTMLElement | undefined;
339
- /** openui 档交互通道(引擎持有;react 层 OpenUiInteraction attach 后生效) */
340
- getOpenUiChannel(): OpenUiChannel;
341
- emit(event: ChatEvent): void;
342
- }
343
- /**
344
- * 复合 UiBridge(P2/P3 渲染框架档):
345
- * - streamingText / renderResult 始终委托 ReactBridgeState(结果块数据源不变);
346
- * - 交互 request/cancel 按渲染档分发:native → ReactBridgeState(InteractionCard),
347
- * a2ui → LitRendererBridge(@a2ui/lit,容器由 Chatbot 提供),
348
- * openui → OpenUiChannel(@openuidev/react-lang Renderer 由 react 层装配),
349
- * vercel → ReactBridgeState(payload 预览卡消费 bridge.pending,仅可取消);
350
- * - 每次交互开始/结束发 interaction-requested/resolved 事件(UI 据此显隐 a2ui 容器);
351
- * - a2ui/openui 初始化失败(optional peer 未安装等)降级 native + warning 事件,不阻断 run。
352
- */
353
- declare class CompositeUiBridge implements UiBridge {
354
- #private;
355
- constructor(deps: CompositeUiBridgeDeps);
356
- /** 渲染档热切换:丢弃已建的 a2ui 桥与降级状态(新档立即生效,无需重装配 runtime) */
357
- reset(): void;
358
- request(input: InteractionRequest): Promise<InteractionResponse>;
359
- /** runtime 交互超时/取消:按档委托(a2ui/openui 桥 cancel 会以 cancelled resolve 挂起的 request) */
360
- cancel(id: string): void;
361
- renderResult(input: RenderResultRequest): Promise<void>;
362
- renderSurface(event: UiSurfaceEvent): Promise<void>;
363
- requestSurfaceAction(input: UiSurfaceActionRequest): Promise<UiSurfaceActionResponse>;
364
- cancelSurfaceAction(nonce: string): void;
365
- onTextDelta(runId: string, delta: string): Promise<void>;
459
+ /**
460
+ * 页面只读感知策略(需求 10)。**只能在这里注入**:启用与否是宿主侧配置,
461
+ * 设置抽屉里没有也不会有开关(FR-10.1)——风险由部署方承担,
462
+ * 不应交给终端用户随手勾选。
463
+ * @experimental
464
+ */
465
+ pagePerception?: PagePerceptionPolicy;
366
466
  }
367
467
  //#endregion
368
468
  //#region src/core/chatEngine.d.ts
369
- /** 默认沙箱执行器的构造参数(adapter.executor 未注入时;executorFactory 替换点可见同一形状) */
469
+ /** 默认沙箱执行器的构造参数(adapter.executor 未注入时;executorFactory 替换点可见同一形状) @stable */
370
470
  interface SandboxExecutorDeps {
371
471
  fs: FileSystemProvider;
372
472
  sandbox?: SandboxMode;
@@ -374,7 +474,10 @@ interface SandboxExecutorDeps {
374
474
  capabilities?: BridgeCapabilities;
375
475
  approvalScope?: ApprovalScope;
376
476
  uiBridge?: UiBridge;
477
+ /** 缺省时 `.ts` 脚本按 `TOOL_UNSUPPORTED` 拒绝 */
478
+ typescript?: TypeScriptSupportOptions;
377
479
  }
480
+ /** @stable */
378
481
  interface ChatEngineOptions {
379
482
  llm?: LlmClient;
380
483
  loopConfig?: AgentLoopConfig;
@@ -383,27 +486,68 @@ interface ChatEngineOptions {
383
486
  runtimeConfig?: RuntimeConfigStore;
384
487
  /** 初始渲染框架档(默认 'native';运行中可 setRenderer 热切换) */
385
488
  renderer?: RendererKind;
386
- /** 注入 `render_ui` 工具,让模型面向 AI Component Catalog 生成声明式 UI */
489
+ /**
490
+ * 注入 `render_ui` 工具,让模型面向 AI Component Catalog 生成声明式 UI。
491
+ *
492
+ * 注入了 `runtimeConfig` 时**以 `RuntimeConfig.agentCapabilities.generativeUi` 为准**,
493
+ * 本字段只在未接配置存储的宿主上生效(否则设置面板里的开关点了不算数)。
494
+ */
387
495
  generativeUi?: boolean;
388
496
  /** 沙箱执行器替换点(测试注入 spy 断言构造参数;缺省 BrowserWorkerScriptExecutor) */
389
497
  executorFactory?: (deps: SandboxExecutorDeps) => ScriptExecutor;
498
+ /**
499
+ * 会话落盘替换点(缺省 `FsSessionStore`,落在 `<chatRoot>/sessions`)。
500
+ * 宕主换自己的实现(如 IndexedDB)与测试统计端口读写量都走这里。
501
+ */
502
+ sessionStore?: SessionStore<ChatMessage>;
503
+ /**
504
+ * 宿主已注册好钩子的执行器;装配时把 `RuntimeConfig.hooks` 应用到它再交给 runtime。
505
+ * 不注入即不挂钩子(与 0.0.2 行为一致)。
506
+ */
507
+ hooks?: HookRunner;
508
+ /**
509
+ * 治理 port 注入(F1):把 `SkillStatePolicy` 的三个适配器接到本引擎装配的 runtime 上。
510
+ *
511
+ * 不注入即完全关闭,行为与 0.0.2 一致。装配点必须在宿主:chatbot 不能依赖
512
+ * `@webskill/governance`(它是可选治理层,且要求宿主提供治理根与审计存储)。
513
+ *
514
+ * 三个一起给才形成闭环——只给 `skillOutcomeReporter` 会把技能标成 `quarantined`
515
+ * 却仍旧照常路由和执行,降级形同虚设。
516
+ */
517
+ governance?: ChatbotGovernancePorts;
518
+ /**
519
+ * 技能自动生成的候选收货端(需求 12 号)。与 `governance` 同理,装配点在宿主:
520
+ * `@webskill/governance` 的 `createCandidateSink()` 是现成实现。
521
+ *
522
+ * 开关另在 `RuntimeConfig.agentCapabilities.skillGeneration`(默认关);
523
+ * 开关开但未注入本端口时,工具会把 `SKILL_GENERATION_DISABLED` 回给模型。
524
+ */
525
+ skillCandidates?: SkillCandidateSink;
390
526
  }
391
527
  /**
392
528
  * 对话框引擎:装配 WebSkillRuntime + 会话持久化 + 事件分发。
393
- * llmConfig.load() 是异步的,runtime 在首次 send 前懒装配(#ensureReady)。
529
+ * RuntimeConfig 的 load() 是异步的,runtime 在首次 send 前懒装配(#ensureReady)。
530
+ * @stable
394
531
  */
395
532
  declare class ChatEngine {
396
533
  #private;
397
534
  readonly bridge: ReactBridgeState;
398
535
  constructor(adapter: ChatbotHostAdapter, options?: ChatEngineOptions);
536
+ /** 当前待办清单快照(宿主可直读;实时更新订阅 `todo-changed` 事件) */
537
+ get todos(): readonly TodoItem[];
399
538
  /** 当前渲染框架档 */
400
539
  get renderer(): RendererKind;
540
+ /** 当前会话选中的模型条目 id;未显式切换过时为 undefined(走 `RuntimeConfig.llm.defaultId`) */
541
+ get modelId(): string | undefined;
542
+ /**
543
+ * 切换本会话后续消息使用的模型条目(需求 4)。传 `undefined` 回到配置里的默认项。
544
+ * 重装配 runtime 以换掉客户端;已落盘的消息不受影响。
545
+ */
546
+ setModel(entryId: string | undefined): void;
401
547
  /** 渲染框架热切换:复合桥按档分发,无需重装配 runtime(会话句柄保留) */
402
548
  setRenderer(renderer: RendererKind): void;
403
- /** a2ui 档交互容器注入(Chatbot ref 回调;卸载传 null) */
404
- setInteractionMount(el: HTMLElement | null): void;
405
- /** openui 档交互通道(Chatbot 的 OpenUiInteraction 订阅/attach;core 只产出 lang 文本) */
406
- get openUiChannel(): OpenUiChannel;
549
+ /** native 三档共用的交互通道(Chatbot SpecInteraction 订阅/attach;core 只产出 catalog 节点树) */
550
+ get interactionChannel(): SpecInteractionChannel;
407
551
  /** 探测 @a2ui/lit 是否安装(Appearance/设置区 A2UI 档置灰判定) */
408
552
  probeA2uiAvailability(): Promise<boolean>;
409
553
  onEvent(listener: (event: ChatEvent) => void): () => void;
@@ -412,11 +556,21 @@ declare class ChatEngine {
412
556
  * runtime/llm/会话句柄,下次 send 重新装配(RuntimeConfig 重新 load() 应用)
413
557
  */
414
558
  reloadConfig(): void;
415
- /** 旧名保留(与 reloadConfig 同语义,向后兼容) */
416
- reloadLlm(): void;
417
- listSessions(): Promise<ChatSessionMeta[]>;
559
+ /**
560
+ * 会话列表页。归档会话也返回:UI 自己分区展示。
561
+ * `limit` 不给默认值——缺省属于 `SessionStore` 实现,在这里兜底就等于只下推了一半。
562
+ */
563
+ listSessions(options?: PageQuery): Promise<Page<ChatSessionMeta>>;
418
564
  createSession(): Promise<ChatSessionMeta>;
419
- selectSession(id: string): Promise<ChatMessage[]>;
565
+ /**
566
+ * 选中会话并取**最新**一页历史(页内时间升序)。
567
+ * 返回全量 `ChatMessage[]` 的旧签名已移除:长会话下它强迫每个调用方拿全量。
568
+ */
569
+ selectSession(id: string, options?: PageQuery): Promise<Page<ChatMessage>>;
570
+ /** 向历史方向再取一页;`cursor` 只能来自上一页的 `nextCursor` */
571
+ loadMoreMessages(cursor: string, options?: {
572
+ limit?: number;
573
+ }): Promise<Page<ChatMessage>>;
420
574
  deleteSession(id: string): Promise<void>;
421
575
  /** 重命名会话:写入 title 并锁定(后续 send 不再用首条消息覆盖) */
422
576
  renameSession(id: string, title: string): Promise<void>;
@@ -443,13 +597,92 @@ declare class ChatEngine {
443
597
  get attachmentsRoot(): string;
444
598
  /** 取消进行中的 run(Composer Stop 按钮);run 未找到/已结束返回 false */
445
599
  cancel(runId: string): boolean;
446
- /** 列出可恢复的 interrupted run(InterruptedBanner 数据源) */
447
- listInterrupted(): Promise<RunSnapshot$1[]>;
600
+ /** 列出 interrupted run(InterruptedBanner 数据源);版本不受支持的项带 unsupported 标记 */
601
+ listInterrupted(): Promise<RunSnapshotListEntry[]>;
448
602
  /**
449
603
  * 恢复 interrupted run:等待中的交互重新进入 bridge.pending(UI 复用 InteractionForm),
450
604
  * 完成后与 send 同路径(assistant 消息持久化 + run-completed + trace 落盘)。
451
605
  */
452
606
  resume(runId: string): Promise<void>;
607
+ /**
608
+ * 清除跨会话表单填写历史(FR-5.11)。不传 `fieldKey` 即整体清空。
609
+ * 与开关分开:关掉开关只是停止召回,用户往往还想把已存的内容删干净。
610
+ * @experimental
611
+ */
612
+ clearFormAutofill(fieldKey?: string): Promise<void>;
613
+ }
614
+ //#endregion
615
+ //#region src/core/interactionBridge.d.ts
616
+ /** 单个渲染档的能力集(复合桥判定该不该回落 native 的唯一数据源) @experimental */
617
+ interface RendererCapability {
618
+ /** 路径 A:runtime 发起的交互请求能否在本档内渲染 */
619
+ interaction: boolean;
620
+ /** 路径 B:模型产出的 surface 能否在本档内渲染 */
621
+ surface: boolean;
622
+ /** 本档依赖的 optional peer 包名(未安装 → 粘性降级 native) */
623
+ requiresPeer?: string;
624
+ }
625
+ /**
626
+ * 渲染档 → 能力集。四档在 0.4.0 起 interaction/surface 全部等价,
627
+ * 差别只剩「是否依赖 optional peer」。作为可注入值传入 CompositeUiBridge,
628
+ * 便于宿主按实际装配情况覆盖(例如已确认某 peer 不可用)。
629
+ * @experimental
630
+ */
631
+ declare const DEFAULT_RENDERER_CAPABILITIES: Readonly<Record<RendererKind, RendererCapability>>;
632
+ /**
633
+ * 探测 A2UI Lit 渲染器是否可用(@a2ui/lit 为 optional peer,未安装时 import 失败)。
634
+ * Appearance/设置区据此对 A2UI 档置灰;仅动态 import,不强依赖。
635
+ * @experimental
636
+ */
637
+ declare function probeA2uiAvailability(): Promise<boolean>;
638
+ /**
639
+ * 为 A2UI 挂载容器配置 Markdown 渲染(@a2ui/markdown-it,optional peer):
640
+ * 经 @lit/context 向 surface 子树注入 renderMarkdown(markdown-it + dompurify),
641
+ * 消除 "[MarkdownDirective] can't render markdown" 降级。
642
+ * 未安装时返回 false(宿主可据此保留产品化限制说明)。
643
+ * @experimental
644
+ */
645
+ declare function configureA2uiMarkdown(mount: HTMLElement): Promise<boolean>;
646
+ /**
647
+ * 探测 OpenUI 渲染器是否可用(@openuidev/react-lang 为 optional peer)。
648
+ * Appearance/设置区据此对 OpenUI 档置灰;仅动态 import,不强依赖。
649
+ * @experimental
650
+ */
651
+ declare function probeOpenUiAvailability(): Promise<boolean>;
652
+ /** @stable */
653
+ interface CompositeUiBridgeDeps {
654
+ /** native 档交互 + streamingText/renderResult 数据源(始终生效,也是各档降级后的接管方) */
655
+ reactBridge: ReactBridgeState;
656
+ getRenderer(): RendererKind;
657
+ /** 非 native 三档共用的交互通道(引擎持有;本档交互视图 attach 后生效) */
658
+ getInteractionChannel(): SpecInteractionChannel;
659
+ /** 渲染档能力表(省略用 DEFAULT_RENDERER_CAPABILITIES) */
660
+ capabilities?: Readonly<Record<RendererKind, RendererCapability>>;
661
+ emit(event: ChatEvent): void;
662
+ }
663
+ /**
664
+ * 复合 UiBridge(P2/P3 渲染框架档):
665
+ * - streamingText / renderResult 始终委托 ReactBridgeState(结果块数据源不变);
666
+ * - 交互 request/cancel 按渲染档分发:native → ReactBridgeState(InteractionCard),
667
+ * 其余三档 → SpecInteractionChannel(core 产出 catalog 节点树,react 层交给本档
668
+ * 已有的 spec 渲染路径:A2uiSpecSurface / OpenUiSpecSurface / JsonRenderSpecSurface);
669
+ * - 每次交互开始/结束发 interaction-requested/resolved 事件;
670
+ * - 非 native 档初始化失败(optional peer 未安装等)降级 native + warning 事件,不阻断 run。
671
+ * @stable
672
+ */
673
+ declare class CompositeUiBridge implements UiBridge {
674
+ #private;
675
+ constructor(deps: CompositeUiBridgeDeps);
676
+ /** 渲染档热切换:清降级状态(新档立即生效,无需重装配 runtime) */
677
+ reset(): void;
678
+ request(input: InteractionRequest): Promise<InteractionResponse>;
679
+ /** runtime 交互超时/取消:按档委托(通道 cancel 会以 cancelled resolve 挂起的 request) */
680
+ cancel(id: string): void;
681
+ renderResult(input: RenderResultRequest): Promise<void>;
682
+ renderSurface(event: UiSpecEvent): Promise<void>;
683
+ requestSurfaceAction(input: UiSurfaceActionRequest): Promise<UiSurfaceActionResponse>;
684
+ cancelSurfaceAction(nonce: string): void;
685
+ onTextDelta(runId: string, delta: string): Promise<void>;
453
686
  }
454
687
  //#endregion
455
688
  //#region src/i18n.d.ts
@@ -457,6 +690,7 @@ declare class ChatEngine {
457
690
  * chatbot 双语字典:全部 UI 文案的单一来源(英文为主,zh 条目齐全)。
458
691
  * 特性区块(WelcomeScreen / SettingsDrawer 各节 / authorize 说明等)必须含
459
692
  * title + description 双语条目——"会说话的 UI"的文案底座。
693
+ * @stable
460
694
  */
461
695
  declare const chatbotDictionary: {
462
696
  en: {
@@ -469,6 +703,14 @@ declare const chatbotDictionary: {
469
703
  'session.searchPlaceholder': string;
470
704
  'session.empty': string;
471
705
  'session.delete': string;
706
+ 'session.rename': string;
707
+ 'session.renameInput': string;
708
+ 'session.archive': string;
709
+ 'session.unarchive': string;
710
+ 'session.archived': string;
711
+ 'session.loadEarlier': string;
712
+ 'session.loading': string;
713
+ 'message.loadEarlier': string;
472
714
  'welcome.title': string;
473
715
  'welcome.assistantTitle': string;
474
716
  'welcome.description': string;
@@ -494,8 +736,11 @@ declare const chatbotDictionary: {
494
736
  'tool.status.running': string;
495
737
  'tool.status.completed': string;
496
738
  'tool.status.failed': string;
739
+ 'tool.status.denied': string;
497
740
  'tool.duration': string;
498
741
  'tool.args': string;
742
+ 'tool.denied.reason': string;
743
+ 'tool.failed.reason': string;
499
744
  'cot.thinking': string;
500
745
  'cot.thought': string;
501
746
  'cot.summary': string;
@@ -503,12 +748,20 @@ declare const chatbotDictionary: {
503
748
  'cot.working': string;
504
749
  'trace.title': string;
505
750
  'trace.skill': string;
751
+ 'perception.reading': string;
752
+ 'perception.excluded': string;
506
753
  'trace.phase.route': string;
507
754
  'trace.phase.activate': string;
508
755
  'trace.phase.execute': string;
509
756
  'trace.phase.interact': string;
510
757
  'trace.phase.complete': string;
511
758
  'trace.phase.fail': string;
759
+ 'todo.title': string;
760
+ 'todo.progress': string;
761
+ 'todo.status.pending': string;
762
+ 'todo.status.inProgress': string;
763
+ 'todo.status.completed': string;
764
+ 'todo.delegatedTo': string;
512
765
  'interaction.ask.title': string;
513
766
  'interaction.confirm.title': string;
514
767
  'interaction.form.title': string;
@@ -517,6 +770,7 @@ declare const chatbotDictionary: {
517
770
  'interaction.authorize.description': string;
518
771
  'interaction.authorize.capability': string;
519
772
  'interaction.authorize.details': string;
773
+ 'interaction.origin': string;
520
774
  'interaction.submit': string;
521
775
  'interaction.cancel': string;
522
776
  'interaction.confirm': string;
@@ -544,14 +798,37 @@ declare const chatbotDictionary: {
544
798
  'composer.attachments': string;
545
799
  'composer.addAttachment': string;
546
800
  'composer.removeAttachment': string;
801
+ 'composer.model': string;
802
+ 'composer.model.demo': string;
803
+ 'composer.dictate': string;
804
+ 'composer.dictate.stop': string;
805
+ 'composer.dictate.recording': string;
806
+ 'composer.dictate.api-missing': string;
807
+ 'composer.dictate.insecure-context': string;
547
808
  'settings.title': string;
548
809
  'settings.model.title': string;
549
810
  'settings.model.description': string;
811
+ 'settings.model.empty': string;
812
+ 'settings.model.add': string;
813
+ 'settings.model.edit': string;
814
+ 'settings.model.remove': string;
815
+ 'settings.model.setDefault': string;
816
+ 'settings.model.default': string;
817
+ 'settings.model.label': string;
818
+ 'settings.model.labelNote': string;
819
+ 'settings.model.unavailable': string;
820
+ 'settings.model.cancel': string;
550
821
  'settings.provider': string;
551
822
  'settings.providerNote': string;
552
823
  'settings.provider.openai-compatible': string;
553
824
  'settings.provider.anthropic': string;
554
825
  'settings.provider.google': string;
826
+ 'settings.provider.chrome-builtin': string;
827
+ 'settings.provider.chrome-builtin.note': string;
828
+ 'settings.provider.chrome-builtin.limitation': string;
829
+ 'settings.chromeBuiltin.api-missing': string;
830
+ 'settings.chromeBuiltin.model-not-ready': string;
831
+ 'settings.chromeBuiltin.unsupported-browser': string;
555
832
  'settings.provider.anthropic.note': string;
556
833
  'settings.provider.google.note': string;
557
834
  'settings.endpoint': string;
@@ -571,6 +848,30 @@ declare const chatbotDictionary: {
571
848
  'settings.demoNote': string;
572
849
  'settings.save': string;
573
850
  'settings.clear': string;
851
+ 'settings.agent.title': string;
852
+ 'settings.agent.description': string;
853
+ 'settings.agent.todo': string;
854
+ 'settings.agent.todoNote': string;
855
+ 'settings.agent.generativeUi': string;
856
+ 'settings.agent.generativeUiNote': string;
857
+ 'settings.agent.skillGeneration': string;
858
+ 'settings.agent.skillGenerationNote': string;
859
+ 'settings.agent.delegation': string;
860
+ 'settings.agent.delegationNote': string;
861
+ 'settings.agent.formAutofill': string;
862
+ 'settings.agent.formAutofillNote': string;
863
+ 'settings.agent.formAutofillClear': string;
864
+ 'settings.agent.formAutofillCleared': string;
865
+ 'settings.preferences.title': string;
866
+ 'settings.preferences.description': string;
867
+ 'settings.preferences.export': string;
868
+ 'settings.preferences.import': string;
869
+ 'settings.preferences.exported': string;
870
+ 'settings.preferences.imported': string;
871
+ 'settings.voice.title': string;
872
+ 'settings.voice.description': string;
873
+ 'settings.voice.lang': string;
874
+ 'settings.voice.langFollow': string;
574
875
  'settings.appearance.title': string;
575
876
  'settings.appearance.description': string;
576
877
  'settings.theme': string;
@@ -588,6 +889,7 @@ declare const chatbotDictionary: {
588
889
  'vercel.preview.title': string;
589
890
  'vercel.preview.badge': string;
590
891
  'vercel.preview.description': string;
892
+ 'surface.legacy.placeholder': string;
591
893
  'error.title': string;
592
894
  'error.suggestion': string;
593
895
  'error.dismiss': string;
@@ -602,6 +904,14 @@ declare const chatbotDictionary: {
602
904
  'session.searchPlaceholder': string;
603
905
  'session.empty': string;
604
906
  'session.delete': string;
907
+ 'session.rename': string;
908
+ 'session.renameInput': string;
909
+ 'session.archive': string;
910
+ 'session.unarchive': string;
911
+ 'session.archived': string;
912
+ 'session.loadEarlier': string;
913
+ 'session.loading': string;
914
+ 'message.loadEarlier': string;
605
915
  'welcome.title': string;
606
916
  'welcome.assistantTitle': string;
607
917
  'welcome.description': string;
@@ -627,8 +937,11 @@ declare const chatbotDictionary: {
627
937
  'tool.status.running': string;
628
938
  'tool.status.completed': string;
629
939
  'tool.status.failed': string;
940
+ 'tool.status.denied': string;
630
941
  'tool.duration': string;
631
942
  'tool.args': string;
943
+ 'tool.denied.reason': string;
944
+ 'tool.failed.reason': string;
632
945
  'cot.thinking': string;
633
946
  'cot.thought': string;
634
947
  'cot.summary': string;
@@ -636,12 +949,20 @@ declare const chatbotDictionary: {
636
949
  'cot.working': string;
637
950
  'trace.title': string;
638
951
  'trace.skill': string;
952
+ 'perception.reading': string;
953
+ 'perception.excluded': string;
639
954
  'trace.phase.route': string;
640
955
  'trace.phase.activate': string;
641
956
  'trace.phase.execute': string;
642
957
  'trace.phase.interact': string;
643
958
  'trace.phase.complete': string;
644
959
  'trace.phase.fail': string;
960
+ 'todo.title': string;
961
+ 'todo.progress': string;
962
+ 'todo.status.pending': string;
963
+ 'todo.status.inProgress': string;
964
+ 'todo.status.completed': string;
965
+ 'todo.delegatedTo': string;
645
966
  'interaction.ask.title': string;
646
967
  'interaction.confirm.title': string;
647
968
  'interaction.form.title': string;
@@ -650,6 +971,7 @@ declare const chatbotDictionary: {
650
971
  'interaction.authorize.description': string;
651
972
  'interaction.authorize.capability': string;
652
973
  'interaction.authorize.details': string;
974
+ 'interaction.origin': string;
653
975
  'interaction.submit': string;
654
976
  'interaction.cancel': string;
655
977
  'interaction.confirm': string;
@@ -677,14 +999,37 @@ declare const chatbotDictionary: {
677
999
  'composer.attachments': string;
678
1000
  'composer.addAttachment': string;
679
1001
  'composer.removeAttachment': string;
1002
+ 'composer.model': string;
1003
+ 'composer.model.demo': string;
1004
+ 'composer.dictate': string;
1005
+ 'composer.dictate.stop': string;
1006
+ 'composer.dictate.recording': string;
1007
+ 'composer.dictate.api-missing': string;
1008
+ 'composer.dictate.insecure-context': string;
680
1009
  'settings.title': string;
681
1010
  'settings.model.title': string;
682
1011
  'settings.model.description': string;
1012
+ 'settings.model.empty': string;
1013
+ 'settings.model.add': string;
1014
+ 'settings.model.edit': string;
1015
+ 'settings.model.remove': string;
1016
+ 'settings.model.setDefault': string;
1017
+ 'settings.model.default': string;
1018
+ 'settings.model.label': string;
1019
+ 'settings.model.labelNote': string;
1020
+ 'settings.model.unavailable': string;
1021
+ 'settings.model.cancel': string;
683
1022
  'settings.provider': string;
684
1023
  'settings.providerNote': string;
685
1024
  'settings.provider.openai-compatible': string;
686
1025
  'settings.provider.anthropic': string;
687
1026
  'settings.provider.google': string;
1027
+ 'settings.provider.chrome-builtin': string;
1028
+ 'settings.provider.chrome-builtin.note': string;
1029
+ 'settings.provider.chrome-builtin.limitation': string;
1030
+ 'settings.chromeBuiltin.api-missing': string;
1031
+ 'settings.chromeBuiltin.model-not-ready': string;
1032
+ 'settings.chromeBuiltin.unsupported-browser': string;
688
1033
  'settings.provider.anthropic.note': string;
689
1034
  'settings.provider.google.note': string;
690
1035
  'settings.endpoint': string;
@@ -704,6 +1049,30 @@ declare const chatbotDictionary: {
704
1049
  'settings.demoNote': string;
705
1050
  'settings.save': string;
706
1051
  'settings.clear': string;
1052
+ 'settings.agent.title': string;
1053
+ 'settings.agent.description': string;
1054
+ 'settings.agent.todo': string;
1055
+ 'settings.agent.todoNote': string;
1056
+ 'settings.agent.generativeUi': string;
1057
+ 'settings.agent.generativeUiNote': string;
1058
+ 'settings.agent.skillGeneration': string;
1059
+ 'settings.agent.skillGenerationNote': string;
1060
+ 'settings.agent.delegation': string;
1061
+ 'settings.agent.delegationNote': string;
1062
+ 'settings.agent.formAutofill': string;
1063
+ 'settings.agent.formAutofillNote': string;
1064
+ 'settings.agent.formAutofillClear': string;
1065
+ 'settings.agent.formAutofillCleared': string;
1066
+ 'settings.preferences.title': string;
1067
+ 'settings.preferences.description': string;
1068
+ 'settings.preferences.export': string;
1069
+ 'settings.preferences.import': string;
1070
+ 'settings.preferences.exported': string;
1071
+ 'settings.preferences.imported': string;
1072
+ 'settings.voice.title': string;
1073
+ 'settings.voice.description': string;
1074
+ 'settings.voice.lang': string;
1075
+ 'settings.voice.langFollow': string;
707
1076
  'settings.appearance.title': string;
708
1077
  'settings.appearance.description': string;
709
1078
  'settings.theme': string;
@@ -721,12 +1090,13 @@ declare const chatbotDictionary: {
721
1090
  'vercel.preview.title': string;
722
1091
  'vercel.preview.badge': string;
723
1092
  'vercel.preview.description': string;
1093
+ 'surface.legacy.placeholder': string;
724
1094
  'error.title': string;
725
1095
  'error.suggestion': string;
726
1096
  'error.dismiss': string;
727
1097
  };
728
1098
  };
729
- /** chatbot 组件取文案:t('welcome.title') / t('tool.summary.other', { count: 3 }) */
1099
+ /** chatbot 组件取文案:t('welcome.title') / t('tool.summary.other', { count: 3 }) @stable */
730
1100
  declare const useT: () => TranslateFn<{
731
1101
  en: {
732
1102
  'app.title': string;
@@ -738,6 +1108,14 @@ declare const useT: () => TranslateFn<{
738
1108
  'session.searchPlaceholder': string;
739
1109
  'session.empty': string;
740
1110
  'session.delete': string;
1111
+ 'session.rename': string;
1112
+ 'session.renameInput': string;
1113
+ 'session.archive': string;
1114
+ 'session.unarchive': string;
1115
+ 'session.archived': string;
1116
+ 'session.loadEarlier': string;
1117
+ 'session.loading': string;
1118
+ 'message.loadEarlier': string;
741
1119
  'welcome.title': string;
742
1120
  'welcome.assistantTitle': string;
743
1121
  'welcome.description': string;
@@ -763,8 +1141,11 @@ declare const useT: () => TranslateFn<{
763
1141
  'tool.status.running': string;
764
1142
  'tool.status.completed': string;
765
1143
  'tool.status.failed': string;
1144
+ 'tool.status.denied': string;
766
1145
  'tool.duration': string;
767
1146
  'tool.args': string;
1147
+ 'tool.denied.reason': string;
1148
+ 'tool.failed.reason': string;
768
1149
  'cot.thinking': string;
769
1150
  'cot.thought': string;
770
1151
  'cot.summary': string;
@@ -772,12 +1153,20 @@ declare const useT: () => TranslateFn<{
772
1153
  'cot.working': string;
773
1154
  'trace.title': string;
774
1155
  'trace.skill': string;
1156
+ 'perception.reading': string;
1157
+ 'perception.excluded': string;
775
1158
  'trace.phase.route': string;
776
1159
  'trace.phase.activate': string;
777
1160
  'trace.phase.execute': string;
778
1161
  'trace.phase.interact': string;
779
1162
  'trace.phase.complete': string;
780
1163
  'trace.phase.fail': string;
1164
+ 'todo.title': string;
1165
+ 'todo.progress': string;
1166
+ 'todo.status.pending': string;
1167
+ 'todo.status.inProgress': string;
1168
+ 'todo.status.completed': string;
1169
+ 'todo.delegatedTo': string;
781
1170
  'interaction.ask.title': string;
782
1171
  'interaction.confirm.title': string;
783
1172
  'interaction.form.title': string;
@@ -786,6 +1175,7 @@ declare const useT: () => TranslateFn<{
786
1175
  'interaction.authorize.description': string;
787
1176
  'interaction.authorize.capability': string;
788
1177
  'interaction.authorize.details': string;
1178
+ 'interaction.origin': string;
789
1179
  'interaction.submit': string;
790
1180
  'interaction.cancel': string;
791
1181
  'interaction.confirm': string;
@@ -813,14 +1203,37 @@ declare const useT: () => TranslateFn<{
813
1203
  'composer.attachments': string;
814
1204
  'composer.addAttachment': string;
815
1205
  'composer.removeAttachment': string;
1206
+ 'composer.model': string;
1207
+ 'composer.model.demo': string;
1208
+ 'composer.dictate': string;
1209
+ 'composer.dictate.stop': string;
1210
+ 'composer.dictate.recording': string;
1211
+ 'composer.dictate.api-missing': string;
1212
+ 'composer.dictate.insecure-context': string;
816
1213
  'settings.title': string;
817
1214
  'settings.model.title': string;
818
1215
  'settings.model.description': string;
1216
+ 'settings.model.empty': string;
1217
+ 'settings.model.add': string;
1218
+ 'settings.model.edit': string;
1219
+ 'settings.model.remove': string;
1220
+ 'settings.model.setDefault': string;
1221
+ 'settings.model.default': string;
1222
+ 'settings.model.label': string;
1223
+ 'settings.model.labelNote': string;
1224
+ 'settings.model.unavailable': string;
1225
+ 'settings.model.cancel': string;
819
1226
  'settings.provider': string;
820
1227
  'settings.providerNote': string;
821
1228
  'settings.provider.openai-compatible': string;
822
1229
  'settings.provider.anthropic': string;
823
1230
  'settings.provider.google': string;
1231
+ 'settings.provider.chrome-builtin': string;
1232
+ 'settings.provider.chrome-builtin.note': string;
1233
+ 'settings.provider.chrome-builtin.limitation': string;
1234
+ 'settings.chromeBuiltin.api-missing': string;
1235
+ 'settings.chromeBuiltin.model-not-ready': string;
1236
+ 'settings.chromeBuiltin.unsupported-browser': string;
824
1237
  'settings.provider.anthropic.note': string;
825
1238
  'settings.provider.google.note': string;
826
1239
  'settings.endpoint': string;
@@ -840,6 +1253,30 @@ declare const useT: () => TranslateFn<{
840
1253
  'settings.demoNote': string;
841
1254
  'settings.save': string;
842
1255
  'settings.clear': string;
1256
+ 'settings.agent.title': string;
1257
+ 'settings.agent.description': string;
1258
+ 'settings.agent.todo': string;
1259
+ 'settings.agent.todoNote': string;
1260
+ 'settings.agent.generativeUi': string;
1261
+ 'settings.agent.generativeUiNote': string;
1262
+ 'settings.agent.skillGeneration': string;
1263
+ 'settings.agent.skillGenerationNote': string;
1264
+ 'settings.agent.delegation': string;
1265
+ 'settings.agent.delegationNote': string;
1266
+ 'settings.agent.formAutofill': string;
1267
+ 'settings.agent.formAutofillNote': string;
1268
+ 'settings.agent.formAutofillClear': string;
1269
+ 'settings.agent.formAutofillCleared': string;
1270
+ 'settings.preferences.title': string;
1271
+ 'settings.preferences.description': string;
1272
+ 'settings.preferences.export': string;
1273
+ 'settings.preferences.import': string;
1274
+ 'settings.preferences.exported': string;
1275
+ 'settings.preferences.imported': string;
1276
+ 'settings.voice.title': string;
1277
+ 'settings.voice.description': string;
1278
+ 'settings.voice.lang': string;
1279
+ 'settings.voice.langFollow': string;
843
1280
  'settings.appearance.title': string;
844
1281
  'settings.appearance.description': string;
845
1282
  'settings.theme': string;
@@ -857,6 +1294,7 @@ declare const useT: () => TranslateFn<{
857
1294
  'vercel.preview.title': string;
858
1295
  'vercel.preview.badge': string;
859
1296
  'vercel.preview.description': string;
1297
+ 'surface.legacy.placeholder': string;
860
1298
  'error.title': string;
861
1299
  'error.suggestion': string;
862
1300
  'error.dismiss': string;
@@ -871,6 +1309,14 @@ declare const useT: () => TranslateFn<{
871
1309
  'session.searchPlaceholder': string;
872
1310
  'session.empty': string;
873
1311
  'session.delete': string;
1312
+ 'session.rename': string;
1313
+ 'session.renameInput': string;
1314
+ 'session.archive': string;
1315
+ 'session.unarchive': string;
1316
+ 'session.archived': string;
1317
+ 'session.loadEarlier': string;
1318
+ 'session.loading': string;
1319
+ 'message.loadEarlier': string;
874
1320
  'welcome.title': string;
875
1321
  'welcome.assistantTitle': string;
876
1322
  'welcome.description': string;
@@ -896,8 +1342,11 @@ declare const useT: () => TranslateFn<{
896
1342
  'tool.status.running': string;
897
1343
  'tool.status.completed': string;
898
1344
  'tool.status.failed': string;
1345
+ 'tool.status.denied': string;
899
1346
  'tool.duration': string;
900
1347
  'tool.args': string;
1348
+ 'tool.denied.reason': string;
1349
+ 'tool.failed.reason': string;
901
1350
  'cot.thinking': string;
902
1351
  'cot.thought': string;
903
1352
  'cot.summary': string;
@@ -905,12 +1354,20 @@ declare const useT: () => TranslateFn<{
905
1354
  'cot.working': string;
906
1355
  'trace.title': string;
907
1356
  'trace.skill': string;
1357
+ 'perception.reading': string;
1358
+ 'perception.excluded': string;
908
1359
  'trace.phase.route': string;
909
1360
  'trace.phase.activate': string;
910
1361
  'trace.phase.execute': string;
911
1362
  'trace.phase.interact': string;
912
1363
  'trace.phase.complete': string;
913
1364
  'trace.phase.fail': string;
1365
+ 'todo.title': string;
1366
+ 'todo.progress': string;
1367
+ 'todo.status.pending': string;
1368
+ 'todo.status.inProgress': string;
1369
+ 'todo.status.completed': string;
1370
+ 'todo.delegatedTo': string;
914
1371
  'interaction.ask.title': string;
915
1372
  'interaction.confirm.title': string;
916
1373
  'interaction.form.title': string;
@@ -919,6 +1376,7 @@ declare const useT: () => TranslateFn<{
919
1376
  'interaction.authorize.description': string;
920
1377
  'interaction.authorize.capability': string;
921
1378
  'interaction.authorize.details': string;
1379
+ 'interaction.origin': string;
922
1380
  'interaction.submit': string;
923
1381
  'interaction.cancel': string;
924
1382
  'interaction.confirm': string;
@@ -946,14 +1404,37 @@ declare const useT: () => TranslateFn<{
946
1404
  'composer.attachments': string;
947
1405
  'composer.addAttachment': string;
948
1406
  'composer.removeAttachment': string;
1407
+ 'composer.model': string;
1408
+ 'composer.model.demo': string;
1409
+ 'composer.dictate': string;
1410
+ 'composer.dictate.stop': string;
1411
+ 'composer.dictate.recording': string;
1412
+ 'composer.dictate.api-missing': string;
1413
+ 'composer.dictate.insecure-context': string;
949
1414
  'settings.title': string;
950
1415
  'settings.model.title': string;
951
1416
  'settings.model.description': string;
1417
+ 'settings.model.empty': string;
1418
+ 'settings.model.add': string;
1419
+ 'settings.model.edit': string;
1420
+ 'settings.model.remove': string;
1421
+ 'settings.model.setDefault': string;
1422
+ 'settings.model.default': string;
1423
+ 'settings.model.label': string;
1424
+ 'settings.model.labelNote': string;
1425
+ 'settings.model.unavailable': string;
1426
+ 'settings.model.cancel': string;
952
1427
  'settings.provider': string;
953
1428
  'settings.providerNote': string;
954
1429
  'settings.provider.openai-compatible': string;
955
1430
  'settings.provider.anthropic': string;
956
1431
  'settings.provider.google': string;
1432
+ 'settings.provider.chrome-builtin': string;
1433
+ 'settings.provider.chrome-builtin.note': string;
1434
+ 'settings.provider.chrome-builtin.limitation': string;
1435
+ 'settings.chromeBuiltin.api-missing': string;
1436
+ 'settings.chromeBuiltin.model-not-ready': string;
1437
+ 'settings.chromeBuiltin.unsupported-browser': string;
957
1438
  'settings.provider.anthropic.note': string;
958
1439
  'settings.provider.google.note': string;
959
1440
  'settings.endpoint': string;
@@ -973,6 +1454,30 @@ declare const useT: () => TranslateFn<{
973
1454
  'settings.demoNote': string;
974
1455
  'settings.save': string;
975
1456
  'settings.clear': string;
1457
+ 'settings.agent.title': string;
1458
+ 'settings.agent.description': string;
1459
+ 'settings.agent.todo': string;
1460
+ 'settings.agent.todoNote': string;
1461
+ 'settings.agent.generativeUi': string;
1462
+ 'settings.agent.generativeUiNote': string;
1463
+ 'settings.agent.skillGeneration': string;
1464
+ 'settings.agent.skillGenerationNote': string;
1465
+ 'settings.agent.delegation': string;
1466
+ 'settings.agent.delegationNote': string;
1467
+ 'settings.agent.formAutofill': string;
1468
+ 'settings.agent.formAutofillNote': string;
1469
+ 'settings.agent.formAutofillClear': string;
1470
+ 'settings.agent.formAutofillCleared': string;
1471
+ 'settings.preferences.title': string;
1472
+ 'settings.preferences.description': string;
1473
+ 'settings.preferences.export': string;
1474
+ 'settings.preferences.import': string;
1475
+ 'settings.preferences.exported': string;
1476
+ 'settings.preferences.imported': string;
1477
+ 'settings.voice.title': string;
1478
+ 'settings.voice.description': string;
1479
+ 'settings.voice.lang': string;
1480
+ 'settings.voice.langFollow': string;
976
1481
  'settings.appearance.title': string;
977
1482
  'settings.appearance.description': string;
978
1483
  'settings.theme': string;
@@ -990,6 +1495,7 @@ declare const useT: () => TranslateFn<{
990
1495
  'vercel.preview.title': string;
991
1496
  'vercel.preview.badge': string;
992
1497
  'vercel.preview.description': string;
1498
+ 'surface.legacy.placeholder': string;
993
1499
  'error.title': string;
994
1500
  'error.suggestion': string;
995
1501
  'error.dismiss': string;
@@ -997,22 +1503,29 @@ declare const useT: () => TranslateFn<{
997
1503
  }>;
998
1504
  //#endregion
999
1505
  //#region src/react/appearance.d.ts
1000
- /** chatbot 主题(根 div 挂 .dark 类生效) */
1506
+ /** chatbot 主题(根 div 挂 .dark 类生效) @stable */
1001
1507
  type ChatTheme = 'light' | 'dark';
1002
- /** SettingsDrawer 内切换外观时回调宿主持久化 */
1508
+ /** SettingsDrawer 内切换外观时回调宿主持久化 @stable */
1003
1509
  interface AppearanceChange {
1004
1510
  theme?: ChatTheme;
1005
1511
  locale?: Locale;
1006
1512
  /** 渲染框架档(native/a2ui);宿主持久化后经 Chatbot renderer prop 回注 */
1007
1513
  renderer?: RendererKind;
1514
+ /**
1515
+ * 语音识别语言(BCP-47,需求 7 的 FR-7.7)。空串表示跟随界面语言——
1516
+ * 用 `''` 而不是省略字段,是为了让「改回跟随」也能作为一次变更传给宿主。
1517
+ */
1518
+ dictationLang?: string;
1008
1519
  }
1009
1520
  //#endregion
1010
1521
  //#region src/react/useChatLayout.d.ts
1011
- /** 宿主可指定的布局档;auto 按容器尺寸判定 */
1522
+ /** 宿主可指定的布局档;auto 按容器尺寸判定 @stable */
1012
1523
  type ChatLayout = 'auto' | 'fullscreen' | 'embedded';
1524
+ /** @stable */
1013
1525
  type ResolvedChatLayout = 'fullscreen' | 'embedded' | 'mobile';
1014
1526
  //#endregion
1015
1527
  //#region src/react/Chatbot.d.ts
1528
+ /** @stable */
1016
1529
  interface ChatbotProps {
1017
1530
  adapter: ChatbotHostAdapter;
1018
1531
  config?: ChatbotConfig;
@@ -1022,120 +1535,129 @@ interface ChatbotProps {
1022
1535
  theme?: ChatTheme;
1023
1536
  /** 交互渲染框架档(默认 'native';'a2ui' 需宿主安装 optional peer @a2ui/lit) */
1024
1537
  renderer?: RendererKind;
1538
+ /** 语音识别语言(BCP-47);缺省跟随界面语言(FR-7.7) */
1539
+ dictationLang?: string;
1025
1540
  /** Native custom surface 的显式 renderer/schema allowlist。 */
1026
1541
  surfaceRegistry?: SurfaceRegistry;
1027
1542
  /** 布局档(默认 'auto':按容器尺寸在 fullscreen / embedded / mobile 之间判定) */
1028
1543
  layout?: ChatLayout;
1029
1544
  onAppearanceChange?(next: AppearanceChange): void;
1545
+ /**
1546
+ * 装配完成后把引擎交给宿主,用于接线跨界面动作(例如 console 的快照恢复入口
1547
+ * 需要调 `engine.resume(runId)`)。每次重新装配都会再调一次。
1548
+ */
1549
+ onEngineReady?(engine: ChatEngine): void;
1030
1550
  }
1031
1551
  /**
1032
1552
  * ChatEngine owns message/session/runtime state while assistant-ui Base owns the
1033
1553
  * presentation shell and accessible thread primitives.
1554
+ * @stable
1034
1555
  */
1035
- declare function Chatbot({ adapter, config, locale: localeProp, theme: themeProp, renderer: rendererProp, surfaceRegistry, layout, onAppearanceChange }: ChatbotProps): import("react").JSX.Element;
1556
+ declare function Chatbot({ adapter, config, locale: localeProp, theme: themeProp, renderer: rendererProp, dictationLang: dictationLangProp, surfaceRegistry, layout, onAppearanceChange, onEngineReady }: ChatbotProps): import("react").JSX.Element;
1036
1557
  //#endregion
1037
1558
  //#region src/react/A2uiSurfaceHost.d.ts
1559
+ /** @experimental */
1038
1560
  interface A2uiSurfaceHostProps {
1039
1561
  bridge: ReactBridgeState;
1040
1562
  runId?: string;
1041
1563
  registry?: SurfaceRegistry;
1042
1564
  }
1565
+ /** @experimental */
1043
1566
  interface A2uiSurfaceSnapshotHostProps {
1044
- snapshots: readonly UiSurfaceSnapshot[];
1567
+ snapshots: readonly UiSpecSnapshot[];
1045
1568
  registry?: SurfaceRegistry;
1046
1569
  onAction?(event: UiSurfaceActionEvent): void;
1047
- drafts?: UiSurfaceDrafts;
1570
+ drafts?: UiSpecDrafts;
1048
1571
  onDraftChange?(event: {
1049
1572
  runId: string;
1050
1573
  surfaceId: string;
1051
1574
  value: Record<string, unknown>;
1052
1575
  }): void;
1053
1576
  }
1054
- /** Renders persisted A2UI Basic Catalog surfaces and controlled WebSkill extensions without a live bridge. @experimental */
1577
+ /** Renders persisted WebSkill UI spec snapshots through the A2UI BYOC catalog. @experimental */
1055
1578
  declare function A2uiSurfaceSnapshotHost({ snapshots, registry, onAction, drafts, onDraftChange }: A2uiSurfaceSnapshotHostProps): import("react").JSX.Element | null;
1056
- /** Renders A2UI Basic Catalog surfaces and controlled WebSkill extensions from live bridge snapshots. @experimental */
1579
+ /** Renders WebSkill UI spec snapshots from live bridge state through the A2UI BYOC catalog. @experimental */
1057
1580
  declare function A2uiSurfaceHost({ bridge, runId, registry }: A2uiSurfaceHostProps): import("react").JSX.Element;
1058
1581
  //#endregion
1059
1582
  //#region src/react/SkillBadges.d.ts
1060
- /** 消息底部展示该 run 激活的技能名徽章(无技能不渲染) */
1583
+ /** 消息底部展示该 run 激活的技能名徽章(无技能不渲染) @stable */
1061
1584
  declare function SkillBadges({ skills }: {
1062
1585
  skills: string[];
1063
1586
  }): import("react").JSX.Element | null;
1064
1587
  //#endregion
1065
1588
  //#region src/react/InteractionCard.d.ts
1589
+ /** @stable */
1066
1590
  interface InteractionCardProps {
1067
1591
  bridge: ReactBridgeState;
1068
1592
  }
1069
- /** 订阅 bridge.pending 渲染五类交互卡(ask/confirm/form/select/authorize,native) */
1593
+ /**
1594
+ * 订阅 bridge.pending 渲染五类交互卡(native 档;其它档降级后也由它接管)。
1595
+ * 表单本体走 `NativeSpecSurface`——与 native 档 surface 侧同一个渲染入口。
1596
+ * @stable
1597
+ */
1070
1598
  declare function InteractionCard({ bridge }: InteractionCardProps): import("react").JSX.Element | null;
1071
1599
  //#endregion
1072
- //#region src/react/OpenUiInteraction.d.ts
1073
- interface OpenUiInteractionProps {
1074
- channel: OpenUiChannel;
1600
+ //#region src/react/SpecInteraction.d.ts
1601
+ /** @experimental */
1602
+ interface SpecInteractionProps {
1603
+ channel: SpecInteractionChannel;
1604
+ /** 非 native 三档之一:native 的交互卡由 `InteractionCard` 直接渲染 */
1605
+ renderer: Exclude<RendererKind, 'native'>;
1075
1606
  }
1076
1607
  /**
1077
- * openui 档交互视图:订阅 OpenUiChannel(core 产出 openui-lang 文本),动态加载
1078
- * optional peer @openuidev/react-lang Renderer 渲染;动作事件回传 channel.handleAction。
1079
- * 模块加载失败 → channel.fail(桥粘性降级 native,InteractionCard 接管)。
1608
+ * native 三档的交互视图(路径 A):订阅 SpecInteractionChannel(core 产出 catalog
1609
+ * 节点树),交给本档 surface 侧同一个渲染入口渲染;提交/取消经 handleAction 回传。
1610
+ * 未挂载时桥直接降级 native(不悬挂请求)。
1611
+ * @experimental
1080
1612
  */
1081
- declare function OpenUiInteraction({ channel }: OpenUiInteractionProps): import("react").JSX.Element | null;
1613
+ declare function SpecInteraction({ channel, renderer }: SpecInteractionProps): import("react").JSX.Element | null;
1082
1614
  //#endregion
1083
1615
  //#region src/react/OpenUiSurfaceHost.d.ts
1616
+ /** @experimental */
1084
1617
  interface OpenUiSurfaceHostProps {
1085
1618
  bridge: ReactBridgeState;
1086
1619
  runId?: string;
1087
- registry?: SurfaceRegistry;
1088
1620
  }
1621
+ /** @experimental */
1089
1622
  interface OpenUiSurfaceSnapshotHostProps {
1090
- snapshots: readonly UiSurfaceSnapshot[];
1091
- registry?: SurfaceRegistry;
1092
- onAction?(event: UiSurfaceActionEvent): void;
1093
- drafts?: UiSurfaceDrafts;
1094
- onDraftChange?(event: {
1095
- runId: string;
1096
- surfaceId: string;
1097
- value: Record<string, unknown>;
1098
- }): void;
1623
+ snapshots: readonly UiSpecSnapshot[];
1624
+ onAction?: (event: CustomSurfaceActionEvent) => void;
1099
1625
  }
1100
- /** Renders persisted UiSurface snapshots through the OpenUI extension without a live bridge. @experimental */
1101
- declare function OpenUiSurfaceSnapshotHost({ snapshots, registry, onAction, drafts, onDraftChange }: OpenUiSurfaceSnapshotHostProps): import("react").JSX.Element | null;
1102
- /** Renders serializable UiSurface descriptors through an OpenUI library extension. @experimental */
1103
- declare function OpenUiSurfaceHost({ bridge, runId, registry }: OpenUiSurfaceHostProps): import("react").JSX.Element;
1626
+ /** Renders persisted UI spec snapshots through the OpenUI extension without a live bridge. @experimental */
1627
+ declare function OpenUiSurfaceSnapshotHost({ snapshots, onAction }: OpenUiSurfaceSnapshotHostProps): import("react").JSX.Element | null;
1628
+ /** Renders WebSkill UI spec snapshots through an OpenUI library extension. @experimental */
1629
+ declare function OpenUiSurfaceHost({ bridge, runId }: OpenUiSurfaceHostProps): import("react").JSX.Element;
1104
1630
  //#endregion
1105
1631
  //#region src/react/VercelPayloadPreview.d.ts
1632
+ /** @experimental */
1106
1633
  interface VercelPayloadPreviewProps {
1107
1634
  bridge: ReactBridgeState;
1108
1635
  }
1109
1636
  /**
1110
1637
  * vercel 档(payload 预览):不渲染表单,展示 InteractionRequest 经 toVercelToolInvocation
1111
1638
  * 转换后的 Vercel AI SDK 数据契约 JSON 卡。仅提供 Cancel 结束交互(非完整运行时)。
1639
+ * @experimental
1112
1640
  */
1113
1641
  declare function VercelPayloadPreview({ bridge }: VercelPayloadPreviewProps): import("react").JSX.Element | null;
1114
1642
  //#endregion
1115
1643
  //#region src/react/VercelSurfaceHost.d.ts
1644
+ /** @experimental */
1116
1645
  interface VercelSurfaceHostProps {
1117
1646
  bridge: ReactBridgeState;
1118
1647
  runId?: string;
1119
- registry?: SurfaceRegistry;
1120
1648
  }
1649
+ /** @experimental */
1121
1650
  interface VercelSurfaceSnapshotHostProps {
1122
- snapshots: readonly UiSurfaceSnapshot[];
1123
- registry?: SurfaceRegistry;
1124
- onAction?(event: UiSurfaceActionEvent): void;
1125
- drafts?: UiSurfaceDrafts;
1126
- onDraftChange?(event: {
1127
- runId: string;
1128
- surfaceId: string;
1129
- value: Record<string, unknown>;
1130
- }): void;
1651
+ snapshots: readonly UiSpecSnapshot[];
1652
+ onAction?: (event: CustomSurfaceActionEvent) => void;
1131
1653
  }
1132
- /** Renders persisted Vercel-compatible data parts without subscribing to a live bridge. @experimental */
1133
- declare function VercelSurfaceSnapshotHost({ snapshots, registry, onAction, drafts, onDraftChange }: VercelSurfaceSnapshotHostProps): import("react").JSX.Element | null;
1134
- /** Consumes Vercel-compatible surface data parts with a controlled React surface renderer. @experimental */
1135
- declare function VercelSurfaceHost({ bridge, runId, registry }: VercelSurfaceHostProps): import("react").JSX.Element | null;
1654
+ /** Renders persisted UI spec snapshots through the json-render registry without a live bridge. @experimental */
1655
+ declare function VercelSurfaceSnapshotHost({ snapshots, onAction }: VercelSurfaceSnapshotHostProps): import("react").JSX.Element | null;
1656
+ /** Consumes WebSkill UI spec snapshots with a json-render surface renderer. @experimental */
1657
+ declare function VercelSurfaceHost({ bridge, runId }: VercelSurfaceHostProps): import("react").JSX.Element | null;
1136
1658
  //#endregion
1137
1659
  //#region src/react/ResultBlocksPro.d.ts
1138
- /** 可下载文件描述(file 块与 artifact 统一成该形状) */
1660
+ /** 可下载文件描述(file 块与 artifact 统一成该形状) @stable */
1139
1661
  interface DownloadableFile {
1140
1662
  path: string;
1141
1663
  /** 所属 run(artifact 存储路径 <chatRoot>/artifacts/<runId>/<path> 解析用) */
@@ -1143,6 +1665,7 @@ interface DownloadableFile {
1143
1665
  mimeType?: string;
1144
1666
  size?: number;
1145
1667
  }
1668
+ /** @stable */
1146
1669
  interface ResultBlocksProProps {
1147
1670
  bridge: ReactBridgeState;
1148
1671
  /** 只在所属 run 仍活动时展示;完成结果块由 ChatMessage 历史承接。 */
@@ -1150,7 +1673,7 @@ interface ResultBlocksProProps {
1150
1673
  /** 注入后 file 块 / artifact 渲染下载按钮(宿主负责读存储并触发浏览器下载) */
1151
1674
  onDownload?(file: DownloadableFile): void;
1152
1675
  }
1153
- /** 按 blocks 直接渲染的形态(历史消息结果块;当前 run 走 ResultBlocksPro 的 bridge 路径) */
1676
+ /** 按 blocks 直接渲染的形态(历史消息结果块;当前 run 走 ResultBlocksPro 的 bridge 路径) @stable */
1154
1677
  interface ResultBlockListProps {
1155
1678
  blocks: RenderBlock[];
1156
1679
  /** 所属 run(file 块下载路径解析用) */
@@ -1160,15 +1683,18 @@ interface ResultBlockListProps {
1160
1683
  /**
1161
1684
  * 结果块列表(AnimatePresence 逐块入场):markdown / json / table / chart / image / file。
1162
1685
  * 历史消息(ChatMessage.blocks)与当前 run(ResultBlocksPro)共用的渲染形态。
1686
+ * @stable
1163
1687
  */
1164
1688
  declare function ResultBlockList({ blocks, runId, onDownload }: ResultBlockListProps): import("react").JSX.Element;
1165
1689
  /**
1166
1690
  * run 完成结果块渐进挂载(AnimatePresence 逐块入场):
1167
1691
  * markdown / json / table / chart / image / file + artifact 下载卡。
1692
+ * @stable
1168
1693
  */
1169
1694
  declare function ResultBlocksPro({ bridge, activeRunId, onDownload }: ResultBlocksProProps): import("react").JSX.Element | null;
1170
1695
  //#endregion
1171
1696
  //#region src/react/InterruptedBanner.d.ts
1697
+ /** @stable */
1172
1698
  interface InterruptedBannerProps {
1173
1699
  engine: ChatEngine;
1174
1700
  /** 会话切换时重新检查(值变化即触发重新 listInterrupted) */
@@ -1177,39 +1703,57 @@ interface InterruptedBannerProps {
1177
1703
  /**
1178
1704
  * 未完成对话提示条:挂载/会话切换时检查 interrupted 快照,非空则顶部 banner
1179
1705
  * + Resume(engine.resume 后等待中的表单重新进入 bridge.pending)。
1706
+ * @stable
1180
1707
  */
1181
1708
  declare function InterruptedBanner({ engine, sessionId }: InterruptedBannerProps): import("react").JSX.Element | null;
1182
1709
  //#endregion
1183
1710
  //#region src/react/SettingsDrawer.d.ts
1711
+ /** @stable */
1184
1712
  interface SettingsDrawerProps {
1185
1713
  open: boolean;
1186
- llmConfig: ChatbotHostAdapter['llmConfig'];
1187
1714
  /**
1188
- * 运行环境配置存储(P4-A):注入后表单读写 store 的 llm 段 + streaming + loop.temperature,
1189
- * 保存后引擎 reloadConfig 装配生效;缺省回退 adapter.llmConfig 旧路径(仅 OpenAI 兼容)
1715
+ * 运行环境配置存储:模型列表、流式、temperature、Agent 能力全部读写这里。
1716
+ * 缺省时模型区只读展示(宿主没接配置源,谈不上持久化)。
1190
1717
  */
1191
1718
  runtimeConfig?: RuntimeConfigStore;
1192
1719
  theme: ChatTheme;
1193
1720
  locale: Locale;
1194
- /** 当前渲染框架档(Appearance Badge 展示;切换由宿主外观配置源完成) */
1721
+ /** 当前渲染框架档(Appearance 区可切换;缺 optional peer 的档位置灰) */
1195
1722
  renderer?: RendererKind;
1723
+ /**
1724
+ * 语音识别语言(BCP-47);空串即跟随界面语言(FR-7.7)。
1725
+ * @experimental
1726
+ */
1727
+ dictationLang?: string;
1196
1728
  /** 主题/语言切换时回调(宿主借此持久化;内部 state 由 Chatbot 跟随) */
1197
1729
  onAppearanceChange?(next: AppearanceChange): void;
1198
1730
  /** 保存/清除成功后回调(Chatbot 借此触发 engine.reloadConfig) */
1199
1731
  onSaved(): void;
1732
+ /**
1733
+ * 清除跨会话表单填写历史(FR-5.11)。不注入即不渲染按钮(R11)。
1734
+ * @experimental
1735
+ */
1736
+ onClearFormAutofill?(): Promise<void>;
1737
+ /**
1738
+ * 导出偏好时回调(FR-5.1):不注入时默认触发浏览器下载;
1739
+ * 宿主要改成写入自己的存储(或复制到剪贴板)时接本回调。
1740
+ * @experimental
1741
+ */
1742
+ onExportPreferences?(data: PreferenceExport): void;
1200
1743
  onClose(): void;
1201
1744
  }
1202
- /** 设置抽屉:LLM 配置(三协议供应商 / 能力探测 / Demo model 标识 / 流式与 temperature)+ 外观(主题/语言) */
1203
- declare function SettingsDrawer({ open, llmConfig, runtimeConfig, theme, locale, renderer, onAppearanceChange, onSaved, onClose }: SettingsDrawerProps): import("react").JSX.Element;
1745
+ /** 设置抽屉:模型列表(增删改 / 设默认 / 逐条探测)+ 流式与 temperature + Agent 能力 + 外观 @stable */
1746
+ declare function SettingsDrawer({ open, runtimeConfig, theme, locale, renderer, dictationLang, onAppearanceChange, onSaved, onClearFormAutofill, onExportPreferences, onClose }: SettingsDrawerProps): import("react").JSX.Element;
1204
1747
  //#endregion
1205
1748
  //#region src/react/ErrorCard.d.ts
1749
+ /** @stable */
1206
1750
  interface ErrorCardProps {
1207
1751
  /** 稳定错误码(WebSkillError.code / RUN_FAILED;缺省不渲染徽章) */
1208
1752
  code?: string;
1209
1753
  message: string;
1210
1754
  onDismiss?(): void;
1211
1755
  }
1212
- /** 结构化错误卡:错误码徽章 + 描述 + 建议(engine error 事件 / 失败 run) */
1756
+ /** 结构化错误卡:错误码徽章 + 描述 + 建议(engine error 事件 / 失败 run) @stable */
1213
1757
  declare function ErrorCard({ code, message, onDismiss }: ErrorCardProps): import("react").JSX.Element;
1214
1758
  //#endregion
1215
- export { A2uiSurfaceHost, type A2uiSurfaceHostProps, A2uiSurfaceSnapshotHost, type A2uiSurfaceSnapshotHostProps, type AppearanceChange, type ChatAttachmentInput, type ChatAttachmentMeta, ChatEngine, type ChatEngineOptions, type ChatEvent, type ChatLayout, type ChatMessage, type ChatSessionMeta, type ChatTheme, type ChatToolCall, Chatbot, type ChatbotConfig, type ChatbotHostAdapter, type ChatbotProps, CompositeUiBridge, type CompositeUiBridgeDeps, type DownloadableFile, ErrorCard, type ErrorCardProps, InteractionCard, type InteractionCardProps, InterruptedBanner, type InterruptedBannerProps, type LlmConfig, type Locale, OpenUiChannel, OpenUiInteraction, type OpenUiInteractionProps, type OpenUiSession, OpenUiSurfaceHost, type OpenUiSurfaceHostProps, OpenUiSurfaceSnapshotHost, type OpenUiSurfaceSnapshotHostProps, type RendererKind, type ResolvedChatLayout, ResultBlockList, type ResultBlockListProps, ResultBlocksPro, type ResultBlocksProProps, type RunSnapshot, type SandboxExecutorDeps, SettingsDrawer, type SettingsDrawerProps, SkillBadges, VercelPayloadPreview, type VercelPayloadPreviewProps, VercelSurfaceHost, type VercelSurfaceHostProps, VercelSurfaceSnapshotHost, type VercelSurfaceSnapshotHostProps, chatbotDictionary, configureA2uiMarkdown, probeA2uiAvailability, probeOpenUiAvailability, useT };
1759
+ export { A2uiSurfaceHost, type A2uiSurfaceHostProps, A2uiSurfaceSnapshotHost, type A2uiSurfaceSnapshotHostProps, type AppearanceChange, type ChatAttachmentInput, type ChatAttachmentMeta, ChatEngine, type ChatEngineOptions, type ChatEvent, type ChatLayout, type ChatMessage, type ChatSessionMeta, type ChatTheme, type ChatToolCall, Chatbot, type ChatbotConfig, type ChatbotGovernancePorts, type ChatbotHostAdapter, type ChatbotProps, CompositeUiBridge, type CompositeUiBridgeDeps, DEFAULT_RENDERER_CAPABILITIES, type DownloadableFile, ErrorCard, type ErrorCardProps, InteractionCard, type InteractionCardProps, InterruptedBanner, type InterruptedBannerProps, type Locale, OpenUiSurfaceHost, type OpenUiSurfaceHostProps, OpenUiSurfaceSnapshotHost, type OpenUiSurfaceSnapshotHostProps, type RendererCapability, type RendererKind, type ResolvedChatLayout, ResultBlockList, type ResultBlockListProps, ResultBlocksPro, type ResultBlocksProProps, type RunSnapshot, type SandboxExecutorDeps, SettingsDrawer, type SettingsDrawerProps, SkillBadges, SpecInteraction, type SpecInteractionProps, VercelPayloadPreview, type VercelPayloadPreviewProps, VercelSurfaceHost, type VercelSurfaceHostProps, VercelSurfaceSnapshotHost, type VercelSurfaceSnapshotHostProps, chatbotDictionary, configureA2uiMarkdown, probeA2uiAvailability, probeOpenUiAvailability, useT };