@blueking/chat-helper 0.0.8 → 0.0.10-beta.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.
@@ -80,8 +80,9 @@ function _object_spread(target) {
80
80
  return target;
81
81
  }
82
82
  import { ref } from 'vue';
83
- import { AGUIProtocol } from '../event/index.ts.js';
84
- import { MessageRole, MessageStatus } from '../message/index.ts.js';
83
+ import { AGUIProtocol, ApprovalInterruptTicketStatus, RunFinishedOutcomeType } from '../event/index.ts.js';
84
+ import { MessageRole, MessageStatus, UserOperation } from '../message/index.ts.js';
85
+ import { SessionStatus } from '../session/type.ts.js';
85
86
  /**
86
87
  * Agent 模块
87
88
  * @param options - 配置选项
@@ -120,8 +121,19 @@ import { MessageRole, MessageStatus } from '../message/index.ts.js';
120
121
  });
121
122
  }
122
123
  };
124
+ const userOperationStreamRequest = (sessionCode, operation, payload, config)=>{
125
+ var _mediator_http;
126
+ return (_mediator_http = mediator.http) === null || _mediator_http === void 0 ? void 0 : _mediator_http.message.userOperation(sessionCode, operation, payload, config).then(()=>{
127
+ if (operation !== UserOperation.ApprovalCancel) {
128
+ streamRequest({
129
+ sessionCode,
130
+ config
131
+ });
132
+ }
133
+ });
134
+ };
123
135
  const streamRequest = function() {
124
- var _ref = _async_to_generator(function*(sessionCode, url, config) {
136
+ var _ref = _async_to_generator(function*({ sessionCode, url, config, resume, input }) {
125
137
  var // 发起聊天
126
138
  _mediator_http;
127
139
  // ag-ui 协议需要注入消息模块
@@ -155,8 +167,11 @@ import { MessageRole, MessageStatus } from '../message/index.ts.js';
155
167
  method: 'POST',
156
168
  data: {
157
169
  session_code: sessionCode,
170
+ resume,
171
+ input,
158
172
  execute_kwargs: {
159
- stream: true
173
+ stream: true,
174
+ persist_input: !!input
160
175
  }
161
176
  },
162
177
  controller: abortController,
@@ -166,7 +181,7 @@ import { MessageRole, MessageStatus } from '../message/index.ts.js';
166
181
  onStart
167
182
  }, config));
168
183
  });
169
- return function streamRequest(sessionCode, url, config) {
184
+ return function streamRequest(_) {
170
185
  return _ref.apply(this, arguments);
171
186
  };
172
187
  }();
@@ -190,7 +205,11 @@ import { MessageRole, MessageStatus } from '../message/index.ts.js';
190
205
  property
191
206
  }));
192
207
  // 发起聊天
193
- streamRequest(sessionCode, url, config);
208
+ streamRequest({
209
+ sessionCode,
210
+ url,
211
+ config
212
+ });
194
213
  });
195
214
  return function chat(userInput, sessionCode, url, config, property) {
196
215
  return _ref.apply(this, arguments);
@@ -203,10 +222,45 @@ import { MessageRole, MessageStatus } from '../message/index.ts.js';
203
222
  * @param url - 请求 URL(可选)
204
223
  * @param config - 请求配置(可选)
205
224
  */ const resumeStreamingChat = (sessionCode, url, config)=>{
206
- var _mediator_message;
225
+ var _mediator_session_current_value, _mediator_session;
226
+ if (((_mediator_session = mediator.session) === null || _mediator_session === void 0 ? void 0 : (_mediator_session_current_value = _mediator_session.current.value) === null || _mediator_session_current_value === void 0 ? void 0 : _mediator_session_current_value.status) === SessionStatus.Running) {
227
+ streamRequest({
228
+ sessionCode,
229
+ url,
230
+ config
231
+ });
232
+ }
233
+ };
234
+ /**
235
+ * 轮询接口,判断是否可以继续聊天
236
+ * @param sessionCode - 会话编码
237
+ * @returns 是否可以继续聊天
238
+ */ const pollResumeSession = (sessionCode)=>{
239
+ var _mediator_message, _lastMessage_content_outcome, _lastMessage_content, _lastMessage_content_outcome_interrupts, _lastMessage_content_outcome1, _lastMessage_content1;
207
240
  const lastMessage = (_mediator_message = mediator.message) === null || _mediator_message === void 0 ? void 0 : _mediator_message.list.value.at(-1);
208
- if ((lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.status) === MessageStatus.Streaming || (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.role) === MessageRole.User) {
209
- streamRequest(sessionCode, url, config);
241
+ const isInterruptMessage = (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.role) === MessageRole.Interrupt;
242
+ const isTicketPending = (lastMessage === null || lastMessage === void 0 ? void 0 : (_lastMessage_content = lastMessage.content) === null || _lastMessage_content === void 0 ? void 0 : (_lastMessage_content_outcome = _lastMessage_content.outcome) === null || _lastMessage_content_outcome === void 0 ? void 0 : _lastMessage_content_outcome.type) === RunFinishedOutcomeType.Interrupt && (lastMessage === null || lastMessage === void 0 ? void 0 : (_lastMessage_content1 = lastMessage.content) === null || _lastMessage_content1 === void 0 ? void 0 : (_lastMessage_content_outcome1 = _lastMessage_content1.outcome) === null || _lastMessage_content_outcome1 === void 0 ? void 0 : (_lastMessage_content_outcome_interrupts = _lastMessage_content_outcome1.interrupts) === null || _lastMessage_content_outcome_interrupts === void 0 ? void 0 : _lastMessage_content_outcome_interrupts.some((interrupt)=>{
243
+ var _interrupt_metadata_ticket, _interrupt_metadata;
244
+ return ((_interrupt_metadata = interrupt.metadata) === null || _interrupt_metadata === void 0 ? void 0 : (_interrupt_metadata_ticket = _interrupt_metadata.ticket) === null || _interrupt_metadata_ticket === void 0 ? void 0 : _interrupt_metadata_ticket.status) === ApprovalInterruptTicketStatus.Pending;
245
+ }));
246
+ if (isInterruptMessage && isTicketPending) {
247
+ setTimeout(()=>{
248
+ var _mediator_session_current_value, _mediator_session_current, _mediator_session, // 轮询接口,判断是否可以继续聊天
249
+ _mediator_http;
250
+ // 如果会话不匹配,则不继续轮询
251
+ if (sessionCode !== ((_mediator_session = mediator.session) === null || _mediator_session === void 0 ? void 0 : (_mediator_session_current = _mediator_session.current) === null || _mediator_session_current === void 0 ? void 0 : (_mediator_session_current_value = _mediator_session_current.value) === null || _mediator_session_current_value === void 0 ? void 0 : _mediator_session_current_value.sessionCode)) return;
252
+ (_mediator_http = mediator.http) === null || _mediator_http === void 0 ? void 0 : _mediator_http.session.isResumeSession(sessionCode).then((res)=>{
253
+ if (res) {
254
+ // 可以继续聊天,重新发起聊天
255
+ streamRequest({
256
+ sessionCode
257
+ });
258
+ } else {
259
+ // 不可以继续聊天,继续轮询
260
+ pollResumeSession(sessionCode);
261
+ }
262
+ });
263
+ }, 30000);
210
264
  }
211
265
  };
212
266
  /**
@@ -269,7 +323,11 @@ import { MessageRole, MessageStatus } from '../message/index.ts.js';
269
323
  property: originalProperty
270
324
  }));
271
325
  // 6. 立即发起流式请求(不等待删除和创建的 API 完成)
272
- streamRequest(sessionCode, url, config);
326
+ streamRequest({
327
+ sessionCode,
328
+ url,
329
+ config
330
+ });
273
331
  // 7. 在后台等待 API 完成,处理可能的错误
274
332
  Promise.all([
275
333
  deletePromise,
@@ -299,6 +357,8 @@ import { MessageRole, MessageStatus } from '../message/index.ts.js';
299
357
  abortChat,
300
358
  stopChat,
301
359
  getAgentInfo,
302
- reset
360
+ reset,
361
+ pollResumeSession,
362
+ userOperationStreamRequest
303
363
  };
304
364
  };
@@ -43,6 +43,10 @@ export declare class AGUIProtocol implements ISSEProtocol {
43
43
  * 自定义事件 处理流程编排任务开始
44
44
  */
45
45
  handleFlowAgentStartCustomEvent(event: ICustomEvent): void;
46
+ /**
47
+ * 自定义事件 处理流程编排任务更新
48
+ */
49
+ handleFlowAgentUpdateCustomEvent(event: ICustomEvent): void;
46
50
  /**
47
51
  * 自定义事件 处理意图识别结束
48
52
  */
@@ -80,7 +84,7 @@ export declare class AGUIProtocol implements ISSEProtocol {
80
84
  /**
81
85
  * 处理运行完成事件
82
86
  */
83
- handleRunFinishedEvent(_event: IRunFinishedEvent): void;
87
+ handleRunFinishedEvent(event: IRunFinishedEvent): void;
84
88
  /**
85
89
  * 处理运行开始事件
86
90
  */
@@ -105,6 +109,10 @@ export declare class AGUIProtocol implements ISSEProtocol {
105
109
  * 自定义事件 处理临时消息,转换为 AI 文本消息
106
110
  */
107
111
  handleTempMessageCustomEvent(event: ICustomEvent): void;
112
+ /**
113
+ * 自定义事件 处理审批结果
114
+ */
115
+ handleApprovalResultCustomEvent(event: ICustomEvent): void;
108
116
  /**
109
117
  * 处理文本消息块事件
110
118
  */
@@ -37,7 +37,7 @@
37
37
  }
38
38
  import { transferMessageApi2Message } from '../http/transform/index.ts.js';
39
39
  import { ActivityType, MessageRole, MessageStatus, MessageType } from '../message/index.ts.js';
40
- import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
40
+ import { CustomEventName, EventType, FlowTaskState, RunFinishedOutcomeType } from './type.ts.js';
41
41
  /**
42
42
  * AGUI 协议
43
43
  * @param message - 消息模块
@@ -81,6 +81,12 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
81
81
  case CustomEventName.TempMessage:
82
82
  this.handleTempMessageCustomEvent(event);
83
83
  break;
84
+ case CustomEventName.ApprovalResult:
85
+ this.handleApprovalResultCustomEvent(event);
86
+ break;
87
+ case CustomEventName.FlowAgentUpdate:
88
+ this.handleFlowAgentUpdateCustomEvent(event);
89
+ break;
84
90
  default:
85
91
  break;
86
92
  }
@@ -127,6 +133,20 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
127
133
  });
128
134
  }
129
135
  /**
136
+ * 自定义事件 处理流程编排任务更新
137
+ */ handleFlowAgentUpdateCustomEvent(event) {
138
+ const value = event.value;
139
+ this.messageModule.list.value.forEach((item)=>{
140
+ if (item.role === MessageRole.Activity && item.activityType === ActivityType.FlowAgent) {
141
+ const isSameTask = item.content[0].task_id === value[0].task_id;
142
+ // 通过第一个 task_id 判断是否是同一个任务,是的话直接更新消息内容
143
+ if (isSameTask) {
144
+ item.content = value;
145
+ }
146
+ }
147
+ });
148
+ }
149
+ /**
130
150
  * 自定义事件 处理意图识别结束
131
151
  */ handleKnowledgeRagEndCustomEvent(_event) {
132
152
  const message = this.messageModule.getCurrentLoadingMessage();
@@ -206,10 +226,21 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
206
226
  }
207
227
  /**
208
228
  * 处理运行完成事件
209
- */ handleRunFinishedEvent(_event) {
229
+ */ handleRunFinishedEvent(event) {
230
+ var _event_outcome, _event_outcome1;
210
231
  const message = this.messageModule.getCurrentLoadingMessage();
211
- if (message) {
212
- message.status = MessageStatus.Complete;
232
+ message.status = MessageStatus.Complete;
233
+ // 如果是中断消息,则创建一个中断消息
234
+ if (((_event_outcome = event.outcome) === null || _event_outcome === void 0 ? void 0 : _event_outcome.type) === RunFinishedOutcomeType.Interrupt) {
235
+ this.messageModule.plusMessage({
236
+ role: MessageRole.Interrupt,
237
+ content: event,
238
+ status: MessageStatus.Pending
239
+ });
240
+ }
241
+ // 二次返回,直接更新消息内容
242
+ if (((_event_outcome1 = event.outcome) === null || _event_outcome1 === void 0 ? void 0 : _event_outcome1.type) === RunFinishedOutcomeType.Success) {
243
+ message.content = event;
213
244
  }
214
245
  }
215
246
  /**
@@ -249,6 +280,16 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
249
280
  });
250
281
  }
251
282
  /**
283
+ * 自定义事件 处理审批结果
284
+ */ handleApprovalResultCustomEvent(event) {
285
+ const value = event.value;
286
+ const message = this.messageModule.getCurrentLoadingMessage();
287
+ if (message) {
288
+ message.content = value;
289
+ message.status = MessageStatus.Complete;
290
+ }
291
+ }
292
+ /**
252
293
  * 处理文本消息块事件
253
294
  */ handleTextMessageChunkEvent(event) {
254
295
  const message = this.messageModule.getCurrentLoadingMessage();
@@ -1,14 +1,17 @@
1
1
  import { type IMessageApi, type MessageRole, type MessageStatus } from '../message/type';
2
+ import type { JSONSchema4 } from 'json-schema';
2
3
  export declare enum CustomEventName {
3
4
  FlowAgentEnd = "flow_agent_end",
4
5
  FlowAgentResult = "flow_agent_result",
5
6
  FlowAgentStart = "flow_agent_start",
7
+ FlowAgentUpdate = "flow_agent_update",
6
8
  KnowledgeRagEnd = "knowledge_rag_end",
7
9
  KnowledgeRagResult = "knowledge_rag_result",
8
10
  KnowledgeRagStart = "knowledge_rag_start",
9
11
  KnowledgeRagTextContent = "knowledge_rag_text_content",
10
12
  ReferenceDocument = "reference_document",
11
- TempMessage = "temp_message"
13
+ TempMessage = "temp_message",
14
+ ApprovalResult = "approval_result"
12
15
  }
13
16
  export declare enum EventType {
14
17
  ActivityDelta = "ACTIVITY_DELTA",
@@ -40,42 +43,51 @@ export declare enum EventType {
40
43
  }
41
44
  /** BKFlow 收敛后的节点状态 - task.node 的状态枚举 */
42
45
  export declare enum FlowNodeState {
43
- /** 失败 */
44
46
  Failed = "failed",
45
- /** 执行中 */
46
47
  Running = "running",
47
- /** 成功 */
48
48
  Success = "success",
49
- /** 挂起 */
50
49
  Suspended = "suspended"
51
50
  }
52
51
  /** BKFLOW 原始状态 - task 的状态枚举 */
53
52
  export declare enum FlowTaskState {
54
- /** 执行中 */
55
53
  Blocked = "BLOCKED",
56
- /** 执行中 */
57
54
  Created = "CREATED",
58
- /** 失败 */
59
55
  Failed = "FAILED",
60
- /** 成功 */
61
56
  Finished = "FINISHED",
62
- /** 执行中 */
63
57
  LoopReady = "LOOP_READY",
64
- /** 执行中 */
65
58
  Ready = "READY",
66
- /** 失败 */
67
59
  Revoked = "REVOKED",
68
- /** 失败 */
69
60
  RollBackFailed = "ROLL_BACK_FAILED",
70
- /** 执行中 */
71
61
  RollBackSuccess = "ROLL_BACK_SUCCESS",
72
- /** 执行中 */
73
62
  RollingBack = "ROLLING_BACK",
74
- /** 执行中 */
75
63
  Running = "RUNNING",
76
- /** 挂起 */
77
64
  Suspended = "SUSPENDED"
78
65
  }
66
+ /** 运行完成结果 */
67
+ export declare enum RunFinishedOutcomeType {
68
+ Success = "success",
69
+ Interrupt = "interrupt"
70
+ }
71
+ /** 审批状态 */
72
+ export declare enum ApprovalInterruptTicketStatus {
73
+ Abandoned = "abandoned",
74
+ Approved = "approved",
75
+ Cancelled = "cancelled",
76
+ Draft = "draft",
77
+ Expired = "expired",
78
+ Rejected = "rejected",
79
+ Pending = "pending"
80
+ }
81
+ /** 中断原因 */
82
+ export declare enum InterruptReason {
83
+ AIDevToolApproval = "aidev:tool_approval",
84
+ UserQuestion = "aidev:user_question"
85
+ }
86
+ /** 恢复状态 */
87
+ export declare enum ResumeStatus {
88
+ Resolved = "resolved",
89
+ Cancelled = "cancelled"
90
+ }
79
91
  /**
80
92
  * Activity 代表 Agent 执行过程中的活动/动作/任务,可能包含结构化数据
81
93
  * 活动状态的增量更新
@@ -112,21 +124,21 @@ export interface IBaseEvent {
112
124
  export interface ICustomEvent extends IBaseEvent {
113
125
  name: CustomEventName;
114
126
  type: EventType.Custom;
115
- value: IFlowAgentEndCustomValue | IFlowAgentResultCustomValue | IFlowAgentStartCustomValue | IKnowledgeRagResultCustomValue | IKnowledgeRagTextContentCustomValue | IReferenceDocumentCustomValue | ITempMessageCustomValue;
127
+ value: IFlowAgentEndCustomValue | IFlowAgentResultCustomValue | IFlowAgentStartCustomValue | IKnowledgeRagResultCustomValue | IKnowledgeRagTextContentCustomValue | IReferenceDocumentCustomValue | ITempMessageCustomValue | IApprovalResultCustomValue;
116
128
  }
117
129
  export type IEvent = IActivityDeltaEvent | IActivitySnapshotEvent | ICustomEvent | IMessagesSnapshotEvent | IRawEvent | IRunErrorEvent | IRunFinishedEvent | IRunStartedEvent | IStateDeltaEvent | IStateSnapshotEvent | IStepFinishedEvent | IStepStartedEvent | ITextMessageChunkEvent | ITextMessageContentEvent | ITextMessageEndEvent | ITextMessageStartEvent | IThinkingEndEvent | IThinkingStartEvent | IThinkingTextMessageContentEvent | IThinkingTextMessageEndEvent | IThinkingTextMessageStartEvent | IToolCallArgsEvent | IToolCallChunkEvent | IToolCallEndEvent | IToolCallResultEvent | IToolCallStartEvent;
118
130
  export type IFlowAgentEndCustomValue = {
119
131
  task_outputs: string[];
120
132
  }[];
121
133
  export interface IFlowAgentNode {
122
- /** 耗时(s) */
123
134
  elapsed_time: number;
124
- /** 节点id */
125
135
  id: string;
126
- /** 节点名称 */
127
136
  name: string;
128
- /** 节点状态 */
129
137
  state: FlowNodeState;
138
+ retry: number;
139
+ skip: boolean;
140
+ retryable: boolean;
141
+ skippable: boolean;
130
142
  }
131
143
  export type IFlowAgentResultCustomValue = {
132
144
  nodes: Record<string, IFlowAgentNode>;
@@ -173,15 +185,66 @@ export interface IRunErrorEvent extends IBaseEvent {
173
185
  message: string;
174
186
  type: EventType.RunError;
175
187
  }
188
+ export interface IInterrupt<T extends InterruptReason, P extends Record<string, unknown>> {
189
+ id: string;
190
+ reason: T;
191
+ message?: string;
192
+ toolCallId?: string;
193
+ responseSchema?: JSONSchema4;
194
+ expiresAt?: string;
195
+ metadata?: P;
196
+ }
197
+ export type IApprovalInterrupt = IInterrupt<InterruptReason.AIDevToolApproval, {
198
+ ticket: {
199
+ approvers: string[];
200
+ sn: string;
201
+ status: ApprovalInterruptTicketStatus;
202
+ submit_time: string;
203
+ title: string;
204
+ url: string;
205
+ };
206
+ }>;
207
+ export type IUserQuestionInterrupt = IInterrupt<InterruptReason.UserQuestion, {
208
+ questions: {
209
+ header: string;
210
+ multiSelect?: boolean;
211
+ options?: {
212
+ description: string;
213
+ label: string;
214
+ }[];
215
+ question: string;
216
+ }[];
217
+ }>;
218
+ export interface IResume {
219
+ interruptId: string;
220
+ status: ResumeStatus;
221
+ payload: {
222
+ answers: {
223
+ answer: {
224
+ description: string;
225
+ label: string;
226
+ }[];
227
+ multiSelect?: boolean;
228
+ question: string;
229
+ }[];
230
+ };
231
+ }
232
+ export type IRunFinishedOutcome = {
233
+ type: RunFinishedOutcomeType.Success;
234
+ } | {
235
+ type: RunFinishedOutcomeType.Interrupt;
236
+ interrupts: Array<IApprovalInterrupt | IUserQuestionInterrupt>;
237
+ };
176
238
  /**
177
239
  * 标记 Agent 运行正常结束
178
240
  * 返回最终结果 result
179
241
  */
180
242
  export interface IRunFinishedEvent extends IBaseEvent {
181
- result?: unknown;
243
+ result?: IResume;
182
244
  runId: number;
183
245
  threadId: string;
184
246
  type: EventType.RunFinished;
247
+ outcome?: IRunFinishedOutcome;
185
248
  }
186
249
  /**
187
250
  * 标记一次完整的 Agent 执行开始
@@ -234,6 +297,7 @@ export interface ITempMessageCustomValue {
234
297
  message: string;
235
298
  status: MessageStatus;
236
299
  }
300
+ export type IApprovalResultCustomValue = IRunFinishedEvent;
237
301
  export interface ITextMessageChunkEvent extends IBaseEvent {
238
302
  delta?: string;
239
303
  messageId: string;
@@ -27,12 +27,14 @@
27
27
  CustomEventName["FlowAgentEnd"] = "flow_agent_end";
28
28
  CustomEventName["FlowAgentResult"] = "flow_agent_result";
29
29
  CustomEventName["FlowAgentStart"] = "flow_agent_start";
30
+ CustomEventName["FlowAgentUpdate"] = "flow_agent_update";
30
31
  CustomEventName["KnowledgeRagEnd"] = "knowledge_rag_end";
31
32
  CustomEventName["KnowledgeRagResult"] = "knowledge_rag_result";
32
33
  CustomEventName["KnowledgeRagStart"] = "knowledge_rag_start";
33
34
  CustomEventName["KnowledgeRagTextContent"] = "knowledge_rag_text_content";
34
35
  CustomEventName["ReferenceDocument"] = "reference_document";
35
36
  CustomEventName["TempMessage"] = "temp_message";
37
+ CustomEventName["ApprovalResult"] = "approval_result";
36
38
  })(CustomEventName || (CustomEventName = {}));
37
39
  export var EventType;
38
40
  (function(EventType) {
@@ -65,23 +67,48 @@ export var EventType;
65
67
  })(EventType || (EventType = {}));
66
68
  export var FlowNodeState;
67
69
  (function(FlowNodeState) {
68
- /** 失败 */ FlowNodeState["Failed"] = "failed";
69
- /** 执行中 */ FlowNodeState["Running"] = "running";
70
- /** 成功 */ FlowNodeState["Success"] = "success";
71
- /** 挂起 */ FlowNodeState["Suspended"] = "suspended";
70
+ FlowNodeState["Failed"] = "failed";
71
+ FlowNodeState["Running"] = "running";
72
+ FlowNodeState["Success"] = "success";
73
+ FlowNodeState["Suspended"] = "suspended";
72
74
  })(FlowNodeState || (FlowNodeState = {}));
73
75
  export var FlowTaskState;
74
76
  (function(FlowTaskState) {
75
- /** 执行中 */ FlowTaskState["Blocked"] = "BLOCKED";
76
- /** 执行中 */ FlowTaskState["Created"] = "CREATED";
77
- /** 失败 */ FlowTaskState["Failed"] = "FAILED";
78
- /** 成功 */ FlowTaskState["Finished"] = "FINISHED";
79
- /** 执行中 */ FlowTaskState["LoopReady"] = "LOOP_READY";
80
- /** 执行中 */ FlowTaskState["Ready"] = "READY";
81
- /** 失败 */ FlowTaskState["Revoked"] = "REVOKED";
82
- /** 失败 */ FlowTaskState["RollBackFailed"] = "ROLL_BACK_FAILED";
83
- /** 执行中 */ FlowTaskState["RollBackSuccess"] = "ROLL_BACK_SUCCESS";
84
- /** 执行中 */ FlowTaskState["RollingBack"] = "ROLLING_BACK";
85
- /** 执行中 */ FlowTaskState["Running"] = "RUNNING";
86
- /** 挂起 */ FlowTaskState["Suspended"] = "SUSPENDED";
77
+ FlowTaskState["Blocked"] = "BLOCKED";
78
+ FlowTaskState["Created"] = "CREATED";
79
+ FlowTaskState["Failed"] = "FAILED";
80
+ FlowTaskState["Finished"] = "FINISHED";
81
+ FlowTaskState["LoopReady"] = "LOOP_READY";
82
+ FlowTaskState["Ready"] = "READY";
83
+ FlowTaskState["Revoked"] = "REVOKED";
84
+ FlowTaskState["RollBackFailed"] = "ROLL_BACK_FAILED";
85
+ FlowTaskState["RollBackSuccess"] = "ROLL_BACK_SUCCESS";
86
+ FlowTaskState["RollingBack"] = "ROLLING_BACK";
87
+ FlowTaskState["Running"] = "RUNNING";
88
+ FlowTaskState["Suspended"] = "SUSPENDED";
87
89
  })(FlowTaskState || (FlowTaskState = {}));
90
+ export var RunFinishedOutcomeType;
91
+ (function(RunFinishedOutcomeType) {
92
+ RunFinishedOutcomeType["Success"] = "success";
93
+ RunFinishedOutcomeType["Interrupt"] = "interrupt";
94
+ })(RunFinishedOutcomeType || (RunFinishedOutcomeType = {}));
95
+ export var ApprovalInterruptTicketStatus;
96
+ (function(ApprovalInterruptTicketStatus) {
97
+ ApprovalInterruptTicketStatus["Abandoned"] = "abandoned";
98
+ ApprovalInterruptTicketStatus["Approved"] = "approved";
99
+ ApprovalInterruptTicketStatus["Cancelled"] = "cancelled";
100
+ ApprovalInterruptTicketStatus["Draft"] = "draft";
101
+ ApprovalInterruptTicketStatus["Expired"] = "expired";
102
+ ApprovalInterruptTicketStatus["Rejected"] = "rejected";
103
+ ApprovalInterruptTicketStatus["Pending"] = "pending";
104
+ })(ApprovalInterruptTicketStatus || (ApprovalInterruptTicketStatus = {}));
105
+ export var InterruptReason;
106
+ (function(InterruptReason) {
107
+ InterruptReason["AIDevToolApproval"] = "aidev:tool_approval";
108
+ InterruptReason["UserQuestion"] = "aidev:user_question";
109
+ })(InterruptReason || (InterruptReason = {}));
110
+ export var ResumeStatus;
111
+ (function(ResumeStatus) {
112
+ ResumeStatus["Resolved"] = "resolved";
113
+ ResumeStatus["Cancelled"] = "cancelled";
114
+ })(ResumeStatus || (ResumeStatus = {}));
@@ -31,17 +31,21 @@ export declare const useHttp: (options: IUseChatHelperOptions) => {
31
31
  uploadFile: (sessionCode: string, file: File, config?: import("./fetch").IRequestConfig) => Promise<{
32
32
  download_url?: string;
33
33
  }>;
34
+ isResumeSession: (sessionCode: string, config?: import("./fetch").IRequestConfig) => Promise<boolean>;
34
35
  };
35
36
  message: {
36
37
  getMessages: (sessionCode: string, limit?: number, config?: import("./fetch").IRequestConfig) => Promise<import("..").IMessage[]>;
37
- plusMessage: (data: import("..").IMessage, config?: import("./fetch").IRequestConfig) => Promise<import("..").IActivityMessage | import("..").IAssistantMessage | import("..").IDeveloperMessage | import("..").IGuideMessage | import("..").IHiddenAssistantMessage | import("..").IHiddenGuideMessage | import("..").IHiddenMessage | import("..").IHiddenSystemMessage | import("..").IHiddenUserMessage | import("..").IInfoMessage | import("..").IPauseMessage | import("..").IPlaceholderMessage | import("..").IReasoningMessage | import("..").ISystemMessage | import("..").ITemplateAssistantMessage | import("..").ITemplateGuideMessage | import("..").ITemplateHiddenMessage | import("..").ITemplateSystemMessage | import("..").ITemplateUserMessage | import("..").IToolMessage | import("..").IUserMessage>;
38
- modifyMessage: (data: import("..").IMessage, config?: import("./fetch").IRequestConfig) => Promise<import("..").IActivityMessage | import("..").IAssistantMessage | import("..").IDeveloperMessage | import("..").IGuideMessage | import("..").IHiddenAssistantMessage | import("..").IHiddenGuideMessage | import("..").IHiddenMessage | import("..").IHiddenSystemMessage | import("..").IHiddenUserMessage | import("..").IInfoMessage | import("..").IPauseMessage | import("..").IPlaceholderMessage | import("..").IReasoningMessage | import("..").ISystemMessage | import("..").ITemplateAssistantMessage | import("..").ITemplateGuideMessage | import("..").ITemplateHiddenMessage | import("..").ITemplateSystemMessage | import("..").ITemplateUserMessage | import("..").IToolMessage | import("..").IUserMessage>;
38
+ plusMessage: (data: import("..").IMessage, config?: import("./fetch").IRequestConfig) => Promise<import("..").IActivityMessage | import("..").IAssistantMessage | import("..").IDeveloperMessage | import("..").IInterruptMessage | import("..").IGuideMessage | import("..").IHiddenAssistantMessage | import("..").IHiddenGuideMessage | import("..").IHiddenMessage | import("..").IHiddenSystemMessage | import("..").IHiddenUserMessage | import("..").IInfoMessage | import("..").IPauseMessage | import("..").IPlaceholderMessage | import("..").IReasoningMessage | import("..").ISystemMessage | import("..").ITemplateAssistantMessage | import("..").ITemplateGuideMessage | import("..").ITemplateHiddenMessage | import("..").ITemplateSystemMessage | import("..").ITemplateUserMessage | import("..").IToolMessage | import("..").IUserMessage>;
39
+ modifyMessage: (data: import("..").IMessage, config?: import("./fetch").IRequestConfig) => Promise<import("..").IActivityMessage | import("..").IAssistantMessage | import("..").IDeveloperMessage | import("..").IInterruptMessage | import("..").IGuideMessage | import("..").IHiddenAssistantMessage | import("..").IHiddenGuideMessage | import("..").IHiddenMessage | import("..").IHiddenSystemMessage | import("..").IHiddenUserMessage | import("..").IInfoMessage | import("..").IPauseMessage | import("..").IPlaceholderMessage | import("..").IReasoningMessage | import("..").ISystemMessage | import("..").ITemplateAssistantMessage | import("..").ITemplateGuideMessage | import("..").ITemplateHiddenMessage | import("..").ITemplateSystemMessage | import("..").ITemplateUserMessage | import("..").IToolMessage | import("..").IUserMessage>;
39
40
  deleteMessage: (id: string, config?: import("./fetch").IRequestConfig) => Promise<import("..").IMessage>;
40
41
  batchDeleteMessages: (ids: string[], config?: import("./fetch").IRequestConfig) => Promise<number>;
41
42
  shareMessages: (sessionCode: string, contentIds: string[], expiredAt?: number, config?: import("./fetch").IRequestConfig) => Promise<import("./module/message").IShareMessagesResponse>;
42
43
  stopChat: (sessionCode: string, config?: import("./fetch").IRequestConfig) => Promise<void>;
43
44
  getFlowAgentTaskInfo: (taskId: number, config?: import("./fetch").IRequestConfig) => Promise<unknown>;
44
45
  getFlowAgentTaskNodeInfo: (taskId: number, nodeId: string, config?: import("./fetch").IRequestConfig) => Promise<import("..").IFlowAgentTaskNodeInfo>;
46
+ retryFlowAgentTaskNode: (sessionCode: string, nodeId: string, taskId: number, config?: import("./fetch").IRequestConfig) => Promise<void>;
47
+ skipFlowAgentTaskNode: (sessionCode: string, nodeId: string, taskId: number, config?: import("./fetch").IRequestConfig) => Promise<void>;
48
+ userOperation: (sessionCode: string, operation: import("..").UserOperation, payload: import("..").IUserOperationPayload, config?: import("./fetch").IRequestConfig) => Promise<void>;
45
49
  };
46
50
  fetchClient: import("./fetch").FetchClient;
47
51
  };
@@ -28,17 +28,21 @@ export declare const useModule: (fetchClient: FetchClient) => {
28
28
  uploadFile: (sessionCode: string, file: File, config?: import("../fetch").IRequestConfig) => Promise<{
29
29
  download_url?: string;
30
30
  }>;
31
+ isResumeSession: (sessionCode: string, config?: import("../fetch").IRequestConfig) => Promise<boolean>;
31
32
  };
32
33
  message: {
33
34
  getMessages: (sessionCode: string, limit?: number, config?: import("../fetch").IRequestConfig) => Promise<import("../..").IMessage[]>;
34
- plusMessage: (data: import("../..").IMessage, config?: import("../fetch").IRequestConfig) => Promise<import("../..").IActivityMessage | import("../..").IAssistantMessage | import("../..").IDeveloperMessage | import("../..").IGuideMessage | import("../..").IHiddenAssistantMessage | import("../..").IHiddenGuideMessage | import("../..").IHiddenMessage | import("../..").IHiddenSystemMessage | import("../..").IHiddenUserMessage | import("../..").IInfoMessage | import("../..").IPauseMessage | import("../..").IPlaceholderMessage | import("../..").IReasoningMessage | import("../..").ISystemMessage | import("../..").ITemplateAssistantMessage | import("../..").ITemplateGuideMessage | import("../..").ITemplateHiddenMessage | import("../..").ITemplateSystemMessage | import("../..").ITemplateUserMessage | import("../..").IToolMessage | import("../..").IUserMessage>;
35
- modifyMessage: (data: import("../..").IMessage, config?: import("../fetch").IRequestConfig) => Promise<import("../..").IActivityMessage | import("../..").IAssistantMessage | import("../..").IDeveloperMessage | import("../..").IGuideMessage | import("../..").IHiddenAssistantMessage | import("../..").IHiddenGuideMessage | import("../..").IHiddenMessage | import("../..").IHiddenSystemMessage | import("../..").IHiddenUserMessage | import("../..").IInfoMessage | import("../..").IPauseMessage | import("../..").IPlaceholderMessage | import("../..").IReasoningMessage | import("../..").ISystemMessage | import("../..").ITemplateAssistantMessage | import("../..").ITemplateGuideMessage | import("../..").ITemplateHiddenMessage | import("../..").ITemplateSystemMessage | import("../..").ITemplateUserMessage | import("../..").IToolMessage | import("../..").IUserMessage>;
35
+ plusMessage: (data: import("../..").IMessage, config?: import("../fetch").IRequestConfig) => Promise<import("../..").IActivityMessage | import("../..").IAssistantMessage | import("../..").IDeveloperMessage | import("../..").IInterruptMessage | import("../..").IGuideMessage | import("../..").IHiddenAssistantMessage | import("../..").IHiddenGuideMessage | import("../..").IHiddenMessage | import("../..").IHiddenSystemMessage | import("../..").IHiddenUserMessage | import("../..").IInfoMessage | import("../..").IPauseMessage | import("../..").IPlaceholderMessage | import("../..").IReasoningMessage | import("../..").ISystemMessage | import("../..").ITemplateAssistantMessage | import("../..").ITemplateGuideMessage | import("../..").ITemplateHiddenMessage | import("../..").ITemplateSystemMessage | import("../..").ITemplateUserMessage | import("../..").IToolMessage | import("../..").IUserMessage>;
36
+ modifyMessage: (data: import("../..").IMessage, config?: import("../fetch").IRequestConfig) => Promise<import("../..").IActivityMessage | import("../..").IAssistantMessage | import("../..").IDeveloperMessage | import("../..").IInterruptMessage | import("../..").IGuideMessage | import("../..").IHiddenAssistantMessage | import("../..").IHiddenGuideMessage | import("../..").IHiddenMessage | import("../..").IHiddenSystemMessage | import("../..").IHiddenUserMessage | import("../..").IInfoMessage | import("../..").IPauseMessage | import("../..").IPlaceholderMessage | import("../..").IReasoningMessage | import("../..").ISystemMessage | import("../..").ITemplateAssistantMessage | import("../..").ITemplateGuideMessage | import("../..").ITemplateHiddenMessage | import("../..").ITemplateSystemMessage | import("../..").ITemplateUserMessage | import("../..").IToolMessage | import("../..").IUserMessage>;
36
37
  deleteMessage: (id: string, config?: import("../fetch").IRequestConfig) => Promise<import("../..").IMessage>;
37
38
  batchDeleteMessages: (ids: string[], config?: import("../fetch").IRequestConfig) => Promise<number>;
38
39
  shareMessages: (sessionCode: string, contentIds: string[], expiredAt?: number, config?: import("../fetch").IRequestConfig) => Promise<import("./message").IShareMessagesResponse>;
39
40
  stopChat: (sessionCode: string, config?: import("../fetch").IRequestConfig) => Promise<void>;
40
41
  getFlowAgentTaskInfo: (taskId: number, config?: import("../fetch").IRequestConfig) => Promise<unknown>;
41
42
  getFlowAgentTaskNodeInfo: (taskId: number, nodeId: string, config?: import("../fetch").IRequestConfig) => Promise<import("../..").IFlowAgentTaskNodeInfo>;
43
+ retryFlowAgentTaskNode: (sessionCode: string, nodeId: string, taskId: number, config?: import("../fetch").IRequestConfig) => Promise<void>;
44
+ skipFlowAgentTaskNode: (sessionCode: string, nodeId: string, taskId: number, config?: import("../fetch").IRequestConfig) => Promise<void>;
45
+ userOperation: (sessionCode: string, operation: import("../..").UserOperation, payload: import("../..").IUserOperationPayload, config?: import("../fetch").IRequestConfig) => Promise<void>;
42
46
  };
43
47
  fetchClient: FetchClient;
44
48
  };
@@ -1,4 +1,4 @@
1
- import type { IFlowAgentTaskNodeInfo, IMessage } from '../../message/type';
1
+ import type { IFlowAgentTaskNodeInfo, IMessage, IUserOperationPayload, UserOperation } from '../../message/type';
2
2
  import type { FetchClient, IRequestConfig } from '../fetch';
3
3
  /**
4
4
  * 分享消息接口返回数据
@@ -20,12 +20,15 @@ export interface IShareMessagesResponse {
20
20
  */
21
21
  export declare const useMessage: (fetchClient: FetchClient) => {
22
22
  getMessages: (sessionCode: string, limit?: number, config?: IRequestConfig) => Promise<IMessage[]>;
23
- plusMessage: (data: IMessage, config?: IRequestConfig) => Promise<import("../../message/type").IActivityMessage | import("../../message/type").IAssistantMessage | import("../../message/type").IDeveloperMessage | import("../../message/type").IGuideMessage | import("../../message/type").IHiddenAssistantMessage | import("../../message/type").IHiddenGuideMessage | import("../../message/type").IHiddenMessage | import("../../message/type").IHiddenSystemMessage | import("../../message/type").IHiddenUserMessage | import("../../message/type").IInfoMessage | import("../../message/type").IPauseMessage | import("../../message/type").IPlaceholderMessage | import("../../message/type").IReasoningMessage | import("../../message/type").ISystemMessage | import("../../message/type").ITemplateAssistantMessage | import("../../message/type").ITemplateGuideMessage | import("../../message/type").ITemplateHiddenMessage | import("../../message/type").ITemplateSystemMessage | import("../../message/type").ITemplateUserMessage | import("../../message/type").IToolMessage | import("../../message/type").IUserMessage>;
24
- modifyMessage: (data: IMessage, config?: IRequestConfig) => Promise<import("../../message/type").IActivityMessage | import("../../message/type").IAssistantMessage | import("../../message/type").IDeveloperMessage | import("../../message/type").IGuideMessage | import("../../message/type").IHiddenAssistantMessage | import("../../message/type").IHiddenGuideMessage | import("../../message/type").IHiddenMessage | import("../../message/type").IHiddenSystemMessage | import("../../message/type").IHiddenUserMessage | import("../../message/type").IInfoMessage | import("../../message/type").IPauseMessage | import("../../message/type").IPlaceholderMessage | import("../../message/type").IReasoningMessage | import("../../message/type").ISystemMessage | import("../../message/type").ITemplateAssistantMessage | import("../../message/type").ITemplateGuideMessage | import("../../message/type").ITemplateHiddenMessage | import("../../message/type").ITemplateSystemMessage | import("../../message/type").ITemplateUserMessage | import("../../message/type").IToolMessage | import("../../message/type").IUserMessage>;
23
+ plusMessage: (data: IMessage, config?: IRequestConfig) => Promise<import("../../message/type").IActivityMessage | import("../../message/type").IAssistantMessage | import("../../message/type").IDeveloperMessage | import("../../message/type").IInterruptMessage | import("../../message/type").IGuideMessage | import("../../message/type").IHiddenAssistantMessage | import("../../message/type").IHiddenGuideMessage | import("../../message/type").IHiddenMessage | import("../../message/type").IHiddenSystemMessage | import("../../message/type").IHiddenUserMessage | import("../../message/type").IInfoMessage | import("../../message/type").IPauseMessage | import("../../message/type").IPlaceholderMessage | import("../../message/type").IReasoningMessage | import("../../message/type").ISystemMessage | import("../../message/type").ITemplateAssistantMessage | import("../../message/type").ITemplateGuideMessage | import("../../message/type").ITemplateHiddenMessage | import("../../message/type").ITemplateSystemMessage | import("../../message/type").ITemplateUserMessage | import("../../message/type").IToolMessage | import("../../message/type").IUserMessage>;
24
+ modifyMessage: (data: IMessage, config?: IRequestConfig) => Promise<import("../../message/type").IActivityMessage | import("../../message/type").IAssistantMessage | import("../../message/type").IDeveloperMessage | import("../../message/type").IInterruptMessage | import("../../message/type").IGuideMessage | import("../../message/type").IHiddenAssistantMessage | import("../../message/type").IHiddenGuideMessage | import("../../message/type").IHiddenMessage | import("../../message/type").IHiddenSystemMessage | import("../../message/type").IHiddenUserMessage | import("../../message/type").IInfoMessage | import("../../message/type").IPauseMessage | import("../../message/type").IPlaceholderMessage | import("../../message/type").IReasoningMessage | import("../../message/type").ISystemMessage | import("../../message/type").ITemplateAssistantMessage | import("../../message/type").ITemplateGuideMessage | import("../../message/type").ITemplateHiddenMessage | import("../../message/type").ITemplateSystemMessage | import("../../message/type").ITemplateUserMessage | import("../../message/type").IToolMessage | import("../../message/type").IUserMessage>;
25
25
  deleteMessage: (id: string, config?: IRequestConfig) => Promise<IMessage>;
26
26
  batchDeleteMessages: (ids: string[], config?: IRequestConfig) => Promise<number>;
27
27
  shareMessages: (sessionCode: string, contentIds: string[], expiredAt?: number, config?: IRequestConfig) => Promise<IShareMessagesResponse>;
28
28
  stopChat: (sessionCode: string, config?: IRequestConfig) => Promise<void>;
29
29
  getFlowAgentTaskInfo: (taskId: number, config?: IRequestConfig) => Promise<unknown>;
30
30
  getFlowAgentTaskNodeInfo: (taskId: number, nodeId: string, config?: IRequestConfig) => Promise<IFlowAgentTaskNodeInfo>;
31
+ retryFlowAgentTaskNode: (sessionCode: string, nodeId: string, taskId: number, config?: IRequestConfig) => Promise<void>;
32
+ skipFlowAgentTaskNode: (sessionCode: string, nodeId: string, taskId: number, config?: IRequestConfig) => Promise<void>;
33
+ userOperation: (sessionCode: string, operation: UserOperation, payload: IUserOperationPayload, config?: IRequestConfig) => Promise<void>;
31
34
  };