@metad/contracts 0.0.1 → 3.6.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/.babelrc +5 -0
  2. package/.eslintrc.json +18 -0
  3. package/README.md +3 -1
  4. package/babel.config.json +1 -0
  5. package/jest.config.ts +16 -0
  6. package/package.json +5 -5
  7. package/project.json +46 -0
  8. package/src/agent/ai-model.ts +9 -0
  9. package/src/agent/graph.ts +272 -0
  10. package/src/agent/index.ts +5 -0
  11. package/src/agent/token.ts +23 -0
  12. package/src/agent/utils.spec.ts +283 -0
  13. package/src/agent/utils.ts +122 -0
  14. package/src/agent/variables.ts +21 -0
  15. package/src/ai/ai-model.model.ts +228 -0
  16. package/src/ai/ai-provider.model.ts +53 -0
  17. package/src/ai/ai.model.ts +87 -0
  18. package/src/ai/chat-message-feedback.model.ts +31 -0
  19. package/src/ai/chat-message.model.ts +277 -0
  20. package/src/ai/chat.model.ts +207 -0
  21. package/src/ai/copilot-checkpoint.model.ts +25 -0
  22. package/src/ai/copilot-example.model.ts +23 -0
  23. package/src/ai/copilot-model.model.ts +31 -0
  24. package/src/ai/copilot-organization.model.ts +21 -0
  25. package/src/ai/copilot-provider.model.ts +46 -0
  26. package/src/ai/copilot-role.model.ts +48 -0
  27. package/src/ai/copilot-store.model.ts +34 -0
  28. package/src/ai/copilot-user.model.ts +24 -0
  29. package/src/ai/copilot.model.ts +47 -0
  30. package/src/ai/environment.model.ts +18 -0
  31. package/src/ai/feature.model.ts +6 -0
  32. package/src/ai/index.ts +37 -0
  33. package/src/ai/knowledge-doc-page.model.ts +20 -0
  34. package/src/ai/knowledge-doc.model.ts +217 -0
  35. package/src/ai/knowledge-pipeline.ts +106 -0
  36. package/src/ai/knowledge-retrieval-log.model.ts +19 -0
  37. package/src/ai/knowledgebase-task.model.ts +42 -0
  38. package/src/ai/knowledgebase.model.ts +173 -0
  39. package/src/ai/rag-web.ts +54 -0
  40. package/src/ai/rag.ts +24 -0
  41. package/src/ai/role-permissions.ts +13 -0
  42. package/src/ai/types.ts +83 -0
  43. package/src/ai/xpert-agent-execution.model.ts +115 -0
  44. package/src/ai/xpert-agent.model.ts +258 -0
  45. package/src/ai/xpert-project.model.ts +103 -0
  46. package/src/ai/xpert-task.model.ts +32 -0
  47. package/src/ai/xpert-template.model.ts +53 -0
  48. package/src/ai/xpert-tool-mcp.model.ts +72 -0
  49. package/src/ai/xpert-tool.model.ts +211 -0
  50. package/src/ai/xpert-toolset.model.ts +220 -0
  51. package/src/ai/xpert-workflow-task.prompt.ts +71 -0
  52. package/src/ai/xpert-workflow.model.ts +449 -0
  53. package/src/ai/xpert-workspace.model.ts +42 -0
  54. package/src/ai/xpert.model.ts +781 -0
  55. package/src/analytics/ai.ts +79 -0
  56. package/src/analytics/approval-policy.model.ts +40 -0
  57. package/src/analytics/business-area-user.model.ts +43 -0
  58. package/src/analytics/business-area.ts +20 -0
  59. package/src/analytics/certification.model.ts +12 -0
  60. package/src/analytics/chatbi-conversation.model.ts +16 -0
  61. package/src/analytics/chatbi-model.model.ts +22 -0
  62. package/src/analytics/collection.model.ts +8 -0
  63. package/src/analytics/comment.model.ts +14 -0
  64. package/src/analytics/data-source-type.ts +19 -0
  65. package/src/analytics/data-source.ts +72 -0
  66. package/src/analytics/favorite.ts +18 -0
  67. package/src/analytics/features.ts +19 -0
  68. package/src/analytics/feed-model.ts +15 -0
  69. package/src/analytics/gateway.ts +30 -0
  70. package/src/analytics/index.ts +39 -0
  71. package/src/analytics/indicator-app.ts +49 -0
  72. package/{analytics/indicator-market.d.ts → src/analytics/indicator-market.ts} +8 -4
  73. package/src/analytics/indicator.ts +127 -0
  74. package/src/analytics/model-query-log.model.ts +46 -0
  75. package/src/analytics/model-query.ts +22 -0
  76. package/{analytics/notification-destination.d.ts → src/analytics/notification-destination.ts} +14 -10
  77. package/src/analytics/permission-approval-user.model.ts +12 -0
  78. package/src/analytics/permission-approval.model.ts +58 -0
  79. package/src/analytics/project.model.ts +56 -0
  80. package/src/analytics/role-permissions.ts +36 -0
  81. package/src/analytics/schema.ts +300 -0
  82. package/src/analytics/screenshot.model.ts +28 -0
  83. package/src/analytics/semantic-model-entity.ts +49 -0
  84. package/src/analytics/semantic-model-member.ts +45 -0
  85. package/src/analytics/semantic-model.ts +228 -0
  86. package/{analytics/story-point.d.ts → src/analytics/story-point.ts} +16 -10
  87. package/src/analytics/story-template.model.ts +34 -0
  88. package/src/analytics/story-widget.ts +15 -0
  89. package/src/analytics/story.ts +109 -0
  90. package/src/analytics/subscription.ts +43 -0
  91. package/src/analytics/visit.model.ts +39 -0
  92. package/src/analytics/webSocket.ts +53 -0
  93. package/src/api-key.model.ts +11 -0
  94. package/src/base-entity.model.ts +33 -0
  95. package/src/contact.model.ts +45 -0
  96. package/src/core.model.ts +103 -0
  97. package/{country.model.d.ts → src/country.model.ts} +6 -5
  98. package/src/currency.model.ts +582 -0
  99. package/src/custom-smtp.model.ts +27 -0
  100. package/src/date-picker.model.ts +5 -0
  101. package/src/email-template.model.ts +50 -0
  102. package/src/email.model.ts +46 -0
  103. package/src/employee.model.ts +199 -0
  104. package/src/entity-with-members.model.ts +16 -0
  105. package/src/feature.model.ts +108 -0
  106. package/src/file-provider.ts +37 -0
  107. package/src/help-center-article.model.ts +35 -0
  108. package/src/help-center.model.ts +33 -0
  109. package/src/http-status.enum.ts +58 -0
  110. package/src/import-export.model.ts +42 -0
  111. package/src/index.ts +60 -0
  112. package/src/integration/dify.ts +31 -0
  113. package/src/integration/dingtalk.ts +16 -0
  114. package/src/integration/fastgpt.ts +32 -0
  115. package/src/integration/firecrawl.ts +46 -0
  116. package/src/integration/github.ts +149 -0
  117. package/src/integration/index.ts +19 -0
  118. package/src/integration/lark.ts +79 -0
  119. package/src/integration/ragflow.ts +32 -0
  120. package/src/integration/wecom.ts +16 -0
  121. package/src/integration.model.ts +118 -0
  122. package/src/invite.model.ts +144 -0
  123. package/src/language.model.ts +22 -0
  124. package/src/organization-contact.model.ts +84 -0
  125. package/src/organization-department.model.ts +26 -0
  126. package/src/organization-language.model.ts +24 -0
  127. package/src/organization-projects.model.ts +99 -0
  128. package/src/organization-team-employee-model.ts +14 -0
  129. package/src/organization-team-model.ts +25 -0
  130. package/src/organization.model.ts +266 -0
  131. package/src/password-reset.model.ts +24 -0
  132. package/src/plain-object.model.ts +13 -0
  133. package/src/plugin.ts +15 -0
  134. package/src/role-permission.model.ts +123 -0
  135. package/src/role.model.ts +31 -0
  136. package/src/schedule.ts +71 -0
  137. package/src/secret-token.model.ts +15 -0
  138. package/src/seed.model.ts +50 -0
  139. package/src/storage-file.model.ts +46 -0
  140. package/src/tag-entity.model.ts +23 -0
  141. package/src/tenant.model.ts +52 -0
  142. package/src/tools/index.ts +1 -0
  143. package/src/tools/sandbox.ts +5 -0
  144. package/src/translation.model.ts +37 -0
  145. package/src/types.ts +276 -0
  146. package/src/user-organization.model.ts +31 -0
  147. package/src/user.model.ts +147 -0
  148. package/src/visibility.model.ts +6 -0
  149. package/tsconfig.json +22 -0
  150. package/tsconfig.lib.json +10 -0
  151. package/tsconfig.spec.json +9 -0
  152. package/analytics/business-area-user.model.d.ts +0 -29
  153. package/analytics/business-area.d.ts +0 -16
  154. package/analytics/business-group.d.ts +0 -12
  155. package/analytics/data-source-type.d.ts +0 -12
  156. package/analytics/data-source.d.ts +0 -43
  157. package/analytics/favorite.d.ts +0 -14
  158. package/analytics/features.d.ts +0 -19
  159. package/analytics/feed-model.d.ts +0 -13
  160. package/analytics/index.d.ts +0 -20
  161. package/analytics/indicator.d.ts +0 -31
  162. package/analytics/insight-model.d.ts +0 -14
  163. package/analytics/model-query.d.ts +0 -12
  164. package/analytics/role-permissions.d.ts +0 -19
  165. package/analytics/semantic-model.d.ts +0 -42
  166. package/analytics/story-widget.d.ts +0 -11
  167. package/analytics/story.d.ts +0 -18
  168. package/analytics/subscription.d.ts +0 -38
  169. package/analytics/user-business-group.model.d.ts +0 -29
  170. package/analytics/visit.model.d.ts +0 -27
  171. package/analytics/webSocket.d.ts +0 -40
  172. package/base-entity.model.d.ts +0 -21
  173. package/contact.model.d.ts +0 -41
  174. package/core.model.d.ts +0 -25
  175. package/currency.model.d.ts +0 -579
  176. package/email-template.model.d.ts +0 -47
  177. package/email.model.d.ts +0 -36
  178. package/employee.model.d.ts +0 -128
  179. package/entity-with-members.model.d.ts +0 -13
  180. package/feature.model.d.ts +0 -134
  181. package/file-provider.d.ts +0 -31
  182. package/help-center-article.model.d.ts +0 -27
  183. package/help-center.model.d.ts +0 -28
  184. package/http-status.enum.d.ts +0 -57
  185. package/import-export.model.d.ts +0 -36
  186. package/index.cjs +0 -1283
  187. package/index.d.ts +0 -33
  188. package/index.js +0 -1272
  189. package/language.model.d.ts +0 -19
  190. package/organization-contact.model.d.ts +0 -73
  191. package/organization-department.model.d.ts +0 -20
  192. package/organization-language.model.d.ts +0 -18
  193. package/organization-team-employee-model.d.ts +0 -12
  194. package/organization-team-model.d.ts +0 -19
  195. package/organization.model.d.ts +0 -227
  196. package/role-permission.model.d.ts +0 -63
  197. package/role.model.d.ts +0 -21
  198. package/seed.model.d.ts +0 -38
  199. package/tag-entity.model.d.ts +0 -10
  200. package/tenant.model.d.ts +0 -24
  201. package/translation.model.d.ts +0 -20
  202. package/user-organization.model.d.ts +0 -24
  203. package/user.model.d.ts +0 -117
  204. package/visibility.model.d.ts +0 -5
@@ -0,0 +1,449 @@
1
+ import { I18nObject, letterStartSUID } from "../types"
2
+ import { ICopilotModel } from "./copilot-model.model"
3
+ import { TKBRecallParams } from "./knowledgebase.model"
4
+ import { ApiAuthType, TErrorHandling, TXpertRefParameter } from "./types"
5
+ import { TStateVariable, TXpertParameter } from "./xpert.model"
6
+
7
+ export type TWorkflowNodeMeta = {
8
+ name: string
9
+ label: I18nObject
10
+ icon: {
11
+ svg?: string
12
+ remixicon?: string
13
+ color?: string
14
+ }
15
+ configSchema: any
16
+ }
17
+
18
+ export type TWorkflowTriggerMeta = TWorkflowNodeMeta
19
+
20
+ export enum WorkflowNodeTypeEnum {
21
+ /**
22
+ * Trigger
23
+ */
24
+ TRIGGER = 'trigger',
25
+ /**
26
+ * State Variable Assigner
27
+ */
28
+ ASSIGNER = 'assigner',
29
+ /**
30
+ * Router
31
+ */
32
+ IF_ELSE = 'if-else',
33
+ LIST_OPERATOR = 'list-operator',
34
+ VARIABLE_AGGREGATOR = 'variable-aggregator',
35
+ // SPLITTER = 'splitter',
36
+ ITERATING = 'iterating',
37
+ ANSWER = 'answer',
38
+ CODE = 'code',
39
+ HTTP = 'http',
40
+ KNOWLEDGE = 'knowledge',
41
+ SUBFLOW = 'subflow',
42
+ TEMPLATE = 'template',
43
+ CLASSIFIER = 'classifier',
44
+ TOOL = 'tool',
45
+ AGENT_TOOL = 'agent-tool',
46
+ NOTE = 'note',
47
+ /**
48
+ * Task node, distribute tasks to sub-agents
49
+ */
50
+ TASK = 'task',
51
+
52
+ // Knowledge Pipeline nodes
53
+ SOURCE = 'source',
54
+ PROCESSOR = 'processor',
55
+ CHUNKER = 'chunker',
56
+ UNDERSTANDING = 'understanding',
57
+ KNOWLEDGE_BASE = 'knowledgebase',
58
+ }
59
+
60
+ export interface IWorkflowNode {
61
+ id: string
62
+ key: string
63
+ title?: string
64
+ description?: string | I18nObject
65
+ type: WorkflowNodeTypeEnum
66
+ }
67
+
68
+ export enum VariableOperationEnum {
69
+ APPEND = 'append',
70
+ EXTEND = 'extend',
71
+ OVERWRITE = 'overwrite',
72
+ CLEAR = 'clear'
73
+ }
74
+
75
+ export type TVariableAssigner = {
76
+ id: string
77
+ inputType: 'variable' | 'constant' | 'message'
78
+ /**
79
+ * value from variable
80
+ */
81
+ value?: string
82
+ /**
83
+ * value write to state's variable
84
+ */
85
+ variableSelector: string
86
+ /**
87
+ * How to write value to variable
88
+ */
89
+ operation: VariableOperationEnum
90
+
91
+ /**
92
+ * The message template to write to messages variable
93
+ */
94
+ messages?: {role: string; content: string}[]
95
+ }
96
+
97
+ export interface IWFNAssigner extends IWorkflowNode {
98
+ type: WorkflowNodeTypeEnum.ASSIGNER
99
+ assigners: TVariableAssigner[]
100
+ }
101
+
102
+ export interface IWFNIfElse extends IWorkflowNode {
103
+ type: WorkflowNodeTypeEnum.IF_ELSE
104
+ cases: TWFCase[]
105
+ }
106
+
107
+ /**
108
+ * The list operator can filter and extract attributes such as file format type, file name, and size,
109
+ * passing different format files to corresponding processing nodes to achieve precise control over different file processing flows.
110
+ */
111
+ export interface IWFNListOperator extends IWorkflowNode {
112
+ type: WorkflowNodeTypeEnum.LIST_OPERATOR
113
+ // Input Variable *
114
+ input: string
115
+ // Variable type of items in the input array
116
+ itemVarType: string
117
+ // Filter condition
118
+ filterBy?: {
119
+ enabled: boolean
120
+ conditions: TWFCaseCondition[]
121
+ logicalOperator: WorkflowLogicalOperator
122
+ }
123
+ // Extract the N item
124
+ extractBy?: {
125
+ enabled: boolean
126
+ index: number
127
+ }
128
+ // Sort items by variable
129
+ sortBy?: {
130
+ enabled: boolean
131
+ variable: string
132
+ descending?: boolean
133
+ }
134
+ // Top N items
135
+ topN?: {
136
+ enabled: boolean
137
+ count: number
138
+ }
139
+ }
140
+
141
+ /**
142
+ * Aggregate variables from multiple branches into a single variable to achieve unified configuration for downstream nodes.
143
+ */
144
+ export interface IWFNVariableAggregator extends IWorkflowNode {
145
+ type: WorkflowNodeTypeEnum.VARIABLE_AGGREGATOR
146
+ // Input Variables *
147
+ inputs: string[]
148
+ // Output Variable type
149
+ outputType: string
150
+ // Aggregation method
151
+ // method?: 'concat' | 'merge' | 'custom'
152
+ }
153
+
154
+ // export interface IWFNSplitter extends IWorkflowNode {
155
+ // type: WorkflowNodeTypeEnum.SPLITTER
156
+ // }
157
+
158
+ export interface IWFNIterating extends IWorkflowNode {
159
+ type: WorkflowNodeTypeEnum.ITERATING
160
+ /**
161
+ * Variable name of input array in state
162
+ */
163
+ inputVariable: string
164
+ inputParams?: TXpertRefParameter[]
165
+ outputParams?: TXpertRefParameter[]
166
+ /**
167
+ * Execute in parallel, otherwise execute sequentially
168
+ */
169
+ parallel?: boolean
170
+ /**
171
+ * Maximum number of parallel task
172
+ */
173
+ maximum?: number
174
+
175
+ /**
176
+ * - terminate: terminate on error
177
+ * - ignore: ignore error and continue
178
+ * - remove: remove error output
179
+ */
180
+ errorMode?: 'terminate' | 'ignore' | 'remove'
181
+ }
182
+
183
+ /**
184
+ * The parameter name that represents the entire current element in array
185
+ */
186
+ export const IteratingItemParameterName = '$item'
187
+ export const IteratingIndexParameterName = '$index'
188
+
189
+ export interface IWFNAnswer extends IWorkflowNode {
190
+ type: WorkflowNodeTypeEnum.ANSWER
191
+ promptTemplate: string
192
+ mute?: boolean
193
+ }
194
+
195
+ export enum WorkflowLogicalOperator {
196
+ AND = 'and',
197
+ OR = 'or'
198
+ }
199
+
200
+ export enum WorkflowComparisonOperator {
201
+ CONTAINS = 'contains',
202
+ NOT_CONTAINS = 'not-contains',
203
+ EQUAL = 'equal',
204
+ NOT_EQUAL = 'not-equal',
205
+ GT = 'gt',
206
+ LT = 'lt',
207
+ GE = 'ge',
208
+ LE = 'le',
209
+ STARTS_WITH = 'starts-with',
210
+ ENDS_WITH = 'ends-with',
211
+ EMPTY = 'empty',
212
+ NOT_EMPTY = 'not-empty',
213
+ IS_TRUE = 'is-true',
214
+ IS_FALSE = 'is-false',
215
+ LIKE = 'like',
216
+ NOT_LIKE = 'not-like'
217
+ }
218
+
219
+ /**
220
+ * Comparison condition for if-else and list-operator nodes
221
+ */
222
+ export type TWFCaseCondition = {
223
+ id: string
224
+ comparisonOperator: WorkflowComparisonOperator
225
+ value?: string
226
+ varType?: string
227
+ variableSelector?: string
228
+ }
229
+
230
+ export type TWFCase = {
231
+ caseId: string
232
+ conditions: TWFCaseCondition[]
233
+ logicalOperator: WorkflowLogicalOperator
234
+ }
235
+
236
+ export type TWorkflowVarGroup = {
237
+ // /**
238
+ // * @deprecated use group
239
+ // */
240
+ // agent?: Partial<IXpertAgent>
241
+ group?: {
242
+ name: string
243
+ description: string | I18nObject
244
+ }
245
+ variables: TStateVariable[]
246
+ }
247
+
248
+ export type TWorkflowRetry = {
249
+ enabled?: boolean
250
+ stopAfterAttempt?: number
251
+ retryInterval?: number // second
252
+ }
253
+
254
+ export interface IWFNCode extends IWorkflowNode {
255
+ type: WorkflowNodeTypeEnum.CODE
256
+ language: 'python' | 'javascript'
257
+ code: string
258
+ inputs: {name: string; variable?: string}[]
259
+ outputs: TXpertParameter[]
260
+ /**
261
+ * Retry on failure
262
+ */
263
+ retry?: TWorkflowRetry
264
+ /**
265
+ * Error handling
266
+ */
267
+ errorHandling?: TErrorHandling
268
+ }
269
+
270
+ // Http workflow node
271
+ export type BodyType = 'none' | 'form-data' | 'x-www-form-urlencoded' | 'json' | 'raw' | 'binary';
272
+ interface HttpParam {
273
+ key: string;
274
+ value: string;
275
+ }
276
+ interface HttpHeader {
277
+ name: string;
278
+ value: string;
279
+ }
280
+
281
+ export type TWorkflowAuthorization = {
282
+ auth_type?: ApiAuthType
283
+ api_key_type?: '' | 'bearer' | 'custom'
284
+ api_key_header?: string
285
+ api_key_value?: string
286
+ username?: string
287
+ password?: string
288
+ }
289
+
290
+ export interface IWFNHttp extends IWorkflowNode {
291
+ type: WorkflowNodeTypeEnum.HTTP
292
+ authorization?: TWorkflowAuthorization
293
+ method: 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head'
294
+ url: string
295
+ headers: HttpHeader[]
296
+ params: HttpParam[]
297
+ body: {
298
+ type?: BodyType
299
+ body?: string; // 如果是 JSON 类型
300
+ encodedForm?: HttpParam[]
301
+ }
302
+ connectionTimeout?: number
303
+ readTimeout?: number
304
+ writeTimeout?: number
305
+ /**
306
+ * Retry on failure
307
+ */
308
+ retry?: TWorkflowRetry
309
+ /**
310
+ * Error handling
311
+ */
312
+ errorHandling?: TErrorHandling
313
+ }
314
+
315
+ export interface IWFNKnowledgeRetrieval extends IWorkflowNode {
316
+ queryVariable: string
317
+ knowledgebases: string[]
318
+ recall?: TKBRecallParams
319
+ }
320
+
321
+ export interface IWFNSubflow extends IWorkflowNode {
322
+ inputParams?: TXpertRefParameter[]
323
+ outputParams?: TXpertRefParameter[]
324
+ }
325
+
326
+ export interface IWFNTemplate extends IWorkflowNode {
327
+ type: WorkflowNodeTypeEnum.TEMPLATE,
328
+ inputParams?: TXpertRefParameter[]
329
+ code: string
330
+
331
+ /**
332
+ * Error handling
333
+ */
334
+ errorHandling?: TErrorHandling
335
+ }
336
+
337
+ export interface IWFNClassifier extends IWorkflowNode {
338
+ type: WorkflowNodeTypeEnum.CLASSIFIER
339
+ copilotModel: ICopilotModel
340
+ inputVariables: string[]
341
+ classes: {
342
+ description?: string
343
+ }[]
344
+ instruction?: string
345
+ }
346
+
347
+ export interface IWFNClassifier extends IWorkflowNode {
348
+ type: WorkflowNodeTypeEnum.CLASSIFIER
349
+ copilotModel: ICopilotModel
350
+ inputVariables: string[]
351
+ classes: {
352
+ description?: string
353
+ }[]
354
+ instruction?: string
355
+ }
356
+
357
+ export interface IWFNTemplate extends IWorkflowNode {
358
+ type: WorkflowNodeTypeEnum.TEMPLATE,
359
+ inputParams?: TXpertRefParameter[]
360
+ code: string
361
+
362
+ /**
363
+ * Error handling
364
+ */
365
+ errorHandling?: TErrorHandling
366
+ }
367
+
368
+ export interface IWFNTool extends IWorkflowNode {
369
+ type: WorkflowNodeTypeEnum.TOOL,
370
+ toolsetId: string
371
+ toolName: string
372
+ /**
373
+ * @deprecated Use parameters instead
374
+ */
375
+ parameterVariable: string
376
+ parameters?: any
377
+ omitBlankValues?: boolean
378
+
379
+ /**
380
+ * Error handling
381
+ */
382
+ errorHandling?: TErrorHandling
383
+ }
384
+
385
+ export interface IWFNNote extends IWorkflowNode {
386
+ content: string
387
+ }
388
+
389
+ export interface IWFNAgentTool extends IWorkflowNode {
390
+ type: WorkflowNodeTypeEnum.AGENT_TOOL,
391
+ // Tool name
392
+ toolName: string
393
+ // Tool description
394
+ toolDescription?: string
395
+ // Tool schema
396
+ toolParameters?: TXpertParameter[]
397
+
398
+ /**
399
+ * End point tool
400
+ */
401
+ isEnd?: boolean
402
+
403
+ /**
404
+ * @deprecated Mixed sub-processes are not suitable for catching exceptions unless they are implemented using a separate subgraph
405
+ * Error handling
406
+ */
407
+ errorHandling?: TErrorHandling
408
+ }
409
+
410
+ export interface IWFNTrigger extends IWorkflowNode {
411
+ type: WorkflowNodeTypeEnum.TRIGGER,
412
+ from: 'chat' | 'integration' | 'scheduler'
413
+ parameters?: TXpertParameter[]
414
+ config?: any
415
+ }
416
+
417
+ export interface IWFNTask extends IWorkflowNode {
418
+ type: WorkflowNodeTypeEnum.TASK,
419
+ descriptionPrefix?: string
420
+ descriptionSuffix?: string
421
+ }
422
+
423
+ export function genListOperatorKey() {
424
+ return letterStartSUID('ListOperator_')
425
+ }
426
+
427
+ export function genVariableAggregatorKey() {
428
+ return letterStartSUID('VariableAggregator_')
429
+ }
430
+
431
+ export function isAgentKey(key: string) {
432
+ return key?.toLowerCase().startsWith('agent_')
433
+ }
434
+
435
+ export function isRouterKey(key: string) {
436
+ return key?.toLowerCase().startsWith('router_')
437
+ }
438
+
439
+ export function isIteratingKey(key: string) {
440
+ return key?.toLowerCase().startsWith('iterating_')
441
+ }
442
+
443
+ export function isWorkflowKey(key: string) {
444
+ return isRouterKey(key) || isIteratingKey(key)
445
+ }
446
+
447
+ export function workflowNodeIdentifier(node: IWorkflowNode) {
448
+ return node.title || node.key
449
+ }
@@ -0,0 +1,42 @@
1
+ import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model'
2
+ import { IUser } from '../user.model'
3
+ import { IEnvironment } from './environment.model'
4
+ import { IXpert } from './xpert.model'
5
+
6
+ /**
7
+ * Expert Workspace
8
+ */
9
+ export interface IXpertWorkspace extends IBasePerTenantAndOrganizationEntityModel {
10
+ name: string
11
+ description?: string
12
+ status: TXpertWorkspaceStatus
13
+ settings?: TXpertWorkspaceSettings
14
+
15
+ // Many to one
16
+ ownerId: string
17
+ owner?: IUser
18
+
19
+ // One to many
20
+ xperts?: IXpert[]
21
+ environments?: IEnvironment[]
22
+
23
+ members?: IUser[]
24
+ }
25
+
26
+ export type TXpertWorkspaceSettings = {
27
+ //
28
+ }
29
+ export type TXpertWorkspaceStatus = 'active' | 'deprecated' | 'archived'
30
+
31
+ export interface IBasePerWorkspaceEntityModel extends IBasePerTenantAndOrganizationEntityModel {
32
+ workspaceId?: string
33
+ workspace?: IXpertWorkspace
34
+ /**
35
+ * Publish date of latest
36
+ */
37
+ publishAt?: Date
38
+ /**
39
+ * Soft deleted
40
+ */
41
+ deletedAt?: Date
42
+ }