@webskill/chatbot 0.20.0 → 0.21.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 +9 -1
- package/dist/index.js +23 -13
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1344,6 +1344,8 @@ declare const chatbotDictionary: {
|
|
|
1344
1344
|
'interaction.pageAction.attach': string;
|
|
1345
1345
|
'interaction.pageAction.scroll.down': string;
|
|
1346
1346
|
'interaction.pageAction.scroll.up': string;
|
|
1347
|
+
'interaction.pageAction.scroll.left': string;
|
|
1348
|
+
'interaction.pageAction.scroll.right': string;
|
|
1347
1349
|
'interaction.pageAction.hover': string;
|
|
1348
1350
|
'interaction.pageAction.drag': string;
|
|
1349
1351
|
'interaction.pageAction.back': string;
|
|
@@ -1778,6 +1780,8 @@ declare const chatbotDictionary: {
|
|
|
1778
1780
|
'interaction.pageAction.attach': string;
|
|
1779
1781
|
'interaction.pageAction.scroll.down': string;
|
|
1780
1782
|
'interaction.pageAction.scroll.up': string;
|
|
1783
|
+
'interaction.pageAction.scroll.left': string;
|
|
1784
|
+
'interaction.pageAction.scroll.right': string;
|
|
1781
1785
|
'interaction.pageAction.hover': string;
|
|
1782
1786
|
'interaction.pageAction.drag': string;
|
|
1783
1787
|
'interaction.pageAction.back': string;
|
|
@@ -2215,6 +2219,8 @@ declare const useT: () => TranslateFn<{
|
|
|
2215
2219
|
'interaction.pageAction.attach': string;
|
|
2216
2220
|
'interaction.pageAction.scroll.down': string;
|
|
2217
2221
|
'interaction.pageAction.scroll.up': string;
|
|
2222
|
+
'interaction.pageAction.scroll.left': string;
|
|
2223
|
+
'interaction.pageAction.scroll.right': string;
|
|
2218
2224
|
'interaction.pageAction.hover': string;
|
|
2219
2225
|
'interaction.pageAction.drag': string;
|
|
2220
2226
|
'interaction.pageAction.back': string;
|
|
@@ -2649,6 +2655,8 @@ declare const useT: () => TranslateFn<{
|
|
|
2649
2655
|
'interaction.pageAction.attach': string;
|
|
2650
2656
|
'interaction.pageAction.scroll.down': string;
|
|
2651
2657
|
'interaction.pageAction.scroll.up': string;
|
|
2658
|
+
'interaction.pageAction.scroll.left': string;
|
|
2659
|
+
'interaction.pageAction.scroll.right': string;
|
|
2652
2660
|
'interaction.pageAction.hover': string;
|
|
2653
2661
|
'interaction.pageAction.drag': string;
|
|
2654
2662
|
'interaction.pageAction.back': string;
|
|
@@ -3228,6 +3236,6 @@ declare function ErrorCard({ code, message, loopLimits, onOpenSettings, onDismis
|
|
|
3228
3236
|
* Version of the published `@webskill/chatbot` package, injected at build time.
|
|
3229
3237
|
* @stable
|
|
3230
3238
|
*/
|
|
3231
|
-
declare const CHATBOT_VERSION = "0.
|
|
3239
|
+
declare const CHATBOT_VERSION = "0.21.0";
|
|
3232
3240
|
//#endregion
|
|
3233
3241
|
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, type DwgHost, 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, WEB_OFFICE_TEMPLATE_PREFIX, chatbotDictionary, configureA2uiMarkdown, createLocalStorageRuntimeConfigStore, createMemoryRuntimeConfigStore, isLlmEntryUsable, pickUsableLlmEntry, probeA2uiAvailability, probeOpenUiAvailability, sandboxExecutorDeps, useT };
|
package/dist/index.js
CHANGED
|
@@ -23,12 +23,12 @@ import { BEHAVIOR_RECORDS_KEY, DEFAULT_LOOP_LIMITS, DEFAULT_USER_PROFILE_LIMITS,
|
|
|
23
23
|
import { BrowserWorkerScriptExecutor, WebOfficePolicy, capturePhoto, checkCameraAvailability, checkDictationAvailability, compressImageToBudget, createEncryptedMemoryStore, createLlmClient, createWebOfficeToolSource, deleteMemoryEncryptionKey, openCamera, openMemoryEncryptionKey, probeChromeBuiltinAvailability, startDictation, toDocumentImage } from "@webskill/sdk/browser";
|
|
24
24
|
import { JsonRenderSpecSurface, NativeSpecSurface, OpenUiSpecSurface, ReactBridgeState, SpecInteractionChannel, SurfaceFormTextsProvider, UiSurfaceSnapshotList, probeJsonRenderAvailability } from "@webskill/sdk/ui-react";
|
|
25
25
|
import { A2UI_SPEC_FORM_PATH, collectFormScopes, createUiCatalogToolSource, fromA2uiSpecAction, fromA2uiSurfaceAction, interactionToFormModel, interactionToUiSpec, loadOpenUiPeers, loadWebSkillLitCatalog, renderMiniChart, shapeInteractionValue, toA2uiSpecMessages, toA2uiSurfaceAction, toVercelToolInvocation, uiCatalog } from "@webskill/sdk/ui";
|
|
26
|
-
import { DownloadedFilePolicy, PAGE_ACTION_KINDS, TodoStore, createDelegationToolSource, createDocumentToolSource, createDownloadedFileToolSource, createDwgToolSource, createPageActionToolSource, createPageImageToolSource, createPagePerceptionToolSource, createRemoteImageToolSource, createSkillGenerationToolSource, createSpreadsheetToolSource, createTabWorksetToolSource, createTemplateToolSource, createTodoToolSource, withDelegationOrigin } from "@webskill/sdk/agent";
|
|
26
|
+
import { DownloadedFilePolicy, PAGE_ACTION_KINDS, SCROLL_DIRECTIONS, TodoStore, createDelegationToolSource, createDocumentToolSource, createDownloadedFileToolSource, createDwgToolSource, createPageActionToolSource, createPageImageToolSource, createPagePerceptionToolSource, createRemoteImageToolSource, createSkillGenerationToolSource, createSpreadsheetToolSource, createTabWorksetToolSource, createTemplateToolSource, createTodoToolSource, withDelegationOrigin } from "@webskill/sdk/agent";
|
|
27
27
|
import { DataRenderers, Tools } from "@assistant-ui/core/react";
|
|
28
28
|
import { ModelContext, Suggestions } from "@assistant-ui/core/store";
|
|
29
29
|
import { Derived, attachTransformScopes, useClientLookup, useClientResource } from "@assistant-ui/store";
|
|
30
30
|
import { resource, useMemoCache, withKey } from "@assistant-ui/tap";
|
|
31
|
-
import { POLICY_DENIAL_CODES } from "@webskill/sdk/governance";
|
|
31
|
+
import { POLICY_DENIAL_CODES, USER_CAUSED_CODES } from "@webskill/sdk/governance";
|
|
32
32
|
|
|
33
33
|
//#region ../ui-kit/src/i18n/createI18n.ts
|
|
34
34
|
/** 字典工厂:各包定义自己的双语字典(恒等返回,保留字面量类型) */
|
|
@@ -26477,6 +26477,8 @@ const chatbotDictionary = defineDictionary({
|
|
|
26477
26477
|
"interaction.pageAction.attach": "Allow the assistant to attach a file to “{target}”?",
|
|
26478
26478
|
"interaction.pageAction.scroll.down": "Allow the assistant to scroll down the area around “{target}”?",
|
|
26479
26479
|
"interaction.pageAction.scroll.up": "Allow the assistant to scroll up the area around “{target}”?",
|
|
26480
|
+
"interaction.pageAction.scroll.left": "Allow the assistant to scroll left the area around “{target}”?",
|
|
26481
|
+
"interaction.pageAction.scroll.right": "Allow the assistant to scroll right the area around “{target}”?",
|
|
26480
26482
|
"interaction.pageAction.hover": "Allow the assistant to hover over “{target}”?",
|
|
26481
26483
|
"interaction.pageAction.drag": "Allow the assistant to drag “{target}” onto another element?",
|
|
26482
26484
|
"interaction.pageAction.back": "Allow the assistant to go back to the previous page on “{target}”?",
|
|
@@ -26911,6 +26913,8 @@ const chatbotDictionary = defineDictionary({
|
|
|
26911
26913
|
"interaction.pageAction.attach": "允许助手向「{target}」附加文件吗?",
|
|
26912
26914
|
"interaction.pageAction.scroll.down": "允许助手在「{target}」所在区域向下滚动吗?",
|
|
26913
26915
|
"interaction.pageAction.scroll.up": "允许助手在「{target}」所在区域向上滚动吗?",
|
|
26916
|
+
"interaction.pageAction.scroll.left": "允许助手在「{target}」所在区域向左滚动吗?",
|
|
26917
|
+
"interaction.pageAction.scroll.right": "允许助手在「{target}」所在区域向右滚动吗?",
|
|
26914
26918
|
"interaction.pageAction.hover": "允许助手将鼠标悬停在「{target}」上吗?",
|
|
26915
26919
|
"interaction.pageAction.drag": "允许助手将「{target}」拖到另一个位置吗?",
|
|
26916
26920
|
"interaction.pageAction.back": "允许助手在「{target}」上返回上一页吗?",
|
|
@@ -30780,7 +30784,7 @@ function pageActionDetails(details) {
|
|
|
30780
30784
|
role,
|
|
30781
30785
|
...typeof name === "string" ? { name } : {},
|
|
30782
30786
|
...typeof value === "string" ? { value } : {},
|
|
30783
|
-
...direction === "
|
|
30787
|
+
...typeof direction === "string" && SCROLL_DIRECTIONS.includes(direction) ? { direction } : {},
|
|
30784
30788
|
...typeof frame === "string" ? { frame } : {},
|
|
30785
30789
|
...record["elevated"] === true ? { elevated: true } : {},
|
|
30786
30790
|
...record["rememberable"] === true ? { rememberable: true } : {},
|
|
@@ -42570,13 +42574,17 @@ function ToolGroup({ count, running, children }) {
|
|
|
42570
42574
|
}) : null, children]
|
|
42571
42575
|
});
|
|
42572
42576
|
}
|
|
42573
|
-
/**
|
|
42577
|
+
/** 被策略拦下的错误码与执行失败必须分开显示(需求 1 FR-1.6)。
|
|
42578
|
+
* 0.9.0 分册 14(UX-13):判定消费统一码集,不再只认 TOOL_NOT_ALLOWED。
|
|
42579
|
+
* 0.24.0 分册 12:界面口径是**并集**——策略拦下与用户拒绝,对用户而言是同一件事:
|
|
42580
|
+
* 都不是技能坏了。(治理面仍然分族,见 governance 侧两个集合的注释。) */
|
|
42581
|
+
const isDenied = (code) => POLICY_DENIAL_CODES.has(code) || USER_CAUSED_CODES.has(code);
|
|
42582
|
+
/** 错误码 → 标题文案;**拒绝类不在表内**(由 isDenied 统一判),
|
|
42583
|
+
* 其余未列出的码走通用「失败原因」(0.6.0 FR-18.2)。
|
|
42584
|
+
* 拒绝类曾经在这里另拄一份名单,结果是往集合里加码只改得动徽章、标题留在原地。 */
|
|
42574
42585
|
const ERROR_TITLE_KEYS = {
|
|
42575
|
-
["TOOL_NOT_ALLOWED"]: "tool.denied.reason",
|
|
42576
42586
|
TOOL_NOT_FOUND: "tool.notFound.reason",
|
|
42577
|
-
TOOL_RESOLUTION_EXHAUSTED: "tool.exhausted.reason"
|
|
42578
|
-
NETWORK_BLOCKED: "tool.denied.reason",
|
|
42579
|
-
FS_PERMISSION_DENIED: "tool.denied.reason"
|
|
42587
|
+
TOOL_RESOLUTION_EXHAUSTED: "tool.exhausted.reason"
|
|
42580
42588
|
};
|
|
42581
42589
|
function toolErrorOf(part) {
|
|
42582
42590
|
const result = part.result;
|
|
@@ -42587,7 +42595,8 @@ function toolErrorOf(part) {
|
|
|
42587
42595
|
...typeof record["errorMessage"] === "string" ? { errorMessage: record["errorMessage"] } : {}
|
|
42588
42596
|
};
|
|
42589
42597
|
}
|
|
42590
|
-
/** 工具行:状态 / 耗时 / 参数摘要。工具返回值不在 chatbot 数据面内,因此不渲染结果区。
|
|
42598
|
+
/** 工具行:状态 / 耗时 / 参数摘要。工具返回值不在 chatbot 数据面内,因此不渲染结果区。
|
|
42599
|
+
* 导出仅供同包用例直接渲染(与本文件其余组件同例);包入口不再导出,不进 API 快照。 */
|
|
42591
42600
|
function ToolRow({ part }) {
|
|
42592
42601
|
const t = useT();
|
|
42593
42602
|
const [open, setOpen] = useState(false);
|
|
@@ -42597,7 +42606,7 @@ function ToolRow({ part }) {
|
|
|
42597
42606
|
useEffect(() => {
|
|
42598
42607
|
if (part.isError === true) setOpen(true);
|
|
42599
42608
|
}, [part.isError]);
|
|
42600
|
-
const denied = part.isError === true && typeof errorCode === "string" &&
|
|
42609
|
+
const denied = part.isError === true && typeof errorCode === "string" && isDenied(errorCode);
|
|
42601
42610
|
const status = running ? "running" : denied ? "denied" : part.isError === true ? "failed" : "completed";
|
|
42602
42611
|
const duration = part.timing && completedAt !== void 0 ? formatDuration(completedAt - part.timing.startedAt) : void 0;
|
|
42603
42612
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -42652,7 +42661,7 @@ function ToolRow({ part }) {
|
|
|
42652
42661
|
children: [errorMessage !== void 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
42653
42662
|
/* @__PURE__ */ jsx("p", {
|
|
42654
42663
|
className: "text-xs text-muted italic",
|
|
42655
|
-
children: t(errorCode
|
|
42664
|
+
children: t(errorCode === void 0 ? "tool.failed.reason" : denied ? "tool.denied.reason" : ERROR_TITLE_KEYS[errorCode] ?? "tool.failed.reason")
|
|
42656
42665
|
}),
|
|
42657
42666
|
/* @__PURE__ */ jsx("p", {
|
|
42658
42667
|
"data-testid": "tool-error-reason",
|
|
@@ -44927,7 +44936,8 @@ function Chatbot({ adapter, config, locale: localeProp, theme: themeProp, render
|
|
|
44927
44936
|
notifyStorageError: (fileName) => storageToastRef.current?.(fileName),
|
|
44928
44937
|
drawingsSupported: () => adapter.dwg !== void 0,
|
|
44929
44938
|
...adapter.docxExtractor ? { docxExtractor: adapter.docxExtractor } : {},
|
|
44930
|
-
...adapter.xlsxExtractor ? { xlsxExtractor: adapter.xlsxExtractor } : {}
|
|
44939
|
+
...adapter.xlsxExtractor ? { xlsxExtractor: adapter.xlsxExtractor } : {},
|
|
44940
|
+
...adapter.pptxExtractor ? { pptxExtractor: adapter.pptxExtractor } : {}
|
|
44931
44941
|
}), [adapter, engine]);
|
|
44932
44942
|
useEffect(() => {
|
|
44933
44943
|
let cancelled = false;
|
|
@@ -45612,7 +45622,7 @@ function VercelPayloadPreview({ bridge }) {
|
|
|
45612
45622
|
* Version of the published `@webskill/chatbot` package, injected at build time.
|
|
45613
45623
|
* @stable
|
|
45614
45624
|
*/
|
|
45615
|
-
const CHATBOT_VERSION = "0.
|
|
45625
|
+
const CHATBOT_VERSION = "0.21.0";
|
|
45616
45626
|
|
|
45617
45627
|
//#endregion
|
|
45618
45628
|
export { A2uiSurfaceHost, A2uiSurfaceSnapshotHost, CHATBOT_VERSION, ChatEngine, Chatbot, ChatbotVisionDelegate, CompositeUiBridge, DEFAULT_RENDERER_CAPABILITIES, DEFAULT_RUNTIME_CONFIG_STORAGE_KEY, ErrorCard, InteractionCard, InterruptedBanner, OpenUiSurfaceHost, OpenUiSurfaceSnapshotHost, ResultBlockList, ResultBlocksPro, SkillBadges, SpecInteraction, VercelPayloadPreview, VercelSurfaceHost, VercelSurfaceSnapshotHost, WEB_OFFICE_TEMPLATE_PREFIX, chatbotDictionary, configureA2uiMarkdown, createLocalStorageRuntimeConfigStore, createMemoryRuntimeConfigStore, isLlmEntryUsable, pickUsableLlmEntry, probeA2uiAvailability, probeOpenUiAvailability, sandboxExecutorDeps, useT };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webskill/chatbot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@a2ui/web_core": "^0.10.5",
|
|
39
39
|
"@lit/context": "^1.1.0",
|
|
40
40
|
"@openuidev/react-lang": "0.2.8",
|
|
41
|
-
"@webskill/sdk": "^0.
|
|
41
|
+
"@webskill/sdk": "^0.24.0",
|
|
42
42
|
"mermaid": "^12.0.0",
|
|
43
43
|
"react": ">=19.0.0",
|
|
44
44
|
"react-dom": ">=19.0.0",
|