@metad/contracts 3.6.0 → 3.6.2

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/index.esm.js CHANGED
@@ -1742,6 +1742,8 @@ var ModelFeature;
1742
1742
  ModelFeature["AGENT_THOUGHT"] = "agent-thought";
1743
1743
  ModelFeature["VISION"] = "vision";
1744
1744
  ModelFeature["STREAM_TOOL_CALL"] = "stream-tool-call";
1745
+ ModelFeature["VIDEO"] = "video";
1746
+ ModelFeature["STRUCTURED_OUTPUT"] = "structured-output";
1745
1747
  })(ModelFeature || (ModelFeature = {}));
1746
1748
  var ModelPropertyKey;
1747
1749
  (function(ModelPropertyKey) {
@@ -2046,6 +2048,9 @@ var WorkflowComparisonOperator;
2046
2048
  WorkflowComparisonOperator["LIKE"] = "like";
2047
2049
  WorkflowComparisonOperator["NOT_LIKE"] = "not-like";
2048
2050
  })(WorkflowComparisonOperator || (WorkflowComparisonOperator = {}));
2051
+ function genXpertTriggerKey() {
2052
+ return letterStartSUID("Trigger_");
2053
+ }
2049
2054
  function genListOperatorKey() {
2050
2055
  return letterStartSUID("ListOperator_");
2051
2056
  }
@@ -2182,7 +2187,7 @@ function _array_like_to_array$4(arr, len) {
2182
2187
  function _array_with_holes$3(arr) {
2183
2188
  if (Array.isArray(arr)) return arr;
2184
2189
  }
2185
- function _define_property$1(obj, key, value) {
2190
+ function _define_property$3(obj, key, value) {
2186
2191
  if (key in obj) {
2187
2192
  Object.defineProperty(obj, key, {
2188
2193
  value: value,
@@ -2222,7 +2227,7 @@ function _iterable_to_array_limit$2(arr, i) {
2222
2227
  function _non_iterable_rest$3() {
2223
2228
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2224
2229
  }
2225
- function _object_spread(target) {
2230
+ function _object_spread$2(target) {
2226
2231
  for(var i = 1; i < arguments.length; i++){
2227
2232
  var source = arguments[i] != null ? arguments[i] : {};
2228
2233
  var ownKeys = Object.keys(source);
@@ -2232,12 +2237,12 @@ function _object_spread(target) {
2232
2237
  }));
2233
2238
  }
2234
2239
  ownKeys.forEach(function(key) {
2235
- _define_property$1(target, key, source[key]);
2240
+ _define_property$3(target, key, source[key]);
2236
2241
  });
2237
2242
  }
2238
2243
  return target;
2239
2244
  }
2240
- function ownKeys(object, enumerableOnly) {
2245
+ function ownKeys$1(object, enumerableOnly) {
2241
2246
  var keys = Object.keys(object);
2242
2247
  if (Object.getOwnPropertySymbols) {
2243
2248
  var symbols = Object.getOwnPropertySymbols(object);
@@ -2245,12 +2250,12 @@ function ownKeys(object, enumerableOnly) {
2245
2250
  }
2246
2251
  return keys;
2247
2252
  }
2248
- function _object_spread_props(target, source) {
2253
+ function _object_spread_props$1(target, source) {
2249
2254
  source = source != null ? source : {};
2250
2255
  if (Object.getOwnPropertyDescriptors) {
2251
2256
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2252
2257
  } else {
2253
- ownKeys(Object(source)).forEach(function(key) {
2258
+ ownKeys$1(Object(source)).forEach(function(key) {
2254
2259
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2255
2260
  });
2256
2261
  }
@@ -2331,7 +2336,7 @@ function configurableStoreNamespace(configurable) {
2331
2336
  var _varName_split = _sliced_to_array$2(varName.split("."), 2), agentChannelName = _varName_split[0], variableName = _varName_split[1];
2332
2337
  if (variableName) {
2333
2338
  var _state_agentChannelName;
2334
- state[agentChannelName] = _object_spread_props(_object_spread({}, (_state_agentChannelName = state[agentChannelName]) !== null && _state_agentChannelName !== void 0 ? _state_agentChannelName : {}), _define_property$1({}, variableName, value));
2339
+ state[agentChannelName] = _object_spread_props$1(_object_spread$2({}, (_state_agentChannelName = state[agentChannelName]) !== null && _state_agentChannelName !== void 0 ? _state_agentChannelName : {}), _define_property$3({}, variableName, value));
2335
2340
  } else {
2336
2341
  state[agentChannelName] = value;
2337
2342
  }
@@ -2458,26 +2463,85 @@ var KnowledgebasePermission;
2458
2463
  */ var KnowledgeTask = "task_id";
2459
2464
  /**
2460
2465
  * Specify the data source to run
2461
- */ var KnowledgeSources = "sources";
2462
- var KnowledgeDocuments = "documents";
2463
- var KnowledgeFolderId = "folder_id";
2466
+ */ var KNOWLEDGE_SOURCES_NAME = "sources";
2467
+ var KNOWLEDGE_DOCUMENTS_NAME = "documents";
2468
+ var KNOWLEDGE_FOLDER_ID_NAME = "folder_id";
2464
2469
  var KNOWLEDGE_STAGE_NAME = "stage";
2465
2470
 
2466
- var KDocumentSourceType;
2467
- (function(KDocumentSourceType) {
2471
+ var DocumentSourceProviderCategoryEnum;
2472
+ (function(DocumentSourceProviderCategoryEnum) {
2468
2473
  /**
2469
- * Local files
2470
- */ KDocumentSourceType["FILE"] = "file";
2474
+ * Local files uploaded directly to the system
2475
+ */ DocumentSourceProviderCategoryEnum["LocalFile"] = "local-file";
2476
+ /**
2477
+ * Remote file systems, e.g. S3, FTP, etc.
2478
+ */ DocumentSourceProviderCategoryEnum["FileSystem"] = "file-system";
2471
2479
  /**
2472
- * Remote files (FTP, SFTP, etc.)
2473
- */ KDocumentSourceType["REMOTE_FILE"] = "remote-file";
2480
+ * Online documents, e.g. public URLs, Google Docs, etc.
2481
+ */ DocumentSourceProviderCategoryEnum["OnlineDocument"] = "online-document";
2474
2482
  /**
2475
- * Web documents
2476
- */ KDocumentSourceType["WEB"] = "web";
2483
+ * Web crawling from public websites
2484
+ */ DocumentSourceProviderCategoryEnum["WebCrawl"] = "web-crawl";
2485
+ /**
2486
+ * Database connections, e.g. MySQL, PostgreSQL, etc.
2487
+ * @deprecated Planning
2488
+ */ DocumentSourceProviderCategoryEnum["Database"] = "database";
2489
+ })(DocumentSourceProviderCategoryEnum || (DocumentSourceProviderCategoryEnum = {}));
2490
+ function genPipelineSourceKey() {
2491
+ return letterStartSUID("Source_");
2492
+ }
2493
+ function genPipelineProcessorKey() {
2494
+ return letterStartSUID("Processor_");
2495
+ }
2496
+ function genPipelineChunkerKey() {
2497
+ return letterStartSUID("Chunker_");
2498
+ }
2499
+ function genPipelineUnderstandingKey() {
2500
+ return letterStartSUID("Understanding_");
2501
+ }
2502
+ function genPipelineKnowledgeBaseKey() {
2503
+ return letterStartSUID("KnowledgeBase_");
2504
+ }
2505
+
2506
+ function _define_property$2(obj, key, value) {
2507
+ if (key in obj) {
2508
+ Object.defineProperty(obj, key, {
2509
+ value: value,
2510
+ enumerable: true,
2511
+ configurable: true,
2512
+ writable: true
2513
+ });
2514
+ } else {
2515
+ obj[key] = value;
2516
+ }
2517
+ return obj;
2518
+ }
2519
+ function _object_spread$1(target) {
2520
+ for(var i = 1; i < arguments.length; i++){
2521
+ var source = arguments[i] != null ? arguments[i] : {};
2522
+ var ownKeys = Object.keys(source);
2523
+ if (typeof Object.getOwnPropertySymbols === "function") {
2524
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2525
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2526
+ }));
2527
+ }
2528
+ ownKeys.forEach(function(key) {
2529
+ _define_property$2(target, key, source[key]);
2530
+ });
2531
+ }
2532
+ return target;
2533
+ }
2534
+ var DocumentTypeEnum;
2535
+ (function(DocumentTypeEnum) {
2477
2536
  /**
2478
2537
  * Folder, parent of other documents
2479
- */ KDocumentSourceType["FOLDER"] = "folder";
2480
- })(KDocumentSourceType || (KDocumentSourceType = {}));
2538
+ */ DocumentTypeEnum["FOLDER"] = "folder";
2539
+ /**
2540
+ * Local files
2541
+ * @deprecated use DocumentSourceProviderCategoryEnum local file type instead
2542
+ */ DocumentTypeEnum["FILE"] = "file";
2543
+ })(DocumentTypeEnum || (DocumentTypeEnum = {}));
2544
+ var KDocumentSourceType = _object_spread$1({}, DocumentSourceProviderCategoryEnum, DocumentTypeEnum);
2481
2545
  var KBDocumentCategoryEnum;
2482
2546
  (function(KBDocumentCategoryEnum) {
2483
2547
  KBDocumentCategoryEnum["Text"] = "text";
@@ -2492,6 +2556,10 @@ var KBDocumentStatusEnum;
2492
2556
  KBDocumentStatusEnum["WAITING"] = "waiting";
2493
2557
  KBDocumentStatusEnum["VALIDATE"] = "validate";
2494
2558
  KBDocumentStatusEnum["RUNNING"] = "running";
2559
+ KBDocumentStatusEnum["TRANSFORMED"] = "transformed";
2560
+ KBDocumentStatusEnum["SPLITTED"] = "splitted";
2561
+ KBDocumentStatusEnum["UNDERSTOOD"] = "understood";
2562
+ KBDocumentStatusEnum["EMBEDDING"] = "embedding";
2495
2563
  KBDocumentStatusEnum["CANCEL"] = "cancel";
2496
2564
  KBDocumentStatusEnum["FINISH"] = "finish";
2497
2565
  KBDocumentStatusEnum["ERROR"] = "error";
@@ -2501,9 +2569,46 @@ function isDocumentSheet(type) {
2501
2569
  "csv",
2502
2570
  "xls",
2503
2571
  "xlsx",
2504
- "ods"
2572
+ "ods",
2573
+ "vnd.openxmlformats-officedocument.spreadsheetml.sheet"
2574
+ ].includes(type);
2575
+ }
2576
+ function isImageType(type) {
2577
+ return [
2578
+ "jpg",
2579
+ "jpeg",
2580
+ "png",
2581
+ "gif",
2582
+ "bmp",
2583
+ "tiff",
2584
+ "svg",
2585
+ "webp"
2586
+ ].includes(type);
2587
+ }
2588
+ function isVideoType(type) {
2589
+ return [
2590
+ "mp4",
2591
+ "avi",
2592
+ "mov",
2593
+ "wmv",
2594
+ "flv",
2595
+ "mkv",
2596
+ "webm"
2597
+ ].includes(type);
2598
+ }
2599
+ function isAudioType(type) {
2600
+ return [
2601
+ "mp3",
2602
+ "wav",
2603
+ "aac",
2604
+ "flac",
2605
+ "ogg",
2606
+ "m4a"
2505
2607
  ].includes(type);
2506
2608
  }
2609
+ function classificateDocumentCategory(entity) {
2610
+ return isDocumentSheet(entity.type) ? "sheet" : isImageType(entity.type) ? "image" : isVideoType(entity.type) ? "video" : isAudioType(entity.type) ? "audio" : "text";
2611
+ }
2507
2612
 
2508
2613
  var AIPermissionsEnum;
2509
2614
  (function(AIPermissionsEnum) {
@@ -3038,39 +3143,177 @@ var MCPServerType;
3038
3143
  MCPServerType["CODE"] = "code";
3039
3144
  })(MCPServerType || (MCPServerType = {}));
3040
3145
 
3041
- var DocumentSourceProviderCategoryEnum;
3042
- (function(DocumentSourceProviderCategoryEnum) {
3043
- /**
3044
- * Local files uploaded directly to the system
3045
- */ DocumentSourceProviderCategoryEnum["LocalFile"] = "local-file";
3046
- /**
3047
- * Remote file systems, e.g. S3, FTP, etc.
3048
- */ DocumentSourceProviderCategoryEnum["FileSystem"] = "file-system";
3049
- /**
3050
- * Online documents, e.g. public URLs, Google Docs, etc.
3051
- */ DocumentSourceProviderCategoryEnum["OnlineDocument"] = "online-document";
3052
- /**
3053
- * Web crawling from public websites
3054
- */ DocumentSourceProviderCategoryEnum["WebCrawl"] = "web-crawl";
3055
- /**
3056
- * Database connections, e.g. MySQL, PostgreSQL, etc.
3057
- * @deprecated Planning
3058
- */ DocumentSourceProviderCategoryEnum["Database"] = "database";
3059
- })(DocumentSourceProviderCategoryEnum || (DocumentSourceProviderCategoryEnum = {}));
3060
- function genPipelineSourceKey() {
3061
- return letterStartSUID("Source_");
3146
+ function _define_property$1(obj, key, value) {
3147
+ if (key in obj) {
3148
+ Object.defineProperty(obj, key, {
3149
+ value: value,
3150
+ enumerable: true,
3151
+ configurable: true,
3152
+ writable: true
3153
+ });
3154
+ } else {
3155
+ obj[key] = value;
3156
+ }
3157
+ return obj;
3062
3158
  }
3063
- function genPipelineProcessorKey() {
3064
- return letterStartSUID("Processor_");
3159
+ function _object_spread(target) {
3160
+ for(var i = 1; i < arguments.length; i++){
3161
+ var source = arguments[i] != null ? arguments[i] : {};
3162
+ var ownKeys = Object.keys(source);
3163
+ if (typeof Object.getOwnPropertySymbols === "function") {
3164
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
3165
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
3166
+ }));
3167
+ }
3168
+ ownKeys.forEach(function(key) {
3169
+ _define_property$1(target, key, source[key]);
3170
+ });
3171
+ }
3172
+ return target;
3065
3173
  }
3066
- function genPipelineChunkerKey() {
3067
- return letterStartSUID("Chunker_");
3174
+ function ownKeys(object, enumerableOnly) {
3175
+ var keys = Object.keys(object);
3176
+ if (Object.getOwnPropertySymbols) {
3177
+ var symbols = Object.getOwnPropertySymbols(object);
3178
+ keys.push.apply(keys, symbols);
3179
+ }
3180
+ return keys;
3068
3181
  }
3069
- function genPipelineUnderstandingKey() {
3070
- return letterStartSUID("Understanding_");
3182
+ function _object_spread_props(target, source) {
3183
+ source = source != null ? source : {};
3184
+ if (Object.getOwnPropertyDescriptors) {
3185
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3186
+ } else {
3187
+ ownKeys(Object(source)).forEach(function(key) {
3188
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3189
+ });
3190
+ }
3191
+ return target;
3071
3192
  }
3072
- function genPipelineKnowledgeBaseKey() {
3073
- return letterStartSUID("KnowledgeBase_");
3193
+ /**
3194
+ * Build a hierarchical tree structure from a flat list of DocumentInterface objects,
3195
+ * and
3196
+ *
3197
+ * @template Metadata - Type of metadata, defaults to IDocChunkMetadata
3198
+ * @param documents - A flat array of DocumentInterface objects
3199
+ * @returns the hierarchical tree (root-level DocumentInterface[])
3200
+ */ function buildChunkTree(documents) {
3201
+ if (!documents || documents.length === 0) return [];
3202
+ // Step 1. Build a lookup map for quick access by chunkId
3203
+ var map = new Map();
3204
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
3205
+ try {
3206
+ for(var _iterator = documents[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
3207
+ var doc = _step.value;
3208
+ var _doc_metadata;
3209
+ if ((_doc_metadata = doc.metadata) === null || _doc_metadata === void 0 ? void 0 : _doc_metadata.chunkId) {
3210
+ map.set(doc.metadata.chunkId, _object_spread_props(_object_spread({}, doc), {
3211
+ metadata: _object_spread_props(_object_spread({}, doc.metadata), {
3212
+ children: []
3213
+ })
3214
+ }));
3215
+ }
3216
+ }
3217
+ } catch (err) {
3218
+ _didIteratorError = true;
3219
+ _iteratorError = err;
3220
+ } finally{
3221
+ try {
3222
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
3223
+ _iterator.return();
3224
+ }
3225
+ } finally{
3226
+ if (_didIteratorError) {
3227
+ throw _iteratorError;
3228
+ }
3229
+ }
3230
+ }
3231
+ // Step 2. Organize nodes into tree
3232
+ var roots = [];
3233
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
3234
+ try {
3235
+ for(var _iterator1 = map.values()[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
3236
+ var doc1 = _step1.value;
3237
+ var parentId = doc1.metadata.parentId;
3238
+ if (parentId && map.has(parentId)) {
3239
+ var parent = map.get(parentId);
3240
+ parent.metadata.children = parent.metadata.children || [];
3241
+ parent.metadata.children.push(doc1);
3242
+ } else {
3243
+ roots.push(doc1);
3244
+ }
3245
+ }
3246
+ } catch (err) {
3247
+ _didIteratorError1 = true;
3248
+ _iteratorError1 = err;
3249
+ } finally{
3250
+ try {
3251
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
3252
+ _iterator1.return();
3253
+ }
3254
+ } finally{
3255
+ if (_didIteratorError1) {
3256
+ throw _iteratorError1;
3257
+ }
3258
+ }
3259
+ }
3260
+ return roots;
3261
+ }
3262
+ /**
3263
+ * Find all leaf nodes (nodes without children).
3264
+ *
3265
+ * @param roots
3266
+ * @returns
3267
+ */ function collectTreeLeaves(roots) {
3268
+ var leaves = [];
3269
+ var collectLeaves = function(node) {
3270
+ var children = node.metadata.children;
3271
+ if (!children || children.length === 0) {
3272
+ leaves.push(node);
3273
+ } else {
3274
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
3275
+ try {
3276
+ for(var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
3277
+ var child = _step.value;
3278
+ collectLeaves(child);
3279
+ }
3280
+ } catch (err) {
3281
+ _didIteratorError = true;
3282
+ _iteratorError = err;
3283
+ } finally{
3284
+ try {
3285
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
3286
+ _iterator.return();
3287
+ }
3288
+ } finally{
3289
+ if (_didIteratorError) {
3290
+ throw _iteratorError;
3291
+ }
3292
+ }
3293
+ }
3294
+ }
3295
+ };
3296
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
3297
+ try {
3298
+ for(var _iterator = roots[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
3299
+ var root = _step.value;
3300
+ collectLeaves(root);
3301
+ }
3302
+ } catch (err) {
3303
+ _didIteratorError = true;
3304
+ _iteratorError = err;
3305
+ } finally{
3306
+ try {
3307
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
3308
+ _iterator.return();
3309
+ }
3310
+ } finally{
3311
+ if (_didIteratorError) {
3312
+ throw _iteratorError;
3313
+ }
3314
+ }
3315
+ }
3316
+ return leaves;
3074
3317
  }
3075
3318
 
3076
3319
  var PermissionsEnum;
@@ -3469,21 +3712,6 @@ var IntegrationLarkProvider = {
3469
3712
  }
3470
3713
  };
3471
3714
 
3472
- var IntegrationWeComProvider = {
3473
- name: IntegrationEnum.WECOM,
3474
- label: {
3475
- en_US: "WeCom",
3476
- zh_Hans: "企业微信"
3477
- },
3478
- avatar: "wecom.webp",
3479
- webhook: true,
3480
- schema: {
3481
- type: "object",
3482
- properties: {}
3483
- },
3484
- pro: true
3485
- };
3486
-
3487
3715
  function _define_property(obj, key, value) {
3488
3716
  if (key in obj) {
3489
3717
  Object.defineProperty(obj, key, {
@@ -3498,7 +3726,8 @@ function _define_property(obj, key, value) {
3498
3726
  return obj;
3499
3727
  }
3500
3728
  var _obj;
3501
- var INTEGRATION_PROVIDERS = (_obj = {}, _define_property(_obj, IntegrationEnum.LARK, IntegrationLarkProvider), _define_property(_obj, IntegrationEnum.DINGTALK, IntegrationDingTalkProvider), _define_property(_obj, IntegrationEnum.WECOM, IntegrationWeComProvider), // [IntegrationEnum.FIRECRAWL]: IntegrationFirecrawlProvider,
3729
+ var INTEGRATION_PROVIDERS = (_obj = {}, // [IntegrationEnum.LARK]: IntegrationLarkProvider,
3730
+ _define_property(_obj, IntegrationEnum.DINGTALK, IntegrationDingTalkProvider), // [IntegrationEnum.WECOM]: IntegrationWeComProvider,
3502
3731
  _define_property(_obj, IntegrationEnum.GITHUB, IntegrationGitHubProvider), _obj);
3503
3732
 
3504
3733
  var AiModelTypeEnum;
@@ -3897,4 +4126,4 @@ var InterruptMessageType;
3897
4126
  InterruptMessageType["Select"] = "select";
3898
4127
  })(InterruptMessageType || (InterruptMessageType = {}));
3899
4128
 
3900
- export { AIPermissionsEnum, AI_MODEL_TYPE_VARIABLE, AccessEnum, AgentEventType, AgentType, AiBusinessRole, AiFeatureEnum, AiModelTypeEnum, AiProtocol, AiProvider, AiProviderRole, AlignmentOptions, AnalyticsFeatures, AnalyticsPermissionsEnum, ApiAuthType, ApiProviderSchemaType, ApprovalPolicyTypesEnum, ApprovalPolicyTypesStringEnum, Attachment_Type_Options, AuthenticationEnum, BIInterruptMessageType, BonusTypeEnum, BusinessAreaRole, BusinessType, CONTEXT_VARIABLE_CURRENTSTATE, ChatDashboardMessageType, ChatGatewayEvent, ChatMessageEventTypeEnum, ChatMessageFeedbackRatingEnum, ChatMessageStepCategory, ChatMessageTypeEnum, ClientFocusEnum, ConfigurateMethod, ContactOrganizationInviteStatus, ContactType, CredentialFormTypeEnum, CredentialsType, CrudActionEnum, CurrenciesEnum, CurrencyPosition, DEFAULT_CURRENCIES, DEFAULT_DATE_FORMATS, DEFAULT_INTEGRATION_PAID_FILTERS, DEFAULT_INVITE_EXPIRY_PERIOD, DEFAULT_PROFIT_BASED_BONUS, DEFAULT_REVENUE_BASED_BONUS, DEFAULT_TENANT, DEFAULT_TIME_FORMATS, DEFAULT_TYPE, DataSourceProtocolEnum, DataSourceSyntaxEnum, DataSourceTypeEnum, DefaultValueDateTypeEnum, DocumentSourceProviderCategoryEnum, EmailTemplateEnum, EmailTemplateNameEnum, EmbeddingStatusEnum, FeatureEnum, FeatureStatusEnum, FeedTypeEnum, FetchFrom, FileStorageProviderEnum, GRAPH_NODE_SUMMARIZE_CONVERSATION, GRAPH_NODE_TITLE_CONVERSATION, HttpStatus, IFeatureToggleTypeEnum, INTEGRATION_PROVIDERS, ImportHistoryStatusEnum, ImportTypeEnum, IndicatorOptionFields, IndicatorStatusEnum, IndicatorTagEnum, IndicatorType, IntegrationEnum, IntegrationFeatureEnum, IntegrationFilterEnum, IntegrationGitHubProvider, IntegrationLarkProvider, InterruptMessageType, InvitationExpirationEnum, InvitationTypeEnum, InviteStatusEnum, IteratingIndexParameterName, IteratingItemParameterName, KBDocumentCategoryEnum, KBDocumentStatusEnum, KDocumentSourceType, KDocumentWebTypeEnum, KDocumentWebTypeOptions, KNOWLEDGE_STAGE_NAME, KnowledgeDocuments, KnowledgeFolderId, KnowledgeProviderEnum, KnowledgeSources, KnowledgeStructureEnum, KnowledgeTask, KnowledgebaseChannel, KnowledgebasePermission, KnowledgebaseTypeEnum, LanguagesEnum, LanguagesMap, ListsInputTypeEnum, LocalAgentType, LongTermMemoryTypeEnum, MCPServerType, schema as MDX, MEMORY_PROFILE_PROMPT, MEMORY_QA_PROMPT, MinimumProjectSizeEnum, ModelEntityType, ModelFeature, ModelPropertyKey, ModelTypeEnum, OllamaEmbeddingsProviders, OpenAIEmbeddingsProviders, OrderTypeEnum, OrganizationContactBudgetTypeEnum, OrganizationDemoNetworkEnum, OrganizationPermissionsEnum, OrganizationProjectBudgetTypeEnum, OrganizationSelectInput, ParameterType, ParameterTypeEnum, PayPeriodEnum, PermissionApprovalStatus, PermissionApprovalStatusTypesEnum, PermissionGroups, PermissionsEnum, PriceType, ProjectBillingEnum, ProjectOwnerEnum, ProjectStatusEnum, ProviderEnum, ProviderType, QueryStatusEnum, RegionsEnum, RequestMethodEnum, RoleTypeEnum, RolesEnum, SMTPSecureEnum, STATE_VARIABLE_FILES, STATE_VARIABLE_HUMAN, STATE_VARIABLE_INPUT, STATE_VARIABLE_SYS, STATE_VARIABLE_TITLE_CHANNEL, ScheduleTaskStatus, SemanticModelStatusEnum, StoryStatusEnum, StoryTemplateType, SubscriptionType, TASK_DESCRIPTION_PREFIX, TASK_DESCRIPTION_SUFFIX, TENANT_AGENT_LOCAL_URL, TOOL_NAME_REGEX, TagCategoryEnum, TaskFrequency, TaskListTypeEnum, TimeGranularity, ToolParameterForm, ToolParameterType, ToolTagEnum, TranslationLanguageMap, UserType, VariableOperationEnum, VariableOperations, VectorTypeEnum, Visibility, VisitEntityEnum, VisitTypeEnum, WeekDaysEnum, WorkflowComparisonOperator, WorkflowLogicalOperator, WorkflowNodeTypeEnum, XpertAgentExecutionStatusEnum, XpertParameterTypeEnum, XpertToolsetCategoryEnum, XpertTypeEnum, agentLabel, agentUniqueName, allChannels, channelName, configurableStoreNamespace, convertToUrlPath, createAgentConnections, createXpertGraph, createXpertNodes, embeddingCubeCollectionName, extractSemanticModelDraft, figureOutXpert, findStartNodes, genListOperatorKey, genPipelineChunkerKey, genPipelineKnowledgeBaseKey, genPipelineProcessorKey, genPipelineSourceKey, genPipelineUnderstandingKey, genVariableAggregatorKey, generateCronExpression, getAgentVarGroup, getCurrentGraph, getEnabledTools, getStoreNamespace, getSwarmPartners, getToolCallFromConfig, getToolCallIdFromConfig, getToolLabel, getVariableSchema, getWorkflowTriggers, getWorkspaceFromRunnable, isAgentKey, isDocumentSheet, isEnableTool, isIteratingKey, isMessageGroup, isRouterKey, isToolEnabled, isWorkflowKey, letterStartSUID, locateNodes, mapTranslationLanguage, messageContentText, omitXpertRelations, setStateVariable, shortTitle, transformInstallation, uuid, workflowNodeIdentifier, xpertLabel };
4129
+ export { AIPermissionsEnum, AI_MODEL_TYPE_VARIABLE, AccessEnum, AgentEventType, AgentType, AiBusinessRole, AiFeatureEnum, AiModelTypeEnum, AiProtocol, AiProvider, AiProviderRole, AlignmentOptions, AnalyticsFeatures, AnalyticsPermissionsEnum, ApiAuthType, ApiProviderSchemaType, ApprovalPolicyTypesEnum, ApprovalPolicyTypesStringEnum, Attachment_Type_Options, AuthenticationEnum, BIInterruptMessageType, BonusTypeEnum, BusinessAreaRole, BusinessType, CONTEXT_VARIABLE_CURRENTSTATE, ChatDashboardMessageType, ChatGatewayEvent, ChatMessageEventTypeEnum, ChatMessageFeedbackRatingEnum, ChatMessageStepCategory, ChatMessageTypeEnum, ClientFocusEnum, ConfigurateMethod, ContactOrganizationInviteStatus, ContactType, CredentialFormTypeEnum, CredentialsType, CrudActionEnum, CurrenciesEnum, CurrencyPosition, DEFAULT_CURRENCIES, DEFAULT_DATE_FORMATS, DEFAULT_INTEGRATION_PAID_FILTERS, DEFAULT_INVITE_EXPIRY_PERIOD, DEFAULT_PROFIT_BASED_BONUS, DEFAULT_REVENUE_BASED_BONUS, DEFAULT_TENANT, DEFAULT_TIME_FORMATS, DEFAULT_TYPE, DataSourceProtocolEnum, DataSourceSyntaxEnum, DataSourceTypeEnum, DefaultValueDateTypeEnum, DocumentSourceProviderCategoryEnum, DocumentTypeEnum, EmailTemplateEnum, EmailTemplateNameEnum, EmbeddingStatusEnum, FeatureEnum, FeatureStatusEnum, FeedTypeEnum, FetchFrom, FileStorageProviderEnum, GRAPH_NODE_SUMMARIZE_CONVERSATION, GRAPH_NODE_TITLE_CONVERSATION, HttpStatus, IFeatureToggleTypeEnum, INTEGRATION_PROVIDERS, ImportHistoryStatusEnum, ImportTypeEnum, IndicatorOptionFields, IndicatorStatusEnum, IndicatorTagEnum, IndicatorType, IntegrationEnum, IntegrationFeatureEnum, IntegrationFilterEnum, IntegrationGitHubProvider, IntegrationLarkProvider, InterruptMessageType, InvitationExpirationEnum, InvitationTypeEnum, InviteStatusEnum, IteratingIndexParameterName, IteratingItemParameterName, KBDocumentCategoryEnum, KBDocumentStatusEnum, KDocumentSourceType, KDocumentWebTypeEnum, KDocumentWebTypeOptions, KNOWLEDGE_DOCUMENTS_NAME, KNOWLEDGE_FOLDER_ID_NAME, KNOWLEDGE_SOURCES_NAME, KNOWLEDGE_STAGE_NAME, KnowledgeProviderEnum, KnowledgeStructureEnum, KnowledgeTask, KnowledgebaseChannel, KnowledgebasePermission, KnowledgebaseTypeEnum, LanguagesEnum, LanguagesMap, ListsInputTypeEnum, LocalAgentType, LongTermMemoryTypeEnum, MCPServerType, schema as MDX, MEMORY_PROFILE_PROMPT, MEMORY_QA_PROMPT, MinimumProjectSizeEnum, ModelEntityType, ModelFeature, ModelPropertyKey, ModelTypeEnum, OllamaEmbeddingsProviders, OpenAIEmbeddingsProviders, OrderTypeEnum, OrganizationContactBudgetTypeEnum, OrganizationDemoNetworkEnum, OrganizationPermissionsEnum, OrganizationProjectBudgetTypeEnum, OrganizationSelectInput, ParameterType, ParameterTypeEnum, PayPeriodEnum, PermissionApprovalStatus, PermissionApprovalStatusTypesEnum, PermissionGroups, PermissionsEnum, PriceType, ProjectBillingEnum, ProjectOwnerEnum, ProjectStatusEnum, ProviderEnum, ProviderType, QueryStatusEnum, RegionsEnum, RequestMethodEnum, RoleTypeEnum, RolesEnum, SMTPSecureEnum, STATE_VARIABLE_FILES, STATE_VARIABLE_HUMAN, STATE_VARIABLE_INPUT, STATE_VARIABLE_SYS, STATE_VARIABLE_TITLE_CHANNEL, ScheduleTaskStatus, SemanticModelStatusEnum, StoryStatusEnum, StoryTemplateType, SubscriptionType, TASK_DESCRIPTION_PREFIX, TASK_DESCRIPTION_SUFFIX, TENANT_AGENT_LOCAL_URL, TOOL_NAME_REGEX, TagCategoryEnum, TaskFrequency, TaskListTypeEnum, TimeGranularity, ToolParameterForm, ToolParameterType, ToolTagEnum, TranslationLanguageMap, UserType, VariableOperationEnum, VariableOperations, VectorTypeEnum, Visibility, VisitEntityEnum, VisitTypeEnum, WeekDaysEnum, WorkflowComparisonOperator, WorkflowLogicalOperator, WorkflowNodeTypeEnum, XpertAgentExecutionStatusEnum, XpertParameterTypeEnum, XpertToolsetCategoryEnum, XpertTypeEnum, agentLabel, agentUniqueName, allChannels, buildChunkTree, channelName, classificateDocumentCategory, collectTreeLeaves, configurableStoreNamespace, convertToUrlPath, createAgentConnections, createXpertGraph, createXpertNodes, embeddingCubeCollectionName, extractSemanticModelDraft, figureOutXpert, findStartNodes, genListOperatorKey, genPipelineChunkerKey, genPipelineKnowledgeBaseKey, genPipelineProcessorKey, genPipelineSourceKey, genPipelineUnderstandingKey, genVariableAggregatorKey, genXpertTriggerKey, generateCronExpression, getAgentVarGroup, getCurrentGraph, getEnabledTools, getStoreNamespace, getSwarmPartners, getToolCallFromConfig, getToolCallIdFromConfig, getToolLabel, getVariableSchema, getWorkflowTriggers, getWorkspaceFromRunnable, isAgentKey, isAudioType, isDocumentSheet, isEnableTool, isImageType, isIteratingKey, isMessageGroup, isRouterKey, isToolEnabled, isVideoType, isWorkflowKey, letterStartSUID, locateNodes, mapTranslationLanguage, messageContentText, omitXpertRelations, setStateVariable, shortTitle, transformInstallation, uuid, workflowNodeIdentifier, xpertLabel };
package/package.json CHANGED
@@ -1,7 +1,14 @@
1
1
  {
2
2
  "name": "@metad/contracts",
3
- "version": "3.6.0",
3
+ "version": "3.6.2",
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
  },
@@ -4,31 +4,31 @@ import { I18nObject } from '../types';
4
4
  import { ICopilot } from './copilot.model';
5
5
  export interface IAiModel extends IBasePerTenantAndOrganizationEntityModel {
6
6
  /**
7
- * 模型名称
7
+ * Model name
8
8
  */
9
9
  name: string;
10
10
  /**
11
- * 模型展示名称
11
+ * Model display name
12
12
  */
13
13
  label: string;
14
14
  /**
15
- * 模型类型
15
+ * Model type
16
16
  */
17
17
  modelType: string;
18
18
  /**
19
- * 模型特性
19
+ * Model features
20
20
  */
21
21
  features: string[];
22
22
  /**
23
- * 模型属性
23
+ * Model properties
24
24
  */
25
25
  modelProperties: Record<string, any>;
26
26
  /**
27
- * 参数规则
27
+ * Parameter rules
28
28
  */
29
29
  parameterRules: Record<string, any>[];
30
30
  /**
31
- * 定价信息
31
+ * Pricing information
32
32
  */
33
33
  pricing: {
34
34
  input: string;
@@ -37,7 +37,7 @@ export interface IAiModel extends IBasePerTenantAndOrganizationEntityModel {
37
37
  currency: string;
38
38
  };
39
39
  /**
40
- * 是否已废弃
40
+ * Deprecated
41
41
  */
42
42
  deprecated: boolean;
43
43
  }
@@ -101,6 +101,7 @@ export interface CredentialFormSchema {
101
101
  options?: {
102
102
  label: I18nObject;
103
103
  value: number | string | boolean;
104
+ show_on?: FormShowOnObject[];
104
105
  }[];
105
106
  placeholder: I18nObject;
106
107
  max_length?: number;
@@ -119,7 +120,9 @@ export declare enum ModelFeature {
119
120
  MULTI_TOOL_CALL = "multi-tool-call",
120
121
  AGENT_THOUGHT = "agent-thought",
121
122
  VISION = "vision",
122
- STREAM_TOOL_CALL = "stream-tool-call"
123
+ STREAM_TOOL_CALL = "stream-tool-call",
124
+ VIDEO = "video",
125
+ STRUCTURED_OUTPUT = "structured-output"
123
126
  }
124
127
  export declare enum ModelPropertyKey {
125
128
  MODE = "mode",
package/src/ai/index.d.ts CHANGED
@@ -36,3 +36,4 @@ export * from './environment.model';
36
36
  export * from './knowledgebase-task.model';
37
37
  export * from './knowledge-pipeline';
38
38
  export * from './knowledge-retrieval-log.model';
39
+ export * from './knowledge-doc-chunk.model';
@@ -0,0 +1,60 @@
1
+ import { DocumentInterface } from '@langchain/core/documents';
2
+ import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
3
+ import { IKnowledgeDocument } from './knowledge-doc.model';
4
+ import { IKnowledgebase } from './knowledgebase.model';
5
+ export type TDocumentAsset = {
6
+ type: 'image' | 'video' | 'audio' | 'file';
7
+ url: string;
8
+ filePath: string;
9
+ };
10
+ export interface IDocChunkMetadata {
11
+ chunkId: string;
12
+ parentId?: string | null;
13
+ children?: DocumentInterface<IDocChunkMetadata>[];
14
+ knowledgeId?: string;
15
+ chunkIndex?: number;
16
+ enabled?: boolean;
17
+ /**
18
+ * Default to 'text'. Indicates the original media type of the chunk.
19
+ * @default text
20
+ */
21
+ mediaType?: 'text' | 'image' | 'video' | 'audio';
22
+ /**
23
+ * Associated assets like images, videos, etc.
24
+ */
25
+ assets?: TDocumentAsset[];
26
+ /**
27
+ * Whether the chunk is represented as a vector in the vector store
28
+ */
29
+ isVector?: boolean;
30
+ score?: number;
31
+ relevanceScore?: number;
32
+ [key: string]: any;
33
+ }
34
+ /**
35
+ * Segmented chunk of a knowledge document
36
+ */
37
+ export interface IKnowledgeDocumentChunk<Metadata extends IDocChunkMetadata = any> extends DocumentInterface<Metadata>, IBasePerTenantAndOrganizationEntityModel {
38
+ documentId?: string;
39
+ document?: IKnowledgeDocument;
40
+ knowledgebaseId?: string;
41
+ knowledgebase?: IKnowledgebase;
42
+ parent?: IKnowledgeDocumentChunk<Metadata>;
43
+ children?: IKnowledgeDocumentChunk<Metadata>[];
44
+ }
45
+ /**
46
+ * Build a hierarchical tree structure from a flat list of DocumentInterface objects,
47
+ * and
48
+ *
49
+ * @template Metadata - Type of metadata, defaults to IDocChunkMetadata
50
+ * @param documents - A flat array of DocumentInterface objects
51
+ * @returns the hierarchical tree (root-level DocumentInterface[])
52
+ */
53
+ export declare function buildChunkTree<Metadata extends IDocChunkMetadata = IDocChunkMetadata>(documents: DocumentInterface<Metadata>[]): DocumentInterface<Metadata>[];
54
+ /**
55
+ * Find all leaf nodes (nodes without children).
56
+ *
57
+ * @param roots
58
+ * @returns
59
+ */
60
+ export declare function collectTreeLeaves(roots: IKnowledgeDocumentChunk[]): IKnowledgeDocumentChunk<any>[];