@blueking/chat-x 0.0.45-beta.7 → 0.0.45-beta.8
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/README.md +1 -1
- package/dist/ag-ui/types/constants.d.ts +16 -0
- package/dist/ag-ui/types/contents.d.ts +2 -0
- package/dist/ag-ui/types/index.d.ts +2 -0
- package/dist/ag-ui/types/interrupt.d.ts +152 -0
- package/dist/ag-ui/types/messages.d.ts +2 -0
- package/dist/ag-ui/types/schema.d.ts +42 -0
- package/dist/components/ai-questions/questions-container.vue.d.ts +3 -0
- package/dist/components/ai-questions/selection-question.vue.d.ts +3 -0
- package/dist/components/chat-content/flow-agent-content/flow-agent-content.vue.d.ts +3 -0
- package/dist/components/chat-content/flow-agent-content/use-flow-agent.d.ts +4 -0
- package/dist/components/chat-content/flow-agent-content/use-flow-node-actions.d.ts +32 -0
- package/dist/components/chat-content/index.d.ts +2 -0
- package/dist/components/chat-input/ai-slash-input/command.d.ts +1 -2
- package/dist/components/chat-input/ai-slash-input/constants.d.ts +0 -4
- package/dist/components/chat-input/chat-input.vue.d.ts +14 -8
- package/dist/components/chat-input/input-attachment/input-attachment.vue.d.ts +1 -0
- package/dist/components/chat-input/input-info-alert.vue.d.ts +6 -0
- package/dist/components/chat-message/activity-message/activity-message.vue.d.ts +4 -1
- package/dist/components/chat-message/assistant-message/assistant-message.vue.d.ts +1 -1
- package/dist/components/chat-message/interrupt-message/index.d.ts +2 -0
- package/dist/components/chat-message/interrupt-message/interrupt-message.vue.d.ts +17 -0
- package/dist/components/chat-message/interrupt-message/tool-approval-card.vue.d.ts +9 -0
- package/dist/components/chat-message/interrupt-message/user-question/index.d.ts +5 -0
- package/dist/components/chat-message/interrupt-message/user-question/use-user-question.d.ts +35 -0
- package/dist/components/chat-message/interrupt-message/user-question/user-question-answered-card.vue.d.ts +25 -0
- package/dist/components/chat-message/interrupt-message/user-question/user-question-card.vue.d.ts +25 -0
- package/dist/components/chat-message/interrupt-message/user-question/user-question-choice.vue.d.ts +13 -0
- package/dist/components/chat-message/interrupt-message/user-question/user-question-option.vue.d.ts +17 -0
- package/dist/components/chat-message/message-container/message-container.vue.d.ts +14 -7
- package/dist/components/chat-message/message-render/message-render.vue.d.ts +4 -0
- package/dist/components/index.d.ts +3 -2
- package/dist/composables/use-global-config.d.ts +3 -0
- package/dist/composables/use-message-group.d.ts +2224 -355
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/interrupt.d.ts +24 -0
- package/dist/index.css +1 -1
- package/dist/index.js +2557 -1937
- package/dist/index.js.map +1 -1
- package/dist/lang/lang.d.ts +34 -2
- package/dist/mcp/generated/docs/activity-layout.md +138 -0
- package/dist/mcp/generated/docs/activity-message.md +21 -7
- package/dist/mcp/generated/docs/ai-image.md +9 -4
- package/dist/mcp/generated/docs/ai-loading.md +11 -6
- package/dist/mcp/generated/docs/ai-prompt-list.md +42 -0
- package/dist/mcp/generated/docs/ai-selection.md +10 -5
- package/dist/mcp/generated/docs/ai-slash-editor.md +43 -0
- package/dist/mcp/generated/docs/ai-slash-input.md +43 -0
- package/dist/mcp/generated/docs/ai-slash-menu.md +42 -0
- package/dist/mcp/generated/docs/animation-text.md +9 -4
- package/dist/mcp/generated/docs/assistant-message.md +10 -5
- package/dist/mcp/generated/docs/chat-container.md +173 -19
- package/dist/mcp/generated/docs/chat-input.md +78 -10
- package/dist/mcp/generated/docs/cite-content.md +8 -3
- package/dist/mcp/generated/docs/code-content.md +9 -4
- package/dist/mcp/generated/docs/common-error-content.md +10 -5
- package/dist/mcp/generated/docs/constants.md +68 -3
- package/dist/mcp/generated/docs/content-render.md +10 -5
- package/dist/mcp/generated/docs/delete-tool.md +9 -4
- package/dist/mcp/generated/docs/desc-panel.md +9 -4
- package/dist/mcp/generated/docs/detail-section.md +93 -0
- package/dist/mcp/generated/docs/execution-summary.md +10 -5
- package/dist/mcp/generated/docs/file-content.md +9 -4
- package/dist/mcp/generated/docs/file-upload-btn.md +10 -5
- package/dist/mcp/generated/docs/flow-agent-content.md +252 -0
- package/dist/mcp/generated/docs/flow-agent-node-detail.md +240 -0
- package/dist/mcp/generated/docs/highlight-keyword.md +10 -5
- package/dist/mcp/generated/docs/image-content.md +9 -4
- package/dist/mcp/generated/docs/image-preview-group.md +9 -4
- package/dist/mcp/generated/docs/image-preview.md +10 -5
- package/dist/mcp/generated/docs/info-message.md +7 -2
- package/dist/mcp/generated/docs/input-attachment.md +43 -0
- package/dist/mcp/generated/docs/input-info-alert.md +42 -0
- package/dist/mcp/generated/docs/interrupt-message.md +216 -0
- package/dist/mcp/generated/docs/interrupt.md +377 -0
- package/dist/mcp/generated/docs/key-value-content.md +9 -4
- package/dist/mcp/generated/docs/knowledge-rag-content.md +126 -0
- package/dist/mcp/generated/docs/latex-content.md +9 -4
- package/dist/mcp/generated/docs/loading-message.md +11 -6
- package/dist/mcp/generated/docs/markdown-container.md +1 -1
- package/dist/mcp/generated/docs/markdown-content.md +13 -8
- package/dist/mcp/generated/docs/markdown-latex.md +3 -3
- package/dist/mcp/generated/docs/markdown-mermaid.md +3 -3
- package/dist/mcp/generated/docs/mermaid-content.md +9 -4
- package/dist/mcp/generated/docs/message-container.md +74 -16
- package/dist/mcp/generated/docs/message-loading.md +120 -0
- package/dist/mcp/generated/docs/message-render.md +23 -11
- package/dist/mcp/generated/docs/message-tools.md +10 -5
- package/dist/mcp/generated/docs/messages.md +75 -11
- package/dist/mcp/generated/docs/overflow-tips.md +4 -4
- package/dist/mcp/generated/docs/preview-toolbar.md +42 -0
- package/dist/mcp/generated/docs/questions-container.md +88 -0
- package/dist/mcp/generated/docs/reasoning-message.md +10 -5
- package/dist/mcp/generated/docs/reference-content.md +10 -5
- package/dist/mcp/generated/docs/reference-doc-content.md +112 -0
- package/dist/mcp/generated/docs/schema.md +93 -0
- package/dist/mcp/generated/docs/scroll-btn.md +8 -3
- package/dist/mcp/generated/docs/selection-footer.md +9 -4
- package/dist/mcp/generated/docs/selection-question.md +91 -0
- package/dist/mcp/generated/docs/shortcut-btn.md +10 -5
- package/dist/mcp/generated/docs/shortcut-btns.md +10 -5
- package/dist/mcp/generated/docs/shortcut-render.md +10 -5
- package/dist/mcp/generated/docs/simple-table.md +103 -0
- package/dist/mcp/generated/docs/text-content.md +9 -4
- package/dist/mcp/generated/docs/theme.md +50 -4
- package/dist/mcp/generated/docs/tool-approval-card.md +164 -0
- package/dist/mcp/generated/docs/tool-btn.md +9 -4
- package/dist/mcp/generated/docs/tool-message.md +10 -5
- package/dist/mcp/generated/docs/toolcall-render.md +10 -5
- package/dist/mcp/generated/docs/use-animation-text.md +4 -4
- package/dist/mcp/generated/docs/use-clipboard.md +3 -3
- package/dist/mcp/generated/docs/use-command-selection.md +1 -1
- package/dist/mcp/generated/docs/use-custom-tab.md +1 -1
- package/dist/mcp/generated/docs/use-flow-node-actions.md +124 -0
- package/dist/mcp/generated/docs/use-full-screen.md +3 -3
- package/dist/mcp/generated/docs/use-global-config.md +20 -5
- package/dist/mcp/generated/docs/use-menu-keydown.md +1 -1
- package/dist/mcp/generated/docs/use-message-group.md +42 -10
- package/dist/mcp/generated/docs/use-observer-visible-list.md +1 -1
- package/dist/mcp/generated/docs/user-feedback.md +8 -3
- package/dist/mcp/generated/docs/user-message.md +18 -13
- package/dist/mcp/generated/docs/user-question-answered-card.md +106 -0
- package/dist/mcp/generated/docs/user-question-card.md +228 -0
- package/dist/mcp/generated/docs/user-question-choice.md +108 -0
- package/dist/mcp/generated/docs/user-question-option.md +42 -0
- package/dist/mcp/generated/docs/vnode-renderer.md +126 -0
- package/dist/mcp/generated/index.json +1105 -562
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/list-components.d.ts +7 -6
- package/dist/mcp/tools/list-components.js +23 -29
- package/dist/mcp/tools/list-components.js.map +1 -1
- package/dist/mcp/tools/search-docs.js +1 -1
- package/dist/mcp/tools/search-docs.js.map +1 -1
- package/dist/mcp/utils/doc-loader.d.ts +1 -1
- package/dist/types/editor.d.ts +0 -1
- package/dist/utils/utils.d.ts +2 -2
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -458,7 +458,7 @@ CSS 变量 + `useGlobalConfig` 统一调整全局展示配置。
|
|
|
458
458
|
|
|
459
459
|
| 工具 | 说明 |
|
|
460
460
|
| ------------------- | ------------------------------------------- |
|
|
461
|
-
| `list_components` |
|
|
461
|
+
| `list_components` | 列出所有索引条目,支持按 kind / domain 过滤 |
|
|
462
462
|
| `get_component_doc` | 获取指定组件文档,含 AI 摘要 |
|
|
463
463
|
| `search_docs` | 关键词搜索文档 |
|
|
464
464
|
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
export declare enum APPROVAL_STATUS {
|
|
2
|
+
ABANDONED = "abandoned",// 已废弃
|
|
3
|
+
APPROVED = "approved",// 已批准
|
|
4
|
+
CANCELLED = "cancelled",// 已取消
|
|
5
|
+
DRAFT = "draft",// 草稿 - 待审批
|
|
6
|
+
EXPIRED = "expired",// 已过期
|
|
7
|
+
PENDING = "pending",// 待审批
|
|
8
|
+
REJECTED = "rejected",// 已拒绝
|
|
9
|
+
REVOKED = "revoked"
|
|
10
|
+
}
|
|
11
|
+
export declare enum InterruptReason {
|
|
12
|
+
AIDevToolApproval = "aidev:tool_approval",// AI dev 第三方审批
|
|
13
|
+
UserQuestion = "aidev:user_question"
|
|
14
|
+
}
|
|
1
15
|
export declare enum MessageContentType {
|
|
2
16
|
Binary = "binary",
|
|
3
17
|
FlowAgent = "flow_agent",
|
|
@@ -19,6 +33,7 @@ export declare enum MessageRole {
|
|
|
19
33
|
HiddenSystem = "hidden-system",
|
|
20
34
|
HiddenUser = "hidden-user",
|
|
21
35
|
Info = "info",
|
|
36
|
+
Interrupt = "interrupt",
|
|
22
37
|
Loading = "loading",
|
|
23
38
|
Pause = "pause",
|
|
24
39
|
Placeholder = "placeholder",
|
|
@@ -43,3 +58,4 @@ export declare enum MessageStatus {
|
|
|
43
58
|
Streaming = "streaming",
|
|
44
59
|
Success = "success"
|
|
45
60
|
}
|
|
61
|
+
export declare const APPROVAL_STATUS_MAP: Record<APPROVAL_STATUS, string>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { APPROVAL_STATUS, InterruptReason, MessageRole } from './constants';
|
|
2
|
+
import type { BaseMessage } from './messages';
|
|
3
|
+
/**
|
|
4
|
+
* 可恢复操作(resume operation)枚举。
|
|
5
|
+
*
|
|
6
|
+
* 统一标识用户在「中断消息 / 活动消息」上触发的、需回传 Agent 处理的动作;
|
|
7
|
+
* 业务侧通过 `onInterruptResume` 回调的 `payload.operation` 字段进行分支处理。
|
|
8
|
+
* 新增操作类型只需在此扩展,回调契约与透传链路保持不变。
|
|
9
|
+
*/
|
|
10
|
+
export declare enum InterruptResumeOperation {
|
|
11
|
+
/** 主动取消第三方工具审批:在 interrupt 记录上写入取消结果 */
|
|
12
|
+
ApprovalCancel = "approval_cancel",
|
|
13
|
+
/** 重试失败的流程节点:bkflow 节点状态重置为可执行 */
|
|
14
|
+
FlowNodeRetry = "flow_node_retry",
|
|
15
|
+
/** 跳过失败的流程节点:bkflow 节点标记为已跳过 */
|
|
16
|
+
FlowNodeSkip = "flow_node_skip"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* AI Dev 第三方工具审批中断
|
|
20
|
+
*/
|
|
21
|
+
export type AIDevToolApprovalInterrupt = BaseInterrupt<InterruptReason.AIDevToolApproval, AIDevToolApprovalInterruptPayloadMetaData>;
|
|
22
|
+
export type AIDevToolApprovalInterruptPayloadMetaData = {
|
|
23
|
+
ticket: {
|
|
24
|
+
approvers: string[];
|
|
25
|
+
sn: string;
|
|
26
|
+
status: APPROVAL_STATUS;
|
|
27
|
+
submit_time: string;
|
|
28
|
+
title: string;
|
|
29
|
+
url: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* AI Dev 第三方工具审批中断响应(resume 后用于 outcome.success 时会话内回显审批单)。
|
|
34
|
+
* payload 透传中断时的 metaData(含 ticket),以便复用 ToolApprovalCard 渲染。
|
|
35
|
+
*/
|
|
36
|
+
export type AIDevToolApprovalResume = BaseResume<InterruptReason.AIDevToolApproval, {
|
|
37
|
+
metadata: AIDevToolApprovalInterruptPayloadMetaData;
|
|
38
|
+
}>;
|
|
39
|
+
export type BaseInterrupt<T extends InterruptReason, M extends Record<string, any>> = {
|
|
40
|
+
expiresAt?: string;
|
|
41
|
+
id: string;
|
|
42
|
+
message?: string;
|
|
43
|
+
metadata?: M;
|
|
44
|
+
properties?: Record<string, any>;
|
|
45
|
+
reason: T;
|
|
46
|
+
toolCallId: string;
|
|
47
|
+
};
|
|
48
|
+
export type BaseResume<T extends InterruptReason, P extends Record<string, any> = Record<string, any>> = {
|
|
49
|
+
id?: string;
|
|
50
|
+
interruptId: string;
|
|
51
|
+
payload: P;
|
|
52
|
+
reason: T;
|
|
53
|
+
status: 'cancelled' | 'resolved';
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* 流程节点(flow-agent)操作响应负载:重试 / 跳过失败节点。
|
|
57
|
+
* 流程节点不属于 interrupt,故节点定位信息(taskId / nodeId)随 payload 一并回传,
|
|
58
|
+
* 此时 `onInterruptResume` 的第二个 `interrupt` 参数为空。
|
|
59
|
+
*/
|
|
60
|
+
export type FlowNodeResume = {
|
|
61
|
+
operation: InterruptResumeOperation.FlowNodeRetry | InterruptResumeOperation.FlowNodeSkip;
|
|
62
|
+
payload: {
|
|
63
|
+
node_id: string;
|
|
64
|
+
task_id: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type Interrupt = AIDevToolApprovalInterrupt | BaseInterrupt<InterruptReason, Record<string, any>> | UserQuestionInterrupt;
|
|
68
|
+
export type InterruptItem = Interrupt;
|
|
69
|
+
/**
|
|
70
|
+
* 中断消息
|
|
71
|
+
*
|
|
72
|
+
* 对应 AG-UI 协议 `RUN_FINISHED { outcome: { type: "interrupt", interrupts } }` 事件。
|
|
73
|
+
* 当 Agent 需要 human-in-the-loop(审批 / 补充信息 / 策略阻断等)时,
|
|
74
|
+
* 会派生此类型消息以驱动 UI 渲染等待用户响应;用户响应后通过
|
|
75
|
+
* `RunAgentInput.resume = { interruptId, payload }` 把结果回传给 Agent。
|
|
76
|
+
*
|
|
77
|
+
* @see https://docs.ag-ui.com/drafts/interrupts
|
|
78
|
+
*/
|
|
79
|
+
export type InterruptMessage = BaseMessage<MessageRole.Interrupt, {
|
|
80
|
+
message?: string;
|
|
81
|
+
/** 是否已被用户响应(resume)过,用于 UI 区分"等待响应 / 已处理"两种态 */
|
|
82
|
+
outcome?: RunFinishedOutcome;
|
|
83
|
+
/** outcome.type === success 用户 resume 后回传/持久化的结果,用于会话内按 reason 回显 */
|
|
84
|
+
result?: InterruptResult;
|
|
85
|
+
runId?: string;
|
|
86
|
+
threadId?: string;
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* 中断处理结果(resume 后回传/持久化,用于 outcome.success 时会话内回显)。
|
|
90
|
+
* 按 reason 区分不同结果形态,统一具备 BaseResume 的 { interruptId, reason, status };
|
|
91
|
+
* 新增中断类型的回显结果只需在此联合扩展。
|
|
92
|
+
*/
|
|
93
|
+
export type InterruptResult = AIDevToolApprovalResume | UserQuestionResume;
|
|
94
|
+
export type InterruptResume = FlowNodeResume | ToolApprovalResume | UserQuestionResume;
|
|
95
|
+
/**
|
|
96
|
+
* 中断响应回调(统一约定:payload 在前,原始中断信息在后)
|
|
97
|
+
* @param payload 响应负载(resume payload),通过 `payload.operation` 区分动作类型
|
|
98
|
+
* @param interrupt 中断原始信息;流程节点等非中断来源的操作可不传
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
export type OnInterruptResume = (payload: InterruptResume, interrupt?: Interrupt) => Promise<void> | void;
|
|
102
|
+
export type RunFinishedOutcome = {
|
|
103
|
+
interrupts: Interrupt[];
|
|
104
|
+
type: 'interrupt';
|
|
105
|
+
} | {
|
|
106
|
+
type: 'success';
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* 第三方工具审批中断的响应负载(取消审批等动作)
|
|
110
|
+
*/
|
|
111
|
+
export type ToolApprovalResume = {
|
|
112
|
+
operation: InterruptResumeOperation.ApprovalCancel;
|
|
113
|
+
payload: {
|
|
114
|
+
interrupt_id: number | string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* 用户对单个问题的回答
|
|
119
|
+
*/
|
|
120
|
+
export type UserQuestionAnswerItem = {
|
|
121
|
+
answer: UserQuestionOptionItem[];
|
|
122
|
+
multiSelect?: boolean;
|
|
123
|
+
question: string;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* 用户回答问题中断
|
|
127
|
+
*/
|
|
128
|
+
export type UserQuestionInterrupt = BaseInterrupt<InterruptReason.UserQuestion, {
|
|
129
|
+
questions: UserQuestionItem[];
|
|
130
|
+
}>;
|
|
131
|
+
/**
|
|
132
|
+
* 用户回答问题中的单个问题
|
|
133
|
+
*/
|
|
134
|
+
export type UserQuestionItem = {
|
|
135
|
+
header: string;
|
|
136
|
+
multiSelect?: boolean;
|
|
137
|
+
options?: UserQuestionOptionItem[];
|
|
138
|
+
question: string;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* 用户回答问题选项;label 为 `others` 时代表用户自定义输入,description 为输入文本
|
|
142
|
+
*/
|
|
143
|
+
export type UserQuestionOptionItem = {
|
|
144
|
+
description: string;
|
|
145
|
+
label: string;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* 用户回答问题中断响应
|
|
149
|
+
*/
|
|
150
|
+
export type UserQuestionResume = BaseResume<InterruptReason.UserQuestion, {
|
|
151
|
+
answers: UserQuestionAnswerItem[];
|
|
152
|
+
}>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { OldShortcut, Shortcut } from '../../types';
|
|
2
2
|
import type { MessageContentType, MessageRole, MessageStatus } from './constants';
|
|
3
3
|
import type { ContentMap, InputContent } from './contents';
|
|
4
|
+
import type { InterruptMessage } from './interrupt';
|
|
4
5
|
export interface ActivityMessage extends BaseMessage<MessageRole.Activity, ContentMap[MessageContentType.FlowAgent] | ContentMap[MessageContentType.KnowledgeRag] | ContentMap[MessageContentType.ReferenceDocument]> {
|
|
5
6
|
activityType: MessageContentType.FlowAgent | MessageContentType.KnowledgeRag | MessageContentType.ReferenceDocument | string;
|
|
6
7
|
}
|
|
@@ -73,6 +74,7 @@ export type MessageMap = AIBluekingMessageMap & {
|
|
|
73
74
|
[MessageRole.HiddenSystem]: HiddenSystemMessage;
|
|
74
75
|
[MessageRole.HiddenUser]: HiddenUserMessage;
|
|
75
76
|
[MessageRole.Info]: InfoMessage;
|
|
77
|
+
[MessageRole.Interrupt]: InterruptMessage;
|
|
76
78
|
[MessageRole.Loading]: LoadingMessage;
|
|
77
79
|
[MessageRole.Pause]: PauseMessage;
|
|
78
80
|
[MessageRole.Placeholder]: PlaceholderMessage;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { FromSchema } from 'json-schema-to-ts';
|
|
2
|
+
export declare const UserSingleChoiceQuestionSchema: {
|
|
3
|
+
readonly properties: {
|
|
4
|
+
readonly question: {
|
|
5
|
+
readonly enum: readonly [];
|
|
6
|
+
readonly type: "string";
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
readonly required: readonly ["question"];
|
|
10
|
+
readonly type: "object";
|
|
11
|
+
};
|
|
12
|
+
export declare const UserMultiChoiceQuestionSchema: {
|
|
13
|
+
readonly properties: {
|
|
14
|
+
readonly question: {
|
|
15
|
+
readonly items: {
|
|
16
|
+
readonly enum: readonly [];
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
};
|
|
19
|
+
readonly uniqueItems: true;
|
|
20
|
+
readonly type: "array";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
readonly required: readonly ["question"];
|
|
24
|
+
readonly type: "object";
|
|
25
|
+
};
|
|
26
|
+
export declare const UserQuestionSchema: {
|
|
27
|
+
readonly properties: {
|
|
28
|
+
readonly question: {
|
|
29
|
+
readonly items: {
|
|
30
|
+
readonly enum: readonly [];
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
};
|
|
33
|
+
readonly uniqueItems: true;
|
|
34
|
+
readonly type: "array";
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
readonly required: readonly ["question"];
|
|
38
|
+
readonly type: "object";
|
|
39
|
+
};
|
|
40
|
+
export type UserMultiChoiceQuestion = FromSchema<typeof UserMultiChoiceQuestionSchema>;
|
|
41
|
+
export type UserQuestion = UserMultiChoiceQuestion;
|
|
42
|
+
export type UserSingleChoiceQuestion = FromSchema<typeof UserSingleChoiceQuestionSchema>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { MessageStatus as MessageStatusType } from '../../../ag-ui/types/constants';
|
|
2
2
|
import type { BkFlowMessageContent } from '../../../ag-ui/types/contents';
|
|
3
|
+
import type { OnInterruptResume } from '../../../ag-ui/types/interrupt';
|
|
3
4
|
import 'tippy.js/dist/tippy.css';
|
|
4
5
|
type __VLS_Props = {
|
|
5
6
|
content?: BkFlowMessageContent;
|
|
6
7
|
messageUid?: string;
|
|
8
|
+
/** resume 回调:节点「重试 / 跳过」与第三方审批取消复用同一回调,按 payload.operation 分流 */
|
|
9
|
+
onInterruptResume?: OnInterruptResume;
|
|
7
10
|
status?: MessageStatusType;
|
|
8
11
|
};
|
|
9
12
|
type __VLS_ModelProps = {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Component, Ref } from 'vue';
|
|
2
|
+
import { InterruptResumeOperation } from '../../../ag-ui/types/interrupt';
|
|
3
|
+
import type { BkFlowNode, BkFlowTask } from '../../../ag-ui/types/contents';
|
|
4
|
+
import type { OnInterruptResume } from '../../../ag-ui/types/interrupt';
|
|
5
|
+
import type { FlowNodeVM, FlowTaskVM } from './use-flow-agent';
|
|
6
|
+
/** 节点行尾操作类型标识 */
|
|
7
|
+
export type FlowNodeActionId = 'detail' | InterruptResumeOperation.FlowNodeRetry | InterruptResumeOperation.FlowNodeSkip;
|
|
8
|
+
/** 节点行尾操作视图模型:详情 / 重试 / 跳过统一为同一渲染单元(图标 + 文案 + 点击) */
|
|
9
|
+
export interface FlowNodeActionVM {
|
|
10
|
+
/** 按钮图标组件 */
|
|
11
|
+
icon: Component;
|
|
12
|
+
/** 唯一标识,用于 v-for key 与样式钩子 */
|
|
13
|
+
id: FlowNodeActionId;
|
|
14
|
+
/** 国际化文案 */
|
|
15
|
+
label: string;
|
|
16
|
+
/** 点击执行 */
|
|
17
|
+
run: () => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* flow-agent 节点行尾操作 composable。
|
|
21
|
+
*
|
|
22
|
+
* 将「详情(打开侧栏)」与「重试 / 跳过(回传 Agent resume)」聚合为统一的、声明式的
|
|
23
|
+
* 操作列表,组件层只需遍历渲染,显隐与点击行为均收敛于此,便于复用、单测与扩展。
|
|
24
|
+
*/
|
|
25
|
+
export declare const useFlowNodeActions: (options: {
|
|
26
|
+
/** resume 回调(与第三方审批取消同一回调,按 payload.operation 分流) */
|
|
27
|
+
onInterruptResume: Ref<OnInterruptResume | undefined>;
|
|
28
|
+
/** 打开节点详情侧栏(复用 useFlowTab 的能力) */
|
|
29
|
+
openNodeDetail: (task: BkFlowTask, node: BkFlowNode) => void;
|
|
30
|
+
}) => {
|
|
31
|
+
getNodeActions: (task: FlowTaskVM, node: FlowNodeVM) => FlowNodeActionVM[];
|
|
32
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { EditorCommand } from '../../../edix';
|
|
2
2
|
import type { Position } from '../../../edix/doc/types';
|
|
3
|
-
import type { IAiSlashMenuItem
|
|
3
|
+
import type { IAiSlashMenuItem } from '../../../types/editor';
|
|
4
4
|
export declare const DeleteTag: EditorCommand<[Position, Position]>;
|
|
5
5
|
export declare const InsertTag: EditorCommand<[Position, IAiSlashMenuItem]>;
|
|
6
6
|
export declare const InsertText: EditorCommand<[Position, string]>;
|
|
7
|
-
export declare const InsertSkillTag: EditorCommand<[Position, ISkillListItem]>;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { VoidNode } from '../../../edix/doc/types';
|
|
2
|
-
import type { TagSchema } from '../../../types/input';
|
|
3
|
-
export declare const tagNodeToMessageString: (node: VoidNode) => string;
|
|
4
|
-
export declare const tagSchemaToMessageString: (doc: TagSchema) => string;
|
|
5
1
|
export declare const tagSchema: import("../../..").DocSchema<({
|
|
6
2
|
text: string;
|
|
7
3
|
type: "text";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type UserMessage, MessageContentType, MessageStatus } from '../../ag-ui/types';
|
|
1
|
+
import { type Interrupt, type InterruptResume, type UserMessage, MessageContentType, MessageStatus } from '../../ag-ui/types';
|
|
2
2
|
import { type AITippyProps, type IAiSlashMenuItem, type ISkillListItem, type Shortcut, type TagSchema, type UploadFile, UploadStatus } from '../../types';
|
|
3
3
|
export type ChatInputEmits = {
|
|
4
4
|
(e: 'selectShortcut', shortcut: Shortcut): void;
|
|
@@ -10,7 +10,10 @@ export type ChatInputProps = {
|
|
|
10
10
|
inputMaxHeight?: number;
|
|
11
11
|
messageStatus?: MessageStatus;
|
|
12
12
|
modelValue: string | TagSchema;
|
|
13
|
-
onSendMessage?: (message: UserMessage['content'], docSchema: TagSchema
|
|
13
|
+
onSendMessage?: (message: UserMessage['content'], docSchema: TagSchema, options?: {
|
|
14
|
+
interrupt?: Interrupt;
|
|
15
|
+
payload?: InterruptResume;
|
|
16
|
+
}) => Promise<void>;
|
|
14
17
|
onStopSending?: () => Promise<void>;
|
|
15
18
|
onUpload?: (files: File) => Promise<{
|
|
16
19
|
download_url?: string;
|
|
@@ -18,6 +21,7 @@ export type ChatInputProps = {
|
|
|
18
21
|
placeholder?: string;
|
|
19
22
|
prompts?: string[];
|
|
20
23
|
resources?: IAiSlashMenuItem[];
|
|
24
|
+
sendDisabledTip?: string;
|
|
21
25
|
shortcutId?: string;
|
|
22
26
|
shortcuts?: Shortcut[];
|
|
23
27
|
skills?: ISkillListItem[];
|
|
@@ -29,7 +33,7 @@ type __VLS_ModelProps = {
|
|
|
29
33
|
'cite'?: string;
|
|
30
34
|
};
|
|
31
35
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
32
|
-
declare var __VLS_1: {}, __VLS_3: {},
|
|
36
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_14: {
|
|
33
37
|
files: {
|
|
34
38
|
data?: string | undefined;
|
|
35
39
|
filename?: string | undefined;
|
|
@@ -51,17 +55,19 @@ declare var __VLS_1: {}, __VLS_3: {}, __VLS_12: {
|
|
|
51
55
|
} | undefined;
|
|
52
56
|
status?: UploadStatus | undefined;
|
|
53
57
|
}[];
|
|
54
|
-
},
|
|
58
|
+
}, __VLS_51: {}, __VLS_75: {};
|
|
55
59
|
type __VLS_Slots = {} & {
|
|
56
60
|
top?: (props: typeof __VLS_1) => any;
|
|
57
61
|
} & {
|
|
58
|
-
|
|
62
|
+
interrupt?: (props: typeof __VLS_3) => any;
|
|
59
63
|
} & {
|
|
60
|
-
|
|
64
|
+
'input-header'?: (props: typeof __VLS_5) => any;
|
|
61
65
|
} & {
|
|
62
|
-
|
|
66
|
+
files?: (props: typeof __VLS_14) => any;
|
|
63
67
|
} & {
|
|
64
|
-
|
|
68
|
+
attachment?: (props: typeof __VLS_51) => any;
|
|
69
|
+
} & {
|
|
70
|
+
'send-icon'?: (props: typeof __VLS_75) => any;
|
|
65
71
|
};
|
|
66
72
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
67
73
|
focus: () => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
content: string;
|
|
3
|
+
};
|
|
4
|
+
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>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type { OnInterruptResume } from '../../../ag-ui/types/interrupt';
|
|
1
2
|
import type { ActivityMessage } from '../../../ag-ui/types/messages';
|
|
2
|
-
type __VLS_Props = Partial<ActivityMessage
|
|
3
|
+
type __VLS_Props = Partial<ActivityMessage> & {
|
|
4
|
+
onInterruptResume?: OnInterruptResume;
|
|
5
|
+
};
|
|
3
6
|
type __VLS_ModelProps = {
|
|
4
7
|
'collapsed'?: boolean;
|
|
5
8
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { InterruptMessage, OnInterruptResume } from '../../../ag-ui/types/interrupt';
|
|
2
|
+
import type { UserQuestionAnsweredCardSlots } from './user-question/user-question-answered-card.vue';
|
|
3
|
+
type __VLS_Slots = {
|
|
4
|
+
answeredQuestion: UserQuestionAnsweredCardSlots['answer'];
|
|
5
|
+
};
|
|
6
|
+
type __VLS_Props = Partial<InterruptMessage> & {
|
|
7
|
+
onInterruptResume?: OnInterruptResume;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: 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
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AIDevToolApprovalInterrupt, OnInterruptResume } from '../../../ag-ui/types/interrupt';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
interrupt: AIDevToolApprovalInterrupt;
|
|
4
|
+
onInterruptResume?: OnInterruptResume;
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
};
|
|
7
|
+
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>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './use-user-question';
|
|
2
|
+
export { default as UserQuestionAnsweredCard } from './user-question-answered-card.vue';
|
|
3
|
+
export { default as UserQuestionCard } from './user-question-card.vue';
|
|
4
|
+
export { default as UserQuestionChoice } from './user-question-choice.vue';
|
|
5
|
+
export { default as UserQuestionOption } from './user-question-option.vue';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { UserQuestionAnswerItem, UserQuestionInterrupt, UserQuestionItem, UserQuestionOptionItem, UserQuestionResume } from '../../../../ag-ui/types/interrupt';
|
|
2
|
+
/** label 为该值的选项代表「Others 自定义输入」 */
|
|
3
|
+
export declare const OTHERS_OPTION_LABEL = "others";
|
|
4
|
+
/** 选项序号字母:0 -> A、1 -> B …… 超过 26 时回退为数字 */
|
|
5
|
+
export declare const toLetter: (index: number) => string;
|
|
6
|
+
/** 归一化后的展示选项(含字母序号与 Others 标记),由选择题渲染组件内部使用 */
|
|
7
|
+
export type NormalizedUserQuestionOption = UserQuestionOptionItem & {
|
|
8
|
+
isOthers: boolean;
|
|
9
|
+
letter: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 用户回答问题(human-in-the-loop)的答案聚合与 resume payload 构建。
|
|
13
|
+
*
|
|
14
|
+
* 设计目标:composable 只负责「收集每题答案 + 完成态计算 + payload 组装」,
|
|
15
|
+
* 对「回答形态」(单选/多选/表单/任意自定义)零感知;
|
|
16
|
+
* 各题如何作答与如何校验,全部下沉到对应的渲染组件(默认为选择题),
|
|
17
|
+
* 渲染组件作答有效时回传已组装的 {@link UserQuestionAnswerItem},无效时回传 undefined。
|
|
18
|
+
*
|
|
19
|
+
* @param getInterrupt 返回当前 UserQuestion 中断的 getter(响应式)
|
|
20
|
+
*/
|
|
21
|
+
export declare const useUserQuestion: (getInterrupt: () => undefined | UserQuestionInterrupt) => {
|
|
22
|
+
questions: import("vue").ComputedRef<UserQuestionItem[]>;
|
|
23
|
+
answeredCount: import("vue").ComputedRef<number>;
|
|
24
|
+
totalCount: import("vue").ComputedRef<number>;
|
|
25
|
+
completed: import("vue").ComputedRef<boolean>;
|
|
26
|
+
getAnswer: (questionIndex: number) => undefined | UserQuestionAnswerItem;
|
|
27
|
+
setAnswer: (questionIndex: number, answer: undefined | UserQuestionAnswerItem) => void;
|
|
28
|
+
buildResolvePayload: () => UserQuestionResume;
|
|
29
|
+
buildSkipPayload: () => UserQuestionResume;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* 自由文本 resume(用户在 chat-input 直接输入而非走结构化选择)。
|
|
33
|
+
* 多题场景下信息有损:统一作为单条 Others 自由文本回传。
|
|
34
|
+
*/
|
|
35
|
+
export declare const buildSkipResumePayload: (interrupt?: UserQuestionInterrupt) => UserQuestionResume;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type VNode } from 'vue';
|
|
2
|
+
import type { UserQuestionAnswerItem } from '../../../../ag-ui/types/interrupt';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
answers: UserQuestionAnswerItem[];
|
|
5
|
+
status?: 'cancelled' | 'resolved';
|
|
6
|
+
};
|
|
7
|
+
export type UserQuestionAnsweredCardSlots = {
|
|
8
|
+
answer: (props: {
|
|
9
|
+
index: number;
|
|
10
|
+
item: UserQuestionAnswerItem;
|
|
11
|
+
status: 'cancelled' | 'resolved';
|
|
12
|
+
}) => null | undefined | VNode;
|
|
13
|
+
};
|
|
14
|
+
type __VLS_Slots = UserQuestionAnsweredCardSlots;
|
|
15
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
16
|
+
status: "cancelled" | "resolved";
|
|
17
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
package/dist/components/chat-message/interrupt-message/user-question/user-question-card.vue.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type VNode } from 'vue';
|
|
2
|
+
import type { OnInterruptResume, UserQuestionAnswerItem, UserQuestionInterrupt, UserQuestionItem } from '../../../../ag-ui/types/interrupt';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
interrupt: UserQuestionInterrupt;
|
|
5
|
+
onResume?: OnInterruptResume;
|
|
6
|
+
};
|
|
7
|
+
export type UserQuestionCardSlots = {
|
|
8
|
+
question: (props: {
|
|
9
|
+
answer: undefined | UserQuestionAnswerItem;
|
|
10
|
+
confirm: () => void;
|
|
11
|
+
qIndex: number;
|
|
12
|
+
question: UserQuestionItem;
|
|
13
|
+
setAnswer: (answer: undefined | UserQuestionAnswerItem) => void;
|
|
14
|
+
}) => null | undefined | VNode;
|
|
15
|
+
};
|
|
16
|
+
type __VLS_Slots = UserQuestionCardSlots;
|
|
17
|
+
declare const __VLS_base: 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>;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
package/dist/components/chat-message/interrupt-message/user-question/user-question-choice.vue.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { UserQuestionAnswerItem, UserQuestionItem } from '../../../../ag-ui/types/interrupt';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
question: UserQuestionItem;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
6
|
+
answer: (answer: UserQuestionAnswerItem | undefined) => any;
|
|
7
|
+
confirm: () => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
onAnswer?: ((answer: UserQuestionAnswerItem | undefined) => any) | undefined;
|
|
10
|
+
onConfirm?: (() => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
package/dist/components/chat-message/interrupt-message/user-question/user-question-option.vue.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NormalizedUserQuestionOption } from './use-user-question';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
option: NormalizedUserQuestionOption;
|
|
4
|
+
othersText?: string;
|
|
5
|
+
selected: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
+
select: () => any;
|
|
9
|
+
confirm: () => any;
|
|
10
|
+
"update:othersText": (value: string) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onSelect?: (() => any) | undefined;
|
|
13
|
+
onConfirm?: (() => any) | undefined;
|
|
14
|
+
"onUpdate:othersText"?: ((value: string) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|