@webskill/chatbot 0.26.0 → 0.27.0-next.1
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 +4 -2
- package/dist/index.js +32 -6
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -3344,13 +3344,15 @@ declare function SkillBadges({ skills }: {
|
|
|
3344
3344
|
/** @stable */
|
|
3345
3345
|
interface InteractionCardProps {
|
|
3346
3346
|
bridge: ReactBridgeState;
|
|
3347
|
+
/** @experimental */
|
|
3348
|
+
locale?: 'zh' | 'en';
|
|
3347
3349
|
}
|
|
3348
3350
|
/**
|
|
3349
3351
|
* 订阅 bridge.pending 渲染五类交互卡(native 档;其它档降级后也由它接管)。
|
|
3350
3352
|
* 表单本体走 `NativeSpecSurface`——与 native 档 surface 侧同一个渲染入口。
|
|
3351
3353
|
* @stable
|
|
3352
3354
|
*/
|
|
3353
|
-
declare function InteractionCard({ bridge }: InteractionCardProps): import("react").JSX.Element
|
|
3355
|
+
declare function InteractionCard({ bridge, locale }: InteractionCardProps): import("react").JSX.Element;
|
|
3354
3356
|
//#endregion
|
|
3355
3357
|
//#region src/react/SpecInteraction.d.ts
|
|
3356
3358
|
/** @experimental */
|
|
@@ -3498,6 +3500,6 @@ declare function ErrorCard({ code, message, loopLimits, onOpenSettings, onDismis
|
|
|
3498
3500
|
* Version of the published `@webskill/chatbot` package, injected at build time.
|
|
3499
3501
|
* @stable
|
|
3500
3502
|
*/
|
|
3501
|
-
declare const CHATBOT_VERSION = "0.
|
|
3503
|
+
declare const CHATBOT_VERSION = "0.27.0-next.1";
|
|
3502
3504
|
//#endregion
|
|
3503
3505
|
export { A2uiSurfaceHost, type A2uiSurfaceHostProps, A2uiSurfaceSnapshotHost, type A2uiSurfaceSnapshotHostProps, type AppearanceChange, CHATBOT_VERSION, type ChatAttachmentInput, type ChatAttachmentMeta, type ChatComponent, type ChatComponentCallRecord, type ChatComponentConfirmation, type ChatComponentCredentialField, type ChatComponentInvokeContext, type ChatComponentOutcome, type ChatComponentStore, type ChatComponentText, 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, type HttpMessageComponentOptions, 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, createHttpMessageComponent, createLocalStorageRuntimeConfigStore, createMemoryRuntimeConfigStore, isLlmEntryUsable, pickUsableLlmEntry, probeA2uiAvailability, probeOpenUiAvailability, sandboxExecutorDeps, useT };
|
package/dist/index.js
CHANGED
|
@@ -43877,10 +43877,23 @@ function A2uiSpecSurface({ spec, surfaceId, actions, onAction, registry, runId,
|
|
|
43877
43877
|
...actionId === "submit" ? { value } : {}
|
|
43878
43878
|
});
|
|
43879
43879
|
});
|
|
43880
|
+
const saveDraft = useEffectEvent((value) => {
|
|
43881
|
+
formValuesRef.current = value;
|
|
43882
|
+
if (runId !== void 0) onDraftChange?.({
|
|
43883
|
+
runId,
|
|
43884
|
+
surfaceId,
|
|
43885
|
+
value
|
|
43886
|
+
});
|
|
43887
|
+
});
|
|
43880
43888
|
useEffect(() => {
|
|
43881
43889
|
let disposed = false;
|
|
43882
43890
|
let surfaceElement;
|
|
43891
|
+
const mount = mountRef.current;
|
|
43883
43892
|
const a2uiSurfaceId = `webskill-spec-${surfaceId}`;
|
|
43893
|
+
const captureDraft = () => {
|
|
43894
|
+
const values = surfaceElement?.surface?.dataModel.get(A2UI_SPEC_FORM_PATH);
|
|
43895
|
+
if (typeof values === "object" && values !== null && !Array.isArray(values)) saveDraft(structuredClone(values));
|
|
43896
|
+
};
|
|
43884
43897
|
(async () => {
|
|
43885
43898
|
try {
|
|
43886
43899
|
const [{ MessageProcessor }, lit, catalog] = await Promise.all([
|
|
@@ -43889,9 +43902,10 @@ function A2uiSpecSurface({ spec, surfaceId, actions, onAction, registry, runId,
|
|
|
43889
43902
|
loadWebSkillLitCatalog()
|
|
43890
43903
|
]);
|
|
43891
43904
|
lit.A2uiSurface;
|
|
43892
|
-
const mount = mountRef.current;
|
|
43893
43905
|
if (disposed || !mount) return;
|
|
43894
43906
|
configureA2uiMarkdown(mount);
|
|
43907
|
+
mount.addEventListener("input", captureDraft);
|
|
43908
|
+
mount.addEventListener("change", captureDraft);
|
|
43895
43909
|
const processor = new MessageProcessor([catalog, lit.basicCatalog], (action) => {
|
|
43896
43910
|
const decoded = fromA2uiSpecAction(action);
|
|
43897
43911
|
if (!decoded) return;
|
|
@@ -43908,7 +43922,10 @@ function A2uiSpecSurface({ spec, surfaceId, actions, onAction, registry, runId,
|
|
|
43908
43922
|
mount.replaceChildren(surfaceElement);
|
|
43909
43923
|
});
|
|
43910
43924
|
processor.processMessages(toA2uiSpecMessages(uiCatalog, spec, { surfaceId: a2uiSurfaceId }));
|
|
43911
|
-
const previousValues =
|
|
43925
|
+
const previousValues = {
|
|
43926
|
+
...draft ?? {},
|
|
43927
|
+
...formValuesRef.current
|
|
43928
|
+
};
|
|
43912
43929
|
if (Object.keys(previousValues).length > 0) {
|
|
43913
43930
|
const defaults = processor.getClientDataModel("v0.9.1")?.surfaces?.[a2uiSurfaceId]?.[A2UI_SPEC_FORM_PATH.slice(1)];
|
|
43914
43931
|
processor.processMessages([{
|
|
@@ -43930,8 +43947,9 @@ function A2uiSpecSurface({ spec, surfaceId, actions, onAction, registry, runId,
|
|
|
43930
43947
|
})();
|
|
43931
43948
|
return () => {
|
|
43932
43949
|
disposed = true;
|
|
43933
|
-
|
|
43934
|
-
|
|
43950
|
+
captureDraft();
|
|
43951
|
+
mount?.removeEventListener("input", captureDraft);
|
|
43952
|
+
mount?.removeEventListener("change", captureDraft);
|
|
43935
43953
|
surfaceElement?.remove();
|
|
43936
43954
|
};
|
|
43937
43955
|
}, [spec, surfaceId]);
|
|
@@ -45911,7 +45929,15 @@ const INTERACTION_ACTIONS$1 = [{
|
|
|
45911
45929
|
* 表单本体走 `NativeSpecSurface`——与 native 档 surface 侧同一个渲染入口。
|
|
45912
45930
|
* @stable
|
|
45913
45931
|
*/
|
|
45914
|
-
function InteractionCard({ bridge }) {
|
|
45932
|
+
function InteractionCard({ bridge, locale }) {
|
|
45933
|
+
const card = /* @__PURE__ */ jsx(InteractionCardBody, { bridge });
|
|
45934
|
+
if (locale === void 0) return card;
|
|
45935
|
+
return /* @__PURE__ */ jsx(LocaleProvider, {
|
|
45936
|
+
locale,
|
|
45937
|
+
children: /* @__PURE__ */ jsx(ChatbotSurfaceTexts, { children: card })
|
|
45938
|
+
});
|
|
45939
|
+
}
|
|
45940
|
+
function InteractionCardBody({ bridge }) {
|
|
45915
45941
|
const pending = useSyncExternalStore(bridge.subscribe, () => bridge.pending);
|
|
45916
45942
|
if (!pending) return null;
|
|
45917
45943
|
if (pending.type === "file-pick") return /* @__PURE__ */ jsx(FilePickCard, {
|
|
@@ -47763,7 +47789,7 @@ function VercelPayloadPreview({ bridge }) {
|
|
|
47763
47789
|
* Version of the published `@webskill/chatbot` package, injected at build time.
|
|
47764
47790
|
* @stable
|
|
47765
47791
|
*/
|
|
47766
|
-
const CHATBOT_VERSION = "0.
|
|
47792
|
+
const CHATBOT_VERSION = "0.27.0-next.1";
|
|
47767
47793
|
|
|
47768
47794
|
//#endregion
|
|
47769
47795
|
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, createHttpMessageComponent, 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.27.0-next.1",
|
|
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.30.0-next.0",
|
|
42
42
|
"mermaid": "^12.0.0",
|
|
43
43
|
"react": ">=19.0.0",
|
|
44
44
|
"react-dom": ">=19.0.0",
|