@metad/contracts 3.8.3 → 3.9.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 (38) hide show
  1. package/index.cjs.js +709 -310
  2. package/index.esm.js +695 -305
  3. package/package.json +6 -6
  4. package/src/agent/graph.d.ts +44 -29
  5. package/src/agent/token.d.ts +0 -17
  6. package/src/ai/assistant-binding.model.d.ts +74 -0
  7. package/src/ai/chat-event.model.d.ts +8 -0
  8. package/src/ai/chat-message.model.d.ts +1 -1
  9. package/src/ai/chat.model.d.ts +7 -1
  10. package/src/ai/feature.model.d.ts +5 -1
  11. package/src/ai/index.d.ts +40 -1
  12. package/src/ai/message-content.utils.d.ts +7 -1
  13. package/src/ai/sandbox.d.ts +3 -1
  14. package/src/ai/skill.model.d.ts +37 -18
  15. package/src/ai/xpert-agent-execution.model.d.ts +9 -0
  16. package/src/ai/xpert-agent.model.d.ts +3 -31
  17. package/src/ai/xpert-chat.model.d.ts +66 -0
  18. package/src/ai/xpert-project.model.d.ts +3 -0
  19. package/src/ai/xpert-workspace.model.d.ts +6 -1
  20. package/src/ai/xpert.model.d.ts +14 -4
  21. package/src/ai/xpert.utils.d.ts +8 -5
  22. package/src/api-key.model.d.ts +59 -1
  23. package/src/index.d.ts +3 -0
  24. package/src/integration.model.d.ts +7 -0
  25. package/src/invite.model.d.ts +2 -0
  26. package/src/plugin.d.ts +66 -1
  27. package/src/role.model.d.ts +3 -4
  28. package/src/scope.model.d.ts +9 -0
  29. package/src/types.d.ts +5 -2
  30. package/src/user-group.model.d.ts +7 -0
  31. package/src/view-extension/index.d.ts +1 -0
  32. package/src/view-extension/model.d.ts +183 -0
  33. package/index.esm.d.ts +0 -1
  34. package/src/help-center-article.model.d.ts +0 -0
  35. package/src/help-center.model.d.ts +0 -0
  36. package/src/integration/dify.d.ts +0 -0
  37. package/src/integration/fastgpt.d.ts +0 -0
  38. /package/{index.cjs.d.ts → index.d.ts} +0 -0
package/index.cjs.js CHANGED
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var ShortUniqueId = require('short-unique-id');
4
- var chatkitTypes = require('@xpert-ai/chatkit-types');
5
4
 
6
5
  function _array_like_to_array$6(arr, len) {
7
6
  if (len == null || len > arr.length) len = arr.length;
@@ -38,6 +37,7 @@ var uuid = function() {
38
37
  }
39
38
  return (_uuidGenerator = uuidGenerator).randomUUID.apply(_uuidGenerator, _to_consumable_array$2(args));
40
39
  };
40
+ // Parameters
41
41
  exports.ParameterTypeEnum = void 0;
42
42
  (function(ParameterTypeEnum) {
43
43
  ParameterTypeEnum["STRING"] = "string";
@@ -918,26 +918,31 @@ exports.OrganizationDemoNetworkEnum = void 0;
918
918
  /**
919
919
  * Here is the intermediate type definition converted from the actual schema type to the xmla file format.
920
920
  * But the type definition here can also be referenced by the actual schema definition.
921
+ */ /**
922
+ * Mondrian 仅支持三种 Dimension 类型,
923
+ * 更丰富的语义可以通过 Semantics 来定义
921
924
  */ var DimensionType;
922
925
  (function(DimensionType) {
923
926
  DimensionType["StandardDimension"] = "StandardDimension";
924
927
  DimensionType["TimeDimension"] = "TimeDimension";
925
928
  DimensionType["MeasuresDimension"] = "MeasuresDimension";
926
929
  })(DimensionType || (DimensionType = {}));
927
- var Access;
930
+ /**
931
+ * enumerates the allowable access rights.
932
+ */ var Access;
928
933
  (function(Access) {
929
934
  /**
930
- * No access to an object and its children.
931
- */ Access["none"] = "none";
935
+ * No access to an object and its children.
936
+ */ Access["none"] = "none";
932
937
  /**
933
- * A grant that covers none of the children unless explicitly granted.
934
- */ Access["custom"] = "custom";
938
+ * A grant that covers none of the children unless explicitly granted.
939
+ */ Access["custom"] = "custom";
935
940
  /**
936
- * Access to all shared dimensions (applies to schema grant).
937
- */ Access["all_dimensions"] = "all_dimensions";
941
+ * Access to all shared dimensions (applies to schema grant).
942
+ */ Access["all_dimensions"] = "all_dimensions";
938
943
  /**
939
- * All access to an object and its children.
940
- */ Access["all"] = "all";
944
+ * All access to an object and its children.
945
+ */ Access["all"] = "all";
941
946
  })(Access || (Access = {}));
942
947
  var RollupPolicy;
943
948
  (function(RollupPolicy) {
@@ -947,10 +952,10 @@ var RollupPolicy;
947
952
  })(RollupPolicy || (RollupPolicy = {}));
948
953
 
949
954
  var schema = /*#__PURE__*/Object.freeze({
950
- __proto__: null,
951
- get Access () { return Access; },
952
- get DimensionType () { return DimensionType; },
953
- get RollupPolicy () { return RollupPolicy; }
955
+ __proto__: null,
956
+ get Access () { return Access; },
957
+ get DimensionType () { return DimensionType; },
958
+ get RollupPolicy () { return RollupPolicy; }
954
959
  });
955
960
 
956
961
  exports.ChatDashboardMessageType = void 0;
@@ -1073,22 +1078,28 @@ var IndicatorOptionFields = [
1073
1078
  "aggregator",
1074
1079
  "calendar"
1075
1080
  ];
1076
- exports.IndicatorType = void 0;
1081
+ /**
1082
+ * Indicator Type:
1083
+ * * Basic indicators
1084
+ * * Derivative Indicators
1085
+ */ exports.IndicatorType = void 0;
1077
1086
  (function(IndicatorType) {
1078
1087
  IndicatorType["BASIC"] = "BASIC";
1079
1088
  IndicatorType["DERIVE"] = "DERIVE";
1080
1089
  })(exports.IndicatorType || (exports.IndicatorType = {}));
1081
- exports.IndicatorStatusEnum = void 0;
1090
+ /**
1091
+ * Status of the indicator
1092
+ */ exports.IndicatorStatusEnum = void 0;
1082
1093
  (function(IndicatorStatusEnum) {
1083
1094
  /**
1084
- * draft
1085
- */ IndicatorStatusEnum["DRAFT"] = "DRAFT";
1095
+ * draft
1096
+ */ IndicatorStatusEnum["DRAFT"] = "DRAFT";
1086
1097
  /**
1087
- * Published
1088
- */ IndicatorStatusEnum["RELEASED"] = "RELEASED";
1098
+ * Published
1099
+ */ IndicatorStatusEnum["RELEASED"] = "RELEASED";
1089
1100
  /**
1090
- * Offline Archive
1091
- */ IndicatorStatusEnum["ARCHIVED"] = "ARCHIVED";
1101
+ * Offline Archive
1102
+ */ IndicatorStatusEnum["ARCHIVED"] = "ARCHIVED";
1092
1103
  })(exports.IndicatorStatusEnum || (exports.IndicatorStatusEnum = {}));
1093
1104
 
1094
1105
  exports.TimeGranularity = void 0;
@@ -1098,6 +1109,7 @@ exports.TimeGranularity = void 0;
1098
1109
  TimeGranularity["Month"] = "Month";
1099
1110
  TimeGranularity["Week"] = "Week";
1100
1111
  TimeGranularity["Day"] = "Day";
1112
+ // @todo more
1101
1113
  })(exports.TimeGranularity || (exports.TimeGranularity = {}));
1102
1114
  exports.IndicatorTagEnum = void 0;
1103
1115
  (function(IndicatorTagEnum) {
@@ -1142,31 +1154,39 @@ exports.AnalyticsPermissionsEnum = void 0;
1142
1154
  AnalyticsPermissionsEnum["PERMISSION_APPROVAL_EDIT"] = "PERMISSION_APPROVAL_EDIT";
1143
1155
  })(exports.AnalyticsPermissionsEnum || (exports.AnalyticsPermissionsEnum = {}));
1144
1156
 
1145
- exports.AgentType = void 0;
1157
+ /**
1158
+ * Data agent types
1159
+ */ exports.AgentType = void 0;
1146
1160
  (function(AgentType) {
1147
1161
  AgentType["Local"] = "local";
1148
1162
  AgentType["Browser"] = "browser";
1149
1163
  AgentType["Server"] = "server";
1150
1164
  AgentType["Wasm"] = "wasm";
1151
1165
  })(exports.AgentType || (exports.AgentType = {}));
1152
- exports.ModelTypeEnum = void 0;
1166
+ /**
1167
+ * Types of semantic model
1168
+ */ exports.ModelTypeEnum = void 0;
1153
1169
  (function(ModelTypeEnum) {
1154
1170
  ModelTypeEnum["XMLA"] = "XMLA";
1155
1171
  ModelTypeEnum["SQL"] = "SQL";
1156
1172
  })(exports.ModelTypeEnum || (exports.ModelTypeEnum = {}));
1157
- exports.RoleTypeEnum = void 0;
1173
+ /**
1174
+ * Role types
1175
+ */ exports.RoleTypeEnum = void 0;
1158
1176
  (function(RoleTypeEnum) {
1159
1177
  RoleTypeEnum["single"] = "single";
1160
1178
  RoleTypeEnum["union"] = "union";
1161
1179
  })(exports.RoleTypeEnum || (exports.RoleTypeEnum = {}));
1162
- exports.SemanticModelStatusEnum = void 0;
1180
+ /**
1181
+ * Status of semantic model
1182
+ */ exports.SemanticModelStatusEnum = void 0;
1163
1183
  (function(SemanticModelStatusEnum) {
1164
1184
  /**
1165
- * Using
1166
- */ SemanticModelStatusEnum["Progressing"] = "progressing";
1185
+ * Using
1186
+ */ SemanticModelStatusEnum["Progressing"] = "progressing";
1167
1187
  /**
1168
- * Archived
1169
- */ SemanticModelStatusEnum["Archived"] = "archived";
1188
+ * Archived
1189
+ */ SemanticModelStatusEnum["Archived"] = "archived";
1170
1190
  })(exports.SemanticModelStatusEnum || (exports.SemanticModelStatusEnum = {}));
1171
1191
  function extractSemanticModelDraft(model) {
1172
1192
  var _model_options, _model_options1;
@@ -1199,38 +1219,40 @@ function embeddingCubeCollectionName(modelKey, cube, isDraft) {
1199
1219
  exports.StoryStatusEnum = void 0;
1200
1220
  (function(StoryStatusEnum) {
1201
1221
  /**
1202
- * 草稿
1203
- */ StoryStatusEnum["DRAFT"] = "DRAFT";
1222
+ * 草稿
1223
+ */ StoryStatusEnum["DRAFT"] = "DRAFT";
1204
1224
  /**
1205
- * 重新编辑
1206
- */ StoryStatusEnum["CHANGING"] = "CHANGING";
1225
+ * 重新编辑
1226
+ */ StoryStatusEnum["CHANGING"] = "CHANGING";
1207
1227
  /**
1208
- * 审阅中
1209
- */ StoryStatusEnum["REVIEW"] = "REVIEW";
1228
+ * 审阅中
1229
+ */ StoryStatusEnum["REVIEW"] = "REVIEW";
1210
1230
  /**
1211
- * 通过
1212
- */ StoryStatusEnum["APPROVED"] = "APPROVED";
1231
+ * 通过
1232
+ */ StoryStatusEnum["APPROVED"] = "APPROVED";
1213
1233
  /**
1214
- * 退回
1215
- */ StoryStatusEnum["REJECTED"] = "REJECTED";
1234
+ * 退回
1235
+ */ StoryStatusEnum["REJECTED"] = "REJECTED";
1216
1236
  /**
1217
- * 已发布
1218
- */ StoryStatusEnum["RELEASED"] = "RELEASED";
1237
+ * 已发布
1238
+ */ StoryStatusEnum["RELEASED"] = "RELEASED";
1219
1239
  /**
1220
- * 下线存档
1221
- */ StoryStatusEnum["ARCHIVED"] = "ARCHIVED";
1240
+ * 下线存档
1241
+ */ StoryStatusEnum["ARCHIVED"] = "ARCHIVED";
1222
1242
  })(exports.StoryStatusEnum || (exports.StoryStatusEnum = {}));
1223
- exports.AccessEnum = void 0;
1243
+ /**
1244
+ * 用户对某个实体的访问权限
1245
+ */ exports.AccessEnum = void 0;
1224
1246
  (function(AccessEnum) {
1225
1247
  /**
1226
- * 可看到
1227
- */ AccessEnum["View"] = "View";
1248
+ * 可看到
1249
+ */ AccessEnum["View"] = "View";
1228
1250
  /**
1229
- * 可读取详情
1230
- */ AccessEnum["Read"] = "Read";
1251
+ * 可读取详情
1252
+ */ AccessEnum["Read"] = "Read";
1231
1253
  /**
1232
- * 可编辑
1233
- */ AccessEnum["Write"] = "Write";
1254
+ * 可编辑
1255
+ */ AccessEnum["Write"] = "Write";
1234
1256
  })(exports.AccessEnum || (exports.AccessEnum = {}));
1235
1257
 
1236
1258
  exports.SubscriptionType = void 0;
@@ -1297,11 +1319,11 @@ var PermissionApprovalStatus = {
1297
1319
  exports.ProjectStatusEnum = void 0;
1298
1320
  (function(ProjectStatusEnum) {
1299
1321
  /**
1300
- * In use
1301
- */ ProjectStatusEnum["Progressing"] = "Progressing";
1322
+ * In use
1323
+ */ ProjectStatusEnum["Progressing"] = "Progressing";
1302
1324
  /**
1303
- * Archived
1304
- */ ProjectStatusEnum["Archived"] = "Archived";
1325
+ * Archived
1326
+ */ ProjectStatusEnum["Archived"] = "Archived";
1305
1327
  })(exports.ProjectStatusEnum || (exports.ProjectStatusEnum = {}));
1306
1328
 
1307
1329
  exports.StoryTemplateType = void 0;
@@ -1318,17 +1340,52 @@ exports.QueryStatusEnum = void 0;
1318
1340
  QueryStatusEnum["FAILED"] = "failed";
1319
1341
  })(exports.QueryStatusEnum || (exports.QueryStatusEnum = {}));
1320
1342
 
1343
+ exports.AssistantCode = void 0;
1344
+ (function(AssistantCode) {
1345
+ AssistantCode["CHAT_COMMON"] = "chat_common";
1346
+ AssistantCode["XPERT_SHARED"] = "xpert_shared";
1347
+ AssistantCode["CHATBI"] = "chatbi";
1348
+ AssistantCode["CLAWXPERT"] = "clawxpert";
1349
+ })(exports.AssistantCode || (exports.AssistantCode = {}));
1350
+ exports.AssistantBindingScope = void 0;
1351
+ (function(AssistantBindingScope) {
1352
+ AssistantBindingScope["TENANT"] = "tenant";
1353
+ AssistantBindingScope["ORGANIZATION"] = "organization";
1354
+ AssistantBindingScope["USER"] = "user";
1355
+ })(exports.AssistantBindingScope || (exports.AssistantBindingScope = {}));
1356
+ exports.AssistantBindingSourceScope = void 0;
1357
+ (function(AssistantBindingSourceScope) {
1358
+ AssistantBindingSourceScope["NONE"] = "none";
1359
+ AssistantBindingSourceScope["TENANT"] = "tenant";
1360
+ AssistantBindingSourceScope["ORGANIZATION"] = "organization";
1361
+ })(exports.AssistantBindingSourceScope || (exports.AssistantBindingSourceScope = {}));
1362
+ var USER_MANAGED_ASSISTANTS = new Set([
1363
+ exports.AssistantCode.CLAWXPERT
1364
+ ]);
1365
+ function getAssistantManagement(code) {
1366
+ return USER_MANAGED_ASSISTANTS.has(code) ? "user" : "system";
1367
+ }
1368
+ function isUserManagedAssistant(code) {
1369
+ return getAssistantManagement(code) === "user";
1370
+ }
1371
+ function isSystemManagedAssistant(code) {
1372
+ return getAssistantManagement(code) === "system";
1373
+ }
1374
+
1321
1375
  exports.ProviderType = void 0;
1322
1376
  (function(ProviderType) {
1323
1377
  ProviderType["CUSTOM"] = "custom";
1324
1378
  ProviderType["SYSTEM"] = "system";
1325
1379
  })(exports.ProviderType || (exports.ProviderType = {}));
1326
- exports.CredentialFormTypeEnum = void 0;
1380
+ /**
1381
+ * @todo Use JSON Schema to implement
1382
+ */ exports.CredentialFormTypeEnum = void 0;
1327
1383
  (function(CredentialFormTypeEnum) {
1328
1384
  CredentialFormTypeEnum["TEXT_INPUT"] = "text-input";
1329
1385
  CredentialFormTypeEnum["SECRET_INPUT"] = "secret-input";
1330
1386
  CredentialFormTypeEnum["SELECT"] = "select";
1331
1387
  CredentialFormTypeEnum["RADIO"] = "radio";
1388
+ // SWITCH = "switch", // use ParameterType.BOOLEAN
1332
1389
  })(exports.CredentialFormTypeEnum || (exports.CredentialFormTypeEnum = {}));
1333
1390
  exports.FetchFrom = void 0;
1334
1391
  (function(FetchFrom) {
@@ -1364,7 +1421,9 @@ exports.ConfigurateMethod = void 0;
1364
1421
  ConfigurateMethod["PREDEFINED_MODEL"] = "predefined-model";
1365
1422
  ConfigurateMethod["CUSTOMIZABLE_MODEL"] = "customizable-model";
1366
1423
  })(exports.ConfigurateMethod || (exports.ConfigurateMethod = {}));
1367
- exports.ParameterType = void 0;
1424
+ /**
1425
+ * @todo Use JSON Schema to implement
1426
+ */ exports.ParameterType = void 0;
1368
1427
  (function(ParameterType) {
1369
1428
  ParameterType["FLOAT"] = "float";
1370
1429
  ParameterType["INT"] = "int";
@@ -1386,58 +1445,62 @@ exports.PriceType = void 0;
1386
1445
  AiBusinessRole["FinanceBP"] = "finance_bp";
1387
1446
  AiBusinessRole["SupplyChainExpert"] = "supply_chain_expert";
1388
1447
  })(exports.AiBusinessRole || (exports.AiBusinessRole = {}));
1389
- exports.AiProvider = void 0;
1448
+ /**
1449
+ * Providers for LLMs
1450
+ *
1451
+ * - https://js.langchain.com/docs/integrations/chat/
1452
+ */ exports.AiProvider = void 0;
1390
1453
  (function(AiProvider) {
1391
1454
  /**
1392
- * - https://js.langchain.com/docs/integrations/chat/openai/
1393
- */ AiProvider["OpenAI"] = "openai";
1455
+ * - https://js.langchain.com/docs/integrations/chat/openai/
1456
+ */ AiProvider["OpenAI"] = "openai";
1394
1457
  /**
1395
- * - https://js.langchain.com/docs/integrations/chat/openai/
1396
- */ AiProvider["Azure"] = "azure";
1458
+ * - https://js.langchain.com/docs/integrations/chat/openai/
1459
+ */ AiProvider["Azure"] = "azure";
1397
1460
  // DashScope = 'dashscope',
1398
1461
  /**
1399
- * - https://ollama.com/
1400
- * - https://js.langchain.com/docs/integrations/chat/ollama/
1401
- */ AiProvider["Ollama"] = "ollama";
1462
+ * - https://ollama.com/
1463
+ * - https://js.langchain.com/docs/integrations/chat/ollama/
1464
+ */ AiProvider["Ollama"] = "ollama";
1402
1465
  /**
1403
- * - https://www.deepseek.com/zh
1404
- * - https://js.langchain.com/docs/integrations/chat/openai/
1405
- */ AiProvider["DeepSeek"] = "deepseek";
1466
+ * - https://www.deepseek.com/zh
1467
+ * - https://js.langchain.com/docs/integrations/chat/openai/
1468
+ */ AiProvider["DeepSeek"] = "deepseek";
1406
1469
  /**
1407
- * - https://docs.anthropic.com/en/home
1408
- * - https://js.langchain.com/docs/integrations/chat/anthropic/
1409
- */ AiProvider["Anthropic"] = "anthropic";
1470
+ * - https://docs.anthropic.com/en/home
1471
+ * - https://js.langchain.com/docs/integrations/chat/anthropic/
1472
+ */ AiProvider["Anthropic"] = "anthropic";
1410
1473
  /**
1411
- * - https://www.aliyun.com/product/bailian
1412
- * - https://js.langchain.com/docs/integrations/chat/alibaba_tongyi/
1413
- */ AiProvider["AlibabaTongyi"] = "alibaba_tongyi";
1474
+ * - https://www.aliyun.com/product/bailian
1475
+ * - https://js.langchain.com/docs/integrations/chat/alibaba_tongyi/
1476
+ */ AiProvider["AlibabaTongyi"] = "alibaba_tongyi";
1414
1477
  /**
1415
- * - https://open.bigmodel.cn/
1416
- * - https://js.langchain.com/docs/integrations/chat/openai/
1417
- */ AiProvider["Zhipu"] = "zhipu";
1478
+ * - https://open.bigmodel.cn/
1479
+ * - https://js.langchain.com/docs/integrations/chat/openai/
1480
+ */ AiProvider["Zhipu"] = "zhipu";
1418
1481
  /**
1419
- * - https://qianfan.cloud.baidu.com/
1420
- * - https://js.langchain.com/docs/integrations/chat/baidu_qianfan/
1421
- */ AiProvider["BaiduQianfan"] = "baidu_qianfan";
1482
+ * - https://qianfan.cloud.baidu.com/
1483
+ * - https://js.langchain.com/docs/integrations/chat/baidu_qianfan/
1484
+ */ AiProvider["BaiduQianfan"] = "baidu_qianfan";
1422
1485
  /**
1423
- * - https://www.together.ai/
1424
- * - https://js.langchain.com/docs/integrations/chat/togetherai/
1425
- */ AiProvider["Together"] = "together";
1486
+ * - https://www.together.ai/
1487
+ * - https://js.langchain.com/docs/integrations/chat/togetherai/
1488
+ */ AiProvider["Together"] = "together";
1426
1489
  /**
1427
- * - https://platform.moonshot.cn/console
1428
- * - https://js.langchain.com/docs/integrations/chat/openai/
1429
- */ AiProvider["Moonshot"] = "moonshot";
1490
+ * - https://platform.moonshot.cn/console
1491
+ * - https://js.langchain.com/docs/integrations/chat/openai/
1492
+ */ AiProvider["Moonshot"] = "moonshot";
1430
1493
  /**
1431
- * - https://groq.com/
1432
- * - https://js.langchain.com/docs/integrations/chat/openai/
1433
- */ AiProvider["Groq"] = "groq";
1494
+ * - https://groq.com/
1495
+ * - https://js.langchain.com/docs/integrations/chat/openai/
1496
+ */ AiProvider["Groq"] = "groq";
1434
1497
  /**
1435
- * - https://mistral.ai/
1436
- *
1437
- */ AiProvider["Mistral"] = "mistral";
1498
+ * - https://mistral.ai/
1499
+ *
1500
+ */ AiProvider["Mistral"] = "mistral";
1438
1501
  /**
1439
- * - https://cohere.com/
1440
- */ AiProvider["Cohere"] = "cohere";
1502
+ * - https://cohere.com/
1503
+ */ AiProvider["Cohere"] = "cohere";
1441
1504
  })(exports.AiProvider || (exports.AiProvider = {}));
1442
1505
  exports.AiProtocol = void 0;
1443
1506
  (function(AiProtocol) {
@@ -1445,15 +1508,53 @@ exports.AiProtocol = void 0;
1445
1508
  AiProtocol["Others"] = "others";
1446
1509
  })(exports.AiProtocol || (exports.AiProtocol = {}));
1447
1510
  var OpenAIEmbeddingsProviders = [
1448
- "openai",
1449
- "azure",
1450
- "deepseek"
1511
+ exports.AiProvider.OpenAI,
1512
+ exports.AiProvider.Azure,
1513
+ exports.AiProvider.DeepSeek
1451
1514
  ];
1452
1515
  var OllamaEmbeddingsProviders = [
1453
- "ollama"
1516
+ exports.AiProvider.Ollama
1454
1517
  ];
1455
1518
 
1456
- exports.ChatGatewayEvent = void 0;
1519
+ function _define_property$6(obj, key, value) {
1520
+ if (key in obj) {
1521
+ Object.defineProperty(obj, key, {
1522
+ value: value,
1523
+ enumerable: true,
1524
+ configurable: true,
1525
+ writable: true
1526
+ });
1527
+ } else {
1528
+ obj[key] = value;
1529
+ }
1530
+ return obj;
1531
+ }
1532
+ function _object_spread$5(target) {
1533
+ for(var i = 1; i < arguments.length; i++){
1534
+ var source = arguments[i] != null ? arguments[i] : {};
1535
+ var ownKeys = Object.keys(source);
1536
+ if (typeof Object.getOwnPropertySymbols === "function") {
1537
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1538
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1539
+ }));
1540
+ }
1541
+ ownKeys.forEach(function(key) {
1542
+ _define_property$6(target, key, source[key]);
1543
+ });
1544
+ }
1545
+ return target;
1546
+ }
1547
+ var CHAT_EVENT_TYPE_THREAD_CONTEXT_USAGE = "thread_context_usage";
1548
+ var CHAT_EVENT_TYPE_CONVERSATION_TITLE_SUMMARY = "conversation_title_summary";
1549
+ function createConversationTitleSummaryEvent(event) {
1550
+ return _object_spread$5({
1551
+ type: CHAT_EVENT_TYPE_CONVERSATION_TITLE_SUMMARY
1552
+ }, event);
1553
+ }
1554
+
1555
+ /**
1556
+ * @deprecated use ChatMessageEventTypeEnum
1557
+ */ exports.ChatGatewayEvent = void 0;
1457
1558
  (function(ChatGatewayEvent) {
1458
1559
  ChatGatewayEvent["ACK"] = "ack";
1459
1560
  ChatGatewayEvent["ConversationCreated"] = "conversation_created";
@@ -1489,7 +1590,9 @@ var MEMORY_PROFILE_PROMPT = "Extract new user profile information from the above
1489
1590
 
1490
1591
  var USAGE_HOUR_FORMAT = "yyyy-MM-dd HH";
1491
1592
 
1492
- exports.AiProviderRole = void 0;
1593
+ /**
1594
+ * The order of priority is: `Embedding`, `Secondary`, `Primary`
1595
+ */ exports.AiProviderRole = void 0;
1493
1596
  (function(AiProviderRole) {
1494
1597
  AiProviderRole["Primary"] = "primary";
1495
1598
  AiProviderRole["Secondary"] = "secondary";
@@ -1503,6 +1606,10 @@ exports.AiFeatureEnum = void 0;
1503
1606
  AiFeatureEnum["FEATURE_COPILOT_KNOWLEDGEBASE"] = "FEATURE_COPILOT_KNOWLEDGEBASE";
1504
1607
  AiFeatureEnum["FEATURE_COPILOT_CHAT"] = "FEATURE_COPILOT_CHAT";
1505
1608
  AiFeatureEnum["FEATURE_XPERT"] = "FEATURE_XPERT";
1609
+ AiFeatureEnum["FEATURE_XPERT_CHATBI"] = "FEATURE_XPERT_CHATBI";
1610
+ AiFeatureEnum["FEATURE_XPERT_CLAWXPERT"] = "FEATURE_XPERT_CLAWXPERT";
1611
+ AiFeatureEnum["FEATURE_XPERT_CODEXPERT"] = "FEATURE_XPERT_CODEXPERT";
1612
+ AiFeatureEnum["FEATURE_XPERT_DEEP_RESEARCH"] = "FEATURE_XPERT_DEEP_RESEARCH";
1506
1613
  })(exports.AiFeatureEnum || (exports.AiFeatureEnum = {}));
1507
1614
 
1508
1615
  exports.VectorTypeEnum = void 0;
@@ -1539,14 +1646,14 @@ exports.KDocumentWebTypeEnum = void 0;
1539
1646
  })(exports.KDocumentWebTypeEnum || (exports.KDocumentWebTypeEnum = {}));
1540
1647
  var KDocumentWebTypeOptions = [
1541
1648
  {
1542
- value: "playwright",
1649
+ value: exports.KDocumentWebTypeEnum.Playwright,
1543
1650
  label: {
1544
1651
  en_US: "Playwright"
1545
1652
  },
1546
1653
  icon: '<svg width="100%" height="100%" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M136.444 221.556C123.558 225.213 115.104 231.625 109.535 238.032C114.869 233.364 122.014 229.08 131.652 226.348C141.51 223.554 149.92 223.574 156.869 224.915V219.481C150.941 218.939 144.145 219.371 136.444 221.556ZM108.946 175.876L61.0895 188.484C61.0895 188.484 61.9617 189.716 63.5767 191.36L104.153 180.668C104.153 180.668 103.578 188.077 98.5847 194.705C108.03 187.559 108.946 175.876 108.946 175.876ZM149.005 288.347C81.6582 306.486 46.0272 228.438 35.2396 187.928C30.2556 169.229 28.0799 155.067 27.5 145.928C27.4377 144.979 27.4665 144.179 27.5336 143.446C24.04 143.657 22.3674 145.473 22.7077 150.721C23.2876 159.855 25.4633 174.016 30.4473 192.721C41.2301 233.225 76.8659 311.273 144.213 293.134C158.872 289.185 169.885 281.992 178.152 272.81C170.532 279.692 160.995 285.112 149.005 288.347ZM161.661 128.11V132.903H188.077C187.535 131.206 186.989 129.677 186.447 128.11H161.661Z" fill="#2D4552"/>\n<path d="M193.981 167.584C205.861 170.958 212.144 179.287 215.465 186.658L228.711 190.42C228.711 190.42 226.904 164.623 203.57 157.995C181.741 151.793 168.308 170.124 166.674 172.496C173.024 167.972 182.297 164.268 193.981 167.584ZM299.422 186.777C277.573 180.547 264.145 198.916 262.535 201.255C268.89 196.736 278.158 193.031 289.837 196.362C301.698 199.741 307.976 208.06 311.307 215.436L324.572 219.212C324.572 219.212 322.736 193.41 299.422 186.777ZM286.262 254.795L176.072 223.99C176.072 223.99 177.265 230.038 181.842 237.869L274.617 263.805C282.255 259.386 286.262 254.795 286.262 254.795ZM209.867 321.102C122.618 297.71 133.166 186.543 147.284 133.865C153.097 112.156 159.073 96.0203 164.029 85.204C161.072 84.5953 158.623 86.1529 156.203 91.0746C150.941 101.747 144.212 119.124 137.7 143.45C123.586 196.127 113.038 307.29 200.283 330.682C241.406 341.699 273.442 324.955 297.323 298.659C274.655 319.19 245.714 330.701 209.867 321.102Z" fill="#2D4552"/>\n<path d="M161.661 262.296V239.863L99.3324 257.537C99.3324 257.537 103.938 230.777 136.444 221.556C146.302 218.762 154.713 218.781 161.661 220.123V128.11H192.869C189.471 117.61 186.184 109.526 183.423 103.909C178.856 94.612 174.174 100.775 163.545 109.665C156.059 115.919 137.139 129.261 108.668 136.933C80.1966 144.61 57.179 142.574 47.5752 140.911C33.9601 138.562 26.8387 135.572 27.5049 145.928C28.0847 155.062 30.2605 169.224 35.2445 187.928C46.0272 228.433 81.663 306.481 149.01 288.342C166.602 283.602 179.019 274.233 187.626 262.291H161.661V262.296ZM61.0848 188.484L108.946 175.876C108.946 175.876 107.551 194.288 89.6087 199.018C71.6614 203.743 61.0848 188.484 61.0848 188.484Z" fill="#E2574C"/>\n<path d="M341.786 129.174C329.345 131.355 299.498 134.072 262.612 124.185C225.716 114.304 201.236 97.0224 191.537 88.8994C177.788 77.3834 171.74 69.3802 165.788 81.4857C160.526 92.163 153.797 109.54 147.284 133.866C133.171 186.543 122.623 297.706 209.867 321.098C297.093 344.47 343.53 242.92 357.644 190.238C364.157 165.917 367.013 147.5 367.799 135.625C368.695 122.173 359.455 126.078 341.786 129.174ZM166.497 172.756C166.497 172.756 180.246 151.372 203.565 158C226.899 164.628 228.706 190.425 228.706 190.425L166.497 172.756ZM223.42 268.713C182.403 256.698 176.077 223.99 176.077 223.99L286.262 254.796C286.262 254.791 264.021 280.578 223.42 268.713ZM262.377 201.495C262.377 201.495 276.107 180.126 299.422 186.773C322.736 193.411 324.572 219.208 324.572 219.208L262.377 201.495Z" fill="#2EAD33"/>\n<path d="M139.88 246.04L99.3324 257.532C99.3324 257.532 103.737 232.44 133.607 222.496L110.647 136.33L108.663 136.933C80.1918 144.611 57.1742 142.574 47.5704 140.911C33.9554 138.563 26.834 135.572 27.5001 145.929C28.08 155.063 30.2557 169.224 35.2397 187.929C46.0225 228.433 81.6583 306.481 149.005 288.342L150.989 287.719L139.88 246.04ZM61.0848 188.485L108.946 175.876C108.946 175.876 107.551 194.288 89.6087 199.018C71.6615 203.743 61.0848 188.485 61.0848 188.485Z" fill="#D65348"/>\n<path d="M225.27 269.163L223.415 268.712C182.398 256.698 176.072 223.99 176.072 223.99L232.89 239.872L262.971 124.281L262.607 124.185C225.711 114.304 201.232 97.0224 191.532 88.8994C177.783 77.3834 171.735 69.3802 165.783 81.4857C160.526 92.163 153.797 109.54 147.284 133.866C133.171 186.543 122.623 297.706 209.867 321.097L211.655 321.5L225.27 269.163ZM166.497 172.756C166.497 172.756 180.246 151.372 203.565 158C226.899 164.628 228.706 190.425 228.706 190.425L166.497 172.756Z" fill="#1D8D22"/>\n<path d="M141.946 245.451L131.072 248.537C133.641 263.019 138.169 276.917 145.276 289.195C146.513 288.922 147.74 288.687 149 288.342C152.302 287.451 155.364 286.348 158.312 285.145C150.371 273.361 145.118 259.789 141.946 245.451ZM137.7 143.451C132.112 164.307 127.113 194.326 128.489 224.436C130.952 223.367 133.554 222.371 136.444 221.551L138.457 221.101C136.003 188.939 141.308 156.165 147.284 133.866C148.799 128.225 150.318 122.978 151.832 118.085C149.393 119.637 146.767 121.228 143.776 122.867C141.759 129.093 139.722 135.898 137.7 143.451Z" fill="#C04B41"/>\n</svg>'
1547
1654
  },
1548
1655
  {
1549
- value: "firecrawl",
1656
+ value: exports.KDocumentWebTypeEnum.FireCrawl,
1550
1657
  label: {
1551
1658
  en_US: "FireCrawl"
1552
1659
  },
@@ -1559,19 +1666,19 @@ exports.WorkflowNodeTypeEnum = void 0;
1559
1666
  WorkflowNodeTypeEnum["START"] = "start";
1560
1667
  WorkflowNodeTypeEnum["END"] = "end";
1561
1668
  /**
1562
- * Trigger
1563
- */ WorkflowNodeTypeEnum["TRIGGER"] = "trigger";
1669
+ * Trigger
1670
+ */ WorkflowNodeTypeEnum["TRIGGER"] = "trigger";
1564
1671
  /**
1565
- * State Variable Assigner
1566
- */ WorkflowNodeTypeEnum["ASSIGNER"] = "assigner";
1672
+ * State Variable Assigner
1673
+ */ WorkflowNodeTypeEnum["ASSIGNER"] = "assigner";
1567
1674
  /**
1568
- * Router
1569
- */ WorkflowNodeTypeEnum["IF_ELSE"] = "if-else";
1675
+ * Router
1676
+ */ WorkflowNodeTypeEnum["IF_ELSE"] = "if-else";
1570
1677
  WorkflowNodeTypeEnum["LIST_OPERATOR"] = "list-operator";
1571
1678
  WorkflowNodeTypeEnum["VARIABLE_AGGREGATOR"] = "variable-aggregator";
1572
1679
  /**
1573
- * @deprecated use ITERATOR instead
1574
- */ WorkflowNodeTypeEnum["ITERATING"] = "iterating";
1680
+ * @deprecated use ITERATOR instead
1681
+ */ WorkflowNodeTypeEnum["ITERATING"] = "iterating";
1575
1682
  WorkflowNodeTypeEnum["ITERATOR"] = "iterator";
1576
1683
  WorkflowNodeTypeEnum["HTTP"] = "http";
1577
1684
  WorkflowNodeTypeEnum["SUBFLOW"] = "subflow";
@@ -1579,8 +1686,8 @@ exports.WorkflowNodeTypeEnum = void 0;
1579
1686
  WorkflowNodeTypeEnum["AGENT_TOOL"] = "agent-tool";
1580
1687
  WorkflowNodeTypeEnum["NOTE"] = "note";
1581
1688
  /**
1582
- * Task node, distribute tasks to sub-agents
1583
- */ WorkflowNodeTypeEnum["TASK"] = "task";
1689
+ * Task node, distribute tasks to sub-agents
1690
+ */ WorkflowNodeTypeEnum["TASK"] = "task";
1584
1691
  // Knowledge Pipeline nodes
1585
1692
  WorkflowNodeTypeEnum["SOURCE"] = "source";
1586
1693
  WorkflowNodeTypeEnum["PROCESSOR"] = "processor";
@@ -1601,20 +1708,20 @@ exports.WorkflowNodeTypeEnum = void 0;
1601
1708
  // 📦 Database Operation Nodes
1602
1709
  // ===============================
1603
1710
  /**
1604
- * Custom SQL
1605
- */ WorkflowNodeTypeEnum["DB_SQL"] = "db-sql";
1711
+ * Custom SQL
1712
+ */ WorkflowNodeTypeEnum["DB_SQL"] = "db-sql";
1606
1713
  /**
1607
- * Insert data (INSERT)
1608
- */ WorkflowNodeTypeEnum["DB_INSERT"] = "db-insert";
1714
+ * Insert data (INSERT)
1715
+ */ WorkflowNodeTypeEnum["DB_INSERT"] = "db-insert";
1609
1716
  /**
1610
- * Update data (UPDATE)
1611
- */ WorkflowNodeTypeEnum["DB_UPDATE"] = "db-update";
1717
+ * Update data (UPDATE)
1718
+ */ WorkflowNodeTypeEnum["DB_UPDATE"] = "db-update";
1612
1719
  /**
1613
- * Delete data (DELETE)
1614
- */ WorkflowNodeTypeEnum["DB_DELETE"] = "db-delete";
1720
+ * Delete data (DELETE)
1721
+ */ WorkflowNodeTypeEnum["DB_DELETE"] = "db-delete";
1615
1722
  /**
1616
- * Query data (SELECT)
1617
- */ WorkflowNodeTypeEnum["DB_QUERY"] = "db-query";
1723
+ * Query data (SELECT)
1724
+ */ WorkflowNodeTypeEnum["DB_QUERY"] = "db-query";
1618
1725
  // ===============================
1619
1726
  // 🏆 Pro Nodes
1620
1727
  // ===============================
@@ -1704,14 +1811,14 @@ function workflowNodeIdentifier(node) {
1704
1811
  exports.XpertTypeEnum = void 0;
1705
1812
  (function(XpertTypeEnum) {
1706
1813
  /**
1707
- * Chat Agents
1708
- */ XpertTypeEnum["Agent"] = "agent";
1814
+ * Chat Agents
1815
+ */ XpertTypeEnum["Agent"] = "agent";
1709
1816
  /**
1710
- * Copilot in UI
1711
- */ XpertTypeEnum["Copilot"] = "copilot";
1817
+ * Copilot in UI
1818
+ */ XpertTypeEnum["Copilot"] = "copilot";
1712
1819
  /**
1713
- * Knowledge Workflow
1714
- */ XpertTypeEnum["Knowledge"] = "knowledge";
1820
+ * Knowledge Workflow
1821
+ */ XpertTypeEnum["Knowledge"] = "knowledge";
1715
1822
  })(exports.XpertTypeEnum || (exports.XpertTypeEnum = {}));
1716
1823
  exports.LongTermMemoryTypeEnum = void 0;
1717
1824
  (function(LongTermMemoryTypeEnum) {
@@ -1721,11 +1828,11 @@ exports.LongTermMemoryTypeEnum = void 0;
1721
1828
  exports.XpertParameterTypeEnum = void 0;
1722
1829
  (function(XpertParameterTypeEnum) {
1723
1830
  /**
1724
- * @deprecated use string
1725
- */ XpertParameterTypeEnum["TEXT"] = "text";
1831
+ * @deprecated use string
1832
+ */ XpertParameterTypeEnum["TEXT"] = "text";
1726
1833
  /**
1727
- * @deprecated use string
1728
- */ XpertParameterTypeEnum["PARAGRAPH"] = "paragraph";
1834
+ * @deprecated use string
1835
+ */ XpertParameterTypeEnum["PARAGRAPH"] = "paragraph";
1729
1836
  XpertParameterTypeEnum["STRING"] = "string";
1730
1837
  XpertParameterTypeEnum["NUMBER"] = "number";
1731
1838
  XpertParameterTypeEnum["OBJECT"] = "object";
@@ -1796,7 +1903,7 @@ function _array_like_to_array$5(arr, len) {
1796
1903
  function _array_with_holes$4(arr) {
1797
1904
  if (Array.isArray(arr)) return arr;
1798
1905
  }
1799
- function _define_property$4(obj, key, value) {
1906
+ function _define_property$5(obj, key, value) {
1800
1907
  if (key in obj) {
1801
1908
  Object.defineProperty(obj, key, {
1802
1909
  value: value,
@@ -1836,7 +1943,7 @@ function _iterable_to_array_limit$3(arr, i) {
1836
1943
  function _non_iterable_rest$4() {
1837
1944
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1838
1945
  }
1839
- function _object_spread$3(target) {
1946
+ function _object_spread$4(target) {
1840
1947
  for(var i = 1; i < arguments.length; i++){
1841
1948
  var source = arguments[i] != null ? arguments[i] : {};
1842
1949
  var ownKeys = Object.keys(source);
@@ -1846,12 +1953,12 @@ function _object_spread$3(target) {
1846
1953
  }));
1847
1954
  }
1848
1955
  ownKeys.forEach(function(key) {
1849
- _define_property$4(target, key, source[key]);
1956
+ _define_property$5(target, key, source[key]);
1850
1957
  });
1851
1958
  }
1852
1959
  return target;
1853
1960
  }
1854
- function ownKeys$2(object, enumerableOnly) {
1961
+ function ownKeys$3(object, enumerableOnly) {
1855
1962
  var keys = Object.keys(object);
1856
1963
  if (Object.getOwnPropertySymbols) {
1857
1964
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1859,12 +1966,12 @@ function ownKeys$2(object, enumerableOnly) {
1859
1966
  }
1860
1967
  return keys;
1861
1968
  }
1862
- function _object_spread_props$2(target, source) {
1969
+ function _object_spread_props$3(target, source) {
1863
1970
  source = source != null ? source : {};
1864
1971
  if (Object.getOwnPropertyDescriptors) {
1865
1972
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1866
1973
  } else {
1867
- ownKeys$2(Object(source)).forEach(function(key) {
1974
+ ownKeys$3(Object(source)).forEach(function(key) {
1868
1975
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1869
1976
  });
1870
1977
  }
@@ -1906,9 +2013,9 @@ function messageContentText(content) {
1906
2013
  }
1907
2014
  /**
1908
2015
  * Get workspace folder for sandbox from runnable configurable
1909
- *
1910
- * @param configurable
1911
- * @returns
2016
+ *
2017
+ * @param configurable
2018
+ * @returns
1912
2019
  */ function getWorkspaceFromRunnable(configurable) {
1913
2020
  return (configurable === null || configurable === void 0 ? void 0 : configurable.projectId) ? {
1914
2021
  type: "project",
@@ -1930,9 +2037,9 @@ function getToolCallIdFromConfig(config) {
1930
2037
  * Compute long-term memory namespace:
1931
2038
  * 1. When a user talks to a digital expert individually, use `ExpertId` + `UserId` to store memory
1932
2039
  * 2. When talking to a digital expert in a project, all users and digital experts share `ProjectId` to store memory
1933
- *
1934
- * @param config
1935
- * @returns
2040
+ *
2041
+ * @param config
2042
+ * @returns
1936
2043
  */ function getStoreNamespace(config) {
1937
2044
  var configurable = config.configurable;
1938
2045
  return configurableStoreNamespace(configurable);
@@ -1947,16 +2054,16 @@ function configurableStoreNamespace(configurable) {
1947
2054
  }
1948
2055
  /**
1949
2056
  * Set value into variable of state.
1950
- *
1951
- * @param state
1952
- * @param varName
1953
- * @param value
1954
- * @returns
2057
+ *
2058
+ * @param state
2059
+ * @param varName
2060
+ * @param value
2061
+ * @returns
1955
2062
  */ function setStateVariable(state, varName, value) {
1956
2063
  var _varName_split = _sliced_to_array$3(varName.split("."), 2), agentChannelName = _varName_split[0], variableName = _varName_split[1];
1957
2064
  if (variableName) {
1958
2065
  var _state_agentChannelName;
1959
- state[agentChannelName] = _object_spread_props$2(_object_spread$3({}, (_state_agentChannelName = state[agentChannelName]) !== null && _state_agentChannelName !== void 0 ? _state_agentChannelName : {}), _define_property$4({}, variableName, value));
2066
+ state[agentChannelName] = _object_spread_props$3(_object_spread$4({}, (_state_agentChannelName = state[agentChannelName]) !== null && _state_agentChannelName !== void 0 ? _state_agentChannelName : {}), _define_property$5({}, variableName, value));
1960
2067
  } else {
1961
2068
  state[agentChannelName] = value;
1962
2069
  }
@@ -1964,10 +2071,10 @@ function configurableStoreNamespace(configurable) {
1964
2071
  }
1965
2072
  /**
1966
2073
  * Get agent variable group from graph.
1967
- *
1968
- * @param key
1969
- * @param graph
1970
- * @returns
2074
+ *
2075
+ * @param key
2076
+ * @param graph
2077
+ * @returns
1971
2078
  */ function getAgentVarGroup(key, graph) {
1972
2079
  var _agent_options;
1973
2080
  var node = graph.nodes.find(function(_) {
@@ -2023,9 +2130,9 @@ function configurableStoreNamespace(configurable) {
2023
2130
  // Swarm
2024
2131
  /**
2025
2132
  * Get swarm partners of agent in team
2026
- *
2027
- * @param graph
2028
- * @param agentKey
2133
+ *
2134
+ * @param graph
2135
+ * @param agentKey
2029
2136
  */ function getSwarmPartners(graph, agentKey, partners, leaderKey) {
2030
2137
  var connections = graph.connections.filter(function(conn) {
2031
2138
  return conn.type === "agent" && conn.to === agentKey && (leaderKey ? conn.from !== leaderKey : true) && graph.connections.some(function(_) {
@@ -2047,7 +2154,9 @@ function getWorkflowTriggers(graph, from) {
2047
2154
  });
2048
2155
  }
2049
2156
 
2050
- exports.KnowledgeProviderEnum = void 0;
2157
+ /**
2158
+ * Non-internal types should remain the same as IntegrationEnum.
2159
+ */ exports.KnowledgeProviderEnum = void 0;
2051
2160
  (function(KnowledgeProviderEnum) {
2052
2161
  KnowledgeProviderEnum["Internal"] = "internal";
2053
2162
  })(exports.KnowledgeProviderEnum || (exports.KnowledgeProviderEnum = {}));
@@ -2062,18 +2171,20 @@ exports.KnowledgeStructureEnum = void 0;
2062
2171
  KnowledgeStructureEnum["ParentChild"] = "parent-child";
2063
2172
  KnowledgeStructureEnum["QA"] = "qa";
2064
2173
  })(exports.KnowledgeStructureEnum || (exports.KnowledgeStructureEnum = {}));
2065
- exports.KnowledgebasePermission = void 0;
2174
+ /**
2175
+ * Knowledgebase permission levels
2176
+ */ exports.KnowledgebasePermission = void 0;
2066
2177
  (function(KnowledgebasePermission) {
2067
2178
  /**
2068
- * Only visible to you
2069
- * @default
2070
- */ KnowledgebasePermission["Private"] = "private";
2179
+ * Only visible to you
2180
+ * @default
2181
+ */ KnowledgebasePermission["Private"] = "private";
2071
2182
  /**
2072
- * Visible to all members in the organization
2073
- */ KnowledgebasePermission["Organization"] = "organization";
2183
+ * Visible to all members in the organization
2184
+ */ KnowledgebasePermission["Organization"] = "organization";
2074
2185
  /**
2075
- * Visible to all members in the tenant
2076
- */ KnowledgebasePermission["Public"] = "public";
2186
+ * Visible to all members in the tenant
2187
+ */ KnowledgebasePermission["Public"] = "public";
2077
2188
  })(exports.KnowledgebasePermission || (exports.KnowledgebasePermission = {}));
2078
2189
  /**
2079
2190
  * Channel name for knowledgebase pipeline
@@ -2088,24 +2199,26 @@ var KNOWLEDGE_DOCUMENTS_NAME = "documents";
2088
2199
  var KNOWLEDGE_FOLDER_ID_NAME = "folder_id";
2089
2200
  var KNOWLEDGE_STAGE_NAME = "stage";
2090
2201
 
2091
- exports.DocumentSourceProviderCategoryEnum = void 0;
2202
+ /**
2203
+ * Category of document source provider
2204
+ */ exports.DocumentSourceProviderCategoryEnum = void 0;
2092
2205
  (function(DocumentSourceProviderCategoryEnum) {
2093
2206
  /**
2094
- * Local files uploaded directly to the system
2095
- */ DocumentSourceProviderCategoryEnum["LocalFile"] = "local-file";
2207
+ * Local files uploaded directly to the system
2208
+ */ DocumentSourceProviderCategoryEnum["LocalFile"] = "local-file";
2096
2209
  /**
2097
- * Remote file systems, e.g. S3, FTP, etc.
2098
- */ DocumentSourceProviderCategoryEnum["FileSystem"] = "file-system";
2210
+ * Remote file systems, e.g. S3, FTP, etc.
2211
+ */ DocumentSourceProviderCategoryEnum["FileSystem"] = "file-system";
2099
2212
  /**
2100
- * Online documents, e.g. public URLs, Google Docs, etc.
2101
- */ DocumentSourceProviderCategoryEnum["OnlineDocument"] = "online-document";
2213
+ * Online documents, e.g. public URLs, Google Docs, etc.
2214
+ */ DocumentSourceProviderCategoryEnum["OnlineDocument"] = "online-document";
2102
2215
  /**
2103
- * Web crawling from public websites
2104
- */ DocumentSourceProviderCategoryEnum["WebCrawl"] = "web-crawl";
2216
+ * Web crawling from public websites
2217
+ */ DocumentSourceProviderCategoryEnum["WebCrawl"] = "web-crawl";
2105
2218
  /**
2106
- * Database connections, e.g. MySQL, PostgreSQL, etc.
2107
- * @deprecated Planning
2108
- */ DocumentSourceProviderCategoryEnum["Database"] = "database";
2219
+ * Database connections, e.g. MySQL, PostgreSQL, etc.
2220
+ * @deprecated Planning
2221
+ */ DocumentSourceProviderCategoryEnum["Database"] = "database";
2109
2222
  })(exports.DocumentSourceProviderCategoryEnum || (exports.DocumentSourceProviderCategoryEnum = {}));
2110
2223
  function genPipelineSourceKey() {
2111
2224
  return letterStartSUID("Source_");
@@ -2123,7 +2236,7 @@ function genPipelineKnowledgeBaseKey() {
2123
2236
  return letterStartSUID("KnowledgeBase_");
2124
2237
  }
2125
2238
 
2126
- function _define_property$3(obj, key, value) {
2239
+ function _define_property$4(obj, key, value) {
2127
2240
  if (key in obj) {
2128
2241
  Object.defineProperty(obj, key, {
2129
2242
  value: value,
@@ -2136,7 +2249,7 @@ function _define_property$3(obj, key, value) {
2136
2249
  }
2137
2250
  return obj;
2138
2251
  }
2139
- function _object_spread$2(target) {
2252
+ function _object_spread$3(target) {
2140
2253
  for(var i = 1; i < arguments.length; i++){
2141
2254
  var source = arguments[i] != null ? arguments[i] : {};
2142
2255
  var ownKeys = Object.keys(source);
@@ -2146,23 +2259,30 @@ function _object_spread$2(target) {
2146
2259
  }));
2147
2260
  }
2148
2261
  ownKeys.forEach(function(key) {
2149
- _define_property$3(target, key, source[key]);
2262
+ _define_property$4(target, key, source[key]);
2150
2263
  });
2151
2264
  }
2152
2265
  return target;
2153
2266
  }
2154
- exports.DocumentTypeEnum = void 0;
2267
+ /**
2268
+ * Import Type:
2269
+ * - file: local file
2270
+ * - web: web document
2271
+ * ...
2272
+ */ exports.DocumentTypeEnum = void 0;
2155
2273
  (function(DocumentTypeEnum) {
2156
2274
  /**
2157
- * Folder, parent of other documents
2158
- */ DocumentTypeEnum["FOLDER"] = "folder";
2275
+ * Folder, parent of other documents
2276
+ */ DocumentTypeEnum["FOLDER"] = "folder";
2159
2277
  /**
2160
- * Local files
2161
- * @deprecated use DocumentSourceProviderCategoryEnum local file type instead
2162
- */ DocumentTypeEnum["FILE"] = "file";
2278
+ * Local files
2279
+ * @deprecated use DocumentSourceProviderCategoryEnum local file type instead
2280
+ */ DocumentTypeEnum["FILE"] = "file";
2163
2281
  })(exports.DocumentTypeEnum || (exports.DocumentTypeEnum = {}));
2164
- var KDocumentSourceType = _object_spread$2({}, exports.DocumentSourceProviderCategoryEnum, exports.DocumentTypeEnum);
2165
- exports.KBDocumentCategoryEnum = void 0;
2282
+ var KDocumentSourceType = _object_spread$3({}, exports.DocumentSourceProviderCategoryEnum, exports.DocumentTypeEnum);
2283
+ /**
2284
+ * Document type category, determine how to process the document.
2285
+ */ exports.KBDocumentCategoryEnum = void 0;
2166
2286
  (function(KBDocumentCategoryEnum) {
2167
2287
  KBDocumentCategoryEnum["Text"] = "text";
2168
2288
  KBDocumentCategoryEnum["Image"] = "image";
@@ -2227,7 +2347,7 @@ function isAudioType(type) {
2227
2347
  ].includes(type);
2228
2348
  }
2229
2349
  function classificateDocumentCategory(entity) {
2230
- return isDocumentSheet(entity.type) ? "sheet" : isImageType(entity.type) ? "image" : isVideoType(entity.type) ? "video" : isAudioType(entity.type) ? "audio" : "text";
2350
+ return isDocumentSheet(entity.type) ? exports.KBDocumentCategoryEnum.Sheet : isImageType(entity.type) ? exports.KBDocumentCategoryEnum.Image : isVideoType(entity.type) ? exports.KBDocumentCategoryEnum.Video : isAudioType(entity.type) ? exports.KBDocumentCategoryEnum.Audio : exports.KBDocumentCategoryEnum.Text;
2231
2351
  }
2232
2352
  /**
2233
2353
  * System standard Metadata field definition constants
@@ -2272,17 +2392,19 @@ function classificateDocumentCategory(entity) {
2272
2392
  exports.AIPermissionsEnum = void 0;
2273
2393
  (function(AIPermissionsEnum) {
2274
2394
  /**
2275
- * Create or edit Knowledgebase in organization.
2276
- */ AIPermissionsEnum["KNOWLEDGEBASE_EDIT"] = "KNOWLEDGEBASE_EDIT";
2395
+ * Create or edit Knowledgebase in organization.
2396
+ */ AIPermissionsEnum["KNOWLEDGEBASE_EDIT"] = "KNOWLEDGEBASE_EDIT";
2277
2397
  AIPermissionsEnum["COPILOT_VIEW"] = "COPILOT_VIEW";
2278
2398
  AIPermissionsEnum["COPILOT_EDIT"] = "COPILOT_EDIT";
2279
2399
  /**
2280
- * Create or edit Xperts in organization.
2281
- */ AIPermissionsEnum["XPERT_EDIT"] = "XPERT_EDIT";
2400
+ * Create or edit Xperts in organization.
2401
+ */ AIPermissionsEnum["XPERT_EDIT"] = "XPERT_EDIT";
2282
2402
  AIPermissionsEnum["CHAT_VIEW"] = "CHAT_VIEW";
2283
2403
  })(exports.AIPermissionsEnum || (exports.AIPermissionsEnum = {}));
2284
2404
 
2285
- exports.XpertAgentExecutionStatusEnum = void 0;
2405
+ /**
2406
+ * Corresponds to the status of Run in [Agent Protocol](https://github.com/langchain-ai/agent-protocol).
2407
+ */ exports.XpertAgentExecutionStatusEnum = void 0;
2286
2408
  (function(XpertAgentExecutionStatusEnum) {
2287
2409
  XpertAgentExecutionStatusEnum["RUNNING"] = "running";
2288
2410
  XpertAgentExecutionStatusEnum["SUCCESS"] = "success";
@@ -2311,7 +2433,7 @@ exports.ToolParameterForm = void 0;
2311
2433
  var TOOL_NAME_REGEX = /^[a-zA-Z0-9_-]+$/;
2312
2434
  // Helper functions for tools
2313
2435
  /**
2314
- *
2436
+ *
2315
2437
  * @param tool Tool
2316
2438
  * @param disableToolDefault Is default disable tools
2317
2439
  * @returns Tool is enabled?
@@ -2328,7 +2450,7 @@ var TOOL_NAME_REGEX = /^[a-zA-Z0-9_-]+$/;
2328
2450
  }
2329
2451
  /**
2330
2452
  * Tool is enabled?
2331
- *
2453
+ *
2332
2454
  * @deprecated use isToolEnabled
2333
2455
  */ function isEnableTool(tool, toolset) {
2334
2456
  var disabled = tool.disabled;
@@ -2372,11 +2494,11 @@ exports.XpertToolsetCategoryEnum = void 0;
2372
2494
  XpertToolsetCategoryEnum["BUILTIN"] = "builtin";
2373
2495
  XpertToolsetCategoryEnum["API"] = "api";
2374
2496
  /**
2375
- * [Anthropic Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction)
2376
- */ XpertToolsetCategoryEnum["MCP"] = "mcp";
2497
+ * [Anthropic Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction)
2498
+ */ XpertToolsetCategoryEnum["MCP"] = "mcp";
2377
2499
  /**
2378
- * @deprecated
2379
- */ XpertToolsetCategoryEnum["WORKFLOW"] = "workflow";
2500
+ * @deprecated
2501
+ */ XpertToolsetCategoryEnum["WORKFLOW"] = "workflow";
2380
2502
  })(exports.XpertToolsetCategoryEnum || (exports.XpertToolsetCategoryEnum = {}));
2381
2503
  exports.CredentialsType = void 0;
2382
2504
  (function(CredentialsType) {
@@ -2392,8 +2514,8 @@ exports.CredentialsType = void 0;
2392
2514
  exports.ApiProviderSchemaType = void 0;
2393
2515
  (function(ApiProviderSchemaType) {
2394
2516
  /**
2395
- * Enum class for api provider schema type.
2396
- */ ApiProviderSchemaType["OPENAPI"] = "openapi";
2517
+ * Enum class for api provider schema type.
2518
+ */ ApiProviderSchemaType["OPENAPI"] = "openapi";
2397
2519
  ApiProviderSchemaType["SWAGGER"] = "swagger";
2398
2520
  ApiProviderSchemaType["OPENAI_PLUGIN"] = "openai_plugin";
2399
2521
  ApiProviderSchemaType["OPENAI_ACTIONS"] = "openai_actions";
@@ -2422,7 +2544,9 @@ exports.ToolTagEnum = void 0;
2422
2544
  ToolTagEnum["OTHER"] = "other";
2423
2545
  })(exports.ToolTagEnum || (exports.ToolTagEnum = {}));
2424
2546
 
2425
- exports.XpertTableStatus = void 0;
2547
+ /**
2548
+ * Table status
2549
+ */ exports.XpertTableStatus = void 0;
2426
2550
  (function(XpertTableStatus) {
2427
2551
  XpertTableStatus["DRAFT"] = "draft";
2428
2552
  XpertTableStatus["READY"] = "ready";
@@ -2448,6 +2572,7 @@ function genXpertDBSqlKey() {
2448
2572
  return letterStartSUID("DBSql_");
2449
2573
  }
2450
2574
 
2575
+ // Helpers
2451
2576
  function _array_like_to_array$4(arr, len) {
2452
2577
  if (len == null || len > arr.length) len = arr.length;
2453
2578
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -2456,12 +2581,59 @@ function _array_like_to_array$4(arr, len) {
2456
2581
  function _array_without_holes$1(arr) {
2457
2582
  if (Array.isArray(arr)) return _array_like_to_array$4(arr);
2458
2583
  }
2584
+ function _define_property$3(obj, key, value) {
2585
+ if (key in obj) {
2586
+ Object.defineProperty(obj, key, {
2587
+ value: value,
2588
+ enumerable: true,
2589
+ configurable: true,
2590
+ writable: true
2591
+ });
2592
+ } else {
2593
+ obj[key] = value;
2594
+ }
2595
+ return obj;
2596
+ }
2459
2597
  function _iterable_to_array$2(iter) {
2460
2598
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2461
2599
  }
2462
2600
  function _non_iterable_spread$1() {
2463
2601
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2464
2602
  }
2603
+ function _object_spread$2(target) {
2604
+ for(var i = 1; i < arguments.length; i++){
2605
+ var source = arguments[i] != null ? arguments[i] : {};
2606
+ var ownKeys = Object.keys(source);
2607
+ if (typeof Object.getOwnPropertySymbols === "function") {
2608
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2609
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2610
+ }));
2611
+ }
2612
+ ownKeys.forEach(function(key) {
2613
+ _define_property$3(target, key, source[key]);
2614
+ });
2615
+ }
2616
+ return target;
2617
+ }
2618
+ function ownKeys$2(object, enumerableOnly) {
2619
+ var keys = Object.keys(object);
2620
+ if (Object.getOwnPropertySymbols) {
2621
+ var symbols = Object.getOwnPropertySymbols(object);
2622
+ keys.push.apply(keys, symbols);
2623
+ }
2624
+ return keys;
2625
+ }
2626
+ function _object_spread_props$2(target, source) {
2627
+ source = source != null ? source : {};
2628
+ if (Object.getOwnPropertyDescriptors) {
2629
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2630
+ } else {
2631
+ ownKeys$2(Object(source)).forEach(function(key) {
2632
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2633
+ });
2634
+ }
2635
+ return target;
2636
+ }
2465
2637
  function _object_without_properties$1(source, excluded) {
2466
2638
  if (source == null) return {};
2467
2639
  var target = _object_without_properties_loose$1(source, excluded);
@@ -2500,10 +2672,9 @@ function _unsupported_iterable_to_array$4(o, minLen) {
2500
2672
  if (n === "Map" || n === "Set") return Array.from(n);
2501
2673
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
2502
2674
  }
2503
- // Helpers
2504
2675
  function omitXpertRelations(xpert) {
2505
2676
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2506
- var _ref = xpert !== null && xpert !== void 0 ? xpert : {}; _ref.draft; _ref.agent; _ref.agents; _ref.executors; _ref.leaders; _ref.knowledgebases; _ref.knowledgebase; _ref.environment; _ref.integrations; _ref.toolsets; _ref.managers; var rest = _object_without_properties$1(_ref, [
2677
+ var _ref = xpert !== null && xpert !== void 0 ? xpert : {}; _ref.draft; _ref.agent; _ref.agents; _ref.executors; _ref.leaders; _ref.knowledgebases; _ref.knowledgebase; _ref.environment; _ref.integrations; _ref.toolsets; _ref.userGroups; var rest = _object_without_properties$1(_ref, [
2507
2678
  "draft",
2508
2679
  "agent",
2509
2680
  "agents",
@@ -2514,16 +2685,16 @@ function omitXpertRelations(xpert) {
2514
2685
  "environment",
2515
2686
  "integrations",
2516
2687
  "toolsets",
2517
- "managers"
2688
+ "userGroups"
2518
2689
  ]);
2519
2690
  return rest;
2520
2691
  }
2521
2692
  /**
2522
2693
  * Figure out latest xpert or draft xpert.
2523
- *
2524
- * @param xpert
2694
+ *
2695
+ * @param xpert
2525
2696
  * @param isDraft Is draft
2526
- * @returns
2697
+ * @returns
2527
2698
  */ function figureOutXpert(xpert, isDraft) {
2528
2699
  var _xpert_draft;
2529
2700
  var _ref;
@@ -2555,8 +2726,7 @@ function locateNodes(nodes, position) {
2555
2726
  var _node_size;
2556
2727
  var _node_size_width;
2557
2728
  return node.position.x + ((_node_size_width = (_node_size = node.size) === null || _node_size === void 0 ? void 0 : _node_size.width) !== null && _node_size_width !== void 0 ? _node_size_width : 240);
2558
- }) // Node width min 240
2559
- ;
2729
+ }); // Node width min 240
2560
2730
  var y0Positions = positions.map(function(pos) {
2561
2731
  return pos.y;
2562
2732
  });
@@ -2564,8 +2734,7 @@ function locateNodes(nodes, position) {
2564
2734
  var _node_size;
2565
2735
  var _node_size_height;
2566
2736
  return node.position.y + ((_node_size_height = (_node_size = node.size) === null || _node_size === void 0 ? void 0 : _node_size.height) !== null && _node_size_height !== void 0 ? _node_size_height : 70);
2567
- }) // Node height min 70
2568
- ;
2737
+ }); // Node height min 70
2569
2738
  var xRange = {
2570
2739
  min: (_Math = Math).min.apply(_Math, _to_consumable_array$1(x0Positions)),
2571
2740
  max: (_Math1 = Math).max.apply(_Math1, _to_consumable_array$1(x1Positions))
@@ -2683,8 +2852,7 @@ function locateNodes(nodes, position) {
2683
2852
  var _node_size;
2684
2853
  var _node_size_width;
2685
2854
  return node.position.x + ((_node_size_width = (_node_size = node.size) === null || _node_size === void 0 ? void 0 : _node_size.width) !== null && _node_size_width !== void 0 ? _node_size_width : 240);
2686
- }) // Node width min 240
2687
- ;
2855
+ }); // Node width min 240
2688
2856
  var y0Positions = positions.map(function(pos) {
2689
2857
  return pos.y;
2690
2858
  });
@@ -2692,8 +2860,7 @@ function locateNodes(nodes, position) {
2692
2860
  var _node_size;
2693
2861
  var _node_size_height;
2694
2862
  return node.position.y + ((_node_size_height = (_node_size = node.size) === null || _node_size === void 0 ? void 0 : _node_size.height) !== null && _node_size_height !== void 0 ? _node_size_height : 70);
2695
- }) // Node height min 70
2696
- ;
2863
+ }); // Node height min 70
2697
2864
  var xRange = {
2698
2865
  min: (_Math = Math).min.apply(_Math, _to_consumable_array$1(x0Positions)),
2699
2866
  max: (_Math1 = Math).max.apply(_Math1, _to_consumable_array$1(x1Positions))
@@ -2771,16 +2938,65 @@ function createAgentConnections(agent, collaborators) {
2771
2938
  });
2772
2939
  return connections;
2773
2940
  }
2941
+ function replaceAgentInDraft(draft, sourceKey, agent, options) {
2942
+ var _draft_nodes, _draft_connections;
2943
+ var targetKey = agent === null || agent === void 0 ? void 0 : agent.key;
2944
+ if (!targetKey) {
2945
+ throw new Error("Target agent key is required");
2946
+ }
2947
+ var replacedNode = false;
2948
+ var nodes = (_draft_nodes = draft.nodes) === null || _draft_nodes === void 0 ? void 0 : _draft_nodes.map(function(node) {
2949
+ if (node.type === "agent" && node.key === sourceKey) {
2950
+ replacedNode = true;
2951
+ var _node_entity;
2952
+ return _object_spread_props$2(_object_spread$2({}, node), {
2953
+ key: targetKey,
2954
+ entity: _object_spread_props$2(_object_spread$2({}, (_node_entity = node.entity) !== null && _node_entity !== void 0 ? _node_entity : {}, agent), {
2955
+ key: targetKey
2956
+ })
2957
+ });
2958
+ }
2959
+ return node;
2960
+ });
2961
+ if (!replacedNode && (options === null || options === void 0 ? void 0 : options.requireNode) !== false) {
2962
+ throw new Error("Can't find agent for key: ".concat(sourceKey));
2963
+ }
2964
+ var connections = (_draft_connections = draft.connections) === null || _draft_connections === void 0 ? void 0 : _draft_connections.map(function(connection) {
2965
+ var from = connection.from === sourceKey ? targetKey : connection.from;
2966
+ var to = connection.to === sourceKey ? targetKey : connection.to;
2967
+ if (from === connection.from && to === connection.to) {
2968
+ return connection;
2969
+ }
2970
+ return _object_spread_props$2(_object_spread$2({}, connection), {
2971
+ from: from,
2972
+ to: to,
2973
+ key: "".concat(from, "/").concat(to)
2974
+ });
2975
+ });
2976
+ return _object_spread_props$2(_object_spread$2({}, draft), {
2977
+ team: draft.team ? _object_spread_props$2(_object_spread$2({}, draft.team), {
2978
+ agent: draft.team.agent ? _object_spread_props$2(_object_spread$2({}, draft.team.agent, agent), {
2979
+ key: targetKey
2980
+ }) : _object_spread_props$2(_object_spread$2({}, agent), {
2981
+ key: targetKey
2982
+ })
2983
+ }) : draft.team,
2984
+ nodes: nodes,
2985
+ connections: connections
2986
+ });
2987
+ }
2774
2988
 
2775
2989
  exports.ApiAuthType = void 0;
2776
2990
  (function(ApiAuthType) {
2777
2991
  /**
2778
- * Enum class for api provider auth type.
2779
- */ ApiAuthType["NONE"] = "none";
2992
+ * Enum class for api provider auth type.
2993
+ */ ApiAuthType["NONE"] = "none";
2780
2994
  ApiAuthType["API_KEY"] = "api_key";
2781
2995
  ApiAuthType["BASIC"] = "basic";
2782
2996
  })(exports.ApiAuthType || (exports.ApiAuthType = {}));
2783
- exports.EmbeddingStatusEnum = void 0;
2997
+ /**
2998
+ * Embedding status of an entity, such as an bi indicator or kb document.
2999
+ */ exports.EmbeddingStatusEnum = void 0;
2784
3000
  (function(EmbeddingStatusEnum) {
2785
3001
  EmbeddingStatusEnum["PROCESSING"] = "processing";
2786
3002
  EmbeddingStatusEnum["SUCCESS"] = "success";
@@ -2841,7 +3057,14 @@ exports.MCPServerType = void 0;
2841
3057
  MCPServerType["HTTP"] = "http";
2842
3058
  })(exports.MCPServerType || (exports.MCPServerType = {}));
2843
3059
 
2844
- function _define_property$2(obj, key, value) {
3060
+ /**
3061
+ * Build a hierarchical tree structure from a flat list of DocumentInterface objects,
3062
+ * and
3063
+ *
3064
+ * @template Metadata - Type of metadata, defaults to IDocChunkMetadata
3065
+ * @param documents - A flat array of DocumentInterface objects
3066
+ * @returns the hierarchical tree (root-level DocumentInterface[])
3067
+ */ function _define_property$2(obj, key, value) {
2845
3068
  if (key in obj) {
2846
3069
  Object.defineProperty(obj, key, {
2847
3070
  value: value,
@@ -2888,14 +3111,7 @@ function _object_spread_props$1(target, source) {
2888
3111
  }
2889
3112
  return target;
2890
3113
  }
2891
- /**
2892
- * Build a hierarchical tree structure from a flat list of DocumentInterface objects,
2893
- * and
2894
- *
2895
- * @template Metadata - Type of metadata, defaults to IDocChunkMetadata
2896
- * @param documents - A flat array of DocumentInterface objects
2897
- * @returns the hierarchical tree (root-level DocumentInterface[])
2898
- */ function buildChunkTree(documents) {
3114
+ function buildChunkTree(documents) {
2899
3115
  if (!documents || documents.length === 0) return [];
2900
3116
  // Step 1. Build a lookup map for quick access by chunkId
2901
3117
  var map = new Map();
@@ -2959,9 +3175,9 @@ function _object_spread_props$1(target, source) {
2959
3175
  }
2960
3176
  /**
2961
3177
  * Find all leaf nodes (nodes without children).
2962
- *
2963
- * @param roots
2964
- * @returns
3178
+ *
3179
+ * @param roots
3180
+ * @returns
2965
3181
  */ function collectTreeLeaves(roots) {
2966
3182
  var leaves = [];
2967
3183
  var collectLeaves = function(node) {
@@ -3049,6 +3265,12 @@ function getAgentMiddlewareNodes(graph, agentKey) {
3049
3265
  return middlewares;
3050
3266
  }
3051
3267
 
3268
+ var SANDBOX_WORK_FOR_TYPES = [
3269
+ "user",
3270
+ "project",
3271
+ "environment"
3272
+ ];
3273
+
3052
3274
  function _array_like_to_array$3(arr, len) {
3053
3275
  if (len == null || len > arr.length) len = arr.length;
3054
3276
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -3238,9 +3460,6 @@ function getSeparator(previousType, previousText, nextText, joinHint) {
3238
3460
  if (joinHint) {
3239
3461
  return mapJoinHint(joinHint);
3240
3462
  }
3241
- if (previousType === "component") {
3242
- return "\n\n";
3243
- }
3244
3463
  if (endsWithCodeFence(previousText)) {
3245
3464
  return "\n";
3246
3465
  }
@@ -3292,6 +3511,25 @@ function filterText(content) {
3292
3511
  }
3293
3512
  return "";
3294
3513
  }
3514
+ function mergeTextChunkForDisplay(previous, incoming) {
3515
+ return _object_spread(_object_spread_props(_object_spread({}, previous), {
3516
+ text: "".concat(previous.text).concat(incoming.text)
3517
+ }), !previous.id && incoming.id ? {
3518
+ id: incoming.id
3519
+ } : {}, !previous.agentKey && incoming.agentKey ? {
3520
+ agentKey: incoming.agentKey
3521
+ } : {}, !previous.xpertName && incoming.xpertName ? {
3522
+ xpertName: incoming.xpertName
3523
+ } : {});
3524
+ }
3525
+ function stripAutoDisplaySeparator(incoming, previousOriginal) {
3526
+ if ((previousOriginal === null || previousOriginal === void 0 ? void 0 : previousOriginal.type) === "component" && incoming.text.startsWith("\n\n")) {
3527
+ return _object_spread_props(_object_spread({}, incoming), {
3528
+ text: incoming.text.slice(1)
3529
+ });
3530
+ }
3531
+ return incoming;
3532
+ }
3295
3533
  function mergeComponentData(previous, incoming) {
3296
3534
  var _previous_data, _incoming_data;
3297
3535
  var _incoming_data1;
@@ -3367,7 +3605,7 @@ function resolveMessageAppendContext(options) {
3367
3605
  * - `previous` must be supplied by caller when same-stream join inference is needed.
3368
3606
  */ function appendMessageContent(aiMessage, incoming, context) {
3369
3607
  aiMessage.status = "answering";
3370
- var _ref = context !== null && context !== void 0 ? context : {}, previous = _ref.previous, contextWithoutPrevious = _object_without_properties(_ref, [
3608
+ var _ref = context !== null && context !== void 0 ? context : {}; _ref.previous; var contextWithoutPrevious = _object_without_properties(_ref, [
3371
3609
  "previous"
3372
3610
  ]);
3373
3611
  var resolvedContext = _object_spread({}, inferMessageAppendContext(incoming), contextWithoutPrevious);
@@ -3393,39 +3631,48 @@ function resolveMessageAppendContext(options) {
3393
3631
  }
3394
3632
  var chunks = ensureArrayContent(aiMessage.content);
3395
3633
  if (isTextContent(content)) {
3396
- var _resolvedContext_joinHint;
3397
- var joinHint = (_resolvedContext_joinHint = resolvedContext.joinHint) !== null && _resolvedContext_joinHint !== void 0 ? _resolvedContext_joinHint : shouldJoinWithoutSeparator(previous, resolvedContext) ? "none" : undefined;
3634
+ if (content.id) {
3635
+ var index = chunks.findIndex(function(item) {
3636
+ return isTextContent(item) && item.id === content.id;
3637
+ });
3638
+ if (index > -1) {
3639
+ var mergedContent = _object_spread(_object_spread_props(_object_spread({}, chunks[index]), {
3640
+ text: "".concat(chunks[index].text).concat(content.text)
3641
+ }), !chunks[index].id && content.id ? {
3642
+ id: content.id
3643
+ } : {}, !chunks[index].agentKey && content.agentKey ? {
3644
+ agentKey: content.agentKey
3645
+ } : {}, !chunks[index].xpertName && content.xpertName ? {
3646
+ xpertName: content.xpertName
3647
+ } : {});
3648
+ aiMessage.content = _to_consumable_array(chunks.slice(0, index)).concat([
3649
+ mergedContent
3650
+ ], _to_consumable_array(chunks.slice(index + 1)));
3651
+ return;
3652
+ }
3653
+ }
3398
3654
  var lastContent = chunks[chunks.length - 1];
3399
- if (isTextContent(lastContent) && (joinHint === "none" || !!content.id && !!lastContent.id && lastContent.id === content.id)) {
3400
- var mergedLastContent = _object_spread(_object_spread_props(_object_spread({}, lastContent), {
3655
+ if (isTextContent(lastContent) && !lastContent.id && !content.id) {
3656
+ var mergedLastContent = _object_spread_props(_object_spread({}, lastContent), {
3401
3657
  text: "".concat(lastContent.text).concat(content.text)
3402
- }), !lastContent.id && content.id ? {
3403
- id: content.id
3404
- } : {});
3658
+ });
3405
3659
  aiMessage.content = _to_consumable_array(chunks.slice(0, chunks.length - 1)).concat([
3406
3660
  mergedLastContent
3407
3661
  ]);
3408
3662
  return;
3409
3663
  }
3410
- var _lastContent_type;
3411
- var previousType = (_lastContent_type = lastContent === null || lastContent === void 0 ? void 0 : lastContent.type) !== null && _lastContent_type !== void 0 ? _lastContent_type : null;
3412
- var previousText = isTextContent(lastContent) ? lastContent.text : "";
3413
- var separator = getSeparator(previousType, previousText, content.text, joinHint);
3414
- var appended = _object_spread_props(_object_spread({}, content), {
3415
- text: separator + content.text
3416
- });
3417
3664
  aiMessage.content = _to_consumable_array(chunks).concat([
3418
- appended
3665
+ content
3419
3666
  ]);
3420
3667
  return;
3421
3668
  }
3422
3669
  var nextChunks = _to_consumable_array(chunks);
3423
3670
  if (isComponentContent(content) && content.id) {
3424
- var index = nextChunks.findIndex(function(item) {
3671
+ var index1 = nextChunks.findIndex(function(item) {
3425
3672
  return isComponentContent(item) && item.id === content.id;
3426
3673
  });
3427
- if (index > -1) {
3428
- nextChunks[index] = mergeComponentData(nextChunks[index], content);
3674
+ if (index1 > -1) {
3675
+ nextChunks[index1] = mergeComponentData(nextChunks[index1], content);
3429
3676
  } else {
3430
3677
  nextChunks.push(content);
3431
3678
  }
@@ -3444,6 +3691,54 @@ function appendMessagePlainText(accumulator, incoming, context) {
3444
3691
  var separator = getSeparator("text", previous, nextText, resolvedContext.joinHint);
3445
3692
  return previous + separator + nextText;
3446
3693
  }
3694
+ /**
3695
+ * Creates a display-only content view that reassembles text chunks belonging to
3696
+ * the same stream id. This preserves markdown continuity without changing the
3697
+ * underlying stored/streamed message structure.
3698
+ */ function mergeMessageContentForDisplay(content) {
3699
+ if (!content) {
3700
+ return null;
3701
+ }
3702
+ if (typeof content === "string") {
3703
+ return content.length ? [
3704
+ {
3705
+ type: "text",
3706
+ text: content
3707
+ }
3708
+ ] : null;
3709
+ }
3710
+ if (!Array.isArray(content)) {
3711
+ return [
3712
+ content
3713
+ ];
3714
+ }
3715
+ var merged = [];
3716
+ var textIndexById = new Map();
3717
+ content.forEach(function(item, itemIndex) {
3718
+ if (!isTextContent(item)) {
3719
+ merged.push(item);
3720
+ return;
3721
+ }
3722
+ if (item.id) {
3723
+ var mergedIndex = textIndexById.get(item.id);
3724
+ if (mergedIndex !== undefined && isTextContent(merged[mergedIndex])) {
3725
+ var previousOriginal = content[itemIndex - 1];
3726
+ merged[mergedIndex] = mergeTextChunkForDisplay(merged[mergedIndex], stripAutoDisplaySeparator(item, previousOriginal));
3727
+ return;
3728
+ }
3729
+ textIndexById.set(item.id, merged.length);
3730
+ merged.push(_object_spread({}, item));
3731
+ return;
3732
+ }
3733
+ var lastItem = merged[merged.length - 1];
3734
+ if (isTextContent(lastItem) && !lastItem.id && lastItem.agentKey === item.agentKey && lastItem.xpertName === item.xpertName) {
3735
+ merged[merged.length - 1] = mergeTextChunkForDisplay(lastItem, item);
3736
+ return;
3737
+ }
3738
+ merged.push(_object_spread({}, item));
3739
+ });
3740
+ return merged.length ? merged : null;
3741
+ }
3447
3742
  function stringifyMessageContent(content) {
3448
3743
  if (typeof content === "string") {
3449
3744
  return content;
@@ -3487,6 +3782,45 @@ function filterMessageText(content) {
3487
3782
  return filterText(content) || null;
3488
3783
  }
3489
3784
 
3785
+ var STATE_VARIABLE_HUMAN = "human";
3786
+ exports.ChatMessageTypeEnum = void 0;
3787
+ (function(ChatMessageTypeEnum) {
3788
+ ChatMessageTypeEnum["MESSAGE"] = "message";
3789
+ ChatMessageTypeEnum["EVENT"] = "event";
3790
+ })(exports.ChatMessageTypeEnum || (exports.ChatMessageTypeEnum = {}));
3791
+ exports.ChatMessageEventTypeEnum = void 0;
3792
+ (function(ChatMessageEventTypeEnum) {
3793
+ ChatMessageEventTypeEnum["ON_CONVERSATION_START"] = "on_conversation_start";
3794
+ ChatMessageEventTypeEnum["ON_CONVERSATION_END"] = "on_conversation_end";
3795
+ ChatMessageEventTypeEnum["ON_MESSAGE_START"] = "on_message_start";
3796
+ ChatMessageEventTypeEnum["ON_MESSAGE_END"] = "on_message_end";
3797
+ ChatMessageEventTypeEnum["ON_TOOL_START"] = "on_tool_start";
3798
+ ChatMessageEventTypeEnum["ON_TOOL_END"] = "on_tool_end";
3799
+ ChatMessageEventTypeEnum["ON_TOOL_ERROR"] = "on_tool_error";
3800
+ ChatMessageEventTypeEnum["ON_TOOL_MESSAGE"] = "on_tool_message";
3801
+ ChatMessageEventTypeEnum["ON_AGENT_START"] = "on_agent_start";
3802
+ ChatMessageEventTypeEnum["ON_AGENT_END"] = "on_agent_end";
3803
+ ChatMessageEventTypeEnum["ON_RETRIEVER_START"] = "on_retriever_start";
3804
+ ChatMessageEventTypeEnum["ON_RETRIEVER_END"] = "on_retriever_end";
3805
+ ChatMessageEventTypeEnum["ON_RETRIEVER_ERROR"] = "on_retriever_error";
3806
+ ChatMessageEventTypeEnum["ON_INTERRUPT"] = "on_interrupt";
3807
+ ChatMessageEventTypeEnum["ON_ERROR"] = "on_error";
3808
+ ChatMessageEventTypeEnum["ON_CHAT_EVENT"] = "on_chat_event";
3809
+ ChatMessageEventTypeEnum["ON_CLIENT_EFFECT"] = "on_client_effect";
3810
+ })(exports.ChatMessageEventTypeEnum || (exports.ChatMessageEventTypeEnum = {}));
3811
+ exports.ChatMessageStepCategory = void 0;
3812
+ (function(ChatMessageStepCategory) {
3813
+ ChatMessageStepCategory["List"] = "list";
3814
+ ChatMessageStepCategory["WebSearch"] = "web_search";
3815
+ ChatMessageStepCategory["Files"] = "files";
3816
+ ChatMessageStepCategory["File"] = "file";
3817
+ ChatMessageStepCategory["Program"] = "program";
3818
+ ChatMessageStepCategory["Iframe"] = "iframe";
3819
+ ChatMessageStepCategory["Memory"] = "memory";
3820
+ ChatMessageStepCategory["Tasks"] = "tasks";
3821
+ ChatMessageStepCategory["Knowledges"] = "knowledges";
3822
+ })(exports.ChatMessageStepCategory || (exports.ChatMessageStepCategory = {}));
3823
+
3490
3824
  exports.PermissionsEnum = void 0;
3491
3825
  (function(PermissionsEnum) {
3492
3826
  PermissionsEnum["PROFILE_EDIT"] = "PROFILE_EDIT";
@@ -3524,14 +3858,17 @@ exports.PermissionsEnum = void 0;
3524
3858
  var PermissionGroups = {
3525
3859
  //Permissions which can be given to any role
3526
3860
  GENERAL: [
3527
- "PROFILE_EDIT",
3528
- "ADMIN_DASHBOARD_VIEW",
3529
- "ORG_INVITE_VIEW",
3530
- "ORG_INVITE_EDIT",
3531
- "VIEW_ALL_EMAILS",
3532
- "VIEW_ALL_EMAIL_TEMPLATES",
3533
- "INTEGRATION_EDIT",
3534
- "ORG_DEMO_EDIT",
3861
+ exports.PermissionsEnum.PROFILE_EDIT,
3862
+ exports.PermissionsEnum.ADMIN_DASHBOARD_VIEW,
3863
+ exports.PermissionsEnum.ORG_INVITE_VIEW,
3864
+ exports.PermissionsEnum.ORG_INVITE_EDIT,
3865
+ // PermissionsEnum.ORG_TAGS_EDIT,
3866
+ exports.PermissionsEnum.VIEW_ALL_EMAILS,
3867
+ exports.PermissionsEnum.VIEW_ALL_EMAIL_TEMPLATES,
3868
+ // PermissionsEnum.ORG_HELP_CENTER_EDIT,
3869
+ exports.PermissionsEnum.INTEGRATION_EDIT,
3870
+ // PermissionsEnum.ORG_CONTACT_VIEW,
3871
+ exports.PermissionsEnum.ORG_DEMO_EDIT,
3535
3872
  // PermissionsEnum.VIEW_ALL_ACCOUNTING_TEMPLATES,
3536
3873
  // AI
3537
3874
  exports.AIPermissionsEnum.KNOWLEDGEBASE_EDIT,
@@ -3563,16 +3900,16 @@ var PermissionGroups = {
3563
3900
  ],
3564
3901
  //Readonly permissions, are only enabled for admin role
3565
3902
  ADMINISTRATION: [
3566
- "ORG_USERS_VIEW",
3567
- "ORG_USERS_EDIT",
3568
- "ALL_ORG_VIEW",
3569
- "ALL_ORG_EDIT",
3570
- "CHANGE_SELECTED_ORGANIZATION",
3571
- "CHANGE_ROLES_PERMISSIONS",
3572
- "SUPER_ADMIN_EDIT",
3573
- "INTEGRATION_VIEW",
3574
- "ACCESS_DELETE_ACCOUNT",
3575
- "ACCESS_DELETE_ALL_DATA"
3903
+ exports.PermissionsEnum.ORG_USERS_VIEW,
3904
+ exports.PermissionsEnum.ORG_USERS_EDIT,
3905
+ exports.PermissionsEnum.ALL_ORG_VIEW,
3906
+ exports.PermissionsEnum.ALL_ORG_EDIT,
3907
+ exports.PermissionsEnum.CHANGE_SELECTED_ORGANIZATION,
3908
+ exports.PermissionsEnum.CHANGE_ROLES_PERMISSIONS,
3909
+ exports.PermissionsEnum.SUPER_ADMIN_EDIT,
3910
+ exports.PermissionsEnum.INTEGRATION_VIEW,
3911
+ exports.PermissionsEnum.ACCESS_DELETE_ACCOUNT,
3912
+ exports.PermissionsEnum.ACCESS_DELETE_ALL_DATA
3576
3913
  ]
3577
3914
  };
3578
3915
 
@@ -3598,21 +3935,29 @@ exports.RolesEnum = void 0;
3598
3935
  (function(RolesEnum) {
3599
3936
  RolesEnum["SUPER_ADMIN"] = "SUPER_ADMIN";
3600
3937
  RolesEnum["ADMIN"] = "ADMIN";
3601
- RolesEnum["DATA_ENTRY"] = "DATA_ENTRY";
3602
- RolesEnum["EMPLOYEE"] = "EMPLOYEE";
3603
- RolesEnum["CANDIDATE"] = "CANDIDATE";
3604
- RolesEnum["MANAGER"] = "MANAGER";
3938
+ RolesEnum["AI_BUILDER"] = "AI_BUILDER";
3939
+ RolesEnum["ANALYTICS_BUILDER"] = "ANALYTICS_BUILDER";
3605
3940
  RolesEnum["VIEWER"] = "VIEWER";
3606
- // 有所免费用户
3941
+ // Trial account
3607
3942
  RolesEnum["TRIAL"] = "TRIAL";
3608
3943
  })(exports.RolesEnum || (exports.RolesEnum = {}));
3944
+ var DEFAULT_SYSTEM_ROLES = [
3945
+ exports.RolesEnum.SUPER_ADMIN,
3946
+ exports.RolesEnum.ADMIN,
3947
+ exports.RolesEnum.TRIAL,
3948
+ exports.RolesEnum.AI_BUILDER,
3949
+ exports.RolesEnum.ANALYTICS_BUILDER,
3950
+ exports.RolesEnum.VIEWER
3951
+ ];
3609
3952
 
3610
3953
  exports.UserType = void 0;
3611
3954
  (function(UserType) {
3612
3955
  UserType["USER"] = "user";
3613
3956
  UserType["COMMUNICATION"] = "communication";
3614
3957
  })(exports.UserType || (exports.UserType = {}));
3615
- exports.LanguagesEnum = void 0;
3958
+ /**
3959
+ * Browser http header `Language`
3960
+ */ exports.LanguagesEnum = void 0;
3616
3961
  (function(LanguagesEnum) {
3617
3962
  LanguagesEnum["Chinese"] = "zh-CN";
3618
3963
  LanguagesEnum["SimplifiedChinese"] = "zh-Hans";
@@ -3620,23 +3965,29 @@ exports.LanguagesEnum = void 0;
3620
3965
  LanguagesEnum["English"] = "en";
3621
3966
  })(exports.LanguagesEnum || (exports.LanguagesEnum = {}));
3622
3967
  var LanguagesMap = {
3623
- "zh-CN": "zh-Hans",
3624
- "zh-Hans": "zh-Hans",
3625
- "zh": "zh-Hans"
3968
+ "zh-CN": exports.LanguagesEnum.SimplifiedChinese,
3969
+ "zh-Hans": exports.LanguagesEnum.SimplifiedChinese,
3970
+ "zh": exports.LanguagesEnum.SimplifiedChinese
3626
3971
  };
3972
+ // export enum ComponentLayoutStyleEnum {
3973
+ // CARDS_GRID = 'CARDS_GRID',
3974
+ // TABLE = 'TABLE'
3975
+ // }
3627
3976
  exports.ProviderEnum = void 0;
3628
3977
  (function(ProviderEnum) {
3629
3978
  ProviderEnum["GOOGLE"] = "google";
3630
3979
  ProviderEnum["FACEBOOK"] = "facebook";
3631
3980
  })(exports.ProviderEnum || (exports.ProviderEnum = {}));
3632
3981
 
3633
- /* eslint-disable @typescript-eslint/no-empty-interface */ exports.SMTPSecureEnum = void 0;
3982
+ exports.SMTPSecureEnum = void 0;
3634
3983
  (function(SMTPSecureEnum) {
3635
3984
  SMTPSecureEnum["TRUE"] = "True";
3636
3985
  SMTPSecureEnum["FALSE"] = "False";
3637
3986
  })(exports.SMTPSecureEnum || (exports.SMTPSecureEnum = {}));
3638
3987
 
3639
- exports.IntegrationEnum = void 0;
3988
+ /**
3989
+ * @deprecated use Plugins instead
3990
+ */ exports.IntegrationEnum = void 0;
3640
3991
  (function(IntegrationEnum) {
3641
3992
  IntegrationEnum["UPWORK"] = "Upwork";
3642
3993
  IntegrationEnum["HUBSTAFF"] = "Hubstaff";
@@ -3664,15 +4015,15 @@ exports.IntegrationFilterEnum = void 0;
3664
4015
  })(exports.IntegrationFilterEnum || (exports.IntegrationFilterEnum = {}));
3665
4016
  var DEFAULT_INTEGRATION_PAID_FILTERS = [
3666
4017
  {
3667
- label: "All",
4018
+ label: exports.IntegrationFilterEnum.ALL,
3668
4019
  value: "all"
3669
4020
  },
3670
4021
  {
3671
- label: "Free",
4022
+ label: exports.IntegrationFilterEnum.FREE,
3672
4023
  value: "false"
3673
4024
  },
3674
4025
  {
3675
- label: "Paid",
4026
+ label: exports.IntegrationFilterEnum.PAID,
3676
4027
  value: "true"
3677
4028
  }
3678
4029
  ];
@@ -3716,6 +4067,12 @@ exports.Visibility = void 0;
3716
4067
  Visibility["Private"] = "private";
3717
4068
  })(exports.Visibility || (exports.Visibility = {}));
3718
4069
 
4070
+ exports.RequestScopeLevel = void 0;
4071
+ (function(RequestScopeLevel) {
4072
+ RequestScopeLevel["TENANT"] = "tenant";
4073
+ RequestScopeLevel["ORGANIZATION"] = "organization";
4074
+ })(exports.RequestScopeLevel || (exports.RequestScopeLevel = {}));
4075
+
3719
4076
  var IntegrationDingTalkProvider = {
3720
4077
  name: exports.IntegrationEnum.DINGTALK,
3721
4078
  label: {
@@ -4045,10 +4402,10 @@ function findStartNodes(graph, key) {
4045
4402
  }
4046
4403
  /**
4047
4404
  * Keep the content in the same graph as the key node (including the node, its connected nodes, and the 'edge' type connections between them)
4048
- *
4049
- * @param graph
4050
- * @param key
4051
- * @returns
4405
+ *
4406
+ * @param graph
4407
+ * @param key
4408
+ * @returns
4052
4409
  */ function getCurrentGraph(graph, key) {
4053
4410
  var validConnections = graph.connections.filter(function(conn) {
4054
4411
  return conn.type === "edge";
@@ -4169,13 +4526,13 @@ function _unsupported_iterable_to_array$1(o, minLen) {
4169
4526
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
4170
4527
  }
4171
4528
  /**
4172
- *
4529
+ *
4173
4530
  * Returns the variable schema for a given variable name.
4174
4531
  * The variable name can be in the format of 'groupName.variableName' or just 'variableName'.
4175
- *
4176
- * @param variables
4177
- * @param variable
4178
- * @returns
4532
+ *
4533
+ * @param variables
4534
+ * @param variable
4535
+ * @returns
4179
4536
  */ function getVariableSchema(variables, variable) {
4180
4537
  var _variable_split;
4181
4538
  var _ref = _to_array((_variable_split = variable === null || variable === void 0 ? void 0 : variable.split(".")) !== null && _variable_split !== void 0 ? _variable_split : []), groupName = _ref[0], rest = _ref.slice(1);
@@ -4238,6 +4595,22 @@ function isInterruptMessage(obj) {
4238
4595
  return obj && typeof obj === "object" && "type" in obj && "category" in obj;
4239
4596
  }
4240
4597
 
4598
+ /**
4599
+ * Optional request header used by third-party callers to explicitly set the
4600
+ * business user represented by the current request context.
4601
+ */ var API_PRINCIPAL_USER_ID_HEADER = "x-principal-user-id";
4602
+ /**
4603
+ * Stable binding kinds used to resolve long-lived technical principals.
4604
+ */ exports.ApiKeyBindingType = void 0;
4605
+ (function(ApiKeyBindingType) {
4606
+ ApiKeyBindingType["ASSISTANT"] = "assistant";
4607
+ ApiKeyBindingType["INTEGRATION"] = "integration";
4608
+ ApiKeyBindingType["CLIENT"] = "client";
4609
+ /**
4610
+ * @deprecated legacy type, do not use for new keys. Will be resolved as assistant for backward compatibility.
4611
+ */ ApiKeyBindingType["KNOWLEDGEBASE"] = "knowledgebase";
4612
+ })(exports.ApiKeyBindingType || (exports.ApiKeyBindingType = {}));
4613
+
4241
4614
  function _array_like_to_array(arr, len) {
4242
4615
  if (len == null || len > arr.length) len = arr.length;
4243
4616
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -4300,9 +4673,9 @@ exports.TaskFrequency = void 0;
4300
4673
  })(exports.TaskFrequency || (exports.TaskFrequency = {}));
4301
4674
  /**
4302
4675
  * Generate cron expression: Minutes Hour Day Month Week
4303
- *
4304
- * @param schedule
4305
- * @returns
4676
+ *
4677
+ * @param schedule
4678
+ * @returns
4306
4679
  */ function generateCronExpression(schedule) {
4307
4680
  if (!schedule.time) throw new Error("Time is required for scheduling");
4308
4681
  var _schedule_time_split = _sliced_to_array(schedule.time.split(":"), 2), hourStr = _schedule_time_split[0], minuteStr = _schedule_time_split[1];
@@ -4312,22 +4685,22 @@ exports.TaskFrequency = void 0;
4312
4685
  throw new Error("Invalid time format. Expected HH:mm with valid hour and minute.");
4313
4686
  }
4314
4687
  switch(schedule.frequency){
4315
- case "Once":
4688
+ case exports.TaskFrequency.Once:
4316
4689
  {
4317
4690
  if (!schedule.date) throw new Error("Date is required for Once schedule");
4318
4691
  var date = new Date(schedule.date);
4319
4692
  // if (isNaN(date.getTime())) throw new Error('Invalid date format for Once schedule');
4320
4693
  return "".concat(minute, " ").concat(hour, " ").concat(date.getDate(), " ").concat(date.getMonth() + 1, " *");
4321
4694
  }
4322
- case "Daily":
4695
+ case exports.TaskFrequency.Daily:
4323
4696
  return "".concat(minute, " ").concat(hour, " * * *");
4324
- case "Weekly":
4697
+ case exports.TaskFrequency.Weekly:
4325
4698
  if (schedule.dayOfWeek === undefined || schedule.dayOfWeek < 0 || schedule.dayOfWeek > 6) throw new Error("Valid dayOfWeek (0-6) is required for Weekly schedule");
4326
4699
  return "".concat(minute, " ").concat(hour, " * * ").concat(schedule.dayOfWeek);
4327
- case "Monthly":
4700
+ case exports.TaskFrequency.Monthly:
4328
4701
  if (!schedule.dayOfMonth || schedule.dayOfMonth < 1 || schedule.dayOfMonth > 31) throw new Error("Valid dayOfMonth (1-31) is required for Monthly schedule");
4329
4702
  return "".concat(minute, " ").concat(hour, " ").concat(schedule.dayOfMonth, " * *");
4330
- case "Yearly":
4703
+ case exports.TaskFrequency.Yearly:
4331
4704
  {
4332
4705
  if (!schedule.date) throw new Error("Date is required for Yearly schedule");
4333
4706
  var date1 = new Date(schedule.date);
@@ -4350,9 +4723,29 @@ var PLUGIN_LEVEL = {
4350
4723
  SYSTEM: "system",
4351
4724
  ORGANIZATION: "organization"
4352
4725
  };
4726
+ var PLUGIN_SOURCE = {
4727
+ MARKETPLACE: "marketplace",
4728
+ LOCAL: "local",
4729
+ GIT: "git",
4730
+ URL: "url",
4731
+ NPM: "npm",
4732
+ CODE: "code",
4733
+ ENV: "env"
4734
+ };
4735
+ var PLUGIN_CONFIGURATION_STATUS = {
4736
+ VALID: "valid",
4737
+ INVALID: "invalid"
4738
+ };
4739
+ var PLUGIN_LOAD_STATUS = {
4740
+ LOADED: "loaded",
4741
+ FAILED: "failed"
4742
+ };
4353
4743
 
4354
4744
  exports.AI_MODEL_TYPE_VARIABLE = AI_MODEL_TYPE_VARIABLE;
4745
+ exports.API_PRINCIPAL_USER_ID_HEADER = API_PRINCIPAL_USER_ID_HEADER;
4355
4746
  exports.Attachment_Type_Options = Attachment_Type_Options;
4747
+ exports.CHAT_EVENT_TYPE_CONVERSATION_TITLE_SUMMARY = CHAT_EVENT_TYPE_CONVERSATION_TITLE_SUMMARY;
4748
+ exports.CHAT_EVENT_TYPE_THREAD_CONTEXT_USAGE = CHAT_EVENT_TYPE_THREAD_CONTEXT_USAGE;
4356
4749
  exports.CONTEXT_VARIABLE_CURRENTSTATE = CONTEXT_VARIABLE_CURRENTSTATE;
4357
4750
  exports.DEFAULT_CURRENCIES = DEFAULT_CURRENCIES;
4358
4751
  exports.DEFAULT_DATE_FORMATS = DEFAULT_DATE_FORMATS;
@@ -4360,6 +4753,7 @@ exports.DEFAULT_INTEGRATION_PAID_FILTERS = DEFAULT_INTEGRATION_PAID_FILTERS;
4360
4753
  exports.DEFAULT_INVITE_EXPIRY_PERIOD = DEFAULT_INVITE_EXPIRY_PERIOD;
4361
4754
  exports.DEFAULT_PROFIT_BASED_BONUS = DEFAULT_PROFIT_BASED_BONUS;
4362
4755
  exports.DEFAULT_REVENUE_BASED_BONUS = DEFAULT_REVENUE_BASED_BONUS;
4756
+ exports.DEFAULT_SYSTEM_ROLES = DEFAULT_SYSTEM_ROLES;
4363
4757
  exports.DEFAULT_TENANT = DEFAULT_TENANT;
4364
4758
  exports.DEFAULT_TIME_FORMATS = DEFAULT_TIME_FORMATS;
4365
4759
  exports.FILE_VARIABLES = FILE_VARIABLES;
@@ -4388,14 +4782,19 @@ exports.MEMORY_PROFILE_PROMPT = MEMORY_PROFILE_PROMPT;
4388
4782
  exports.MEMORY_QA_PROMPT = MEMORY_QA_PROMPT;
4389
4783
  exports.OllamaEmbeddingsProviders = OllamaEmbeddingsProviders;
4390
4784
  exports.OpenAIEmbeddingsProviders = OpenAIEmbeddingsProviders;
4785
+ exports.PLUGIN_CONFIGURATION_STATUS = PLUGIN_CONFIGURATION_STATUS;
4391
4786
  exports.PLUGIN_LEVEL = PLUGIN_LEVEL;
4787
+ exports.PLUGIN_LOAD_STATUS = PLUGIN_LOAD_STATUS;
4788
+ exports.PLUGIN_SOURCE = PLUGIN_SOURCE;
4392
4789
  exports.PermissionApprovalStatus = PermissionApprovalStatus;
4393
4790
  exports.PermissionGroups = PermissionGroups;
4791
+ exports.SANDBOX_WORK_FOR_TYPES = SANDBOX_WORK_FOR_TYPES;
4394
4792
  exports.STANDARD_METADATA_FIELDS = STANDARD_METADATA_FIELDS;
4395
4793
  exports.STATE_SYS_VOLUME = STATE_SYS_VOLUME;
4396
4794
  exports.STATE_SYS_WORKSPACE_PATH = STATE_SYS_WORKSPACE_PATH;
4397
4795
  exports.STATE_SYS_WORKSPACE_URL = STATE_SYS_WORKSPACE_URL;
4398
4796
  exports.STATE_VARIABLE_FILES = STATE_VARIABLE_FILES;
4797
+ exports.STATE_VARIABLE_HUMAN = STATE_VARIABLE_HUMAN;
4399
4798
  exports.STATE_VARIABLE_INPUT = STATE_VARIABLE_INPUT;
4400
4799
  exports.STATE_VARIABLE_SYS = STATE_VARIABLE_SYS;
4401
4800
  exports.STATE_VARIABLE_TITLE_CHANNEL = STATE_VARIABLE_TITLE_CHANNEL;
@@ -4418,6 +4817,7 @@ exports.collectTreeLeaves = collectTreeLeaves;
4418
4817
  exports.configurableStoreNamespace = configurableStoreNamespace;
4419
4818
  exports.convertToUrlPath = convertToUrlPath;
4420
4819
  exports.createAgentConnections = createAgentConnections;
4820
+ exports.createConversationTitleSummaryEvent = createConversationTitleSummaryEvent;
4421
4821
  exports.createMessageAppendContextTracker = createMessageAppendContextTracker;
4422
4822
  exports.createXpertGraph = createXpertGraph;
4423
4823
  exports.createXpertNodes = createXpertNodes;
@@ -4448,6 +4848,7 @@ exports.genXpertTriggerKey = genXpertTriggerKey;
4448
4848
  exports.generateCronExpression = generateCronExpression;
4449
4849
  exports.getAgentMiddlewareNodes = getAgentMiddlewareNodes;
4450
4850
  exports.getAgentVarGroup = getAgentVarGroup;
4851
+ exports.getAssistantManagement = getAssistantManagement;
4451
4852
  exports.getCurrentGraph = getCurrentGraph;
4452
4853
  exports.getEnabledTools = getEnabledTools;
4453
4854
  exports.getStoreNamespace = getStoreNamespace;
@@ -4470,14 +4871,18 @@ exports.isIteratorKey = isIteratorKey;
4470
4871
  exports.isMessageGroup = isMessageGroup;
4471
4872
  exports.isMiddlewareToolEnabled = isMiddlewareToolEnabled;
4472
4873
  exports.isRouterKey = isRouterKey;
4874
+ exports.isSystemManagedAssistant = isSystemManagedAssistant;
4473
4875
  exports.isToolEnabled = isToolEnabled;
4876
+ exports.isUserManagedAssistant = isUserManagedAssistant;
4474
4877
  exports.isVideoType = isVideoType;
4475
4878
  exports.isXpertNodeType = isXpertNodeType;
4476
4879
  exports.letterStartSUID = letterStartSUID;
4477
4880
  exports.locateNodes = locateNodes;
4478
4881
  exports.mapTranslationLanguage = mapTranslationLanguage;
4882
+ exports.mergeMessageContentForDisplay = mergeMessageContentForDisplay;
4479
4883
  exports.messageContentText = messageContentText;
4480
4884
  exports.omitXpertRelations = omitXpertRelations;
4885
+ exports.replaceAgentInDraft = replaceAgentInDraft;
4481
4886
  exports.resolveMessageAppendContext = resolveMessageAppendContext;
4482
4887
  exports.setStateVariable = setStateVariable;
4483
4888
  exports.shortTitle = shortTitle;
@@ -4486,9 +4891,3 @@ exports.transformInstallation = transformInstallation;
4486
4891
  exports.uuid = uuid;
4487
4892
  exports.workflowNodeIdentifier = workflowNodeIdentifier;
4488
4893
  exports.xpertLabel = xpertLabel;
4489
- Object.keys(chatkitTypes).forEach(function (k) {
4490
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
4491
- enumerable: true,
4492
- get: function () { return chatkitTypes[k]; }
4493
- });
4494
- });