@metad/contracts 3.8.0 → 3.8.1
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.cjs.js +518 -66
- package/index.esm.js +511 -67
- package/package.json +1 -1
- package/src/ai/chat-message.model.d.ts +1 -1
- package/src/ai/index.d.ts +1 -0
- package/src/ai/message-content.utils.d.ts +52 -0
- package/src/ai/xpert-tool-mcp.model.d.ts +20 -1
- package/src/plugin.d.ts +16 -1
package/index.cjs.js
CHANGED
|
@@ -3,30 +3,30 @@
|
|
|
3
3
|
var ShortUniqueId = require('short-unique-id');
|
|
4
4
|
var chatkitTypes = require('@xpert-ai/chatkit-types');
|
|
5
5
|
|
|
6
|
-
function _array_like_to_array$
|
|
6
|
+
function _array_like_to_array$6(arr, len) {
|
|
7
7
|
if (len == null || len > arr.length) len = arr.length;
|
|
8
8
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9
9
|
return arr2;
|
|
10
10
|
}
|
|
11
|
-
function _array_without_holes$
|
|
12
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
11
|
+
function _array_without_holes$2(arr) {
|
|
12
|
+
if (Array.isArray(arr)) return _array_like_to_array$6(arr);
|
|
13
13
|
}
|
|
14
|
-
function _iterable_to_array$
|
|
14
|
+
function _iterable_to_array$3(iter) {
|
|
15
15
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
16
16
|
}
|
|
17
|
-
function _non_iterable_spread$
|
|
17
|
+
function _non_iterable_spread$2() {
|
|
18
18
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
19
19
|
}
|
|
20
|
-
function _to_consumable_array$
|
|
21
|
-
return _array_without_holes$
|
|
20
|
+
function _to_consumable_array$2(arr) {
|
|
21
|
+
return _array_without_holes$2(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$2();
|
|
22
22
|
}
|
|
23
|
-
function _unsupported_iterable_to_array$
|
|
23
|
+
function _unsupported_iterable_to_array$6(o, minLen) {
|
|
24
24
|
if (!o) return;
|
|
25
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
25
|
+
if (typeof o === "string") return _array_like_to_array$6(o, minLen);
|
|
26
26
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
27
27
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
28
28
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
29
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
29
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
|
|
30
30
|
}
|
|
31
31
|
var _uuidGenerator;
|
|
32
32
|
var uuidGenerator = new ShortUniqueId({
|
|
@@ -36,7 +36,7 @@ var uuid = function() {
|
|
|
36
36
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
37
37
|
args[_key] = arguments[_key];
|
|
38
38
|
}
|
|
39
|
-
return (_uuidGenerator = uuidGenerator).randomUUID.apply(_uuidGenerator, _to_consumable_array$
|
|
39
|
+
return (_uuidGenerator = uuidGenerator).randomUUID.apply(_uuidGenerator, _to_consumable_array$2(args));
|
|
40
40
|
};
|
|
41
41
|
exports.ParameterTypeEnum = void 0;
|
|
42
42
|
(function(ParameterTypeEnum) {
|
|
@@ -1791,15 +1791,15 @@ var VariableOperations = [
|
|
|
1791
1791
|
}
|
|
1792
1792
|
];
|
|
1793
1793
|
|
|
1794
|
-
function _array_like_to_array$
|
|
1794
|
+
function _array_like_to_array$5(arr, len) {
|
|
1795
1795
|
if (len == null || len > arr.length) len = arr.length;
|
|
1796
1796
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1797
1797
|
return arr2;
|
|
1798
1798
|
}
|
|
1799
|
-
function _array_with_holes$
|
|
1799
|
+
function _array_with_holes$4(arr) {
|
|
1800
1800
|
if (Array.isArray(arr)) return arr;
|
|
1801
1801
|
}
|
|
1802
|
-
function _define_property$
|
|
1802
|
+
function _define_property$4(obj, key, value) {
|
|
1803
1803
|
if (key in obj) {
|
|
1804
1804
|
Object.defineProperty(obj, key, {
|
|
1805
1805
|
value: value,
|
|
@@ -1812,7 +1812,7 @@ function _define_property$3(obj, key, value) {
|
|
|
1812
1812
|
}
|
|
1813
1813
|
return obj;
|
|
1814
1814
|
}
|
|
1815
|
-
function _iterable_to_array_limit$
|
|
1815
|
+
function _iterable_to_array_limit$3(arr, i) {
|
|
1816
1816
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1817
1817
|
if (_i == null) return;
|
|
1818
1818
|
var _arr = [];
|
|
@@ -1836,10 +1836,10 @@ function _iterable_to_array_limit$2(arr, i) {
|
|
|
1836
1836
|
}
|
|
1837
1837
|
return _arr;
|
|
1838
1838
|
}
|
|
1839
|
-
function _non_iterable_rest$
|
|
1839
|
+
function _non_iterable_rest$4() {
|
|
1840
1840
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1841
1841
|
}
|
|
1842
|
-
function _object_spread$
|
|
1842
|
+
function _object_spread$3(target) {
|
|
1843
1843
|
for(var i = 1; i < arguments.length; i++){
|
|
1844
1844
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
1845
1845
|
var ownKeys = Object.keys(source);
|
|
@@ -1849,12 +1849,12 @@ function _object_spread$2(target) {
|
|
|
1849
1849
|
}));
|
|
1850
1850
|
}
|
|
1851
1851
|
ownKeys.forEach(function(key) {
|
|
1852
|
-
_define_property$
|
|
1852
|
+
_define_property$4(target, key, source[key]);
|
|
1853
1853
|
});
|
|
1854
1854
|
}
|
|
1855
1855
|
return target;
|
|
1856
1856
|
}
|
|
1857
|
-
function ownKeys$
|
|
1857
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
1858
1858
|
var keys = Object.keys(object);
|
|
1859
1859
|
if (Object.getOwnPropertySymbols) {
|
|
1860
1860
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -1862,27 +1862,27 @@ function ownKeys$1(object, enumerableOnly) {
|
|
|
1862
1862
|
}
|
|
1863
1863
|
return keys;
|
|
1864
1864
|
}
|
|
1865
|
-
function _object_spread_props$
|
|
1865
|
+
function _object_spread_props$2(target, source) {
|
|
1866
1866
|
source = source != null ? source : {};
|
|
1867
1867
|
if (Object.getOwnPropertyDescriptors) {
|
|
1868
1868
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
1869
1869
|
} else {
|
|
1870
|
-
ownKeys$
|
|
1870
|
+
ownKeys$2(Object(source)).forEach(function(key) {
|
|
1871
1871
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1872
1872
|
});
|
|
1873
1873
|
}
|
|
1874
1874
|
return target;
|
|
1875
1875
|
}
|
|
1876
|
-
function _sliced_to_array$
|
|
1877
|
-
return _array_with_holes$
|
|
1876
|
+
function _sliced_to_array$3(arr, i) {
|
|
1877
|
+
return _array_with_holes$4(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$4();
|
|
1878
1878
|
}
|
|
1879
|
-
function _unsupported_iterable_to_array$
|
|
1879
|
+
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
1880
1880
|
if (!o) return;
|
|
1881
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
1881
|
+
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
1882
1882
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1883
1883
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1884
1884
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1885
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
1885
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
|
|
1886
1886
|
}
|
|
1887
1887
|
/**
|
|
1888
1888
|
* @deprecated can use getCurrentTaskInput instead?
|
|
@@ -1956,10 +1956,10 @@ function configurableStoreNamespace(configurable) {
|
|
|
1956
1956
|
* @param value
|
|
1957
1957
|
* @returns
|
|
1958
1958
|
*/ function setStateVariable(state, varName, value) {
|
|
1959
|
-
var _varName_split = _sliced_to_array$
|
|
1959
|
+
var _varName_split = _sliced_to_array$3(varName.split("."), 2), agentChannelName = _varName_split[0], variableName = _varName_split[1];
|
|
1960
1960
|
if (variableName) {
|
|
1961
1961
|
var _state_agentChannelName;
|
|
1962
|
-
state[agentChannelName] = _object_spread_props$
|
|
1962
|
+
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));
|
|
1963
1963
|
} else {
|
|
1964
1964
|
state[agentChannelName] = value;
|
|
1965
1965
|
}
|
|
@@ -2126,7 +2126,7 @@ function genPipelineKnowledgeBaseKey() {
|
|
|
2126
2126
|
return letterStartSUID("KnowledgeBase_");
|
|
2127
2127
|
}
|
|
2128
2128
|
|
|
2129
|
-
function _define_property$
|
|
2129
|
+
function _define_property$3(obj, key, value) {
|
|
2130
2130
|
if (key in obj) {
|
|
2131
2131
|
Object.defineProperty(obj, key, {
|
|
2132
2132
|
value: value,
|
|
@@ -2139,7 +2139,7 @@ function _define_property$2(obj, key, value) {
|
|
|
2139
2139
|
}
|
|
2140
2140
|
return obj;
|
|
2141
2141
|
}
|
|
2142
|
-
function _object_spread$
|
|
2142
|
+
function _object_spread$2(target) {
|
|
2143
2143
|
for(var i = 1; i < arguments.length; i++){
|
|
2144
2144
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
2145
2145
|
var ownKeys = Object.keys(source);
|
|
@@ -2149,7 +2149,7 @@ function _object_spread$1(target) {
|
|
|
2149
2149
|
}));
|
|
2150
2150
|
}
|
|
2151
2151
|
ownKeys.forEach(function(key) {
|
|
2152
|
-
_define_property$
|
|
2152
|
+
_define_property$3(target, key, source[key]);
|
|
2153
2153
|
});
|
|
2154
2154
|
}
|
|
2155
2155
|
return target;
|
|
@@ -2164,7 +2164,7 @@ exports.DocumentTypeEnum = void 0;
|
|
|
2164
2164
|
* @deprecated use DocumentSourceProviderCategoryEnum local file type instead
|
|
2165
2165
|
*/ DocumentTypeEnum["FILE"] = "file";
|
|
2166
2166
|
})(exports.DocumentTypeEnum || (exports.DocumentTypeEnum = {}));
|
|
2167
|
-
var KDocumentSourceType = _object_spread$
|
|
2167
|
+
var KDocumentSourceType = _object_spread$2({}, exports.DocumentSourceProviderCategoryEnum, exports.DocumentTypeEnum);
|
|
2168
2168
|
exports.KBDocumentCategoryEnum = void 0;
|
|
2169
2169
|
(function(KBDocumentCategoryEnum) {
|
|
2170
2170
|
KBDocumentCategoryEnum["Text"] = "text";
|
|
@@ -2451,23 +2451,23 @@ function genXpertDBSqlKey() {
|
|
|
2451
2451
|
return letterStartSUID("DBSql_");
|
|
2452
2452
|
}
|
|
2453
2453
|
|
|
2454
|
-
function _array_like_to_array$
|
|
2454
|
+
function _array_like_to_array$4(arr, len) {
|
|
2455
2455
|
if (len == null || len > arr.length) len = arr.length;
|
|
2456
2456
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
2457
2457
|
return arr2;
|
|
2458
2458
|
}
|
|
2459
|
-
function _array_without_holes(arr) {
|
|
2460
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
2459
|
+
function _array_without_holes$1(arr) {
|
|
2460
|
+
if (Array.isArray(arr)) return _array_like_to_array$4(arr);
|
|
2461
2461
|
}
|
|
2462
|
-
function _iterable_to_array$
|
|
2462
|
+
function _iterable_to_array$2(iter) {
|
|
2463
2463
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
2464
2464
|
}
|
|
2465
|
-
function _non_iterable_spread() {
|
|
2465
|
+
function _non_iterable_spread$1() {
|
|
2466
2466
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2467
2467
|
}
|
|
2468
|
-
function _object_without_properties(source, excluded) {
|
|
2468
|
+
function _object_without_properties$1(source, excluded) {
|
|
2469
2469
|
if (source == null) return {};
|
|
2470
|
-
var target = _object_without_properties_loose(source, excluded);
|
|
2470
|
+
var target = _object_without_properties_loose$1(source, excluded);
|
|
2471
2471
|
var key, i;
|
|
2472
2472
|
if (Object.getOwnPropertySymbols) {
|
|
2473
2473
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
@@ -2480,7 +2480,7 @@ function _object_without_properties(source, excluded) {
|
|
|
2480
2480
|
}
|
|
2481
2481
|
return target;
|
|
2482
2482
|
}
|
|
2483
|
-
function _object_without_properties_loose(source, excluded) {
|
|
2483
|
+
function _object_without_properties_loose$1(source, excluded) {
|
|
2484
2484
|
if (source == null) return {};
|
|
2485
2485
|
var target = {};
|
|
2486
2486
|
var sourceKeys = Object.keys(source);
|
|
@@ -2492,21 +2492,21 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
2492
2492
|
}
|
|
2493
2493
|
return target;
|
|
2494
2494
|
}
|
|
2495
|
-
function _to_consumable_array(arr) {
|
|
2496
|
-
return _array_without_holes(arr) || _iterable_to_array$
|
|
2495
|
+
function _to_consumable_array$1(arr) {
|
|
2496
|
+
return _array_without_holes$1(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$1();
|
|
2497
2497
|
}
|
|
2498
|
-
function _unsupported_iterable_to_array$
|
|
2498
|
+
function _unsupported_iterable_to_array$4(o, minLen) {
|
|
2499
2499
|
if (!o) return;
|
|
2500
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
2500
|
+
if (typeof o === "string") return _array_like_to_array$4(o, minLen);
|
|
2501
2501
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2502
2502
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2503
2503
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2504
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
2504
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
|
|
2505
2505
|
}
|
|
2506
2506
|
// Helpers
|
|
2507
2507
|
function omitXpertRelations(xpert) {
|
|
2508
2508
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2509
|
-
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(_ref, [
|
|
2509
|
+
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, [
|
|
2510
2510
|
"draft",
|
|
2511
2511
|
"agent",
|
|
2512
2512
|
"agents",
|
|
@@ -2570,12 +2570,12 @@ function locateNodes(nodes, position) {
|
|
|
2570
2570
|
}) // Node height min 70
|
|
2571
2571
|
;
|
|
2572
2572
|
var xRange = {
|
|
2573
|
-
min: (_Math = Math).min.apply(_Math, _to_consumable_array(x0Positions)),
|
|
2574
|
-
max: (_Math1 = Math).max.apply(_Math1, _to_consumable_array(x1Positions))
|
|
2573
|
+
min: (_Math = Math).min.apply(_Math, _to_consumable_array$1(x0Positions)),
|
|
2574
|
+
max: (_Math1 = Math).max.apply(_Math1, _to_consumable_array$1(x1Positions))
|
|
2575
2575
|
};
|
|
2576
2576
|
var yRange = {
|
|
2577
|
-
min: (_Math2 = Math).min.apply(_Math2, _to_consumable_array(y0Positions)),
|
|
2578
|
-
max: (_Math3 = Math).max.apply(_Math3, _to_consumable_array(y1Positions))
|
|
2577
|
+
min: (_Math2 = Math).min.apply(_Math2, _to_consumable_array$1(y0Positions)),
|
|
2578
|
+
max: (_Math3 = Math).max.apply(_Math3, _to_consumable_array$1(y1Positions))
|
|
2579
2579
|
};
|
|
2580
2580
|
var size = {
|
|
2581
2581
|
width: xRange.max - xRange.min + 50,
|
|
@@ -2612,9 +2612,9 @@ function locateNodes(nodes, position) {
|
|
|
2612
2612
|
}
|
|
2613
2613
|
if ((_xpert_agents = xpert.agents) === null || _xpert_agents === void 0 ? void 0 : _xpert_agents.length) {
|
|
2614
2614
|
var _agents;
|
|
2615
|
-
(_agents = agents).push.apply(_agents, _to_consumable_array(xpert.agents));
|
|
2615
|
+
(_agents = agents).push.apply(_agents, _to_consumable_array$1(xpert.agents));
|
|
2616
2616
|
}
|
|
2617
|
-
(_nodes = nodes).push.apply(_nodes, _to_consumable_array(agents.map(function(_) {
|
|
2617
|
+
(_nodes = nodes).push.apply(_nodes, _to_consumable_array$1(agents.map(function(_) {
|
|
2618
2618
|
var _xpert_options_agent___key, _xpert_options_agent, _xpert_options, _xpert_options_agent___key1, _xpert_options_agent1, _xpert_options1;
|
|
2619
2619
|
var _xpert_options_agent___key_position;
|
|
2620
2620
|
return {
|
|
@@ -2646,7 +2646,7 @@ function locateNodes(nodes, position) {
|
|
|
2646
2646
|
});
|
|
2647
2647
|
});
|
|
2648
2648
|
var _xpert_knowledgebases;
|
|
2649
|
-
(_nodes1 = nodes).push.apply(_nodes1, _to_consumable_array(((_xpert_knowledgebases = xpert.knowledgebases) !== null && _xpert_knowledgebases !== void 0 ? _xpert_knowledgebases : []).map(function(x) {
|
|
2649
|
+
(_nodes1 = nodes).push.apply(_nodes1, _to_consumable_array$1(((_xpert_knowledgebases = xpert.knowledgebases) !== null && _xpert_knowledgebases !== void 0 ? _xpert_knowledgebases : []).map(function(x) {
|
|
2650
2650
|
var _xpert_options_knowledge_x_id, _xpert_options_knowledge, _xpert_options, _xpert_options_knowledge_x_id1, _xpert_options_knowledge1, _xpert_options1;
|
|
2651
2651
|
var _xpert_options_knowledge_x_id_position;
|
|
2652
2652
|
return {
|
|
@@ -2661,7 +2661,7 @@ function locateNodes(nodes, position) {
|
|
|
2661
2661
|
};
|
|
2662
2662
|
})));
|
|
2663
2663
|
var _xpert_toolsets;
|
|
2664
|
-
(_nodes2 = nodes).push.apply(_nodes2, _to_consumable_array(((_xpert_toolsets = xpert.toolsets) !== null && _xpert_toolsets !== void 0 ? _xpert_toolsets : []).map(function(x) {
|
|
2664
|
+
(_nodes2 = nodes).push.apply(_nodes2, _to_consumable_array$1(((_xpert_toolsets = xpert.toolsets) !== null && _xpert_toolsets !== void 0 ? _xpert_toolsets : []).map(function(x) {
|
|
2665
2665
|
var _xpert_options_toolset_x_id, _xpert_options_toolset, _xpert_options, _xpert_options_toolset_x_id1, _xpert_options_toolset1, _xpert_options1;
|
|
2666
2666
|
var _xpert_options_toolset_x_id_position;
|
|
2667
2667
|
return {
|
|
@@ -2698,12 +2698,12 @@ function locateNodes(nodes, position) {
|
|
|
2698
2698
|
}) // Node height min 70
|
|
2699
2699
|
;
|
|
2700
2700
|
var xRange = {
|
|
2701
|
-
min: (_Math = Math).min.apply(_Math, _to_consumable_array(x0Positions)),
|
|
2702
|
-
max: (_Math1 = Math).max.apply(_Math1, _to_consumable_array(x1Positions))
|
|
2701
|
+
min: (_Math = Math).min.apply(_Math, _to_consumable_array$1(x0Positions)),
|
|
2702
|
+
max: (_Math1 = Math).max.apply(_Math1, _to_consumable_array$1(x1Positions))
|
|
2703
2703
|
};
|
|
2704
2704
|
var yRange = {
|
|
2705
|
-
min: (_Math2 = Math).min.apply(_Math2, _to_consumable_array(y0Positions)),
|
|
2706
|
-
max: (_Math3 = Math).max.apply(_Math3, _to_consumable_array(y1Positions))
|
|
2705
|
+
min: (_Math2 = Math).min.apply(_Math2, _to_consumable_array$1(y0Positions)),
|
|
2706
|
+
max: (_Math3 = Math).max.apply(_Math3, _to_consumable_array$1(y1Positions))
|
|
2707
2707
|
};
|
|
2708
2708
|
var size = {
|
|
2709
2709
|
width: xRange.max - xRange.min + 50,
|
|
@@ -2841,9 +2841,10 @@ exports.MCPServerType = void 0;
|
|
|
2841
2841
|
MCPServerType["SSE"] = "sse";
|
|
2842
2842
|
MCPServerType["STDIO"] = "stdio";
|
|
2843
2843
|
MCPServerType["CODE"] = "code";
|
|
2844
|
+
MCPServerType["HTTP"] = "http";
|
|
2844
2845
|
})(exports.MCPServerType || (exports.MCPServerType = {}));
|
|
2845
2846
|
|
|
2846
|
-
function _define_property$
|
|
2847
|
+
function _define_property$2(obj, key, value) {
|
|
2847
2848
|
if (key in obj) {
|
|
2848
2849
|
Object.defineProperty(obj, key, {
|
|
2849
2850
|
value: value,
|
|
@@ -2856,7 +2857,7 @@ function _define_property$1(obj, key, value) {
|
|
|
2856
2857
|
}
|
|
2857
2858
|
return obj;
|
|
2858
2859
|
}
|
|
2859
|
-
function _object_spread(target) {
|
|
2860
|
+
function _object_spread$1(target) {
|
|
2860
2861
|
for(var i = 1; i < arguments.length; i++){
|
|
2861
2862
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
2862
2863
|
var ownKeys = Object.keys(source);
|
|
@@ -2866,12 +2867,12 @@ function _object_spread(target) {
|
|
|
2866
2867
|
}));
|
|
2867
2868
|
}
|
|
2868
2869
|
ownKeys.forEach(function(key) {
|
|
2869
|
-
_define_property$
|
|
2870
|
+
_define_property$2(target, key, source[key]);
|
|
2870
2871
|
});
|
|
2871
2872
|
}
|
|
2872
2873
|
return target;
|
|
2873
2874
|
}
|
|
2874
|
-
function ownKeys(object, enumerableOnly) {
|
|
2875
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
2875
2876
|
var keys = Object.keys(object);
|
|
2876
2877
|
if (Object.getOwnPropertySymbols) {
|
|
2877
2878
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -2879,12 +2880,12 @@ function ownKeys(object, enumerableOnly) {
|
|
|
2879
2880
|
}
|
|
2880
2881
|
return keys;
|
|
2881
2882
|
}
|
|
2882
|
-
function _object_spread_props(target, source) {
|
|
2883
|
+
function _object_spread_props$1(target, source) {
|
|
2883
2884
|
source = source != null ? source : {};
|
|
2884
2885
|
if (Object.getOwnPropertyDescriptors) {
|
|
2885
2886
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
2886
2887
|
} else {
|
|
2887
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
2888
|
+
ownKeys$1(Object(source)).forEach(function(key) {
|
|
2888
2889
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2889
2890
|
});
|
|
2890
2891
|
}
|
|
@@ -2907,8 +2908,8 @@ function _object_spread_props(target, source) {
|
|
|
2907
2908
|
var doc = _step.value;
|
|
2908
2909
|
var _doc_metadata;
|
|
2909
2910
|
if ((_doc_metadata = doc.metadata) === null || _doc_metadata === void 0 ? void 0 : _doc_metadata.chunkId) {
|
|
2910
|
-
map.set(doc.metadata.chunkId, _object_spread_props(_object_spread({}, doc), {
|
|
2911
|
-
metadata: _object_spread_props(_object_spread({}, doc.metadata), {
|
|
2911
|
+
map.set(doc.metadata.chunkId, _object_spread_props$1(_object_spread$1({}, doc), {
|
|
2912
|
+
metadata: _object_spread_props$1(_object_spread$1({}, doc.metadata), {
|
|
2912
2913
|
children: []
|
|
2913
2914
|
})
|
|
2914
2915
|
}));
|
|
@@ -3051,6 +3052,444 @@ function getAgentMiddlewareNodes(graph, agentKey) {
|
|
|
3051
3052
|
return middlewares;
|
|
3052
3053
|
}
|
|
3053
3054
|
|
|
3055
|
+
function _array_like_to_array$3(arr, len) {
|
|
3056
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3057
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3058
|
+
return arr2;
|
|
3059
|
+
}
|
|
3060
|
+
function _array_with_holes$3(arr) {
|
|
3061
|
+
if (Array.isArray(arr)) return arr;
|
|
3062
|
+
}
|
|
3063
|
+
function _array_without_holes(arr) {
|
|
3064
|
+
if (Array.isArray(arr)) return _array_like_to_array$3(arr);
|
|
3065
|
+
}
|
|
3066
|
+
function _define_property$1(obj, key, value) {
|
|
3067
|
+
if (key in obj) {
|
|
3068
|
+
Object.defineProperty(obj, key, {
|
|
3069
|
+
value: value,
|
|
3070
|
+
enumerable: true,
|
|
3071
|
+
configurable: true,
|
|
3072
|
+
writable: true
|
|
3073
|
+
});
|
|
3074
|
+
} else {
|
|
3075
|
+
obj[key] = value;
|
|
3076
|
+
}
|
|
3077
|
+
return obj;
|
|
3078
|
+
}
|
|
3079
|
+
function _iterable_to_array$1(iter) {
|
|
3080
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
3081
|
+
}
|
|
3082
|
+
function _iterable_to_array_limit$2(arr, i) {
|
|
3083
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
3084
|
+
if (_i == null) return;
|
|
3085
|
+
var _arr = [];
|
|
3086
|
+
var _n = true;
|
|
3087
|
+
var _d = false;
|
|
3088
|
+
var _s, _e;
|
|
3089
|
+
try {
|
|
3090
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
3091
|
+
_arr.push(_s.value);
|
|
3092
|
+
if (i && _arr.length === i) break;
|
|
3093
|
+
}
|
|
3094
|
+
} catch (err) {
|
|
3095
|
+
_d = true;
|
|
3096
|
+
_e = err;
|
|
3097
|
+
} finally{
|
|
3098
|
+
try {
|
|
3099
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
3100
|
+
} finally{
|
|
3101
|
+
if (_d) throw _e;
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
return _arr;
|
|
3105
|
+
}
|
|
3106
|
+
function _non_iterable_rest$3() {
|
|
3107
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3108
|
+
}
|
|
3109
|
+
function _non_iterable_spread() {
|
|
3110
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3111
|
+
}
|
|
3112
|
+
function _object_spread(target) {
|
|
3113
|
+
for(var i = 1; i < arguments.length; i++){
|
|
3114
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
3115
|
+
var ownKeys = Object.keys(source);
|
|
3116
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
3117
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
3118
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
3119
|
+
}));
|
|
3120
|
+
}
|
|
3121
|
+
ownKeys.forEach(function(key) {
|
|
3122
|
+
_define_property$1(target, key, source[key]);
|
|
3123
|
+
});
|
|
3124
|
+
}
|
|
3125
|
+
return target;
|
|
3126
|
+
}
|
|
3127
|
+
function ownKeys(object, enumerableOnly) {
|
|
3128
|
+
var keys = Object.keys(object);
|
|
3129
|
+
if (Object.getOwnPropertySymbols) {
|
|
3130
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
3131
|
+
keys.push.apply(keys, symbols);
|
|
3132
|
+
}
|
|
3133
|
+
return keys;
|
|
3134
|
+
}
|
|
3135
|
+
function _object_spread_props(target, source) {
|
|
3136
|
+
source = source != null ? source : {};
|
|
3137
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
3138
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
3139
|
+
} else {
|
|
3140
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
3141
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
3142
|
+
});
|
|
3143
|
+
}
|
|
3144
|
+
return target;
|
|
3145
|
+
}
|
|
3146
|
+
function _object_without_properties(source, excluded) {
|
|
3147
|
+
if (source == null) return {};
|
|
3148
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
3149
|
+
var key, i;
|
|
3150
|
+
if (Object.getOwnPropertySymbols) {
|
|
3151
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
3152
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
3153
|
+
key = sourceSymbolKeys[i];
|
|
3154
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
3155
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
3156
|
+
target[key] = source[key];
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
return target;
|
|
3160
|
+
}
|
|
3161
|
+
function _object_without_properties_loose(source, excluded) {
|
|
3162
|
+
if (source == null) return {};
|
|
3163
|
+
var target = {};
|
|
3164
|
+
var sourceKeys = Object.keys(source);
|
|
3165
|
+
var key, i;
|
|
3166
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
3167
|
+
key = sourceKeys[i];
|
|
3168
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
3169
|
+
target[key] = source[key];
|
|
3170
|
+
}
|
|
3171
|
+
return target;
|
|
3172
|
+
}
|
|
3173
|
+
function _sliced_to_array$2(arr, i) {
|
|
3174
|
+
return _array_with_holes$3(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
|
|
3175
|
+
}
|
|
3176
|
+
function _to_consumable_array(arr) {
|
|
3177
|
+
return _array_without_holes(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread();
|
|
3178
|
+
}
|
|
3179
|
+
function _unsupported_iterable_to_array$3(o, minLen) {
|
|
3180
|
+
if (!o) return;
|
|
3181
|
+
if (typeof o === "string") return _array_like_to_array$3(o, minLen);
|
|
3182
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3183
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3184
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3185
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
|
|
3186
|
+
}
|
|
3187
|
+
function isNil(value) {
|
|
3188
|
+
return value === null || value === undefined;
|
|
3189
|
+
}
|
|
3190
|
+
function isTextContent(content) {
|
|
3191
|
+
return !!content && typeof content === "object" && content.type === "text";
|
|
3192
|
+
}
|
|
3193
|
+
function isReasoningContent(content) {
|
|
3194
|
+
return !!content && typeof content === "object" && content.type === "reasoning";
|
|
3195
|
+
}
|
|
3196
|
+
function isComponentContent(content) {
|
|
3197
|
+
return !!content && typeof content === "object" && content.type === "component";
|
|
3198
|
+
}
|
|
3199
|
+
function inferContentSource(content) {
|
|
3200
|
+
if (typeof content === "string") {
|
|
3201
|
+
return "text";
|
|
3202
|
+
}
|
|
3203
|
+
switch(content === null || content === void 0 ? void 0 : content.type){
|
|
3204
|
+
case "text":
|
|
3205
|
+
return "text";
|
|
3206
|
+
case "reasoning":
|
|
3207
|
+
return "reasoning";
|
|
3208
|
+
case "component":
|
|
3209
|
+
return "component";
|
|
3210
|
+
case "memory":
|
|
3211
|
+
return "memory";
|
|
3212
|
+
default:
|
|
3213
|
+
return "content";
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
3216
|
+
function mapJoinHint(hint) {
|
|
3217
|
+
switch(hint){
|
|
3218
|
+
case "none":
|
|
3219
|
+
return "";
|
|
3220
|
+
case "space":
|
|
3221
|
+
return " ";
|
|
3222
|
+
case "line":
|
|
3223
|
+
return "\n";
|
|
3224
|
+
case "paragraph":
|
|
3225
|
+
return "\n\n";
|
|
3226
|
+
default:
|
|
3227
|
+
return "";
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
function endsWithCodeFence(text) {
|
|
3231
|
+
var normalized = (text !== null && text !== void 0 ? text : "").replace(/[ \t]+$/g, "");
|
|
3232
|
+
return normalized.endsWith("```");
|
|
3233
|
+
}
|
|
3234
|
+
function shouldJoinWithoutSeparator(previous, current) {
|
|
3235
|
+
return !!(previous === null || previous === void 0 ? void 0 : previous.streamId) && previous.source === current.source && previous.streamId === current.streamId;
|
|
3236
|
+
}
|
|
3237
|
+
function getSeparator(previousType, previousText, nextText, joinHint) {
|
|
3238
|
+
if (!nextText || /^\s/.test(nextText)) {
|
|
3239
|
+
return "";
|
|
3240
|
+
}
|
|
3241
|
+
if (joinHint) {
|
|
3242
|
+
return mapJoinHint(joinHint);
|
|
3243
|
+
}
|
|
3244
|
+
if (previousType === "component") {
|
|
3245
|
+
return "\n\n";
|
|
3246
|
+
}
|
|
3247
|
+
if (endsWithCodeFence(previousText)) {
|
|
3248
|
+
return "\n";
|
|
3249
|
+
}
|
|
3250
|
+
if (previousText && !/[\s\n]$/.test(previousText)) {
|
|
3251
|
+
return "\n";
|
|
3252
|
+
}
|
|
3253
|
+
return "";
|
|
3254
|
+
}
|
|
3255
|
+
function normalizeIncomingContent(content, context) {
|
|
3256
|
+
if (typeof content !== "string") {
|
|
3257
|
+
return content;
|
|
3258
|
+
}
|
|
3259
|
+
return _object_spread({
|
|
3260
|
+
type: "text",
|
|
3261
|
+
text: content
|
|
3262
|
+
}, context.streamId ? {
|
|
3263
|
+
id: context.streamId
|
|
3264
|
+
} : {});
|
|
3265
|
+
}
|
|
3266
|
+
function ensureArrayContent(content) {
|
|
3267
|
+
if (Array.isArray(content)) {
|
|
3268
|
+
return content;
|
|
3269
|
+
}
|
|
3270
|
+
if (typeof content === "string" && content.length > 0) {
|
|
3271
|
+
return [
|
|
3272
|
+
{
|
|
3273
|
+
type: "text",
|
|
3274
|
+
text: content
|
|
3275
|
+
}
|
|
3276
|
+
];
|
|
3277
|
+
}
|
|
3278
|
+
return [];
|
|
3279
|
+
}
|
|
3280
|
+
function stringifySingle(content) {
|
|
3281
|
+
if (content.type === "text") {
|
|
3282
|
+
return content.text;
|
|
3283
|
+
}
|
|
3284
|
+
if (content.type === "component") {
|
|
3285
|
+
return JSON.stringify(content.data);
|
|
3286
|
+
}
|
|
3287
|
+
return JSON.stringify(content);
|
|
3288
|
+
}
|
|
3289
|
+
function filterText(content) {
|
|
3290
|
+
if (typeof content === "string") {
|
|
3291
|
+
return content;
|
|
3292
|
+
}
|
|
3293
|
+
if ((content === null || content === void 0 ? void 0 : content.type) === "text") {
|
|
3294
|
+
return content.text;
|
|
3295
|
+
}
|
|
3296
|
+
return "";
|
|
3297
|
+
}
|
|
3298
|
+
function mergeComponentData(previous, incoming) {
|
|
3299
|
+
var _previous_data, _incoming_data;
|
|
3300
|
+
var _incoming_data1;
|
|
3301
|
+
var mergedIncomingData = Object.entries((_incoming_data1 = incoming.data) !== null && _incoming_data1 !== void 0 ? _incoming_data1 : {}).reduce(function(acc, param) {
|
|
3302
|
+
var _param = _sliced_to_array$2(param, 2), key = _param[0], value = _param[1];
|
|
3303
|
+
if (!isNil(value)) {
|
|
3304
|
+
acc[key] = value;
|
|
3305
|
+
}
|
|
3306
|
+
return acc;
|
|
3307
|
+
}, {});
|
|
3308
|
+
var _previous_data1;
|
|
3309
|
+
return _object_spread_props(_object_spread({}, previous, incoming), {
|
|
3310
|
+
data: _object_spread_props(_object_spread({}, (_previous_data1 = previous.data) !== null && _previous_data1 !== void 0 ? _previous_data1 : {}, mergedIncomingData), {
|
|
3311
|
+
created_date: ((_previous_data = previous.data) === null || _previous_data === void 0 ? void 0 : _previous_data.created_date) || ((_incoming_data = incoming.data) === null || _incoming_data === void 0 ? void 0 : _incoming_data.created_date)
|
|
3312
|
+
})
|
|
3313
|
+
});
|
|
3314
|
+
}
|
|
3315
|
+
function inferMessageAppendContext(content, fallbackSource) {
|
|
3316
|
+
return _object_spread({
|
|
3317
|
+
source: fallbackSource !== null && fallbackSource !== void 0 ? fallbackSource : inferContentSource(content)
|
|
3318
|
+
}, typeof content !== "string" && (content === null || content === void 0 ? void 0 : content.id) ? {
|
|
3319
|
+
streamId: String(content.id)
|
|
3320
|
+
} : {});
|
|
3321
|
+
}
|
|
3322
|
+
function resolveMessageAppendContext(options) {
|
|
3323
|
+
var inferredContext = inferMessageAppendContext(options.incoming, options.fallbackSource);
|
|
3324
|
+
var appendContext = typeof options.incoming === "string" && !inferredContext.streamId && options.fallbackStreamId ? _object_spread_props(_object_spread({}, inferredContext), {
|
|
3325
|
+
streamId: options.fallbackStreamId
|
|
3326
|
+
}) : inferredContext;
|
|
3327
|
+
var messageContext = shouldJoinWithoutSeparator(options.previous, appendContext) ? _object_spread_props(_object_spread({}, appendContext), {
|
|
3328
|
+
joinHint: "none"
|
|
3329
|
+
}) : appendContext;
|
|
3330
|
+
return {
|
|
3331
|
+
appendContext: appendContext,
|
|
3332
|
+
messageContext: messageContext
|
|
3333
|
+
};
|
|
3334
|
+
}
|
|
3335
|
+
/**
|
|
3336
|
+
* Stateful helper for streaming append.
|
|
3337
|
+
*
|
|
3338
|
+
* It keeps the previous append context and resolves the current one, so callers
|
|
3339
|
+
* can avoid passing `previous` manually for every chunk and still get stable
|
|
3340
|
+
* join behavior (for example, same source + same stream -> `joinHint: 'none'`).
|
|
3341
|
+
*
|
|
3342
|
+
* Call `reset()` at turn/session boundaries to prevent cross-turn contamination.
|
|
3343
|
+
*/ function createMessageAppendContextTracker() {
|
|
3344
|
+
var initial = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
3345
|
+
var previous = initial;
|
|
3346
|
+
return {
|
|
3347
|
+
resolve: function resolve(options) {
|
|
3348
|
+
var resolved = resolveMessageAppendContext(_object_spread_props(_object_spread({}, options), {
|
|
3349
|
+
previous: previous
|
|
3350
|
+
}));
|
|
3351
|
+
previous = resolved.appendContext;
|
|
3352
|
+
return resolved;
|
|
3353
|
+
},
|
|
3354
|
+
reset: function reset() {
|
|
3355
|
+
previous = null;
|
|
3356
|
+
},
|
|
3357
|
+
current: function current() {
|
|
3358
|
+
return previous;
|
|
3359
|
+
}
|
|
3360
|
+
};
|
|
3361
|
+
}
|
|
3362
|
+
/**
|
|
3363
|
+
* Append one incoming chunk into a chat message in place.
|
|
3364
|
+
*
|
|
3365
|
+
* Behavior:
|
|
3366
|
+
* - Keeps `aiMessage` object reference stable (caller may hold this object).
|
|
3367
|
+
* - Updates message properties with new references (`content`/`reasoning` arrays)
|
|
3368
|
+
* so UI change detection that relies on reference changes can react reliably.
|
|
3369
|
+
* - Applies context-aware merge rules for text/reasoning/component chunks.
|
|
3370
|
+
* - `previous` must be supplied by caller when same-stream join inference is needed.
|
|
3371
|
+
*/ function appendMessageContent(aiMessage, incoming, context) {
|
|
3372
|
+
aiMessage.status = "answering";
|
|
3373
|
+
var _ref = context !== null && context !== void 0 ? context : {}, previous = _ref.previous, contextWithoutPrevious = _object_without_properties(_ref, [
|
|
3374
|
+
"previous"
|
|
3375
|
+
]);
|
|
3376
|
+
var resolvedContext = _object_spread({}, inferMessageAppendContext(incoming), contextWithoutPrevious);
|
|
3377
|
+
var content = normalizeIncomingContent(incoming, resolvedContext);
|
|
3378
|
+
if (isReasoningContent(content)) {
|
|
3379
|
+
var _aiMessage_reasoning;
|
|
3380
|
+
var reasoning = (_aiMessage_reasoning = aiMessage.reasoning) !== null && _aiMessage_reasoning !== void 0 ? _aiMessage_reasoning : [];
|
|
3381
|
+
var lastReasoning = reasoning[reasoning.length - 1];
|
|
3382
|
+
if ((lastReasoning === null || lastReasoning === void 0 ? void 0 : lastReasoning.id) === content.id) {
|
|
3383
|
+
var mergedReasoning = _object_spread_props(_object_spread({}, lastReasoning), {
|
|
3384
|
+
text: "".concat(lastReasoning.text).concat(content.text)
|
|
3385
|
+
});
|
|
3386
|
+
aiMessage.reasoning = _to_consumable_array(reasoning.slice(0, reasoning.length - 1)).concat([
|
|
3387
|
+
mergedReasoning
|
|
3388
|
+
]);
|
|
3389
|
+
} else {
|
|
3390
|
+
aiMessage.reasoning = _to_consumable_array(reasoning).concat([
|
|
3391
|
+
content
|
|
3392
|
+
]);
|
|
3393
|
+
}
|
|
3394
|
+
aiMessage.status = "reasoning";
|
|
3395
|
+
return;
|
|
3396
|
+
}
|
|
3397
|
+
var chunks = ensureArrayContent(aiMessage.content);
|
|
3398
|
+
if (isTextContent(content)) {
|
|
3399
|
+
var _resolvedContext_joinHint;
|
|
3400
|
+
var joinHint = (_resolvedContext_joinHint = resolvedContext.joinHint) !== null && _resolvedContext_joinHint !== void 0 ? _resolvedContext_joinHint : shouldJoinWithoutSeparator(previous, resolvedContext) ? "none" : undefined;
|
|
3401
|
+
var lastContent = chunks[chunks.length - 1];
|
|
3402
|
+
if (isTextContent(lastContent) && (joinHint === "none" || !!content.id && !!lastContent.id && lastContent.id === content.id)) {
|
|
3403
|
+
var mergedLastContent = _object_spread(_object_spread_props(_object_spread({}, lastContent), {
|
|
3404
|
+
text: "".concat(lastContent.text).concat(content.text)
|
|
3405
|
+
}), !lastContent.id && content.id ? {
|
|
3406
|
+
id: content.id
|
|
3407
|
+
} : {});
|
|
3408
|
+
aiMessage.content = _to_consumable_array(chunks.slice(0, chunks.length - 1)).concat([
|
|
3409
|
+
mergedLastContent
|
|
3410
|
+
]);
|
|
3411
|
+
return;
|
|
3412
|
+
}
|
|
3413
|
+
var _lastContent_type;
|
|
3414
|
+
var previousType = (_lastContent_type = lastContent === null || lastContent === void 0 ? void 0 : lastContent.type) !== null && _lastContent_type !== void 0 ? _lastContent_type : null;
|
|
3415
|
+
var previousText = isTextContent(lastContent) ? lastContent.text : "";
|
|
3416
|
+
var separator = getSeparator(previousType, previousText, content.text, joinHint);
|
|
3417
|
+
var appended = _object_spread_props(_object_spread({}, content), {
|
|
3418
|
+
text: separator + content.text
|
|
3419
|
+
});
|
|
3420
|
+
aiMessage.content = _to_consumable_array(chunks).concat([
|
|
3421
|
+
appended
|
|
3422
|
+
]);
|
|
3423
|
+
return;
|
|
3424
|
+
}
|
|
3425
|
+
var nextChunks = _to_consumable_array(chunks);
|
|
3426
|
+
if (isComponentContent(content) && content.id) {
|
|
3427
|
+
var index = nextChunks.findIndex(function(item) {
|
|
3428
|
+
return isComponentContent(item) && item.id === content.id;
|
|
3429
|
+
});
|
|
3430
|
+
if (index > -1) {
|
|
3431
|
+
nextChunks[index] = mergeComponentData(nextChunks[index], content);
|
|
3432
|
+
} else {
|
|
3433
|
+
nextChunks.push(content);
|
|
3434
|
+
}
|
|
3435
|
+
} else {
|
|
3436
|
+
nextChunks.push(content);
|
|
3437
|
+
}
|
|
3438
|
+
aiMessage.content = nextChunks;
|
|
3439
|
+
}
|
|
3440
|
+
function appendMessagePlainText(accumulator, incoming, context) {
|
|
3441
|
+
var resolvedContext = _object_spread({}, inferMessageAppendContext(incoming), context !== null && context !== void 0 ? context : {});
|
|
3442
|
+
var nextText = filterText(incoming);
|
|
3443
|
+
if (!nextText) {
|
|
3444
|
+
return accumulator !== null && accumulator !== void 0 ? accumulator : "";
|
|
3445
|
+
}
|
|
3446
|
+
var previous = accumulator !== null && accumulator !== void 0 ? accumulator : "";
|
|
3447
|
+
var separator = getSeparator("text", previous, nextText, resolvedContext.joinHint);
|
|
3448
|
+
return previous + separator + nextText;
|
|
3449
|
+
}
|
|
3450
|
+
function stringifyMessageContent(content) {
|
|
3451
|
+
if (typeof content === "string") {
|
|
3452
|
+
return content;
|
|
3453
|
+
}
|
|
3454
|
+
if (Array.isArray(content)) {
|
|
3455
|
+
var result = "";
|
|
3456
|
+
var previousContext = null;
|
|
3457
|
+
content.forEach(function(item) {
|
|
3458
|
+
var itemContext = inferMessageAppendContext(item);
|
|
3459
|
+
var joinHint = shouldJoinWithoutSeparator(previousContext, itemContext) ? "none" : undefined;
|
|
3460
|
+
result = appendMessagePlainText(result, stringifySingle(item), _object_spread({}, itemContext, joinHint ? {
|
|
3461
|
+
joinHint: joinHint
|
|
3462
|
+
} : {}));
|
|
3463
|
+
previousContext = itemContext;
|
|
3464
|
+
});
|
|
3465
|
+
return result;
|
|
3466
|
+
}
|
|
3467
|
+
return stringifySingle(content);
|
|
3468
|
+
}
|
|
3469
|
+
function filterMessageText(content) {
|
|
3470
|
+
if (typeof content === "string") {
|
|
3471
|
+
return content;
|
|
3472
|
+
}
|
|
3473
|
+
if (Array.isArray(content)) {
|
|
3474
|
+
var result = "";
|
|
3475
|
+
var previousContext = null;
|
|
3476
|
+
content.forEach(function(item) {
|
|
3477
|
+
var nextText = filterText(item);
|
|
3478
|
+
if (!nextText) {
|
|
3479
|
+
return;
|
|
3480
|
+
}
|
|
3481
|
+
var itemContext = inferMessageAppendContext(item);
|
|
3482
|
+
var joinHint = shouldJoinWithoutSeparator(previousContext, itemContext) ? "none" : undefined;
|
|
3483
|
+
result = appendMessagePlainText(result, nextText, _object_spread({}, itemContext, joinHint ? {
|
|
3484
|
+
joinHint: joinHint
|
|
3485
|
+
} : {}));
|
|
3486
|
+
previousContext = itemContext;
|
|
3487
|
+
});
|
|
3488
|
+
return result || null;
|
|
3489
|
+
}
|
|
3490
|
+
return filterText(content) || null;
|
|
3491
|
+
}
|
|
3492
|
+
|
|
3054
3493
|
exports.PermissionsEnum = void 0;
|
|
3055
3494
|
(function(PermissionsEnum) {
|
|
3056
3495
|
PermissionsEnum["PROFILE_EDIT"] = "PROFILE_EDIT";
|
|
@@ -3910,6 +4349,11 @@ exports.InterruptMessageType = void 0;
|
|
|
3910
4349
|
InterruptMessageType["Select"] = "select";
|
|
3911
4350
|
})(exports.InterruptMessageType || (exports.InterruptMessageType = {}));
|
|
3912
4351
|
|
|
4352
|
+
var PLUGIN_LEVEL = {
|
|
4353
|
+
SYSTEM: "system",
|
|
4354
|
+
ORGANIZATION: "organization"
|
|
4355
|
+
};
|
|
4356
|
+
|
|
3913
4357
|
exports.AI_MODEL_TYPE_VARIABLE = AI_MODEL_TYPE_VARIABLE;
|
|
3914
4358
|
exports.Attachment_Type_Options = Attachment_Type_Options;
|
|
3915
4359
|
exports.CONTEXT_VARIABLE_CURRENTSTATE = CONTEXT_VARIABLE_CURRENTSTATE;
|
|
@@ -3947,6 +4391,7 @@ exports.MEMORY_PROFILE_PROMPT = MEMORY_PROFILE_PROMPT;
|
|
|
3947
4391
|
exports.MEMORY_QA_PROMPT = MEMORY_QA_PROMPT;
|
|
3948
4392
|
exports.OllamaEmbeddingsProviders = OllamaEmbeddingsProviders;
|
|
3949
4393
|
exports.OpenAIEmbeddingsProviders = OpenAIEmbeddingsProviders;
|
|
4394
|
+
exports.PLUGIN_LEVEL = PLUGIN_LEVEL;
|
|
3950
4395
|
exports.PermissionApprovalStatus = PermissionApprovalStatus;
|
|
3951
4396
|
exports.PermissionGroups = PermissionGroups;
|
|
3952
4397
|
exports.STANDARD_METADATA_FIELDS = STANDARD_METADATA_FIELDS;
|
|
@@ -3967,6 +4412,8 @@ exports.VariableOperations = VariableOperations;
|
|
|
3967
4412
|
exports.agentLabel = agentLabel;
|
|
3968
4413
|
exports.agentUniqueName = agentUniqueName;
|
|
3969
4414
|
exports.allChannels = allChannels;
|
|
4415
|
+
exports.appendMessageContent = appendMessageContent;
|
|
4416
|
+
exports.appendMessagePlainText = appendMessagePlainText;
|
|
3970
4417
|
exports.buildChunkTree = buildChunkTree;
|
|
3971
4418
|
exports.channelName = channelName;
|
|
3972
4419
|
exports.classificateDocumentCategory = classificateDocumentCategory;
|
|
@@ -3974,11 +4421,13 @@ exports.collectTreeLeaves = collectTreeLeaves;
|
|
|
3974
4421
|
exports.configurableStoreNamespace = configurableStoreNamespace;
|
|
3975
4422
|
exports.convertToUrlPath = convertToUrlPath;
|
|
3976
4423
|
exports.createAgentConnections = createAgentConnections;
|
|
4424
|
+
exports.createMessageAppendContextTracker = createMessageAppendContextTracker;
|
|
3977
4425
|
exports.createXpertGraph = createXpertGraph;
|
|
3978
4426
|
exports.createXpertNodes = createXpertNodes;
|
|
3979
4427
|
exports.embeddingCubeCollectionName = embeddingCubeCollectionName;
|
|
3980
4428
|
exports.extractSemanticModelDraft = extractSemanticModelDraft;
|
|
3981
4429
|
exports.figureOutXpert = figureOutXpert;
|
|
4430
|
+
exports.filterMessageText = filterMessageText;
|
|
3982
4431
|
exports.findStartNodes = findStartNodes;
|
|
3983
4432
|
exports.genJSONParseKey = genJSONParseKey;
|
|
3984
4433
|
exports.genJSONStringifyKey = genJSONStringifyKey;
|
|
@@ -4012,6 +4461,7 @@ exports.getToolLabel = getToolLabel;
|
|
|
4012
4461
|
exports.getVariableSchema = getVariableSchema;
|
|
4013
4462
|
exports.getWorkflowTriggers = getWorkflowTriggers;
|
|
4014
4463
|
exports.getWorkspaceFromRunnable = getWorkspaceFromRunnable;
|
|
4464
|
+
exports.inferMessageAppendContext = inferMessageAppendContext;
|
|
4015
4465
|
exports.isAgentKey = isAgentKey;
|
|
4016
4466
|
exports.isAudioType = isAudioType;
|
|
4017
4467
|
exports.isDocumentSheet = isDocumentSheet;
|
|
@@ -4031,8 +4481,10 @@ exports.locateNodes = locateNodes;
|
|
|
4031
4481
|
exports.mapTranslationLanguage = mapTranslationLanguage;
|
|
4032
4482
|
exports.messageContentText = messageContentText;
|
|
4033
4483
|
exports.omitXpertRelations = omitXpertRelations;
|
|
4484
|
+
exports.resolveMessageAppendContext = resolveMessageAppendContext;
|
|
4034
4485
|
exports.setStateVariable = setStateVariable;
|
|
4035
4486
|
exports.shortTitle = shortTitle;
|
|
4487
|
+
exports.stringifyMessageContent = stringifyMessageContent;
|
|
4036
4488
|
exports.transformInstallation = transformInstallation;
|
|
4037
4489
|
exports.uuid = uuid;
|
|
4038
4490
|
exports.workflowNodeIdentifier = workflowNodeIdentifier;
|