@metad/contracts 3.6.1 → 3.6.7

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/package.json CHANGED
@@ -1,7 +1,14 @@
1
1
  {
2
2
  "name": "@metad/contracts",
3
- "version": "3.6.1",
3
+ "version": "3.6.7",
4
4
  "license": "AGPL-3.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/xpert-ai/xpert.git"
8
+ },
9
+ "bugs": {
10
+ "url": "https://github.com/xpert-ai/xpert/issues"
11
+ },
5
12
  "scripts": {
6
13
  "docs": "yarn typedoc --out ./.docs"
7
14
  },
@@ -17,6 +17,9 @@ export const GRAPH_NODE_SUMMARIZE_CONVERSATION = 'summarize_conversation'
17
17
  export const GRAPH_NODE_TITLE_CONVERSATION = 'title_conversation'
18
18
  export const STATE_VARIABLE_FILES = 'files'
19
19
  export const STATE_VARIABLE_INPUT = 'input'
20
+ export const STATE_SYS_VOLUME = 'volume'
21
+ export const STATE_SYS_WORKSPACE_PATH = 'workspace_path'
22
+ export const STATE_SYS_WORKSPACE_URL = 'workspace_url'
20
23
  export const STATE_VARIABLE_TITLE_CHANNEL = channelName('title')
21
24
 
22
25
  export type TMessageChannel = {
@@ -1,4 +1,5 @@
1
- import { TWorkflowVarGroup } from "../ai";
1
+ import { TWorkflowVarGroup } from "../ai/xpert-workflow.model"
2
+ import { TXpertParameter, XpertParameterTypeEnum } from "../ai/xpert.model"
2
3
 
3
4
  /**
4
5
  *
@@ -18,4 +19,48 @@ export function getVariableSchema(variables: TWorkflowVarGroup[], variable: stri
18
19
  group,
19
20
  variable: group?.variables.find((_) => _.name === (rest.join('.') || groupName))
20
21
  }
21
- }
22
+ }
23
+
24
+ export const FILE_VARIABLES: TXpertParameter[] = [
25
+ {
26
+ name: 'filePath',
27
+ type: XpertParameterTypeEnum.STRING,
28
+ description: {
29
+ en_US: 'The path to the file',
30
+ zh_Hans: '文件的路径'
31
+ },
32
+
33
+ },
34
+ {
35
+ name: 'fileName',
36
+ type: XpertParameterTypeEnum.STRING,
37
+ description: {
38
+ en_US: 'The name of the file',
39
+ zh_Hans: '文件的名称'
40
+ },
41
+ },
42
+ {
43
+ name: 'fileUrl',
44
+ type: XpertParameterTypeEnum.STRING,
45
+ description: {
46
+ en_US: 'The URL of the file',
47
+ zh_Hans: '文件的URL地址'
48
+ },
49
+ },
50
+ {
51
+ name: 'fileSize',
52
+ type: XpertParameterTypeEnum.NUMBER,
53
+ description: {
54
+ en_US: 'The size of the file in bytes',
55
+ zh_Hans: '文件的大小,单位为字节'
56
+ },
57
+ },
58
+ {
59
+ name: 'mimeType',
60
+ type: XpertParameterTypeEnum.STRING,
61
+ description: {
62
+ en_US: 'The MIME type of the file',
63
+ zh_Hans: '文件的MIME类型'
64
+ },
65
+ }
66
+ ]
@@ -3,39 +3,40 @@ import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model'
3
3
  import { I18nObject } from '../types'
4
4
  import { ICopilot } from './copilot.model'
5
5
 
6
+
6
7
  export interface IAiModel extends IBasePerTenantAndOrganizationEntityModel {
7
8
  /**
8
- * 模型名称
9
+ * Model name
9
10
  */
10
11
  name: string
11
12
 
12
13
  /**
13
- * 模型展示名称
14
+ * Model display name
14
15
  */
15
16
  label: string
16
17
 
17
18
  /**
18
- * 模型类型
19
+ * Model type
19
20
  */
20
21
  modelType: string
21
22
 
22
23
  /**
23
- * 模型特性
24
+ * Model features
24
25
  */
25
26
  features: string[]
26
27
 
27
28
  /**
28
- * 模型属性
29
+ * Model properties
29
30
  */
30
31
  modelProperties: Record<string, any>
31
32
 
32
33
  /**
33
- * 参数规则
34
+ * Parameter rules
34
35
  */
35
36
  parameterRules: Record<string, any>[]
36
37
 
37
38
  /**
38
- * 定价信息
39
+ * Pricing information
39
40
  */
40
41
  pricing: {
41
42
  input: string
@@ -45,7 +46,7 @@ export interface IAiModel extends IBasePerTenantAndOrganizationEntityModel {
45
46
  }
46
47
 
47
48
  /**
48
- * 是否已废弃
49
+ * Deprecated
49
50
  */
50
51
  deprecated: boolean
51
52
  }
@@ -118,6 +119,7 @@ export interface CredentialFormSchema {
118
119
  options?: {
119
120
  label: I18nObject
120
121
  value: number | string | boolean
122
+ show_on?: FormShowOnObject[]
121
123
  }[]
122
124
  placeholder: I18nObject;
123
125
 
@@ -140,7 +142,9 @@ export enum ModelFeature {
140
142
  MULTI_TOOL_CALL = "multi-tool-call",
141
143
  AGENT_THOUGHT = "agent-thought",
142
144
  VISION = "vision",
143
- STREAM_TOOL_CALL = "stream-tool-call"
145
+ STREAM_TOOL_CALL = "stream-tool-call",
146
+ VIDEO = "video",
147
+ STRUCTURED_OUTPUT = "structured-output"
144
148
  }
145
149
 
146
150
  export enum ModelPropertyKey {
package/src/ai/index.ts CHANGED
@@ -23,6 +23,7 @@ export * from './xpert-agent.model'
23
23
  export * from './xpert-tool.model'
24
24
  export * from './xpert-toolset.model'
25
25
  export * from './xpert-workspace.model'
26
+ export * from './xpert-table.model'
26
27
  export * from './xpert.model'
27
28
  export * from './xpert.utils'
28
29
  export * from './types'
@@ -34,6 +34,9 @@ export interface IDocChunkMetadata {
34
34
  score?: number
35
35
  relevanceScore?: number
36
36
 
37
+ // tokens
38
+ tokens?: number
39
+
37
40
  [key: string]: any
38
41
  }
39
42
 
@@ -3,11 +3,12 @@ import { IIntegration } from '../integration.model'
3
3
  import { IStorageFile } from '../storage-file.model'
4
4
  import { IKnowledgeDocumentPage } from './knowledge-doc-page.model'
5
5
  import { IKnowledgebaseTask } from './knowledgebase-task.model'
6
- import { IKnowledgebase } from './knowledgebase.model'
6
+ import { IKnowledgebase, KBMetadataFieldDef } from './knowledgebase.model'
7
7
  import { TRagWebOptions } from './rag-web'
8
8
  import { IKnowledgeDocumentChunk } from './knowledge-doc-chunk.model'
9
9
  import { DocumentSourceProviderCategoryEnum } from './knowledge-pipeline'
10
10
  import { TCopilotModel } from './copilot-model.model'
11
+ import { I18nObject } from '../types'
11
12
 
12
13
 
13
14
  export type DocumentParserConfig = {
@@ -193,7 +194,7 @@ export type TKnowledgeDocument = {
193
194
  /**
194
195
  * Document, include file, web pages, folder, virtual, etc.
195
196
  */
196
- export interface IKnowledgeDocument<T = Metadata> extends TKnowledgeDocument, IBasePerTenantAndOrganizationEntityModel {
197
+ export interface IKnowledgeDocument<T extends KnowledgeDocumentMetadata = KnowledgeDocumentMetadata> extends TKnowledgeDocument, IBasePerTenantAndOrganizationEntityModel {
197
198
  parent?: IKnowledgeDocument | null
198
199
  children?: IKnowledgeDocument[]
199
200
  knowledgebase?: IKnowledgebase
@@ -203,16 +204,34 @@ export interface IKnowledgeDocument<T = Metadata> extends TKnowledgeDocument, IB
203
204
  metadata?: T
204
205
  }
205
206
 
206
- // export interface IDocumentChunk<Metadata = DocumentMetadata> {
207
- // id: string
208
- // pageContent: string
209
- // metadata: Metadata & {
210
- // knowledgeId?: string
211
- // }
212
- // collection_id: string
213
- // }
207
+ /**
208
+ * System built-in standard document Metadata structure
209
+ */
210
+ export interface StandardDocumentMetadata {
211
+ // ---- Document Info ----
212
+ originalFileName?: string; // Original file name, e.g. "Complex_SQL_QA.markdown"
213
+ originalFileSize?: string | null; // Original file size (if missing, display as "-")
214
+ uploadTime?: string; // Upload time in ISO format
215
+ lastUpdatedTime?: string; // Last updated time
216
+ source?: string; // Source, e.g. "Local File" / "Web Import" / "API"
217
+
218
+ // ---- Technical Parameters ----
219
+ segmentRule?: string; // Segmentation rule, e.g. "General"
220
+ segmentLength?: number; // Maximum segment length (token or char)
221
+ averageSegmentLength?: string; // Average segment length
222
+ segmentCount?: number; // Number of segments
223
+ recallRate?: string; // Recall count statistics, e.g. "0.00% (0/11)"
224
+ embedTime?: string; // Embedding time, e.g. "1.99 sec"
225
+ embedCost?: string | null; // Embedding cost (if none, display as "-")
226
+ tokens?: number; // Number of tokens in the document
227
+ }
228
+
229
+ export interface KnowledgeDocumentMetadata extends StandardDocumentMetadata {
230
+ [key: string]: any
231
+ }
232
+
214
233
 
215
- export type Metadata = any
234
+ // export type Metadata = any
216
235
 
217
236
  export interface IKnowledgeDocumentCreateInput
218
237
  extends IKnowledgeDocument, IBasePerTenantAndOrganizationEntityModel {}
@@ -249,4 +268,97 @@ export function classificateDocumentCategory(entity: Partial<IKnowledgeDocument>
249
268
  isVideoType(entity.type) ? KBDocumentCategoryEnum.Video :
250
269
  isAudioType(entity.type) ? KBDocumentCategoryEnum.Audio :
251
270
  KBDocumentCategoryEnum.Text
252
- }
271
+ }
272
+
273
+ /**
274
+ * System standard Metadata field definition constants
275
+ * It can be used for rendering, validation, sorting, displaying descriptions, etc.
276
+ */
277
+ export const STANDARD_METADATA_FIELDS: { group: I18nObject; fields: KBMetadataFieldDef[] }[] = [
278
+ // Document Info
279
+ {
280
+ group: {
281
+ en_US: 'Document Info',
282
+ zh_Hans: '文档信息'
283
+ },
284
+ fields: [
285
+ {
286
+ key: 'title',
287
+ label: { en_US: 'Original File Name', zh_Hans: '原始文件名称' },
288
+ type: 'string'
289
+ },
290
+ // {
291
+ // key: 'originalFileSize',
292
+ // label: { en_US: 'Original File Size', zh_Hans: '原始文件大小' },
293
+ // type: 'string'
294
+ // },
295
+ // {
296
+ // key: 'uploadTime',
297
+ // label: { en_US: 'Upload Time', zh_Hans: '上传日期' },
298
+ // type: 'datetime'
299
+ // },
300
+ // {
301
+ // key: 'lastUpdatedTime',
302
+ // label: { en_US: 'Last Updated Time', zh_Hans: '最后更新时间' },
303
+ // type: 'datetime'
304
+ // },
305
+ // {
306
+ // key: 'source',
307
+ // label: { en_US: 'Source', zh_Hans: '来源' },
308
+ // type: 'string'
309
+ // }
310
+ ]
311
+ },
312
+ // Technical Parameters
313
+ {
314
+ group: {
315
+ en_US: 'Technical Parameters',
316
+ zh_Hans: '技术参数'
317
+ },
318
+ fields: [
319
+ {
320
+ key: 'tokens',
321
+ label: { en_US: 'Tokens', zh_Hans: '词元' },
322
+ type: 'number'
323
+ },
324
+ // {
325
+ // key: 'segmentRule',
326
+ // label: { en_US: 'Segmentation Rule', zh_Hans: '分段规则' },
327
+ // type: 'string'
328
+ // },
329
+ // {
330
+ // key: 'segmentLength',
331
+ // label: { en_US: 'Segment Length', zh_Hans: '段落长度' },
332
+ // type: 'number'
333
+ // },
334
+ // {
335
+ // key: 'averageSegmentLength',
336
+ // label: { en_US: 'Average Segment Length', zh_Hans: '平均段落长度' },
337
+ // type: 'string'
338
+ // },
339
+ // {
340
+ // key: 'segmentCount',
341
+ // label: { en_US: 'Segment Count', zh_Hans: '段落数量' },
342
+ // type: 'number'
343
+ // },
344
+ // {
345
+ // key: 'recallRate',
346
+ // label: { en_US: 'Recall Count', zh_Hans: '召回次数' },
347
+ // type: 'string'
348
+ // },
349
+ // {
350
+ // key: 'embedTime',
351
+ // label: { en_US: 'Embedding Time', zh_Hans: '嵌入时间' },
352
+ // type: 'string'
353
+ // },
354
+ // {
355
+ // key: 'embedCost',
356
+ // label: { en_US: 'Embedding Cost', zh_Hans: '嵌入花费' },
357
+ // type: 'string'
358
+ // }
359
+ ]
360
+ }
361
+ ] as const;
362
+
363
+
364
+ export type StandardMetadataFieldKey = typeof STANDARD_METADATA_FIELDS[number]['fields'][number]['key'];
@@ -1,5 +1,5 @@
1
1
  import { ICopilotModel } from './copilot-model.model'
2
- import { TAvatar } from '../types'
2
+ import { I18nObject, TAvatar } from '../types'
3
3
  import { IBasePerWorkspaceEntityModel } from './xpert-workspace.model'
4
4
  import { IKnowledgeDocument } from './knowledge-doc.model'
5
5
  import { IXpert } from './xpert.model'
@@ -107,6 +107,11 @@ export type TKnowledgebase = {
107
107
  recall?: TKBRecallParams
108
108
 
109
109
  status?: string
110
+
111
+ /**
112
+ * Metadata custom field definition array
113
+ */
114
+ metadataSchema?: KBMetadataFieldDef[]
110
115
 
111
116
  /**
112
117
  * API service enabled
@@ -172,6 +177,16 @@ export type DocumentMetadata = IDocChunkMetadata & {
172
177
  relevanceScore?: number
173
178
  } & Record<string, any>;
174
179
 
180
+ export type MetadataFieldType =
181
+ | 'string' | 'number' | 'boolean' | 'enum' | 'datetime' | 'string[]' | 'number[]' | 'object';
182
+
183
+ export type KBMetadataFieldDef = {
184
+ key: string; // Unique key, e.g. "department"
185
+ label?: I18nObject; // Display label
186
+ type: MetadataFieldType;
187
+ enumValues?: string[];
188
+ description?: string;
189
+ }
175
190
 
176
191
  /**
177
192
  * Channel name for knowledgebase pipeline
@@ -166,7 +166,13 @@ export type TXpertAgentOptions = {
166
166
  */
167
167
  vision?: {
168
168
  enabled?: boolean
169
+ /**
170
+ * Variable name that store the list of files to be understood
171
+ */
169
172
  variable?: string
173
+ /**
174
+ * Image resolution for vision tasks
175
+ */
170
176
  resolution?: 'high' | 'low'
171
177
  }
172
178
  }
@@ -0,0 +1,100 @@
1
+ import { letterStartSUID } from '../types'
2
+ import { IWorkflowNode, WorkflowNodeTypeEnum } from './xpert-workflow.model'
3
+ import { IBasePerWorkspaceEntityModel } from './xpert-workspace.model'
4
+
5
+ /**
6
+ * 表状态:符合我们前面讨论的多状态流程
7
+ */
8
+ export enum XpertTableStatus {
9
+ DRAFT = 'draft',
10
+ READY = 'ready',
11
+ PENDING_ACTIVATION = 'pendingActivation',
12
+ ACTIVE = 'active',
13
+ NEEDS_MIGRATION = 'needsMigration',
14
+ DEPRECATED = 'deprecated',
15
+ ERROR = 'error'
16
+ }
17
+
18
+ /**
19
+ * Custom Table for Xpert
20
+ */
21
+ export interface IXpertTable extends IBasePerWorkspaceEntityModel, TXpertTable {}
22
+
23
+ export type TXpertTable = {
24
+ name: string // 逻辑表名(用户侧看到的名称,如 "customer_orders")
25
+ description?: string
26
+ database?: string
27
+ schema?: string
28
+ columns?: TXpertTableColumn[]
29
+ status: XpertTableStatus
30
+ version?: number
31
+ activatedAt?: Date
32
+ message?: string
33
+ }
34
+
35
+ export type TXpertTableColumn = {
36
+ name: string
37
+ type: 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'json'
38
+ label?: string
39
+ required?: boolean
40
+ }
41
+
42
+
43
+ // ===============================
44
+ // 📦 Database Operation Nodes
45
+ // ===============================
46
+
47
+ export interface IWorkflowNodeDBOperation extends IWorkflowNode {
48
+ tableId: string
49
+ }
50
+
51
+ export interface IWFNDBInsert extends IWorkflowNodeDBOperation {
52
+ type: WorkflowNodeTypeEnum.DB_INSERT,
53
+ columns?: Record<string, {
54
+ type: 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'json';
55
+ value?: any
56
+ valueSelector?: string
57
+ }>
58
+ }
59
+
60
+ export function genXpertDBInsertKey() {
61
+ return letterStartSUID('DBInsert_')
62
+ }
63
+
64
+ export interface IWFNDBUpdate extends IWorkflowNodeDBOperation {
65
+ type: WorkflowNodeTypeEnum.DB_UPDATE
66
+ columns?: Record<string, {
67
+ type: 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'json';
68
+ value?: any
69
+ valueSelector?: string
70
+ }>
71
+ }
72
+
73
+ export function genXpertDBUpdateKey() {
74
+ return letterStartSUID('DBUpdate_')
75
+ }
76
+
77
+ export interface IWFNDBDelete extends IWorkflowNodeDBOperation {
78
+ type: WorkflowNodeTypeEnum.DB_DELETE,
79
+ }
80
+
81
+ export function genXpertDBDeleteKey() {
82
+ return letterStartSUID('DBDelete_')
83
+ }
84
+
85
+ export interface IWFNDBQuery extends IWorkflowNodeDBOperation {
86
+ type: WorkflowNodeTypeEnum.DB_QUERY,
87
+ }
88
+
89
+ export function genXpertDBQueryKey() {
90
+ return letterStartSUID('DBQuery_')
91
+ }
92
+
93
+ export interface IWFNDBSql extends IWorkflowNodeDBOperation {
94
+ type: WorkflowNodeTypeEnum.DB_SQL
95
+ sqlTemplate?: string
96
+ }
97
+
98
+ export function genXpertDBSqlKey() {
99
+ return letterStartSUID('DBSql_')
100
+ }
@@ -56,6 +56,11 @@ export type TMCPServer = {
56
56
  url?: string,
57
57
  headers?: Record<string, string>
58
58
  useNodeEventSource?: boolean
59
+ /**
60
+ * Default timeout in milliseconds for tool execution. Must be greater than 0.
61
+ * If not specified, tools will use their own configured timeout values.
62
+ */
63
+ defaultToolTimeout?: number
59
64
 
60
65
  files?: {name: string; content: string}[]
61
66
 
@@ -1,3 +1,4 @@
1
+ import type { JSONSchema4 } from "json-schema";
1
2
  import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model'
2
3
  import { I18nObject } from '../types'
3
4
  import { AiProviderRole } from './copilot.model'
@@ -111,8 +112,12 @@ export interface ApiToolBundle {
111
112
  summary?: string;
112
113
  // operation_id
113
114
  operation_id?: string;
114
- // parameters
115
+ /**
116
+ * parameters
117
+ * @deprecated use schema
118
+ */
115
119
  parameters?: TToolParameter[];
120
+ schema?: JSONSchema4
116
121
  // author
117
122
  author: string;
118
123
  // icon
@@ -2,7 +2,7 @@ import { I18nObject, IconDefinition, letterStartSUID } from "../types"
2
2
  import { ICopilotModel } from "./copilot-model.model"
3
3
  import { TKBRecallParams } from "./knowledgebase.model"
4
4
  import { ApiAuthType, TErrorHandling, TXpertRefParameter } from "./types"
5
- import { TStateVariable, TXpertParameter } from "./xpert.model"
5
+ import { TKBRetrievalSettings, TStateVariable, TXpertParameter } from "./xpert.model"
6
6
 
7
7
  export type TWorkflowNodeMeta = {
8
8
  name: string
@@ -28,15 +28,9 @@ export enum WorkflowNodeTypeEnum {
28
28
  IF_ELSE = 'if-else',
29
29
  LIST_OPERATOR = 'list-operator',
30
30
  VARIABLE_AGGREGATOR = 'variable-aggregator',
31
- // SPLITTER = 'splitter',
32
31
  ITERATING = 'iterating',
33
- ANSWER = 'answer',
34
- CODE = 'code',
35
32
  HTTP = 'http',
36
- KNOWLEDGE = 'knowledge',
37
33
  SUBFLOW = 'subflow',
38
- TEMPLATE = 'template',
39
- CLASSIFIER = 'classifier',
40
34
  TOOL = 'tool',
41
35
  AGENT_TOOL = 'agent-tool',
42
36
  NOTE = 'note',
@@ -51,6 +45,47 @@ export enum WorkflowNodeTypeEnum {
51
45
  CHUNKER = 'chunker',
52
46
  UNDERSTANDING = 'understanding',
53
47
  KNOWLEDGE_BASE = 'knowledgebase',
48
+
49
+ // ===============================
50
+ // 📦 Transform Nodes
51
+ // ===============================
52
+ CLASSIFIER = 'classifier',
53
+ KNOWLEDGE = 'knowledge',
54
+ CODE = 'code',
55
+ TEMPLATE = 'template',
56
+ ANSWER = 'answer',
57
+ JSON_STRINGIFY = 'json-stringify',
58
+ JSON_PARSE = 'json-parse',
59
+
60
+ // ===============================
61
+ // 📦 Database Operation Nodes
62
+ // ===============================
63
+
64
+ /**
65
+ * Custom SQL
66
+ */
67
+ DB_SQL = 'db-sql',
68
+
69
+ /**
70
+ * Insert data (INSERT)
71
+ */
72
+ DB_INSERT = 'db-insert',
73
+
74
+ /**
75
+ * Update data (UPDATE)
76
+ */
77
+ DB_UPDATE = 'db-update',
78
+
79
+ /**
80
+ * Delete data (DELETE)
81
+ */
82
+ DB_DELETE = 'db-delete',
83
+
84
+ /**
85
+ * Query data (SELECT)
86
+ */
87
+ DB_QUERY = 'db-query',
88
+
54
89
  }
55
90
 
56
91
  export interface IWorkflowNode {
@@ -312,6 +347,7 @@ export interface IWFNKnowledgeRetrieval extends IWorkflowNode {
312
347
  queryVariable: string
313
348
  knowledgebases: string[]
314
349
  recall?: TKBRecallParams
350
+ retrieval?: TKBRetrievalSettings
315
351
  }
316
352
 
317
353
  export interface IWFNSubflow extends IWorkflowNode {
@@ -416,6 +452,16 @@ export interface IWFNTask extends IWorkflowNode {
416
452
  descriptionSuffix?: string
417
453
  }
418
454
 
455
+ export interface IWFNJSONStringify extends IWorkflowNode {
456
+ type: WorkflowNodeTypeEnum.JSON_STRINGIFY
457
+ inputVariable: string
458
+ }
459
+
460
+ export interface IWFNJSONParse extends IWorkflowNode {
461
+ type: WorkflowNodeTypeEnum.JSON_PARSE
462
+ inputVariable: string
463
+ }
464
+
419
465
  export function genXpertTriggerKey() {
420
466
  return letterStartSUID('Trigger_')
421
467
  }
@@ -428,6 +474,13 @@ export function genVariableAggregatorKey() {
428
474
  return letterStartSUID('VariableAggregator_')
429
475
  }
430
476
 
477
+ export function genJSONStringifyKey() {
478
+ return letterStartSUID('JSONStringify_')
479
+ }
480
+ export function genJSONParseKey() {
481
+ return letterStartSUID('JSONParse_')
482
+ }
483
+
431
484
  export function isAgentKey(key: string) {
432
485
  return key?.toLowerCase().startsWith('agent_')
433
486
  }
@@ -11,10 +11,10 @@ import { IXpertToolset } from './xpert-toolset.model'
11
11
  import { IBasePerWorkspaceEntityModel } from './xpert-workspace.model'
12
12
  import { IIntegration } from '../integration.model'
13
13
  import { TChatFrom, TSensitiveOperation } from './chat.model'
14
- import { IWorkflowNode, TVariableAssigner, VariableOperationEnum } from './xpert-workflow.model'
14
+ import { IWorkflowNode, TVariableAssigner, TWFCase, VariableOperationEnum } from './xpert-workflow.model'
15
15
  import { IEnvironment } from './environment.model'
16
16
  import { IStorageFile } from '../storage-file.model'
17
- import { STATE_VARIABLE_HUMAN, TInterruptCommand } from '../agent'
17
+ import { STATE_VARIABLE_HUMAN, TInterruptCommand } from '../agent/graph'
18
18
 
19
19
  export type ToolCall = LToolCall
20
20
 
@@ -289,10 +289,15 @@ export type TXpertAgentConfig = {
289
289
  mute?: string[][]
290
290
 
291
291
  /**
292
- * Recall params
292
+ * Recall knowledge params
293
293
  */
294
294
  recalls?: Record<string, TKBRecallParams>
295
295
 
296
+ /**
297
+ * Retrieval params for every knowledgebase
298
+ */
299
+ retrievals?: Record<string, TKBRetrievalSettings>
300
+
296
301
  /**
297
302
  * Summarize the title of the conversation
298
303
  */
@@ -390,7 +395,9 @@ export enum XpertParameterTypeEnum {
390
395
  NUMBER = 'number',
391
396
  OBJECT = 'object',
392
397
  SELECT = 'select',
398
+ FILE = 'file',
393
399
  ARRAY_STRING = 'array[string]',
400
+ ARRAY_NUMBER = 'array[number]',
394
401
  ARRAY = 'array[object]',
395
402
  ARRAY_FILE = 'array[file]',
396
403
  ARRAY_DOCUMENT = 'array[document]',
@@ -611,3 +618,20 @@ export type TChatOptions = {
611
618
  */
612
619
  tools?: (StructuredToolInterface | RunnableToolLike)[]
613
620
  }
621
+
622
+ /**
623
+ * Knowledgebase retrieval settings
624
+ */
625
+ export type TKBRetrievalSettings = {
626
+ metadata: {
627
+ filtering_mode: "disabled" | "automatic" | "manual"
628
+ /**
629
+ * Conditions (filter) when mode is manual
630
+ */
631
+ filtering_conditions: TWFCase
632
+ /**
633
+ * Parameter fields (tool call) when mode is automatic
634
+ */
635
+ fields: Record<string, object>
636
+ }
637
+ }
@@ -58,7 +58,7 @@ export interface IColumnDef {
58
58
  /**
59
59
  * Types in javascript
60
60
  */
61
- type: 'number' | 'string' | 'boolean'
61
+ type: 'number' | 'string' | 'boolean' | 'object' | 'timestamp'
62
62
  /**
63
63
  * Original data type in database
64
64
  */
@@ -4,6 +4,7 @@ export type TGatewayQueryEvent = {
4
4
  id: string
5
5
  organizationId: string
6
6
  dataSourceId: string
7
+ tenantId?: string
7
8
  modelId?: string
8
9
  isDraft: boolean
9
10
  body: {
@@ -58,6 +58,27 @@ export type TIndicator = {
58
58
  businessAreaId?: string
59
59
  }
60
60
 
61
+ /**
62
+ * Fields included in the draft of Indicator, please keep it in sync with TIndicator type
63
+ */
64
+ export const IndicatorDraftFields: Array<keyof IIndicator> = [
65
+ "code",
66
+ "name",
67
+ "type",
68
+ "visible",
69
+ "isApplication",
70
+ "modelId",
71
+ "entity",
72
+ "unit",
73
+ "principal",
74
+ "authentication",
75
+ "certificationId",
76
+ "validity",
77
+ "business",
78
+ "options",
79
+ "businessAreaId"
80
+ ]
81
+
61
82
  export type TIndicatorDraft = TIndicator & {
62
83
  checklist?: ChecklistItem[]
63
84
  version?: number
@@ -66,12 +87,6 @@ export type TIndicatorDraft = TIndicator & {
66
87
 
67
88
  export interface IIndicator extends IBasePerProjectEntityModel, TIndicator {
68
89
  draft?: TIndicatorDraft
69
- /**
70
- * Is active: Activate / Deactivate
71
- *
72
- * @deprecated use status instead
73
- */
74
- isActive?: boolean
75
90
 
76
91
  /**
77
92
  * Visibilty in public or secret or private
@@ -87,6 +102,7 @@ export interface IIndicator extends IBasePerProjectEntityModel, TIndicator {
87
102
  status?: IndicatorStatusEnum
88
103
  embeddingStatus?: EmbeddingStatusEnum
89
104
  error?: string
105
+ publishedAt?: Date
90
106
 
91
107
  businessArea?: IBusinessArea
92
108
 
@@ -27,6 +27,7 @@ export type SemanticModelEntityJob = {
27
27
  error?: string
28
28
  createdAt?: Date
29
29
  endAt?: Date
30
+ tokens?: number
30
31
  }
31
32
 
32
33
  export interface ISemanticModelEntity extends IBasePerTenantAndOrganizationEntityModel {
@@ -36,6 +36,10 @@ export interface ISemanticModelMember extends IBasePerTenantAndOrganizationEntit
36
36
 
37
37
  parentUniqueName: string
38
38
 
39
+ metadata?: {
40
+ tokens: number
41
+ }
42
+
39
43
  // Has Vector
40
44
  vector?: boolean
41
45
  }
@@ -194,6 +194,16 @@ export enum SemanticModelStatusEnum {
194
194
  Archived = 'archived'
195
195
  }
196
196
 
197
+ export interface ISemanticModelCache extends IBasePerTenantAndOrganizationEntityModel {
198
+ key: string
199
+ language?: string
200
+ modelId?: string
201
+ model?: ISemanticModel
202
+ query?: string
203
+ data?: string
204
+ }
205
+
206
+
197
207
  /**
198
208
  * @deprecated Equivalent to `VirtualCube` in the ocap framework
199
209
  */
package/src/plugin.ts CHANGED
@@ -6,7 +6,7 @@ export interface PluginMeta {
6
6
  name: PluginName
7
7
  version: string
8
8
  icon?: IconDefinition
9
- category: 'set' | 'doc-source' | 'agent' | 'tools' | 'model' | 'vlm' | 'vector-store' | 'integration'
9
+ category: 'set' | 'doc-source' | 'agent' | 'tools' | 'model' | 'vlm' | 'vector-store' | 'integration' | 'datasource' | 'database'
10
10
  displayName: string
11
11
  description: string
12
12
  keywords?: string[]