@blueking/chat-x 0.0.49-beta.1 → 0.0.49-beta.2

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.
Files changed (35) hide show
  1. package/dist/ag-ui/types/constants.d.ts +1 -0
  2. package/dist/ag-ui/types/file.d.ts +1 -1
  3. package/dist/components/chat-message/assistant-message/assistant-message.vue.d.ts +12 -1
  4. package/dist/components/chat-message/assistant-message/message-artifacts/artifact-file-card.vue.d.ts +0 -2
  5. package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/artifact-preview-host.vue.d.ts +1 -2
  6. package/dist/components/chat-message/assistant-message/message-artifacts/artifact-preview/use-artifact-preview-loader.d.ts +4 -2
  7. package/dist/components/chat-message/assistant-message/message-artifacts/message-artifacts.vue.d.ts +0 -1
  8. package/dist/components/chat-message/interrupt-message/user-question/use-user-question.d.ts +7 -2
  9. package/dist/components/chat-message/user-message/user-message.vue.d.ts +14 -2
  10. package/dist/composables/use-artifact-preview.d.ts +17 -20
  11. package/dist/composables/use-custom-tab.d.ts +2 -0
  12. package/dist/composables/use-message-group.d.ts +1 -2
  13. package/dist/index.css +1 -1
  14. package/dist/index.js +514 -469
  15. package/dist/index.js.map +1 -1
  16. package/dist/lang/lang.d.ts +3 -1
  17. package/dist/mcp/generated/docs/assistant-message.md +1 -1
  18. package/dist/mcp/generated/docs/chat-container.md +7 -6
  19. package/dist/mcp/generated/docs/chat-input.md +2 -10
  20. package/dist/mcp/generated/docs/constants.md +3 -1
  21. package/dist/mcp/generated/docs/content-render.md +2 -10
  22. package/dist/mcp/generated/docs/file-artifact-panel.md +32 -36
  23. package/dist/mcp/generated/docs/info-message.md +6 -5
  24. package/dist/mcp/generated/docs/interrupt.md +1 -0
  25. package/dist/mcp/generated/docs/message-container.md +4 -21
  26. package/dist/mcp/generated/docs/message-render.md +4 -27
  27. package/dist/mcp/generated/docs/messages.md +5 -0
  28. package/dist/mcp/generated/docs/reasoning-message.md +2 -9
  29. package/dist/mcp/generated/docs/toolcall-render.md +8 -8
  30. package/dist/mcp/generated/docs/use-artifact-preview.md +45 -50
  31. package/dist/mcp/generated/docs/use-custom-tab.md +18 -5
  32. package/dist/mcp/generated/docs/use-message-group.md +13 -8
  33. package/dist/mcp/generated/docs/user-question-card.md +6 -3
  34. package/dist/mcp/generated/index.json +7 -7
  35. package/package.json +2 -2
@@ -49,6 +49,7 @@ export declare enum MessageRole {
49
49
  }
50
50
  export declare enum MessageStatus {
51
51
  Complete = "complete",
52
+ Completed = "completed",
52
53
  Disabled = "disabled",
53
54
  Error = "error",
54
55
  Fetching = "fetching",// 请求中
@@ -2,9 +2,9 @@ export declare enum AIFileType {
2
2
  Html = "html",
3
3
  Jpg = "jpg",
4
4
  Json = "json",
5
+ Markdown = "markdown",
5
6
  /** 后台扩展名别名,与 Markdown 等价 */
6
7
  Md = "md",
7
- Markdown = "markdown",
8
8
  Pdf = "pdf",
9
9
  Txt = "txt"
10
10
  }
@@ -1,11 +1,22 @@
1
1
  import type { AssistantMessage } from '../../../ag-ui/types/messages';
2
+ interface AssistantMessageProps {
3
+ content?: string;
4
+ id?: AssistantMessage['id'];
5
+ messageId?: AssistantMessage['messageId'];
6
+ name?: AssistantMessage['name'];
7
+ property?: AssistantMessage['property'];
8
+ role?: AssistantMessage['role'];
9
+ status?: AssistantMessage['status'];
10
+ toolCalls?: AssistantMessage['toolCalls'];
11
+ uid?: AssistantMessage['uid'];
12
+ }
2
13
  declare var __VLS_1: {
3
14
  content: string;
4
15
  };
5
16
  type __VLS_Slots = {} & {
6
17
  default?: (props: typeof __VLS_1) => any;
7
18
  };
8
- declare const __VLS_base: import("vue").DefineComponent<Partial<AssistantMessage>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Partial<AssistantMessage>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const __VLS_base: import("vue").DefineComponent<AssistantMessageProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AssistantMessageProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
20
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
21
  declare const _default: typeof __VLS_export;
11
22
  export default _default;
@@ -3,8 +3,6 @@ import 'tippy.js/dist/tippy.css';
3
3
  type __VLS_Props = {
4
4
  active?: boolean;
5
5
  file: AIFileInfo;
6
- index?: number;
7
- messageUid?: string;
8
6
  onDownload?: (file: AIFileInfo) => void;
9
7
  onPreview?: (file: AIFileInfo) => void;
10
8
  variant?: 'card' | 'list';
@@ -1,7 +1,6 @@
1
1
  import type { AIFileInfo } from '../../../../../ag-ui/types/file';
2
- import type { SessionArtifact } from '../../../../../composables/use-artifact-preview';
3
2
  type __VLS_Props = {
4
- file?: AIFileInfo | SessionArtifact;
3
+ file?: AIFileInfo;
5
4
  };
6
5
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
6
  declare const _default: typeof __VLS_export;
@@ -1,4 +1,5 @@
1
1
  import type { AIFileInfo, ArtifactUrlResult } from '../../../../../ag-ui/types/file';
2
+ import type { ResolveArtifactUrlsOptions } from '../../../../../composables/use-artifact-preview';
2
3
  import type { ArtifactPreviewRendererKind } from './preview-strategy';
3
4
  export type ArtifactPreviewPayload = {
4
5
  content: string;
@@ -7,14 +8,15 @@ export type ArtifactPreviewPayload = {
7
8
  status: ArtifactPreviewStatus;
8
9
  };
9
10
  export type ArtifactPreviewStatus = 'empty' | 'error' | 'idle' | 'loading' | 'ready';
11
+ export type ArtifactPreviewLoadOptions = ResolveArtifactUrlsOptions;
10
12
  export declare const useArtifactPreviewLoader: (options: {
11
13
  canResolve: () => boolean;
12
14
  getFile: () => AIFileInfo | undefined;
13
- resolveUrls: (file: AIFileInfo) => Promise<ArtifactUrlResult>;
15
+ resolveUrls: (file: AIFileInfo, options?: ResolveArtifactUrlsOptions) => Promise<ArtifactUrlResult>;
14
16
  }) => {
15
17
  content: import("vue").ShallowRef<string, string>;
16
18
  dispose: () => void;
17
- load: () => Promise<void>;
19
+ load: (loadOptions?: ArtifactPreviewLoadOptions) => Promise<void>;
18
20
  previewUrl: import("vue").ShallowRef<string, string>;
19
21
  renderer: import("vue").ShallowRef<ArtifactPreviewRendererKind, ArtifactPreviewRendererKind>;
20
22
  status: import("vue").ShallowRef<ArtifactPreviewStatus, ArtifactPreviewStatus>;
@@ -1,7 +1,6 @@
1
1
  import type { AIFileInfo } from '../../../../ag-ui/types/file';
2
2
  type __VLS_Props = {
3
3
  artifacts: AIFileInfo[];
4
- messageUid?: string;
5
4
  onDownload?: (file: AIFileInfo) => void;
6
5
  onPreview?: (file: AIFileInfo) => void;
7
6
  };
@@ -9,9 +9,9 @@ export type NormalizedUserQuestionOption = UserQuestionOptionItem & {
9
9
  letter: string;
10
10
  };
11
11
  /**
12
- * 用户回答问题(human-in-the-loop)的答案聚合与 resume payload 构建。
12
+ * 用户回答问题(human-in-the-loop)的答案聚合、题目分页与 resume payload 构建。
13
13
  *
14
- * 设计目标:composable 只负责「收集每题答案 + 完成态计算 + payload 组装」,
14
+ * 设计目标:composable 只负责「收集每题答案 + 完成态计算 + 分页定位 + payload 组装」,
15
15
  * 对「回答形态」(单选/多选/表单/任意自定义)零感知;
16
16
  * 各题如何作答与如何校验,全部下沉到对应的渲染组件(默认为选择题),
17
17
  * 渲染组件作答有效时回传已组装的 {@link UserQuestionAnswerItem},无效时回传 undefined。
@@ -23,6 +23,11 @@ export declare const useUserQuestion: (getInterrupt: () => undefined | UserQuest
23
23
  answeredCount: import("vue").ComputedRef<number>;
24
24
  totalCount: import("vue").ComputedRef<number>;
25
25
  completed: import("vue").ComputedRef<boolean>;
26
+ currentIndex: import("vue").ShallowRef<number, number>;
27
+ canGoPrev: import("vue").ComputedRef<boolean>;
28
+ canGoNext: import("vue").ComputedRef<boolean>;
29
+ goPrev: () => void;
30
+ goNext: () => void;
26
31
  getAnswer: (questionIndex: number) => undefined | UserQuestionAnswerItem;
27
32
  setAnswer: (questionIndex: number, answer: undefined | UserQuestionAnswerItem) => void;
28
33
  buildResolvePayload: () => UserQuestionResume;
@@ -1,3 +1,4 @@
1
+ import { type InputContent } from '../../../ag-ui/types';
1
2
  import { type TagSchema, MessageToolsStatus } from '../../../types';
2
3
  import { type MessageToolsProps } from '../../message-tools/message-tools.vue';
3
4
  import type { UserMessage } from '../../../ag-ui/types/messages';
@@ -6,7 +7,18 @@ export type UserMessageActionsProps = {
6
7
  onInputConfirm?: (content: UserMessage['content'], docSchema: TagSchema) => Promise<void>;
7
8
  onShortcutConfirm?: (formModel: Record<string, unknown>) => Promise<void>;
8
9
  };
9
- type __VLS_Props = Partial<UserMessage> & Pick<MessageToolsProps, 'onAction' | 'tippyOptions'> & UserMessageActionsProps;
10
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ interface UserMessageProps extends UserMessageActionsProps {
11
+ content?: InputContent[] | string;
12
+ id?: UserMessage['id'];
13
+ messageId?: UserMessage['messageId'];
14
+ name?: UserMessage['name'];
15
+ onAction?: MessageToolsProps['onAction'];
16
+ property?: UserMessage['property'];
17
+ role?: UserMessage['role'];
18
+ status?: UserMessage['status'];
19
+ tippyOptions?: MessageToolsProps['tippyOptions'];
20
+ uid?: UserMessage['uid'];
21
+ }
22
+ declare const __VLS_export: import("vue").DefineComponent<UserMessageProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<UserMessageProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
23
  declare const _default: typeof __VLS_export;
12
24
  export default _default;
@@ -4,54 +4,51 @@ import type { AIFileInfo, ArtifactUrlResult, OnArtifactClick } from '../ag-ui/ty
4
4
  export declare const ARTIFACT_PREVIEW_TOKEN: unique symbol;
5
5
  /** 文件产物侧栏 Tab 的保留唯一标识(固定 Tab,不可关闭) */
6
6
  export declare const FILE_ARTIFACT_TAB_NAME = "file-artifact";
7
+ /** 临时链接缓存有效期(短于后端 token 常见 10 分钟时效) */
8
+ export declare const ARTIFACT_URL_CACHE_TTL_MS: number;
7
9
  export type OpenArtifactPreviewPayload = {
8
10
  /** 被点击的文件 */
9
11
  file: AIFileInfo;
10
- /** 文件在所属消息 artifacts 中的下标 */
11
- index: number;
12
- /** 所属 AssistantMessage uid */
13
- messageUid: string;
12
+ };
13
+ /** resolveArtifactUrls 可选参数 */
14
+ export type ResolveArtifactUrlsOptions = {
15
+ /** 为 true 时跳过 TTL 缓存,强制重新取链(如预览重试) */
16
+ force?: boolean;
14
17
  };
15
18
  /**
16
- * 会话级文件产物:在 AIFileInfo 基础上补充命中所需的唯一 id 与所属消息。
17
- * 由于同一会话可能出现「多个 AssistantMessage + 同名文件」,文件名不可作为唯一键,
18
- * 统一用 messageUid + 消息内下标 + outputId 组合出全局唯一 id。
19
+ * 会话级文件产物:以 outputId 为会话内唯一键(同 outputId 视为同一文件)。
20
+ * 拍平去重后即为 AIFileInfo,此处用别名标明语义。
19
21
  */
20
- export type SessionArtifact = AIFileInfo & {
21
- artifactId: string;
22
- messageUid: string;
23
- };
22
+ export type SessionArtifact = AIFileInfo;
24
23
  type ArtifactPreviewContext = {
25
- /** 当前命中的文件 id */
24
+ /** 当前命中的文件 outputId */
26
25
  activeArtifactId: Ref<string>;
27
26
  /** 是否具备异步取链能力(有 onArtifactClick 时下载按钮可见) */
28
27
  canResolveArtifactUrl: ComputedRef<boolean>;
29
28
  /** 由文件卡片触发:命中文件并弹出/切换到文件产物侧栏 */
30
29
  openPreview: (payload: OpenArtifactPreviewPayload) => void;
31
- /** outputId 缓存并解析 download_url / preview_url */
32
- resolveArtifactUrls: (file: AIFileInfo) => Promise<ArtifactUrlResult>;
33
- /** 直接设置命中文件 id(侧栏列表内切换用) */
30
+ /** 解析 download_url / preview_url:TTL 内复用缓存;force 时强制刷新;并发去重 */
31
+ resolveArtifactUrls: (file: AIFileInfo, options?: ResolveArtifactUrlsOptions) => Promise<ArtifactUrlResult>;
32
+ /** 直接设置命中文件 outputId(侧栏列表内切换用) */
34
33
  setActiveArtifactId: (id: string) => void;
35
34
  };
36
- /** 统一的文件产物唯一 id 生成规则,Provider 与文件卡片两侧必须一致 */
37
- export declare const buildArtifactId: (messageUid: string, index: number, outputId: string) => string;
38
35
  /** 通过临时 <a> 触发浏览器下载 */
39
36
  export declare const triggerArtifactDownload: (url: string, fileName: string) => void;
40
37
  /**
41
38
  * 文件产物预览 Provider(在 ChatContainer 内使用)。
42
- * 维护「命中文件」状态,并封装 onArtifactClick URL 解析与按 outputId 缓存;
39
+ * 维护「命中文件」状态,并封装 onArtifactClick 取链(TTL 缓存 + 并发去重);
43
40
  * 打开侧栏 Tab 的副作用由外部 onOpen 注入。
44
41
  */
45
42
  export declare const useArtifactPreviewProvider: (options: {
46
43
  /** 读取业务侧异步取链回调(用 getter 保持对 props 变更敏感) */
47
44
  getOnArtifactClick?: () => OnArtifactClick | undefined;
48
45
  /** 命中文件后触发:由容器负责 addCustomTab + 展开侧栏 + 选中 Tab */
49
- onOpen: (artifactId: string) => void;
46
+ onOpen: (outputId: string) => void;
50
47
  }) => {
51
48
  activeArtifactId: import("vue").ShallowRef<string, string>;
52
49
  canResolveArtifactUrl: ComputedRef<boolean>;
53
50
  openPreview: (payload: OpenArtifactPreviewPayload) => void;
54
- resolveArtifactUrls: (file: AIFileInfo) => Promise<ArtifactUrlResult>;
51
+ resolveArtifactUrls: (file: AIFileInfo, resolveOptions?: ResolveArtifactUrlsOptions) => Promise<ArtifactUrlResult>;
55
52
  setActiveArtifactId: (id: string) => void;
56
53
  };
57
54
  /** 文件产物预览 Consumer(在深层文件卡片中使用),无 Provider 时返回 undefined 兜底 */
@@ -34,6 +34,7 @@ export declare function useCustomTabProvider<T extends Record<string, unknown>>(
34
34
  }>;
35
35
  isCollapse: ShallowRef<boolean, boolean>;
36
36
  addCustomTab: (tab: CustomTab<T>) => void;
37
+ ensureCustomTab: (tab: CustomTab<T>) => void;
37
38
  removeCustomTab: (tabName: CustomTab<T>["name"]) => void;
38
39
  selectCustomTab: (tab: CustomTab<T>) => void;
39
40
  resetCustomTab: () => void;
@@ -41,6 +42,7 @@ export declare function useCustomTabProvider<T extends Record<string, unknown>>(
41
42
  export declare const useCustomTabConsumer: <T extends Record<string, unknown>>() => {
42
43
  addCustomTab: (tab: CustomTab<T>) => void;
43
44
  displayTabs: ComputedRef<CustomTab<T>[]>;
45
+ ensureCustomTab: (tab: CustomTab<T>) => void;
44
46
  removeCustomTab: (tabName: CustomTab<T>["name"]) => void;
45
47
  selectCustomTab: (tab: CustomTab<T>) => void;
46
48
  selectedTab: ShallowRef<CustomTab<T> | null>;
@@ -1,7 +1,6 @@
1
1
  import type { ComputedRef, MaybeRef, Ref, ShallowRef } from 'vue';
2
2
  import { type Message, APPROVAL_STATUS, InterruptReason, MessageContentType, MessageRole, MessageStatus } from '../ag-ui/types';
3
3
  import { RenderMode } from '../common/constants';
4
- import { type SessionArtifact } from './use-artifact-preview';
5
4
  import type { UserQuestionInterrupt } from '../ag-ui/types/interrupt';
6
5
  export type MessageGroup = {
7
6
  checked: boolean;
@@ -26289,7 +26288,7 @@ export declare const useMessageGroup: (options: {
26289
26288
  userMessageTitle?: number | string | undefined;
26290
26289
  }[]>;
26291
26290
  executionGroups: ComputedRef<MessageGroup[]>;
26292
- sessionArtifacts: ComputedRef<SessionArtifact[]>;
26291
+ sessionArtifacts: ComputedRef<import("..").AIFileInfo[]>;
26293
26292
  activeUserQuestionInterrupt: ComputedRef<UserQuestionInterrupt | undefined>;
26294
26293
  pendingApprovalCount: ComputedRef<number>;
26295
26294
  pendingApprovalTipText: ComputedRef<string>;