@blueking/chat-helper 0.0.12-beta.2 → 0.0.12-beta.21

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.
@@ -35,9 +35,47 @@
35
35
  }
36
36
  return obj;
37
37
  }
38
- import { transferMessageApi2Message } from '../http/transform/index.ts.js';
39
- import { ActivityType, MessageRole, MessageStatus, MessageType } from '../message/index.ts.js';
40
- import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
38
+ function _object_spread(target) {
39
+ for(var i = 1; i < arguments.length; i++){
40
+ var source = arguments[i] != null ? arguments[i] : {};
41
+ var ownKeys = Object.keys(source);
42
+ if (typeof Object.getOwnPropertySymbols === "function") {
43
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
44
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
45
+ }));
46
+ }
47
+ ownKeys.forEach(function(key) {
48
+ _define_property(target, key, source[key]);
49
+ });
50
+ }
51
+ return target;
52
+ }
53
+ function ownKeys(object, enumerableOnly) {
54
+ var keys = Object.keys(object);
55
+ if (Object.getOwnPropertySymbols) {
56
+ var symbols = Object.getOwnPropertySymbols(object);
57
+ if (enumerableOnly) {
58
+ symbols = symbols.filter(function(sym) {
59
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
60
+ });
61
+ }
62
+ keys.push.apply(keys, symbols);
63
+ }
64
+ return keys;
65
+ }
66
+ function _object_spread_props(target, source) {
67
+ source = source != null ? source : {};
68
+ if (Object.getOwnPropertyDescriptors) {
69
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
70
+ } else {
71
+ ownKeys(Object(source)).forEach(function(key) {
72
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
73
+ });
74
+ }
75
+ return target;
76
+ }
77
+ import { ActivityType, MessageRole, MessageStatus, MessageType, formatEventTimestampToCreatedAt, resolveMessageCreatedAt } from '../message/index.ts.js';
78
+ import { CustomEventName, EventType, FlowTaskState, RunFinishedOutcomeType } from './type.ts.js';
41
79
  /**
42
80
  * AGUI 协议
43
81
  * @param message - 消息模块
@@ -49,11 +87,39 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
49
87
  /**
50
88
  * 处理活动快照事件
51
89
  * 记录活动的完整状态
52
- */ handleActivitySnapshotEvent(_event) {}
90
+ */ handleActivitySnapshotEvent(event) {
91
+ if (event.activityType === ActivityType.Info) {
92
+ const message = this.messageModule.getMessageByMessageId(event.messageId);
93
+ if ((message === null || message === void 0 ? void 0 : message.role) === MessageRole.Info) {
94
+ message.content = event.content;
95
+ }
96
+ return;
97
+ }
98
+ if (event.activityType === ActivityType.Interrupt) {
99
+ const message = this.messageModule.getCurrentLoadingMessage();
100
+ if ((message === null || message === void 0 ? void 0 : message.role) === MessageRole.Interrupt) {
101
+ message.content = event.content;
102
+ message.status = MessageStatus.Complete;
103
+ }
104
+ }
105
+ }
106
+ handleArtifactsGeneratedCustomEvent(event) {
107
+ const message = this.messageModule.list.value.findLast((item)=>item.role === MessageRole.Assistant);
108
+ if (message) {
109
+ var _message;
110
+ const value = event.value;
111
+ var _property;
112
+ (_property = (_message = message).property) !== null && _property !== void 0 ? _property : _message.property = {};
113
+ message.property.artifacts = value.artifacts;
114
+ }
115
+ }
53
116
  /**
54
117
  * 处理自定义事件
55
118
  */ handleCustomEvent(event) {
56
119
  switch(event.name){
120
+ case CustomEventName.ArtifactsGenerated:
121
+ this.handleArtifactsGeneratedCustomEvent(event);
122
+ break;
57
123
  case CustomEventName.FlowAgentStart:
58
124
  this.handleFlowAgentStartCustomEvent(event);
59
125
  break;
@@ -63,6 +129,9 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
63
129
  case CustomEventName.FlowAgentEnd:
64
130
  this.handleFlowAgentEndCustomEvent(event);
65
131
  break;
132
+ case CustomEventName.FlowAgentRestart:
133
+ this.handleFlowAgentRestartCustomEvent(event);
134
+ break;
66
135
  case CustomEventName.ReferenceDocument:
67
136
  this.handleReferenceDocumentCustomEvent(event);
68
137
  break;
@@ -81,6 +150,15 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
81
150
  case CustomEventName.TempMessage:
82
151
  this.handleTempMessageCustomEvent(event);
83
152
  break;
153
+ case CustomEventName.ApprovalResult:
154
+ this.handleApprovalResultCustomEvent(event);
155
+ break;
156
+ case CustomEventName.FlowAgentUpdate:
157
+ this.handleFlowAgentUpdateCustomEvent(event);
158
+ break;
159
+ case CustomEventName.Info:
160
+ this.handleInfoCustomEvent(event);
161
+ break;
84
162
  default:
85
163
  break;
86
164
  }
@@ -102,6 +180,20 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
102
180
  }
103
181
  }
104
182
  /**
183
+ * 自定义事件 处理流程编排任务重启
184
+ */ handleFlowAgentRestartCustomEvent(event) {
185
+ const value = event.value;
186
+ this.messageModule.list.value.forEach((item)=>{
187
+ if (item.role === MessageRole.Activity && item.activityType === ActivityType.FlowAgent) {
188
+ const isSameTask = item.content[0].task_id === value[0].task_id;
189
+ // 通过第一个 task_id 判断是否是同一个任务,是的话直接更新消息状态为 streaming
190
+ if (isSameTask) {
191
+ item.status = MessageStatus.Streaming;
192
+ }
193
+ }
194
+ });
195
+ }
196
+ /**
105
197
  * 自定义事件 处理流程编排任务结果(增量更新节点状态)
106
198
  */ handleFlowAgentResultCustomEvent(event) {
107
199
  const message = this.messageModule.getCurrentLoadingMessage();
@@ -118,7 +210,7 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
118
210
  activityType: ActivityType.FlowAgent,
119
211
  content: value.map((item)=>({
120
212
  nodes: {},
121
- task_id: Number(item.task_id),
213
+ task_id: item.task_id,
122
214
  task_name: '',
123
215
  task_outputs: [],
124
216
  task_state: FlowTaskState.Created
@@ -127,6 +219,29 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
127
219
  });
128
220
  }
129
221
  /**
222
+ * 自定义事件 处理流程编排任务更新
223
+ */ handleFlowAgentUpdateCustomEvent(event) {
224
+ const value = event.value;
225
+ this.messageModule.list.value.forEach((item)=>{
226
+ if (item.role === MessageRole.Activity && item.activityType === ActivityType.FlowAgent) {
227
+ const isSameTask = item.content[0].task_id === value[0].task_id;
228
+ // 通过第一个 task_id 判断是否是同一个任务,是的话直接更新消息内容
229
+ if (isSameTask) {
230
+ item.content = value;
231
+ }
232
+ }
233
+ });
234
+ }
235
+ handleInfoCustomEvent(event) {
236
+ const value = event.value;
237
+ this.messageModule.plusMessage({
238
+ role: MessageRole.Info,
239
+ messageId: value.messageId,
240
+ content: value.content,
241
+ status: MessageStatus.Complete
242
+ });
243
+ }
244
+ /**
130
245
  * 自定义事件 处理意图识别结束
131
246
  */ handleKnowledgeRagEndCustomEvent(_event) {
132
247
  const message = this.messageModule.getCurrentLoadingMessage();
@@ -166,10 +281,10 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
166
281
  }
167
282
  /**
168
283
  * 处理消息快照事件
169
- * 用于同步多端消息状态
284
+ * 用于同步多端消息状态;chat_completion 首帧会全量返回历史消息(含 created_at)
170
285
  */ handleMessagesSnapshotEvent(event) {
171
286
  if (event.messages && event.messages.length > 0) {
172
- this.messageModule.list.value = event.messages.map(transferMessageApi2Message);
287
+ this.messageModule.list.value = event.messages.map(normalizeSnapshotMessage);
173
288
  }
174
289
  }
175
290
  /**
@@ -206,11 +321,31 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
206
321
  }
207
322
  /**
208
323
  * 处理运行完成事件
209
- */ handleRunFinishedEvent(_event) {
324
+ */ handleRunFinishedEvent(event) {
325
+ var _event_outcome, _event_outcome1;
326
+ const createdAt = formatEventTimestampToCreatedAt(event.timestamp);
210
327
  const message = this.messageModule.getCurrentLoadingMessage();
211
328
  if (message) {
212
329
  message.status = MessageStatus.Complete;
213
330
  }
331
+ // 本轮流式消息在落库前没有 createdAt,用 RUN_FINISHED.timestamp 转成 ISO 后补上;已有时间的历史消息不覆盖
332
+ if (createdAt) {
333
+ applyCreatedAtToCurrentRun(this.messageModule.list.value, createdAt);
334
+ }
335
+ // 如果是中断消息,则创建一个中断消息
336
+ if (((_event_outcome = event.outcome) === null || _event_outcome === void 0 ? void 0 : _event_outcome.type) === RunFinishedOutcomeType.Interrupt) {
337
+ this.messageModule.plusMessage(_object_spread({
338
+ role: MessageRole.Interrupt,
339
+ content: event,
340
+ status: MessageStatus.Pending
341
+ }, createdAt ? {
342
+ createdAt
343
+ } : {}));
344
+ }
345
+ // 二次返回,直接更新消息内容
346
+ if (((_event_outcome1 = event.outcome) === null || _event_outcome1 === void 0 ? void 0 : _event_outcome1.type) === RunFinishedOutcomeType.Success && (message === null || message === void 0 ? void 0 : message.role) === MessageRole.Interrupt) {
347
+ message.content = event;
348
+ }
214
349
  }
215
350
  /**
216
351
  * 处理运行开始事件
@@ -249,6 +384,16 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
249
384
  });
250
385
  }
251
386
  /**
387
+ * 自定义事件 处理审批结果
388
+ */ handleApprovalResultCustomEvent(event) {
389
+ const value = event.value;
390
+ const message = this.messageModule.getCurrentLoadingMessage();
391
+ if (message) {
392
+ message.content = value;
393
+ message.status = MessageStatus.Complete;
394
+ }
395
+ }
396
+ /**
252
397
  * 处理文本消息块事件
253
398
  */ handleTextMessageChunkEvent(event) {
254
399
  const message = this.messageModule.getCurrentLoadingMessage();
@@ -281,7 +426,14 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
281
426
  }
282
427
  /**
283
428
  * 处理文本消息开始事件
429
+ * 断线续传时会重放缓存事件:同 messageId 已存在则重置内容,避免重复气泡/文本翻倍
284
430
  */ handleTextMessageStartEvent(event) {
431
+ const existing = this.messageModule.getMessageByMessageId(event.messageId);
432
+ if (existing) {
433
+ existing.content = '';
434
+ existing.status = MessageStatus.Streaming;
435
+ return;
436
+ }
285
437
  this.messageModule.plusMessage({
286
438
  role: event.role,
287
439
  content: '',
@@ -512,3 +664,18 @@ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
512
664
  this.onStartCallback = params === null || params === void 0 ? void 0 : params.onStart;
513
665
  }
514
666
  }
667
+ /** chat_completion 快照可能是 camelCase 或 REST snake_case,统一落到 createdAt */ function normalizeSnapshotMessage(message) {
668
+ const createdAt = resolveMessageCreatedAt(message);
669
+ return createdAt ? _object_spread_props(_object_spread({}, message), {
670
+ createdAt
671
+ }) : message;
672
+ }
673
+ /** 从列表尾部向前,给本轮尚未带时间的消息补 createdAt,遇到已有时间的历史消息即停 */ function applyCreatedAtToCurrentRun(messages, createdAt) {
674
+ for(let index = messages.length - 1; index >= 0; index--){
675
+ const item = messages[index];
676
+ if (item.createdAt) {
677
+ break;
678
+ }
679
+ item.createdAt = createdAt;
680
+ }
681
+ }
@@ -1,14 +1,20 @@
1
- import { type IMessageApi, type MessageRole, type MessageStatus } from '../message/type';
1
+ import { type IMessage, type IMessageArtifact, type MessageRole, type MessageStatus } from '../message/type';
2
+ import type { JSONSchema4 } from 'json-schema';
2
3
  export declare enum CustomEventName {
4
+ ArtifactsGenerated = "artifacts_generated",
3
5
  FlowAgentEnd = "flow_agent_end",
4
6
  FlowAgentResult = "flow_agent_result",
5
7
  FlowAgentStart = "flow_agent_start",
8
+ FlowAgentUpdate = "flow_agent_update",
9
+ FlowAgentRestart = "flow_agent_restart",
10
+ Info = "info",
6
11
  KnowledgeRagEnd = "knowledge_rag_end",
7
12
  KnowledgeRagResult = "knowledge_rag_result",
8
13
  KnowledgeRagStart = "knowledge_rag_start",
9
14
  KnowledgeRagTextContent = "knowledge_rag_text_content",
10
15
  ReferenceDocument = "reference_document",
11
- TempMessage = "temp_message"
16
+ TempMessage = "temp_message",
17
+ ApprovalResult = "approval_result"
12
18
  }
13
19
  export declare enum EventType {
14
20
  ActivityDelta = "ACTIVITY_DELTA",
@@ -40,42 +46,51 @@ export declare enum EventType {
40
46
  }
41
47
  /** BKFlow 收敛后的节点状态 - task.node 的状态枚举 */
42
48
  export declare enum FlowNodeState {
43
- /** 失败 */
44
49
  Failed = "failed",
45
- /** 执行中 */
46
50
  Running = "running",
47
- /** 成功 */
48
51
  Success = "success",
49
- /** 挂起 */
50
52
  Suspended = "suspended"
51
53
  }
52
54
  /** BKFLOW 原始状态 - task 的状态枚举 */
53
55
  export declare enum FlowTaskState {
54
- /** 执行中 */
55
56
  Blocked = "BLOCKED",
56
- /** 执行中 */
57
57
  Created = "CREATED",
58
- /** 失败 */
59
58
  Failed = "FAILED",
60
- /** 成功 */
61
59
  Finished = "FINISHED",
62
- /** 执行中 */
63
60
  LoopReady = "LOOP_READY",
64
- /** 执行中 */
65
61
  Ready = "READY",
66
- /** 失败 */
67
62
  Revoked = "REVOKED",
68
- /** 失败 */
69
63
  RollBackFailed = "ROLL_BACK_FAILED",
70
- /** 执行中 */
71
64
  RollBackSuccess = "ROLL_BACK_SUCCESS",
72
- /** 执行中 */
73
65
  RollingBack = "ROLLING_BACK",
74
- /** 执行中 */
75
66
  Running = "RUNNING",
76
- /** 挂起 */
77
67
  Suspended = "SUSPENDED"
78
68
  }
69
+ /** 运行完成结果 */
70
+ export declare enum RunFinishedOutcomeType {
71
+ Success = "success",
72
+ Interrupt = "interrupt"
73
+ }
74
+ /** 审批状态 */
75
+ export declare enum ApprovalInterruptTicketStatus {
76
+ Abandoned = "abandoned",
77
+ Approved = "approved",
78
+ Cancelled = "cancelled",
79
+ Draft = "draft",
80
+ Expired = "expired",
81
+ Rejected = "rejected",
82
+ Pending = "pending"
83
+ }
84
+ /** 中断原因 */
85
+ export declare enum InterruptReason {
86
+ AIDevToolApproval = "aidev:tool_approval",
87
+ UserQuestion = "aidev:user_question"
88
+ }
89
+ /** 恢复状态 */
90
+ export declare enum ResumeStatus {
91
+ Resolved = "resolved",
92
+ Cancelled = "cancelled"
93
+ }
79
94
  /**
80
95
  * Activity 代表 Agent 执行过程中的活动/动作/任务,可能包含结构化数据
81
96
  * 活动状态的增量更新
@@ -101,7 +116,13 @@ export interface IActivitySnapshotEvent extends IBaseEvent {
101
116
  replace?: boolean;
102
117
  type: EventType.ActivitySnapshot;
103
118
  }
119
+ export interface IArtifactsGeneratedCustomValue {
120
+ artifacts: IMessageArtifact[];
121
+ runId: string;
122
+ status: 'complete' | 'empty';
123
+ }
104
124
  export interface IBaseEvent {
125
+ /** 事件时间,毫秒时间戳;RUN_FINISHED 会转成 ISO 字符串写入消息 createdAt */
105
126
  timestamp?: number;
106
127
  type: EventType;
107
128
  }
@@ -112,25 +133,25 @@ export interface IBaseEvent {
112
133
  export interface ICustomEvent extends IBaseEvent {
113
134
  name: CustomEventName;
114
135
  type: EventType.Custom;
115
- value: IFlowAgentEndCustomValue | IFlowAgentResultCustomValue | IFlowAgentStartCustomValue | IKnowledgeRagResultCustomValue | IKnowledgeRagTextContentCustomValue | IReferenceDocumentCustomValue | ITempMessageCustomValue;
136
+ value: IArtifactsGeneratedCustomValue | IFlowAgentEndCustomValue | IFlowAgentResultCustomValue | IFlowAgentStartCustomValue | IFlowAgentRestartCustomValue | IInfoCustomValue | IKnowledgeRagResultCustomValue | IKnowledgeRagTextContentCustomValue | IReferenceDocumentCustomValue | ITempMessageCustomValue | IApprovalResultCustomValue;
116
137
  }
117
138
  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
139
  export type IFlowAgentEndCustomValue = {
119
140
  task_outputs: string[];
120
141
  }[];
121
142
  export interface IFlowAgentNode {
122
- /** 耗时(s) */
123
143
  elapsed_time: number;
124
- /** 节点id */
125
144
  id: string;
126
- /** 节点名称 */
127
145
  name: string;
128
- /** 节点状态 */
129
146
  state: FlowNodeState;
147
+ retry: number;
148
+ skip: boolean;
149
+ retryable: boolean;
150
+ skippable: boolean;
130
151
  }
131
152
  export type IFlowAgentResultCustomValue = {
132
153
  nodes: Record<string, IFlowAgentNode>;
133
- task_id: number;
154
+ task_id: string;
134
155
  task_name: string;
135
156
  task_outputs: string[];
136
157
  task_state: FlowTaskState;
@@ -138,6 +159,11 @@ export type IFlowAgentResultCustomValue = {
138
159
  export type IFlowAgentStartCustomValue = {
139
160
  task_id: string;
140
161
  }[];
162
+ export type IFlowAgentRestartCustomValue = IFlowAgentStartCustomValue;
163
+ export interface IInfoCustomValue {
164
+ content: string;
165
+ messageId: string;
166
+ }
141
167
  export type IKnowledgeRagResultCustomValue = IReferenceDocumentCustomValue;
142
168
  export interface IKnowledgeRagTextContentCustomValue {
143
169
  cover: boolean;
@@ -151,7 +177,7 @@ export interface IKnowledgeRagTextContentCustomValue {
151
177
  * 同步多端消息状态
152
178
  */
153
179
  export interface IMessagesSnapshotEvent extends IBaseEvent {
154
- messages: IMessageApi[];
180
+ messages: IMessage[];
155
181
  type: EventType.MessagesSnapshot;
156
182
  }
157
183
  /**
@@ -173,15 +199,66 @@ export interface IRunErrorEvent extends IBaseEvent {
173
199
  message: string;
174
200
  type: EventType.RunError;
175
201
  }
202
+ export interface IInterrupt<T extends InterruptReason, P extends Record<string, unknown>> {
203
+ id: string;
204
+ reason: T;
205
+ message?: string;
206
+ toolCallId?: string;
207
+ responseSchema?: JSONSchema4;
208
+ expiresAt?: string;
209
+ metadata?: P;
210
+ }
211
+ export type IApprovalInterrupt = IInterrupt<InterruptReason.AIDevToolApproval, {
212
+ ticket: {
213
+ approvers: string[];
214
+ sn: string;
215
+ status: ApprovalInterruptTicketStatus;
216
+ submit_time: string;
217
+ title: string;
218
+ url: string;
219
+ };
220
+ }>;
221
+ export type IUserQuestionInterrupt = IInterrupt<InterruptReason.UserQuestion, {
222
+ questions: {
223
+ header: string;
224
+ multiSelect?: boolean;
225
+ options?: {
226
+ description: string;
227
+ label: string;
228
+ }[];
229
+ question: string;
230
+ }[];
231
+ }>;
232
+ export interface IResume {
233
+ interruptId: string;
234
+ status: ResumeStatus;
235
+ payload?: {
236
+ answers: {
237
+ answer: {
238
+ description: string;
239
+ label: string;
240
+ }[];
241
+ multiSelect?: boolean;
242
+ question: string;
243
+ }[];
244
+ };
245
+ }
246
+ export type IRunFinishedOutcome = {
247
+ type: RunFinishedOutcomeType.Success;
248
+ } | {
249
+ type: RunFinishedOutcomeType.Interrupt;
250
+ interrupts: Array<IApprovalInterrupt | IUserQuestionInterrupt>;
251
+ };
176
252
  /**
177
253
  * 标记 Agent 运行正常结束
178
254
  * 返回最终结果 result
179
255
  */
180
256
  export interface IRunFinishedEvent extends IBaseEvent {
181
- result?: unknown;
257
+ result?: IResume;
182
258
  runId: number;
183
259
  threadId: string;
184
260
  type: EventType.RunFinished;
261
+ outcome?: IRunFinishedOutcome;
185
262
  }
186
263
  /**
187
264
  * 标记一次完整的 Agent 执行开始
@@ -234,6 +311,7 @@ export interface ITempMessageCustomValue {
234
311
  message: string;
235
312
  status: MessageStatus;
236
313
  }
314
+ export type IApprovalResultCustomValue = IRunFinishedEvent;
237
315
  export interface ITextMessageChunkEvent extends IBaseEvent {
238
316
  delta?: string;
239
317
  messageId: string;
@@ -24,15 +24,20 @@
24
24
  * IN THE SOFTWARE.
25
25
  */ export var CustomEventName;
26
26
  (function(CustomEventName) {
27
+ CustomEventName["ArtifactsGenerated"] = "artifacts_generated";
27
28
  CustomEventName["FlowAgentEnd"] = "flow_agent_end";
28
29
  CustomEventName["FlowAgentResult"] = "flow_agent_result";
29
30
  CustomEventName["FlowAgentStart"] = "flow_agent_start";
31
+ CustomEventName["FlowAgentUpdate"] = "flow_agent_update";
32
+ CustomEventName["FlowAgentRestart"] = "flow_agent_restart";
33
+ CustomEventName["Info"] = "info";
30
34
  CustomEventName["KnowledgeRagEnd"] = "knowledge_rag_end";
31
35
  CustomEventName["KnowledgeRagResult"] = "knowledge_rag_result";
32
36
  CustomEventName["KnowledgeRagStart"] = "knowledge_rag_start";
33
37
  CustomEventName["KnowledgeRagTextContent"] = "knowledge_rag_text_content";
34
38
  CustomEventName["ReferenceDocument"] = "reference_document";
35
39
  CustomEventName["TempMessage"] = "temp_message";
40
+ CustomEventName["ApprovalResult"] = "approval_result";
36
41
  })(CustomEventName || (CustomEventName = {}));
37
42
  export var EventType;
38
43
  (function(EventType) {
@@ -65,23 +70,48 @@ export var EventType;
65
70
  })(EventType || (EventType = {}));
66
71
  export var FlowNodeState;
67
72
  (function(FlowNodeState) {
68
- /** 失败 */ FlowNodeState["Failed"] = "failed";
69
- /** 执行中 */ FlowNodeState["Running"] = "running";
70
- /** 成功 */ FlowNodeState["Success"] = "success";
71
- /** 挂起 */ FlowNodeState["Suspended"] = "suspended";
73
+ FlowNodeState["Failed"] = "failed";
74
+ FlowNodeState["Running"] = "running";
75
+ FlowNodeState["Success"] = "success";
76
+ FlowNodeState["Suspended"] = "suspended";
72
77
  })(FlowNodeState || (FlowNodeState = {}));
73
78
  export var FlowTaskState;
74
79
  (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";
80
+ FlowTaskState["Blocked"] = "BLOCKED";
81
+ FlowTaskState["Created"] = "CREATED";
82
+ FlowTaskState["Failed"] = "FAILED";
83
+ FlowTaskState["Finished"] = "FINISHED";
84
+ FlowTaskState["LoopReady"] = "LOOP_READY";
85
+ FlowTaskState["Ready"] = "READY";
86
+ FlowTaskState["Revoked"] = "REVOKED";
87
+ FlowTaskState["RollBackFailed"] = "ROLL_BACK_FAILED";
88
+ FlowTaskState["RollBackSuccess"] = "ROLL_BACK_SUCCESS";
89
+ FlowTaskState["RollingBack"] = "ROLLING_BACK";
90
+ FlowTaskState["Running"] = "RUNNING";
91
+ FlowTaskState["Suspended"] = "SUSPENDED";
87
92
  })(FlowTaskState || (FlowTaskState = {}));
93
+ export var RunFinishedOutcomeType;
94
+ (function(RunFinishedOutcomeType) {
95
+ RunFinishedOutcomeType["Success"] = "success";
96
+ RunFinishedOutcomeType["Interrupt"] = "interrupt";
97
+ })(RunFinishedOutcomeType || (RunFinishedOutcomeType = {}));
98
+ export var ApprovalInterruptTicketStatus;
99
+ (function(ApprovalInterruptTicketStatus) {
100
+ ApprovalInterruptTicketStatus["Abandoned"] = "abandoned";
101
+ ApprovalInterruptTicketStatus["Approved"] = "approved";
102
+ ApprovalInterruptTicketStatus["Cancelled"] = "cancelled";
103
+ ApprovalInterruptTicketStatus["Draft"] = "draft";
104
+ ApprovalInterruptTicketStatus["Expired"] = "expired";
105
+ ApprovalInterruptTicketStatus["Rejected"] = "rejected";
106
+ ApprovalInterruptTicketStatus["Pending"] = "pending";
107
+ })(ApprovalInterruptTicketStatus || (ApprovalInterruptTicketStatus = {}));
108
+ export var InterruptReason;
109
+ (function(InterruptReason) {
110
+ InterruptReason["AIDevToolApproval"] = "aidev:tool_approval";
111
+ InterruptReason["UserQuestion"] = "aidev:user_question";
112
+ })(InterruptReason || (InterruptReason = {}));
113
+ export var ResumeStatus;
114
+ (function(ResumeStatus) {
115
+ ResumeStatus["Resolved"] = "resolved";
116
+ ResumeStatus["Cancelled"] = "cancelled";
117
+ })(ResumeStatus || (ResumeStatus = {}));