@webskill/chatbot 0.17.0 → 0.18.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/chatbot.css CHANGED
@@ -388,6 +388,9 @@
388
388
  .ms-auto {
389
389
  margin-inline-start: auto;
390
390
  }
391
+ .me-1 {
392
+ margin-inline-end: var(--spacing);
393
+ }
391
394
  .mt-0\.5 {
392
395
  margin-top: calc(var(--spacing) * 0.5);
393
396
  }
@@ -708,6 +711,9 @@
708
711
  .cursor-default {
709
712
  cursor: default;
710
713
  }
714
+ .cursor-grab {
715
+ cursor: grab;
716
+ }
711
717
  .cursor-not-allowed {
712
718
  cursor: not-allowed;
713
719
  }
@@ -1032,6 +1038,12 @@
1032
1038
  .bg-muted-foreground {
1033
1039
  background-color: var(--muted-foreground);
1034
1040
  }
1041
+ .bg-muted\/40 {
1042
+ background-color: var(--muted-foreground);
1043
+ @supports (color: color-mix(in lab, red, red)) {
1044
+ background-color: color-mix(in oklab, var(--muted-foreground) 40%, transparent);
1045
+ }
1046
+ }
1035
1047
  .bg-popover {
1036
1048
  background-color: var(--popover);
1037
1049
  }
@@ -1707,6 +1719,9 @@
1707
1719
  --tw-outline-style: none;
1708
1720
  outline-style: none;
1709
1721
  }
1722
+ .active\:cursor-grabbing:active {
1723
+ cursor: grabbing;
1724
+ }
1710
1725
  .active\:bg-primary\/80:active {
1711
1726
  background-color: var(--primary);
1712
1727
  @supports (color: color-mix(in lab, red, red)) {
package/dist/config.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as RuntimeConfig, r as RuntimeConfigStore } from "./index-B25ux241.js";
2
- import { a as parseWebSkillConfig, c as ConfigFieldSpec, i as WebSkillConfigDefaults, l as ConfigLeafKind, n as ParseWebSkillConfigOptions, o as CONFIGURED_RUNTIME_PATHS, r as ParsedWebSkillConfig, s as CONFIG_FIELDS, t as CONFIG_TOP_LEVEL_SECTIONS, u as NON_CONFIGURABLE_RUNTIME_PATHS } from "./parse-Cc8nFxir.js";
1
+ import { n as RuntimeConfig, r as RuntimeConfigStore } from "./index-Nnkn73aD.js";
2
+ import { a as parseWebSkillConfig, c as ConfigFieldSpec, i as WebSkillConfigDefaults, l as ConfigLeafKind, n as ParseWebSkillConfigOptions, o as CONFIGURED_RUNTIME_PATHS, r as ParsedWebSkillConfig, s as CONFIG_FIELDS, t as CONFIG_TOP_LEVEL_SECTIONS, u as NON_CONFIGURABLE_RUNTIME_PATHS } from "./parse-B8D0fl8I.js";
3
3
  //#region src/config/errors.d.ts
4
4
  /** 稳定错误码,供宿主可编程处理;`message` 一律英文 @experimental */
5
5
  type WebSkillConfigErrorCode = 'CONFIG_UNKNOWN_KEY' | 'CONFIG_TYPE' | 'CONFIG_RANGE' | 'CONFIG_ENUM' | 'CONFIG_SHAPE' | 'CONFIG_REFERENCE';
@@ -27,6 +27,9 @@ declare class WebSkillConfigError extends Error {
27
27
  *
28
28
  * 数组是**替换**语义:`entries: []` 是「用户把模型删光了」,
29
29
  * 与「从没配过」(键缺席)必须分得开,否则删掉的条目会自己长回来。
30
+ *
31
+ * 唯一的例外是 `llm.entries` 里的**烘焙条目**:它们是随扩展一起发的运维配置,
32
+ * 不是用户资产,走 `syncBakedEntries` 的下发语义(0.21.0 分册 24)。
30
33
  */
31
34
  /** 三方合并的输入 @experimental */
32
35
  interface ApplyConfigDefaultsInput {
package/dist/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { r as mergeRuntimeConfigDefaults } from "./types-C4dzGOPp.js";
2
- import { a as NON_CONFIGURABLE_RUNTIME_PATHS, i as CONFIG_FIELDS, n as parseWebSkillConfig, o as WebSkillConfigError, r as CONFIGURED_RUNTIME_PATHS, t as CONFIG_TOP_LEVEL_SECTIONS } from "./parse-79VbXLl4.js";
2
+ import { a as NON_CONFIGURABLE_RUNTIME_PATHS, i as CONFIG_FIELDS, n as parseWebSkillConfig, o as WebSkillConfigError, r as CONFIGURED_RUNTIME_PATHS, t as CONFIG_TOP_LEVEL_SECTIONS } from "./parse-Bo68XTn_.js";
3
3
 
4
4
  //#region src/config/merge.ts
5
5
  function isPlainObject(value) {
@@ -37,6 +37,62 @@ function mergeLeaf(stored, defaultValue, lastApplied) {
37
37
  return stored;
38
38
  }
39
39
  /**
40
+ * 烘焙模型按 id 强制同步(0.21.0 分册 24 · FR-24.1)。
41
+ *
42
+ * 与 `mergeLeaf` 的「缺省值」语义不同,这里是**下发**:整片 `entries` 是一片叶子,
43
+ * 用户只要动过列表任意一处,此后所有重新打包的模型配置都到不了他那里。
44
+ * 所以烘焙条目按 id 整条覆盖、按 defaults 的顺序在前,用户自建的按原相对序在末尾。
45
+ *
46
+ * 但下发只在**运维真的重新打包过模型配置时**发生(FR-24.1d):烘焙列表与快照逐字
47
+ * 相同,说明这一版没人改过 `config.json`,此时用户在 Console 里的改动与排序全部作数。
48
+ * 快照缺席(全新安装或重装扩展)按「变了」处理——那正是「恢复初始化配置」的时刻。
49
+ *
50
+ * 读的是 `stored` 原始值而不是合并后的那份:合并后的 `entries` 已经被叶子规则
51
+ * 选过边,从它数不准「用户自建了哪些」。
52
+ */
53
+ function syncBakedEntries(stored, baked, previous, retired) {
54
+ const bakedIds = new Set(baked.map((entry) => entry.id));
55
+ const kept = Array.isArray(stored) ? stored.filter((entry) => isPlainObject(entry) && typeof entry["id"] === "string" && !retired.has(entry["id"])) : [];
56
+ if (previous !== void 0 && sameValue(previous, baked)) {
57
+ const storedIds = new Set(kept.map((entry) => entry.id));
58
+ return [...kept, ...baked.filter((entry) => !storedIds.has(entry.id))];
59
+ }
60
+ return [...baked, ...kept.filter((entry) => !bakedIds.has(entry.id))];
61
+ }
62
+ /**
63
+ * 上一版烘过、这一版不再烘的 id(FR-24.5)。
64
+ *
65
+ * 不认它们的话,运维从 `config.json` 里删掉的模型会以「用户自建」的身份
66
+ * 永久留在每台机器上。快照缺席时分辨不出来,一律保留。
67
+ */
68
+ function retiredBakedIds(lastApplied, baked) {
69
+ const previous = lastApplied?.llm?.entries ?? [];
70
+ const bakedIds = new Set(baked.map((entry) => entry.id));
71
+ return new Set(previous.map((entry) => entry.id).filter((id) => !bakedIds.has(id)));
72
+ }
73
+ /** 烘焙条目在新一版里被删掉时,用户的默认项会变成空引用——那条空引用正是本册造出来的(FR-24.4) */
74
+ function resolveDefaultId(entries, current) {
75
+ if (typeof current === "string" && entries.some((entry) => entry.id === current)) return current;
76
+ return entries[0]?.id;
77
+ }
78
+ /** `llm.entries` 之外的一切仍走 0.20.0 的逐叶子规则 */
79
+ function applyBakedModels(merged, stored, defaults, lastApplied) {
80
+ const baked = defaults.llm?.entries;
81
+ if (baked === void 0 || !isPlainObject(merged)) return merged;
82
+ const storedLlm = isPlainObject(stored) ? stored["llm"] : void 0;
83
+ const entries = syncBakedEntries(isPlainObject(storedLlm) ? storedLlm["entries"] : void 0, baked, lastApplied?.llm?.entries, retiredBakedIds(lastApplied, baked));
84
+ const llm = isPlainObject(merged["llm"]) ? merged["llm"] : {};
85
+ const defaultId = resolveDefaultId(entries, llm["defaultId"]);
86
+ return {
87
+ ...merged,
88
+ llm: {
89
+ ...llm,
90
+ entries,
91
+ ...defaultId === void 0 ? {} : { defaultId }
92
+ }
93
+ };
94
+ }
95
+ /**
40
96
  * `lastApplied` 缺席时每条分支都退化成「stored 存在就取 stored」,
41
97
  * 即老实现的 `deepMerge(defaults, stored)`——修订跟随是纯增量,不改既有语义。
42
98
  * @experimental
@@ -44,7 +100,7 @@ function mergeLeaf(stored, defaultValue, lastApplied) {
44
100
  function applyConfigDefaults(input) {
45
101
  const { stored, defaults, lastApplied } = input;
46
102
  return {
47
- config: mergeRuntimeConfigDefaults(stored === void 0 ? defaults : mergeLeaf(stored, defaults, lastApplied)),
103
+ config: mergeRuntimeConfigDefaults(applyBakedModels(stored === void 0 ? defaults : mergeLeaf(stored, defaults, lastApplied), stored, defaults, lastApplied)),
48
104
  snapshot: defaults
49
105
  };
50
106
  }
@@ -230,6 +230,14 @@ interface RuntimeLlmEntry {
230
230
  * @experimental
231
231
  */
232
232
  thinkingBudgetTokens?: number;
233
+ /**
234
+ * 该模型的上下文窗口(token,分册 20 FR-20.4)。
235
+ *
236
+ * 缺省即「未知」,与「为零」必须可区分:未知时不触发任何压缩,也不显示占比。
237
+ * 仓内**不预置**任何厂商的窗口表——型号到窗口的映射会过期,过期的默认值比没有更坏。
238
+ * 该值只用于判断要不要压缩历史,不参与请求体拼装。
239
+ */
240
+ contextWindow?: number;
233
241
  }
234
242
  /** 模型列表 + 默认项。`defaultId` 由 `mergeRuntimeConfigDefaults` 归一到真实存在的条目 */
235
243
  interface RuntimeLlmSelection {
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { a as RuntimeRendererId, c as RuntimeQuickPrompt, d as TranslateFn, i as RuntimeLlmEntry, l as Locale, n as RuntimeConfig, o as QuickPrompt, r as RuntimeConfigStore, s as QuickPromptIconName, t as RuntimeAppearanceConfig, u as LocalizedText } from "./index-B25ux241.js";
2
- import { AgentLoopConfig, ApprovalScope, BridgeCapabilities, DataSourceInfo, DocumentSurfaceHost, DocxTextExtractor, ExternalSkillProvider, ExternalToolSource, FileSystemProvider, HookRunner, InteractionRequest, InteractionResponse, LifecycleEventInit, LinkedDocumentReader, LlmClient, NetworkPolicy, Page, PageQuery, PdfTextExtractor, RenderBlock, RenderResultRequest, RunSnapshot, RunSnapshotListEntry, RuntimePhase, RuntimeRun, ScriptExecutor, SessionStore, SkillCandidateMarker, SkillCatalogEntry, SkillIntegrityGuard, SkillOutcomeReporter, SkillStateGuard, UiBridge, UiSpecDrafts, UiSpecEvent, UiSpecSnapshot, UiSurfaceActionRequest, UiSurfaceActionResponse, UserProfile, UserProfileExport, WebSkillErrorCode, XlsxTextExtractor, diffUserProfile } from "@webskill/sdk";
3
- import { SandboxMode, TypeScriptSupportOptions } from "@webskill/sdk/browser";
4
- import { CustomSurfaceActionEvent, ReactBridgeState, SpecInteractionChannel, SurfaceRegistry, UiSurfaceActionEvent } from "@webskill/sdk/ui-react";
5
- import { DownloadedFileConsent, DownloadedFileReader, PageActionPolicy, PagePerceptionPolicy, PerceptionPagingBudget, PerceptionRecord, SkillCandidateSink, TabWorksetPolicy, TodoItem } from "@webskill/sdk/agent";
1
+ import { a as RuntimeRendererId, c as RuntimeQuickPrompt, d as TranslateFn, i as RuntimeLlmEntry, l as Locale, n as RuntimeConfig, o as QuickPrompt, r as RuntimeConfigStore, s as QuickPromptIconName, t as RuntimeAppearanceConfig, u as LocalizedText } from "./index-Nnkn73aD.js";
6
2
  import "react";
3
+ import { AgentLoopConfig, ApprovalScope, BridgeCapabilities, DataSourceInfo, DocumentSurfaceHost, DocxTextExtractor, ExternalSkillProvider, ExternalToolSource, FileSystemProvider, HookRunner, InteractionRequest, InteractionResponse, LifecycleEventInit, LinkedDocumentReader, LlmClient, NetworkPolicy, Page, PageQuery, PdfTextExtractor, RenderBlock, RenderResultRequest, RunSnapshot, RunSnapshotListEntry, RuntimePhase, RuntimeRun, ScriptExecutor, SessionStore, SkillCandidateMarker, SkillCatalogEntry, SkillIntegrityGuard, SkillOutcomeReporter, SkillStateGuard, UiBridge, UiSpecDrafts, UiSpecEvent, UiSpecSnapshot, UiSurfaceActionRequest, UiSurfaceActionResponse, UserProfile, UserProfileExport, VisionDelegate, VisionDelegateRequest, VisionDelegateResult, WebSkillErrorCode, XlsxTextExtractor, diffUserProfile } from "@webskill/sdk";
4
+ import { SandboxMode, TypeScriptSupportOptions, WebOfficeConsent, WebOfficeHost } from "@webskill/sdk/browser";
5
+ import { CustomSurfaceActionEvent, ReactBridgeState, SpecInteractionChannel, SurfaceRegistry, UiSurfaceActionEvent } from "@webskill/sdk/ui-react";
6
+ import { ConsentUi, DocxDocumentReader, DownloadedFileConsent, DownloadedFileReader, PageActionPolicy, PagePerceptionPolicy, PdfDocumentReader, PerceptionPagingBudget, PerceptionRecord, SkillCandidateSink, TabWorksetPolicy, TodoItem, XlsxDocumentReader } from "@webskill/sdk/agent";
7
7
  //#region ../core/src/attachment/kind.d.ts
8
8
  /**
9
9
  * 附件类型判据与文本形态。0.14.0 分册 20 从 `@webskill/chatbot` 迁入:
@@ -76,6 +76,71 @@ declare function createLocalStorageRuntimeConfigStore(options?: LocalStorageRunt
76
76
  /** 内存实现:测试、SSR、以及宿主明确不想持久化时使用。 @experimental */
77
77
  declare function createMemoryRuntimeConfigStore(initial?: Partial<RuntimeConfig>): RuntimeConfigStore;
78
78
  //#endregion
79
+ //#region src/core/visionDelegate.d.ts
80
+ /**
81
+ * 委派目标端点的可辨识标识;告知卡与审计都只用这三项(FR-17.6a / FR-17.7a)
82
+ * @experimental
83
+ */
84
+ interface VisionDelegationEndpoint {
85
+ /** 模型条目 id */
86
+ readonly id: string;
87
+ /** 用户在 Console 里给这条起的名字 */
88
+ readonly label: string;
89
+ /** `baseUrl` 的主机名;内置档没有 baseUrl 时是 provider 名 */
90
+ readonly host: string;
91
+ }
92
+ /**
93
+ * 视觉委派的记忆端口(0.21.0 分册 17 · FR-17.9b)。形状照抄 `DownloadedFileConsent`:
94
+ * 存哪、记多久归宿主,SDK 只定接口。不注入即**每次都问**(FR-17.9c)。
95
+ * @experimental
96
+ */
97
+ interface VisionDelegationConsent {
98
+ recall(endpoint: VisionDelegationEndpoint): boolean | Promise<boolean>;
99
+ remember(endpoint: VisionDelegationEndpoint): void | Promise<void>;
100
+ /**
101
+ * 复选框旁的文案。宿主不实现即用通用兜底串——
102
+ * SDK 无权替宿主宣称记住的是「这个端点」还是「所有端点」,写死会变成谎报授权范围。
103
+ */
104
+ describeScope?(endpoint: VisionDelegationEndpoint): string | undefined;
105
+ }
106
+ /** 装配参数;每一项都是「每次调用时重读」的取值函数,不是装配期快照 @experimental */
107
+ interface ChatbotVisionDelegateOptions {
108
+ /** 每次调用时读的实时配置:选中模型与端点列表中途都可能变 */
109
+ config(): Promise<RuntimeConfig | undefined>;
110
+ /** 当前选中的模型条目 id(未选中即用默认项) */
111
+ selectedModelId(): string | undefined;
112
+ /** 选中条目的解析口径必须与主链路一致,否则「主模型看不看得了图」两处会打架 */
113
+ selectedEntry(config: RuntimeConfig | undefined): RuntimeLlmEntry | undefined;
114
+ /** 告知卡出口;引擎的 UI 桥天然满足 */
115
+ ui: ConsentUi;
116
+ consent?: VisionDelegationConsent;
117
+ /** 留痕出口。不注入仍然可以委派(FR-17.6b):审计是宿主能力,不是同意条件 */
118
+ audit?: {
119
+ append(event: {
120
+ type: string;
121
+ target: string;
122
+ data?: Record<string, unknown>;
123
+ }): Promise<unknown>;
124
+ };
125
+ /** 按条目建客户端。缺省由调用方注入 `createLlmClient` */
126
+ createClient(entry: RuntimeLlmEntry): LlmClient;
127
+ }
128
+ /**
129
+ * 视觉委派的宿主侧实现(0.21.0 分册 17)。
130
+ *
131
+ * 三件事按顺序发生:挑端点(FR-17.2)→ 征得同意(FR-17.7)→ 一次调用认完所有图(FR-17.3a)。
132
+ * 在用户作出选择之前**不发出任何请求**:客户端是在同意之后才建的(FR-17.7b / AC-17.3)。
133
+ * @experimental
134
+ */
135
+ declare class ChatbotVisionDelegate implements VisionDelegate {
136
+ #private;
137
+ constructor(options: ChatbotVisionDelegateOptions);
138
+ /** 新会话重新问(AC-17.4)。同意的记忆归宿主,这里不碰 */
139
+ forgetSessionDecision(): void;
140
+ applies(): Promise<boolean>;
141
+ describe(request: VisionDelegateRequest): Promise<VisionDelegateResult>;
142
+ }
143
+ //#endregion
79
144
  //#region src/core/hostAdapter.d.ts
80
145
  /**
81
146
  * 宿主装配口:chatbot 不感知环境(浏览器/Node),全部能力经此注入。
@@ -143,6 +208,27 @@ interface ChatbotHostAdapter {
143
208
  * PDF 仍然默认直传,能读的端点拿到的还是原件;不注入即没有回退能力。
144
209
  */
145
210
  pdfExtractor?: PdfTextExtractor;
211
+ /**
212
+ * 逐页读 PDF(0.21.0 分册 22):拿页数、逐页文本、逐页图、把整页渲成图。
213
+ *
214
+ * 与 `pdfExtractor` 分开给,是因为它们回答的是两个问题:那个问「整份的文本是什么」,
215
+ * 这个问「第 N 页是什么」。三个 `*DocumentReader` 各自独立,缺哪个就哪种格式
216
+ * 明确报「本环境不支持」,不互相兜底。
217
+ * @experimental
218
+ */
219
+ pdfDocumentReader?: PdfDocumentReader;
220
+ /** docx → 块序列(`createDocxBlockReader`);不注入即 `read_document` 读不了 Word @experimental */
221
+ docxDocumentReader?: DocxDocumentReader;
222
+ /** xlsx → 行流(`createXlsxBlockReader`);不注入即 `read_document` 读不了 Excel @experimental */
223
+ xlsxDocumentReader?: XlsxDocumentReader;
224
+ /**
225
+ * 视觉委派的「不再询问」记忆端口(0.21.0 分册 17 · FR-17.9)。
226
+ *
227
+ * **不注入不等于关闭**:委派本身只要模型列表里有能看图的条目就成立,
228
+ * 只是每次都要弹告知卡(FR-17.9c)。本册刻意不加 Console 开关(FR-17.8)。
229
+ * @experimental
230
+ */
231
+ visionConsent?: VisionDelegationConsent;
146
232
  /** 文档读取留痕出口(FR-22.6);分册 17 的 `upload.file.read` 也走这条 */
147
233
  documentAudit?: {
148
234
  append(event: {
@@ -164,6 +250,20 @@ interface ChatbotHostAdapter {
164
250
  /** 「不再询问」的记忆端口;不注入即每次都问 */
165
251
  consent?: DownloadedFileConsent;
166
252
  };
253
+ /**
254
+ * 读页内嵌的 WPS WebOffice 文档(0.21.0 分册 11~13)。
255
+ * **不注入即两个工具都不注册**——本册刻意不加设置开关(FR-13.8):
256
+ * 能不能读取决于这一页有没有那样一份文档,那不是用户需要预先决定的事。
257
+ *
258
+ * 与 `downloads` 同一条装配规矩:宿主只交端口(枚举 / 读取 / 截屏),
259
+ * 授权卡出口与审计出口在引擎这一侧。
260
+ * @experimental
261
+ */
262
+ webOffice?: {
263
+ host: WebOfficeHost;
264
+ /** 「不再询问」的记忆端口;不注入即每次都问 */
265
+ consent?: WebOfficeConsent;
266
+ };
167
267
  /**
168
268
  * 文档投放面(0.15.0 分册 13)。宿主交出 viewer 页地址、投放前确认与审计出口,
169
269
  * 三件都在 `createDocumentSurfaceHost` 的选项里。
@@ -238,6 +338,12 @@ interface ChatEngineOptions {
238
338
  generativeUi?: boolean;
239
339
  /** 沙箱执行器替换点(测试注入 spy 断言构造参数;缺省 BrowserWorkerScriptExecutor) */
240
340
  executorFactory?: (deps: SandboxExecutorDeps) => ScriptExecutor;
341
+ /**
342
+ * 视觉委派用的客户端工厂(分册 17)。缺省 `createLlmClient`——
343
+ * 与主链路同一个工厂,被选中条目的 `baseUrl` / `apiKey` / `model` 原样生效(FR-17.2c)。
344
+ * 替换点存在只为让判据能断言「请求打到了哪个端点」(AC-17.8),不是配置项。
345
+ */
346
+ visionClientFactory?: (entry: RuntimeLlmEntry) => LlmClient;
241
347
  /**
242
348
  * 宿主声明的数据源取数入口(分册 16)。不注入即脚本上下文没有 `fetchData` 这个键。
243
349
  *
@@ -375,8 +481,14 @@ declare class ChatEngine {
375
481
  send(text: string, attachments?: readonly ChatAttachmentInput[]): Promise<void>;
376
482
  /** 附件落盘根目录(composer 附件适配器写入,send 时读回) */
377
483
  get attachmentsRoot(): string;
378
- /** 取消进行中的 run(Composer Stop 按钮);run 未找到/已结束返回 false */
379
- cancel(runId: string): boolean;
484
+ /**
485
+ * 取消进行中的 run(Composer Stop 按钮);run 未找到/已结束返回 false。
486
+ *
487
+ * 不传 runId 就取消引擎自己记着的那一个。UI 那边的 runId 是 `run-started` 事件携回去的,
488
+ * 而 `run-preparing` 到 `run-started` 之间是一整段无声区(队列/发现/路由)——
489
+ * 那段里面板已经是忙碌态、终止按钮已经在了,可 UI 手里还没 id,按下去是个空操作。
490
+ */
491
+ cancel(runId?: string): boolean;
380
492
  /**
381
493
  * 释放引擎:取消进行中的 run、退订全部事件、丢弃装配缓存。
382
494
  * 宿主重挂组件时用它收尾;只是换配置的话用 `reloadConfig()`,不要 dispose。
@@ -668,7 +780,19 @@ interface ChatSessionListResult {
668
780
  skipped: readonly string[];
669
781
  }
670
782
  /** @stable */
671
- type ChatEvent = {
783
+ type ChatEvent =
784
+ /**
785
+ * 请求已受理,正在交给 runtime(分册 20 FR-20.2)。
786
+ *
787
+ * `run-started` 是从 runtime 的 `route` 生命周期事件派生的,而 route 排在
788
+ * 队列 / discover / listSkills / catalogFilter 之后。那一整段里任何一处慢或挂,
789
+ * 界面上都是同一副画面:什么都没有。本事件把那段变成一个显式状态。
790
+ */
791
+ {
792
+ type: 'run-preparing';
793
+ sessionId: string;
794
+ queued: boolean;
795
+ } | {
672
796
  type: 'run-started';
673
797
  runId: string;
674
798
  } | {
@@ -725,6 +849,18 @@ type ChatEvent = {
725
849
  name: string;
726
850
  args?: string;
727
851
  errorCode?: string;
852
+ } |
853
+ /**
854
+ * 委派识图的逐张进度(分册 26 FR-26.9)。挂在 `source` 这个工具名上,
855
+ * 不带 callId——委派发生在工具**结果**回喂阶段,那时调用早已结束。
856
+ * @experimental
857
+ */
858
+ {
859
+ type: 'vision-progress';
860
+ runId: string;
861
+ source: string;
862
+ done: number;
863
+ total: number;
728
864
  } | {
729
865
  type: 'run-completed';
730
866
  runId: string;
@@ -733,6 +869,21 @@ type ChatEvent = {
733
869
  activeSkillNames: string[];
734
870
  /** 终止原因对应的稳定错误码(仅非正常结束时):UI 据此分类提示,不再压平为 RUN_FAILED */
735
871
  code?: WebSkillErrorCode;
872
+ /**
873
+ * 本 run 结束时的上下文水位线(末轮输入 token,分册 20 FR-20.5)。
874
+ * 上游不回报 usage 时缺省——不填 0冒充「已知为零」。
875
+ */
876
+ contextTokens?: number;
877
+ } |
878
+ /**
879
+ * 历史被压缩(分册 20 FR-20.8):只描述运行时历史的变化,会话存储里的原文不动。
880
+ * @experimental
881
+ */
882
+ {
883
+ type: 'context-compacted';
884
+ sessionId: string;
885
+ removed: number;
886
+ kept: number;
736
887
  } | {
737
888
  type: 'todo-changed';
738
889
  runId: string;
@@ -1040,6 +1191,7 @@ declare const chatbotDictionary: {
1040
1191
  'tool.status.completed': string;
1041
1192
  'tool.status.failed': string;
1042
1193
  'tool.status.denied': string;
1194
+ 'tool.vision.progress': string;
1043
1195
  'tool.duration': string;
1044
1196
  'tool.args': string;
1045
1197
  'tool.denied.reason': string;
@@ -1086,6 +1238,7 @@ declare const chatbotDictionary: {
1086
1238
  'todo.status.inProgress': string;
1087
1239
  'todo.status.completed': string;
1088
1240
  'todo.delegatedTo': string;
1241
+ 'todo.dismiss': string;
1089
1242
  'interaction.ask.title': string;
1090
1243
  'interaction.confirm.title': string;
1091
1244
  'interaction.form.title': string;
@@ -1123,6 +1276,21 @@ declare const chatbotDictionary: {
1123
1276
  'interaction.downloadedFile.read': string;
1124
1277
  'interaction.downloadedFile.file': string;
1125
1278
  'interaction.downloadedFile.remember': string;
1279
+ 'interaction.webOffice.listTitle': string;
1280
+ 'interaction.webOffice.listBody': string;
1281
+ 'interaction.webOffice.readTitle': string;
1282
+ 'interaction.webOffice.readBody': string;
1283
+ 'interaction.webOffice.captureTitle': string;
1284
+ 'interaction.webOffice.captureBody': string;
1285
+ 'interaction.webOffice.claimedTypeNote': string;
1286
+ 'interaction.webOffice.rememberFallback': string;
1287
+ 'interaction.visionDelegation.title': string;
1288
+ 'interaction.visionDelegation.reason': string;
1289
+ 'interaction.visionDelegation.endpoint': string;
1290
+ 'interaction.visionDelegation.declineNote': string;
1291
+ 'interaction.visionDelegation.rememberFallback': string;
1292
+ 'interaction.visionDelegation.rememberSession': string;
1293
+ 'interaction.visionDelegation.body': string;
1126
1294
  'interaction.uploadFile.read': string;
1127
1295
  'interaction.uploadFile.file': string;
1128
1296
  'interaction.sandbox.readReference': string;
@@ -1199,6 +1367,12 @@ declare const chatbotDictionary: {
1199
1367
  'composer.addAttachment.imagesOff': string;
1200
1368
  'composer.addAttachment.modelNoImages': string;
1201
1369
  'attachment.imagesDropped': string;
1370
+ 'attachment.storeFailed.title': string;
1371
+ 'attachment.storeFailed': string;
1372
+ 'attachment.pdfAsText': string;
1373
+ 'attachment.pdfRefused': string;
1374
+ 'attachment.pdfNoExtractor': string;
1375
+ 'attachment.textTooLong': string;
1202
1376
  'composer.dictate': string;
1203
1377
  'composer.dictate.stop': string;
1204
1378
  'composer.dictate.recording': string;
@@ -1431,6 +1605,7 @@ declare const chatbotDictionary: {
1431
1605
  'tool.status.completed': string;
1432
1606
  'tool.status.failed': string;
1433
1607
  'tool.status.denied': string;
1608
+ 'tool.vision.progress': string;
1434
1609
  'tool.duration': string;
1435
1610
  'tool.args': string;
1436
1611
  'tool.denied.reason': string;
@@ -1477,6 +1652,7 @@ declare const chatbotDictionary: {
1477
1652
  'todo.status.inProgress': string;
1478
1653
  'todo.status.completed': string;
1479
1654
  'todo.delegatedTo': string;
1655
+ 'todo.dismiss': string;
1480
1656
  'interaction.ask.title': string;
1481
1657
  'interaction.confirm.title': string;
1482
1658
  'interaction.form.title': string;
@@ -1514,6 +1690,21 @@ declare const chatbotDictionary: {
1514
1690
  'interaction.downloadedFile.read': string;
1515
1691
  'interaction.downloadedFile.file': string;
1516
1692
  'interaction.downloadedFile.remember': string;
1693
+ 'interaction.webOffice.listTitle': string;
1694
+ 'interaction.webOffice.listBody': string;
1695
+ 'interaction.webOffice.readTitle': string;
1696
+ 'interaction.webOffice.readBody': string;
1697
+ 'interaction.webOffice.captureTitle': string;
1698
+ 'interaction.webOffice.captureBody': string;
1699
+ 'interaction.webOffice.claimedTypeNote': string;
1700
+ 'interaction.webOffice.rememberFallback': string;
1701
+ 'interaction.visionDelegation.title': string;
1702
+ 'interaction.visionDelegation.reason': string;
1703
+ 'interaction.visionDelegation.endpoint': string;
1704
+ 'interaction.visionDelegation.declineNote': string;
1705
+ 'interaction.visionDelegation.rememberFallback': string;
1706
+ 'interaction.visionDelegation.rememberSession': string;
1707
+ 'interaction.visionDelegation.body': string;
1517
1708
  'interaction.uploadFile.read': string;
1518
1709
  'interaction.uploadFile.file': string;
1519
1710
  'interaction.sandbox.readReference': string;
@@ -1590,6 +1781,12 @@ declare const chatbotDictionary: {
1590
1781
  'composer.addAttachment.imagesOff': string;
1591
1782
  'composer.addAttachment.modelNoImages': string;
1592
1783
  'attachment.imagesDropped': string;
1784
+ 'attachment.storeFailed.title': string;
1785
+ 'attachment.storeFailed': string;
1786
+ 'attachment.pdfAsText': string;
1787
+ 'attachment.pdfRefused': string;
1788
+ 'attachment.pdfNoExtractor': string;
1789
+ 'attachment.textTooLong': string;
1593
1790
  'composer.dictate': string;
1594
1791
  'composer.dictate.stop': string;
1595
1792
  'composer.dictate.recording': string;
@@ -1825,6 +2022,7 @@ declare const useT: () => TranslateFn<{
1825
2022
  'tool.status.completed': string;
1826
2023
  'tool.status.failed': string;
1827
2024
  'tool.status.denied': string;
2025
+ 'tool.vision.progress': string;
1828
2026
  'tool.duration': string;
1829
2027
  'tool.args': string;
1830
2028
  'tool.denied.reason': string;
@@ -1871,6 +2069,7 @@ declare const useT: () => TranslateFn<{
1871
2069
  'todo.status.inProgress': string;
1872
2070
  'todo.status.completed': string;
1873
2071
  'todo.delegatedTo': string;
2072
+ 'todo.dismiss': string;
1874
2073
  'interaction.ask.title': string;
1875
2074
  'interaction.confirm.title': string;
1876
2075
  'interaction.form.title': string;
@@ -1908,6 +2107,21 @@ declare const useT: () => TranslateFn<{
1908
2107
  'interaction.downloadedFile.read': string;
1909
2108
  'interaction.downloadedFile.file': string;
1910
2109
  'interaction.downloadedFile.remember': string;
2110
+ 'interaction.webOffice.listTitle': string;
2111
+ 'interaction.webOffice.listBody': string;
2112
+ 'interaction.webOffice.readTitle': string;
2113
+ 'interaction.webOffice.readBody': string;
2114
+ 'interaction.webOffice.captureTitle': string;
2115
+ 'interaction.webOffice.captureBody': string;
2116
+ 'interaction.webOffice.claimedTypeNote': string;
2117
+ 'interaction.webOffice.rememberFallback': string;
2118
+ 'interaction.visionDelegation.title': string;
2119
+ 'interaction.visionDelegation.reason': string;
2120
+ 'interaction.visionDelegation.endpoint': string;
2121
+ 'interaction.visionDelegation.declineNote': string;
2122
+ 'interaction.visionDelegation.rememberFallback': string;
2123
+ 'interaction.visionDelegation.rememberSession': string;
2124
+ 'interaction.visionDelegation.body': string;
1911
2125
  'interaction.uploadFile.read': string;
1912
2126
  'interaction.uploadFile.file': string;
1913
2127
  'interaction.sandbox.readReference': string;
@@ -1984,6 +2198,12 @@ declare const useT: () => TranslateFn<{
1984
2198
  'composer.addAttachment.imagesOff': string;
1985
2199
  'composer.addAttachment.modelNoImages': string;
1986
2200
  'attachment.imagesDropped': string;
2201
+ 'attachment.storeFailed.title': string;
2202
+ 'attachment.storeFailed': string;
2203
+ 'attachment.pdfAsText': string;
2204
+ 'attachment.pdfRefused': string;
2205
+ 'attachment.pdfNoExtractor': string;
2206
+ 'attachment.textTooLong': string;
1987
2207
  'composer.dictate': string;
1988
2208
  'composer.dictate.stop': string;
1989
2209
  'composer.dictate.recording': string;
@@ -2216,6 +2436,7 @@ declare const useT: () => TranslateFn<{
2216
2436
  'tool.status.completed': string;
2217
2437
  'tool.status.failed': string;
2218
2438
  'tool.status.denied': string;
2439
+ 'tool.vision.progress': string;
2219
2440
  'tool.duration': string;
2220
2441
  'tool.args': string;
2221
2442
  'tool.denied.reason': string;
@@ -2262,6 +2483,7 @@ declare const useT: () => TranslateFn<{
2262
2483
  'todo.status.inProgress': string;
2263
2484
  'todo.status.completed': string;
2264
2485
  'todo.delegatedTo': string;
2486
+ 'todo.dismiss': string;
2265
2487
  'interaction.ask.title': string;
2266
2488
  'interaction.confirm.title': string;
2267
2489
  'interaction.form.title': string;
@@ -2299,6 +2521,21 @@ declare const useT: () => TranslateFn<{
2299
2521
  'interaction.downloadedFile.read': string;
2300
2522
  'interaction.downloadedFile.file': string;
2301
2523
  'interaction.downloadedFile.remember': string;
2524
+ 'interaction.webOffice.listTitle': string;
2525
+ 'interaction.webOffice.listBody': string;
2526
+ 'interaction.webOffice.readTitle': string;
2527
+ 'interaction.webOffice.readBody': string;
2528
+ 'interaction.webOffice.captureTitle': string;
2529
+ 'interaction.webOffice.captureBody': string;
2530
+ 'interaction.webOffice.claimedTypeNote': string;
2531
+ 'interaction.webOffice.rememberFallback': string;
2532
+ 'interaction.visionDelegation.title': string;
2533
+ 'interaction.visionDelegation.reason': string;
2534
+ 'interaction.visionDelegation.endpoint': string;
2535
+ 'interaction.visionDelegation.declineNote': string;
2536
+ 'interaction.visionDelegation.rememberFallback': string;
2537
+ 'interaction.visionDelegation.rememberSession': string;
2538
+ 'interaction.visionDelegation.body': string;
2302
2539
  'interaction.uploadFile.read': string;
2303
2540
  'interaction.uploadFile.file': string;
2304
2541
  'interaction.sandbox.readReference': string;
@@ -2375,6 +2612,12 @@ declare const useT: () => TranslateFn<{
2375
2612
  'composer.addAttachment.imagesOff': string;
2376
2613
  'composer.addAttachment.modelNoImages': string;
2377
2614
  'attachment.imagesDropped': string;
2615
+ 'attachment.storeFailed.title': string;
2616
+ 'attachment.storeFailed': string;
2617
+ 'attachment.pdfAsText': string;
2618
+ 'attachment.pdfRefused': string;
2619
+ 'attachment.pdfNoExtractor': string;
2620
+ 'attachment.textTooLong': string;
2378
2621
  'composer.dictate': string;
2379
2622
  'composer.dictate.stop': string;
2380
2623
  'composer.dictate.recording': string;
@@ -2821,6 +3064,6 @@ declare function ErrorCard({ code, message, loopLimits, onOpenSettings, onDismis
2821
3064
  * Version of the published `@webskill/chatbot` package, injected at build time.
2822
3065
  * @stable
2823
3066
  */
2824
- declare const CHATBOT_VERSION = "0.17.0";
3067
+ declare const CHATBOT_VERSION = "0.18.0";
2825
3068
  //#endregion
2826
- export { A2uiSurfaceHost, type A2uiSurfaceHostProps, A2uiSurfaceSnapshotHost, type A2uiSurfaceSnapshotHostProps, type AppearanceChange, CHATBOT_VERSION, type ChatAttachmentInput, type ChatAttachmentMeta, type ChatContentPart, ChatEngine, type ChatEngineOptions, type ChatEvent, type ChatInteractionRecord, type ChatLayout, type ChatMessage, type ChatRunPhase, type ChatSessionListResult, type ChatSessionMeta, type ChatTheme, type ChatThinking, type ChatTokenUsage, type ChatToolCall, Chatbot, type ChatbotConfig, type ChatbotGovernancePorts, type ChatbotHostAdapter, type ChatbotProps, CompositeUiBridge, type CompositeUiBridgeDeps, DEFAULT_RENDERER_CAPABILITIES, DEFAULT_RUNTIME_CONFIG_STORAGE_KEY, type DownloadableFile, ErrorCard, type ErrorCardProps, InteractionCard, type InteractionCardProps, InterruptedBanner, type InterruptedBannerProps, type Locale, type LocalizedText, OpenUiSurfaceHost, type OpenUiSurfaceHostProps, OpenUiSurfaceSnapshotHost, type OpenUiSurfaceSnapshotHostProps, type QuickPrompt, type QuickPromptIconName, type RendererCapability, type RendererKind, type ResolvedChatLayout, ResultBlockList, type ResultBlockListProps, ResultBlocksPro, type ResultBlocksProProps, type RunSnapshot, type RuntimeAppearanceConfig, type RuntimeConfig, type RuntimeConfigStore, type RuntimeQuickPrompt, type RuntimeRendererId, type SandboxExecutorDeps, type SettingsSectionId, SkillBadges, SpecInteraction, type SpecInteractionProps, VercelPayloadPreview, type VercelPayloadPreviewProps, VercelSurfaceHost, type VercelSurfaceHostProps, VercelSurfaceSnapshotHost, type VercelSurfaceSnapshotHostProps, chatbotDictionary, configureA2uiMarkdown, createLocalStorageRuntimeConfigStore, createMemoryRuntimeConfigStore, isLlmEntryUsable, pickUsableLlmEntry, probeA2uiAvailability, probeOpenUiAvailability, sandboxExecutorDeps, useT };
3069
+ export { A2uiSurfaceHost, type A2uiSurfaceHostProps, A2uiSurfaceSnapshotHost, type A2uiSurfaceSnapshotHostProps, type AppearanceChange, CHATBOT_VERSION, type ChatAttachmentInput, type ChatAttachmentMeta, type ChatContentPart, ChatEngine, type ChatEngineOptions, type ChatEvent, type ChatInteractionRecord, type ChatLayout, type ChatMessage, type ChatRunPhase, type ChatSessionListResult, type ChatSessionMeta, type ChatTheme, type ChatThinking, type ChatTokenUsage, type ChatToolCall, Chatbot, type ChatbotConfig, type ChatbotGovernancePorts, type ChatbotHostAdapter, type ChatbotProps, ChatbotVisionDelegate, type ChatbotVisionDelegateOptions, CompositeUiBridge, type CompositeUiBridgeDeps, DEFAULT_RENDERER_CAPABILITIES, DEFAULT_RUNTIME_CONFIG_STORAGE_KEY, type DownloadableFile, ErrorCard, type ErrorCardProps, InteractionCard, type InteractionCardProps, InterruptedBanner, type InterruptedBannerProps, type Locale, type LocalizedText, OpenUiSurfaceHost, type OpenUiSurfaceHostProps, OpenUiSurfaceSnapshotHost, type OpenUiSurfaceSnapshotHostProps, type QuickPrompt, type QuickPromptIconName, type RendererCapability, type RendererKind, type ResolvedChatLayout, ResultBlockList, type ResultBlockListProps, ResultBlocksPro, type ResultBlocksProProps, type RunSnapshot, type RuntimeAppearanceConfig, type RuntimeConfig, type RuntimeConfigStore, type RuntimeQuickPrompt, type RuntimeRendererId, type SandboxExecutorDeps, type SettingsSectionId, SkillBadges, SpecInteraction, type SpecInteractionProps, VercelPayloadPreview, type VercelPayloadPreviewProps, VercelSurfaceHost, type VercelSurfaceHostProps, VercelSurfaceSnapshotHost, type VercelSurfaceSnapshotHostProps, type VisionDelegationConsent, type VisionDelegationEndpoint, chatbotDictionary, configureA2uiMarkdown, createLocalStorageRuntimeConfigStore, createMemoryRuntimeConfigStore, isLlmEntryUsable, pickUsableLlmEntry, probeA2uiAvailability, probeOpenUiAvailability, sandboxExecutorDeps, useT };