@farris/x-ui 0.0.6 → 0.0.7
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/chat-preview/index.d.ts +17 -0
- package/chat-preview/src/chat-preview.component.d.ts +34 -0
- package/chat-preview/src/chat-preview.props.d.ts +19 -0
- package/chat-preview/src/invoke-agent-workbench-sdk.d.ts +5 -0
- package/chat-preview/src/preview-bridge-host.d.ts +15 -0
- package/chat-preview/src/preview-bridge-protocol.d.ts +22 -0
- package/chat-preview/src/preview-chrome-sdk.d.ts +28 -0
- package/chat-preview/src/preview-iframe-sdk.d.ts +7 -0
- package/components.d.ts +2 -0
- package/dynamic-component/index.d.ts +1 -1
- package/dynamic-component/src/composition/dynamic-component-registry.d.ts +13 -0
- package/dynamic-component/src/composition/types.d.ts +5 -3
- package/farris.x-ui.esm.js +7949 -7323
- package/farris.x-ui.umd.cjs +125 -74
- package/index.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Plugin } from '../../vue';
|
|
2
|
+
import { default as FXChatPreview } from '../../src/chat-preview.component';
|
|
3
|
+
|
|
4
|
+
export * from '../../src/chat-preview.props';
|
|
5
|
+
export * from '../../src/preview-bridge-protocol';
|
|
6
|
+
export { postAssistantToPreviewIframe, subscribeAssistantInPreviewIframe, type PreviewAssistantBridgeSubscribeOptions, } from '../../src/preview-bridge-host';
|
|
7
|
+
/** 按方法名调用宿主 `window.AgentWorkbenchSDK`(由 `@farris/x-workbench` 注入) */
|
|
8
|
+
export { invokeAgentWorkbenchSdkApi } from '../../src/invoke-agent-workbench-sdk';
|
|
9
|
+
/** @deprecated 请使用 {@link subscribeAssistantInPreviewIframe};宿主侧见 `@farris/x-workbench` */
|
|
10
|
+
export { createPreviewIframeSdk } from '../../src/preview-iframe-sdk';
|
|
11
|
+
/** @deprecated */
|
|
12
|
+
export type { CreatePreviewIframeSdkOptions } from '../../src/preview-iframe-sdk';
|
|
13
|
+
/** 会话分屏预览:由 FXConversation 注册,供 AgentWorkbenchSDK 等聚合调用 */
|
|
14
|
+
export { registerPreviewChromeSdk, previewLayoutBridge, type PreviewChromeSdkHandlers, } from '../../src/preview-chrome-sdk';
|
|
15
|
+
export { FXChatPreview };
|
|
16
|
+
declare const _default: typeof FXChatPreview & Plugin;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PreviewConfig } from '../../../../../app-preview';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('../../../vue').DefineComponent<import('../../../vue').ExtractPropTypes<{
|
|
4
|
+
previewConfig: {
|
|
5
|
+
type: import('../../../vue').PropType<PreviewConfig>;
|
|
6
|
+
default: () => {};
|
|
7
|
+
};
|
|
8
|
+
onClose: {
|
|
9
|
+
type: import('../../../vue').PropType<() => void>;
|
|
10
|
+
default: () => void;
|
|
11
|
+
};
|
|
12
|
+
onIframeLoad: {
|
|
13
|
+
type: import('../../../vue').PropType<() => void>;
|
|
14
|
+
default: () => void;
|
|
15
|
+
};
|
|
16
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('../../../vue').ComponentOptionsMixin, import('../../../vue').ComponentOptionsMixin, {}, string, import('../../../vue').PublicProps, Readonly<import('../../../vue').ExtractPropTypes<{
|
|
17
|
+
previewConfig: {
|
|
18
|
+
type: import('../../../vue').PropType<PreviewConfig>;
|
|
19
|
+
default: () => {};
|
|
20
|
+
};
|
|
21
|
+
onClose: {
|
|
22
|
+
type: import('../../../vue').PropType<() => void>;
|
|
23
|
+
default: () => void;
|
|
24
|
+
};
|
|
25
|
+
onIframeLoad: {
|
|
26
|
+
type: import('../../../vue').PropType<() => void>;
|
|
27
|
+
default: () => void;
|
|
28
|
+
};
|
|
29
|
+
}>> & Readonly<{}>, {
|
|
30
|
+
previewConfig: PreviewConfig;
|
|
31
|
+
onClose: () => void;
|
|
32
|
+
onIframeLoad: () => void;
|
|
33
|
+
}, {}, {}, {}, string, import('../../../vue').ComponentProvideOptions, true, {}, any>;
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ExtractPropTypes, PropType } from '../../../vue';
|
|
2
|
+
import { PreviewConfig } from '../../../../../app-preview';
|
|
3
|
+
|
|
4
|
+
export declare const chatPreviewProps: {
|
|
5
|
+
previewConfig: {
|
|
6
|
+
type: PropType<PreviewConfig>;
|
|
7
|
+
default: () => {};
|
|
8
|
+
};
|
|
9
|
+
onClose: {
|
|
10
|
+
type: PropType<() => void>;
|
|
11
|
+
default: () => void;
|
|
12
|
+
};
|
|
13
|
+
/** iframe 文档 load 后回调(用于父页在子页监听器就绪后再 postMessage) */
|
|
14
|
+
onIframeLoad: {
|
|
15
|
+
type: PropType<() => void>;
|
|
16
|
+
default: () => void;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type ChatPreviewProps = ExtractPropTypes<typeof chatPreviewProps>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 按方法名调用宿主挂载的 {@link AgentWorkbenchSDK}(由 `@farris/x-workbench` 在 `window.AgentWorkbenchSDK` 注入)。
|
|
3
|
+
* 供网关 `InputRecommend` 等配置 `api` + `params`;无宿主 SDK 时会告警并返回 `undefined`。
|
|
4
|
+
*/
|
|
5
|
+
export declare function invokeAgentWorkbenchSdkApi(api: string, params?: unknown[]): unknown;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PreviewBridgeAssistantPayload } from '../../../preview-bridge-protocol';
|
|
2
|
+
|
|
3
|
+
export interface PreviewAssistantBridgeSubscribeOptions {
|
|
4
|
+
/** 允许的父页面 origin;不传则只做结构校验,不校验 origin */
|
|
5
|
+
allowedParentOrigins?: string[];
|
|
6
|
+
/**
|
|
7
|
+
* 为 true(默认)时接受 `window.parent` 或 `window.top` 作为发送方。
|
|
8
|
+
*/
|
|
9
|
+
allowTopAsSource?: boolean;
|
|
10
|
+
onAssistantMessage?: (payload: PreviewBridgeAssistantPayload) => void;
|
|
11
|
+
}
|
|
12
|
+
/** 向预览 iframe 的 `contentWindow` 投递助手消息(与 {@link subscribeAssistantInPreviewIframe} 协议一致) */
|
|
13
|
+
export declare function postAssistantToPreviewIframe(targetWindow: Window, targetOrigin: string, payload: PreviewBridgeAssistantPayload): boolean;
|
|
14
|
+
/** 预览页内:订阅父页 / top 推送的助手消息 */
|
|
15
|
+
export declare function subscribeAssistantInPreviewIframe(options: PreviewAssistantBridgeSubscribeOptions): () => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** 父页 → iframe 的 postMessage 协议(与 iframe 侧 SDK 对齐) */
|
|
2
|
+
export declare const PREVIEW_BRIDGE_SOURCE: "farris-x-preview-bridge";
|
|
3
|
+
export declare const PREVIEW_BRIDGE_VERSION: 1;
|
|
4
|
+
export declare const PREVIEW_BRIDGE_MESSAGE_TYPE_ASSISTANT: "assistant.message";
|
|
5
|
+
export interface PreviewBridgeAssistantPayload {
|
|
6
|
+
messageId: string;
|
|
7
|
+
role: 'user' | 'assistant';
|
|
8
|
+
/** 助手消息的完整 content(与会话内结构一致,由 structured clone / 序列化承载) */
|
|
9
|
+
content: unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface PreviewBridgeMessageEnvelope {
|
|
12
|
+
source: typeof PREVIEW_BRIDGE_SOURCE;
|
|
13
|
+
v: typeof PREVIEW_BRIDGE_VERSION;
|
|
14
|
+
type: typeof PREVIEW_BRIDGE_MESSAGE_TYPE_ASSISTANT;
|
|
15
|
+
payload: PreviewBridgeAssistantPayload;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* postMessage 走 structured clone,Vue reactive/Proxy 可能无法克隆导致静默失败;
|
|
19
|
+
* 先 JSON 往返成纯对象再投递。
|
|
20
|
+
*/
|
|
21
|
+
export declare function clonePreviewPayloadForPostMessage(payload: PreviewBridgeAssistantPayload): PreviewBridgeAssistantPayload;
|
|
22
|
+
export declare function isPreviewBridgeAssistantMessage(data: unknown): data is PreviewBridgeMessageEnvelope;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PreviewConfig } from '../../../../../app-preview/src/types';
|
|
2
|
+
|
|
3
|
+
/** 由 FXConversation 注入,供 window 侧 imperative 调用(分屏 / 双栏预览) */
|
|
4
|
+
export interface PreviewChromeSdkHandlers {
|
|
5
|
+
showPreview?: (config: PreviewConfig) => void;
|
|
6
|
+
closePreviewPane?: () => void;
|
|
7
|
+
closeRightPreview?: () => void;
|
|
8
|
+
showFullScreenPreview?: (config: PreviewConfig) => void;
|
|
9
|
+
closeFullScreenPreview?: () => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 会话组件挂载时注册;卸载时执行返回函数。多实例时后进先出,避免前一个页面卸载清空后一个的句柄。
|
|
13
|
+
*/
|
|
14
|
+
export declare function registerPreviewChromeSdk(handlers: PreviewChromeSdkHandlers): () => void;
|
|
15
|
+
/** 实现细节:对外由 `@farris/x-workbench` 的 `agent-workbench-sdk.ts` 聚合为 `window.AgentWorkbenchSDK`。 */
|
|
16
|
+
export declare const previewLayoutBridge: {
|
|
17
|
+
/**
|
|
18
|
+
* 打开或更新预览:右侧空 → 单栏右侧;仅右侧已有 → 双栏(旧右→左,新→右);**左右已有 → 只替换右侧 iframe**。
|
|
19
|
+
*/
|
|
20
|
+
readonly showPreview: (config: PreviewConfig) => void;
|
|
21
|
+
/** 与 {@link previewLayoutBridge.showPreview} 相同,强调在双栏时只换右侧。 */
|
|
22
|
+
readonly replaceRightPreview: (config: PreviewConfig) => void;
|
|
23
|
+
readonly closePreviewPane: () => void;
|
|
24
|
+
readonly closeRightPreview: () => void;
|
|
25
|
+
readonly showFullScreenPreview: (config: PreviewConfig) => void;
|
|
26
|
+
readonly closeFullScreenPreview: () => void;
|
|
27
|
+
readonly isPreviewLayoutActive: () => boolean;
|
|
28
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PreviewAssistantBridgeSubscribeOptions } from '../../../preview-bridge-host';
|
|
2
|
+
|
|
3
|
+
export type CreatePreviewIframeSdkOptions = PreviewAssistantBridgeSubscribeOptions;
|
|
4
|
+
/** @deprecated 请使用 {@link subscribeAssistantInPreviewIframe} */
|
|
5
|
+
export declare function createPreviewIframeSdk(options: CreatePreviewIframeSdkOptions): () => void;
|
|
6
|
+
/** @deprecated 请使用 {@link postAssistantToPreviewIframe} */
|
|
7
|
+
export { postAssistantToPreviewIframe as postAssistantViaAgentWorkbenchSDK } from '../../../preview-bridge-host';
|
package/components.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export { default as FXBubble, FXBubbleAction } from '../bubble';
|
|
|
4
4
|
export * from '../bubble';
|
|
5
5
|
export { default as FXCarousel, FXCarouselItem } from '../carousel';
|
|
6
6
|
export * from '../carousel';
|
|
7
|
+
export { default as FXChatPreview } from '../chat-preview';
|
|
8
|
+
export * from '../chat-preview';
|
|
7
9
|
export { default as FXConfirmDialog } from '../confirm-dialog';
|
|
8
10
|
export * from '../confirm-dialog';
|
|
9
11
|
export { default as FXCoding } from '../coding';
|
|
@@ -2,6 +2,6 @@ import { Plugin } from '../../vue';
|
|
|
2
2
|
import { default as FXDynamicComponent } from '../../src/dynamic-component.component';
|
|
3
3
|
export { default as FXDynamicComponent } from '../../src/dynamic-component.component';
|
|
4
4
|
export * from '../../src/composition/types';
|
|
5
|
-
export { loadDynamicComponent, unloadDynamicComponent, postDynamicComponentAssistantMessage } from '../../src/composition/dynamic-component-registry';
|
|
5
|
+
export { loadDynamicComponent, unloadDynamicComponent, postDynamicComponentAssistantMessage, peekDynamicComponentRegisterBootstrapId, normalizeDynamicComponentRegisterClaim, getDynamicComponentRegistryDebugSnapshot } from '../../src/composition/dynamic-component-registry';
|
|
6
6
|
declare const _default: typeof FXDynamicComponent & Plugin;
|
|
7
7
|
export default _default;
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { DynamicComponentConfig, DynamicComponentAPI, DynamicComponentAssistantMessagePayload } from '../../../../types';
|
|
2
2
|
|
|
3
|
+
/** 与对话 mock 「口令规范化」同源:隐蔽字符会导致 pending key 肉眼一致却 get 失败 */
|
|
4
|
+
export declare function normalizeDynamicComponentRegisterClaim(raw: unknown): string;
|
|
5
|
+
/** 供调试:`import { peekDynamicComponentRegisterBootstrapId } from '@farris/x-ui'` */
|
|
6
|
+
export declare function peekDynamicComponentRegisterBootstrapId(): string | undefined;
|
|
7
|
+
/** 控制台联调快照 */
|
|
8
|
+
export declare function getDynamicComponentRegistryDebugSnapshot(): {
|
|
9
|
+
pendingKeys: string[];
|
|
10
|
+
bootstrapQueue: string[];
|
|
11
|
+
activeKeys: string[];
|
|
12
|
+
windowBootstrapPeek?: string;
|
|
13
|
+
};
|
|
3
14
|
export declare function loadDynamicComponent(config: DynamicComponentConfig): Promise<DynamicComponentAPI>;
|
|
4
15
|
export declare function unloadDynamicComponent(id: string): void;
|
|
5
16
|
export declare function postDynamicComponentAssistantMessage(id: string, payload: DynamicComponentAssistantMessagePayload): boolean;
|
|
6
17
|
declare global {
|
|
7
18
|
interface Window {
|
|
8
19
|
__fluens_dynamic_component_register: (id: string, api: DynamicComponentAPI) => void;
|
|
20
|
+
__fluens_dynamic_component_bootstrap_instance_id?: string;
|
|
21
|
+
__fluens_get_dynamic_component_registry_debug_snapshot?: typeof getDynamicComponentRegistryDebugSnapshot;
|
|
9
22
|
}
|
|
10
23
|
}
|
|
@@ -12,18 +12,20 @@ export interface DynamicComponentConfig {
|
|
|
12
12
|
isFullscreen?: boolean;
|
|
13
13
|
autoOpen?: boolean;
|
|
14
14
|
fileRe?: string;
|
|
15
|
+
/** 打开后落位目标面板,默认 'preview' */
|
|
16
|
+
target?: 'preview' | 'previewExtra';
|
|
15
17
|
}
|
|
16
18
|
export interface DynamicComponentAssistantMessagePayload {
|
|
17
19
|
messageId: string;
|
|
18
|
-
role: 'assistant';
|
|
19
|
-
/**
|
|
20
|
+
role: 'user' | 'assistant';
|
|
21
|
+
/** 会话内消息的完整 content;含 dynamic-component 围栏、markdown、复合块等(与 UI 气泡一致)。 */
|
|
20
22
|
content: unknown;
|
|
21
23
|
}
|
|
22
24
|
export interface DynamicComponentAPI {
|
|
23
25
|
mount(container: HTMLElement, config: DynamicComponentConfig): void;
|
|
24
26
|
unmount(): void;
|
|
25
27
|
/**
|
|
26
|
-
*
|
|
28
|
+
* 可选:接收同会话内用户/助手消息(与右侧 iframe 预览桥一致),用于侧栏/预览区与流式同步。
|
|
27
29
|
*/
|
|
28
30
|
onAssistantMessage?: (payload: DynamicComponentAssistantMessagePayload) => void;
|
|
29
31
|
}
|