@xpert-ai/contracts 3.21.1 → 3.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var ShortUniqueId = require('short-unique-id');
4
+ var zod = require('zod');
4
5
  var chatkitTypes = require('@xpert-ai/chatkit-types');
5
6
  var v3 = require('zod/v3');
6
7
 
@@ -89,30 +90,30 @@ function resolveI18nText(value) {
89
90
  return null;
90
91
  }
91
92
 
92
- function _array_like_to_array$e(arr, len) {
93
+ function _array_like_to_array$f(arr, len) {
93
94
  if (len == null || len > arr.length) len = arr.length;
94
95
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
95
96
  return arr2;
96
97
  }
97
- function _array_without_holes$7(arr) {
98
- if (Array.isArray(arr)) return _array_like_to_array$e(arr);
98
+ function _array_without_holes$8(arr) {
99
+ if (Array.isArray(arr)) return _array_like_to_array$f(arr);
99
100
  }
100
- function _iterable_to_array$9(iter) {
101
+ function _iterable_to_array$a(iter) {
101
102
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
102
103
  }
103
- function _non_iterable_spread$7() {
104
+ function _non_iterable_spread$8() {
104
105
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
105
106
  }
106
- function _to_consumable_array$7(arr) {
107
- return _array_without_holes$7(arr) || _iterable_to_array$9(arr) || _unsupported_iterable_to_array$e(arr) || _non_iterable_spread$7();
107
+ function _to_consumable_array$8(arr) {
108
+ return _array_without_holes$8(arr) || _iterable_to_array$a(arr) || _unsupported_iterable_to_array$f(arr) || _non_iterable_spread$8();
108
109
  }
109
- function _unsupported_iterable_to_array$e(o, minLen) {
110
+ function _unsupported_iterable_to_array$f(o, minLen) {
110
111
  if (!o) return;
111
- if (typeof o === "string") return _array_like_to_array$e(o, minLen);
112
+ if (typeof o === "string") return _array_like_to_array$f(o, minLen);
112
113
  var n = Object.prototype.toString.call(o).slice(8, -1);
113
114
  if (n === "Object" && o.constructor) n = o.constructor.name;
114
115
  if (n === "Map" || n === "Set") return Array.from(n);
115
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
116
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$f(o, minLen);
116
117
  }
117
118
  var _uuidGenerator;
118
119
  var uuidGenerator = new ShortUniqueId({
@@ -122,7 +123,7 @@ var uuid = function() {
122
123
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
123
124
  args[_key] = arguments[_key];
124
125
  }
125
- return (_uuidGenerator = uuidGenerator).randomUUID.apply(_uuidGenerator, _to_consumable_array$7(args));
126
+ return (_uuidGenerator = uuidGenerator).randomUUID.apply(_uuidGenerator, _to_consumable_array$8(args));
126
127
  };
127
128
  // Parameters
128
129
  exports.ParameterTypeEnum = void 0;
@@ -153,30 +154,30 @@ function letterStartSUID(start) {
153
154
  "FileOutput"
154
155
  ];
155
156
 
156
- /** A summary's incoming dependencies constrain its children without making them wait for the summary itself. */ function _array_like_to_array$d(arr, len) {
157
+ /** A summary's incoming dependencies constrain its children without making them wait for the summary itself. */ function _array_like_to_array$e(arr, len) {
157
158
  if (len == null || len > arr.length) len = arr.length;
158
159
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
159
160
  return arr2;
160
161
  }
161
- function _array_without_holes$6(arr) {
162
- if (Array.isArray(arr)) return _array_like_to_array$d(arr);
162
+ function _array_without_holes$7(arr) {
163
+ if (Array.isArray(arr)) return _array_like_to_array$e(arr);
163
164
  }
164
- function _iterable_to_array$8(iter) {
165
+ function _iterable_to_array$9(iter) {
165
166
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
166
167
  }
167
- function _non_iterable_spread$6() {
168
+ function _non_iterable_spread$7() {
168
169
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
169
170
  }
170
- function _to_consumable_array$6(arr) {
171
- return _array_without_holes$6(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$d(arr) || _non_iterable_spread$6();
171
+ function _to_consumable_array$7(arr) {
172
+ return _array_without_holes$7(arr) || _iterable_to_array$9(arr) || _unsupported_iterable_to_array$e(arr) || _non_iterable_spread$7();
172
173
  }
173
- function _unsupported_iterable_to_array$d(o, minLen) {
174
+ function _unsupported_iterable_to_array$e(o, minLen) {
174
175
  if (!o) return;
175
- if (typeof o === "string") return _array_like_to_array$d(o, minLen);
176
+ if (typeof o === "string") return _array_like_to_array$e(o, minLen);
176
177
  var n = Object.prototype.toString.call(o).slice(8, -1);
177
178
  if (n === "Object" && o.constructor) n = o.constructor.name;
178
179
  if (n === "Map" || n === "Set") return Array.from(n);
179
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
180
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
180
181
  }
181
182
  function schedulePredecessors(task, byId) {
182
183
  var ids = new Set(task.predecessorIds);
@@ -191,7 +192,7 @@ function schedulePredecessors(task, byId) {
191
192
  });
192
193
  parentId = parent.parentTaskId;
193
194
  }
194
- return _to_consumable_array$6(ids);
195
+ return _to_consumable_array$7(ids);
195
196
  }
196
197
  /** Tree containment and finish-to-start dependencies are separate acyclic graphs. */ function validateProjectTaskGraph(tasks) {
197
198
  var _loop = function(_i1, _iter1) {
@@ -205,7 +206,7 @@ function schedulePredecessors(task, byId) {
205
206
  active.add(id);
206
207
  var references = relation === "tree" ? task.parentTaskId ? [
207
208
  task.parentTaskId
208
- ] : [] : _to_consumable_array$6(relation === "schedule" ? schedulePredecessors(task, byId) : task.predecessorIds).concat(_to_consumable_array$6(relation === "schedule" && task.kind === "summary" ? tasks.filter(function(child) {
209
+ ] : [] : _to_consumable_array$7(relation === "schedule" ? schedulePredecessors(task, byId) : task.predecessorIds).concat(_to_consumable_array$7(relation === "schedule" && task.kind === "summary" ? tasks.filter(function(child) {
209
210
  return child.parentTaskId === task.id;
210
211
  }).map(function(child) {
211
212
  return child.id;
@@ -317,10 +318,10 @@ function schedulePredecessors(task, byId) {
317
318
  Date.parse(child.startAt)
318
319
  ] : [];
319
320
  });
320
- startAt = starts.length ? new Date((_Math = Math).min.apply(_Math, _to_consumable_array$6(starts))).toISOString() : null;
321
+ startAt = starts.length ? new Date((_Math = Math).min.apply(_Math, _to_consumable_array$7(starts))).toISOString() : null;
321
322
  endAt = children.length && children.every(function(child) {
322
323
  return child.endAt;
323
- }) ? new Date((_Math1 = Math).max.apply(_Math1, _to_consumable_array$6(children.map(function(child) {
324
+ }) ? new Date((_Math1 = Math).max.apply(_Math1, _to_consumable_array$7(children.map(function(child) {
324
325
  return Date.parse(child.endAt);
325
326
  })))).toISOString() : null;
326
327
  if (children.some(function(child) {
@@ -340,9 +341,9 @@ function schedulePredecessors(task, byId) {
340
341
  });
341
342
  var earliest = task.actualStartAt ? Date.parse(task.actualStartAt) : predecessorEnds.some(function(value) {
342
343
  return value === null;
343
- }) ? null : start !== null || predecessorEnds.length ? (_Math2 = Math).max.apply(_Math2, _to_consumable_array$6(start !== null ? [
344
+ }) ? null : start !== null || predecessorEnds.length ? (_Math2 = Math).max.apply(_Math2, _to_consumable_array$7(start !== null ? [
344
345
  Date.parse(start)
345
- ] : []).concat(_to_consumable_array$6(predecessorEnds.map(function(value) {
346
+ ] : []).concat(_to_consumable_array$7(predecessorEnds.map(function(value) {
346
347
  return value;
347
348
  })))) : null;
348
349
  startAt = earliest === null ? null : new Date(earliest).toISOString();
@@ -373,7 +374,7 @@ function schedulePredecessors(task, byId) {
373
374
  return result.get(task.id).endAt !== null;
374
375
  })) {
375
376
  var _Math;
376
- var finish = (_Math = Math).max.apply(_Math, _to_consumable_array$6(leaves.map(function(task) {
377
+ var finish = (_Math = Math).max.apply(_Math, _to_consumable_array$7(leaves.map(function(task) {
377
378
  return Date.parse(result.get(task.id).endAt);
378
379
  })));
379
380
  var mark = function(id) {
@@ -1313,7 +1314,7 @@ exports.OrganizationDemoNetworkEnum = void 0;
1313
1314
  OrganizationDemoNetworkEnum["aliyun"] = "aliyun";
1314
1315
  })(exports.OrganizationDemoNetworkEnum || (exports.OrganizationDemoNetworkEnum = {}));
1315
1316
 
1316
- function _define_property$e(obj, key, value) {
1317
+ function _define_property$f(obj, key, value) {
1317
1318
  if (key in obj) {
1318
1319
  Object.defineProperty(obj, key, {
1319
1320
  value: value,
@@ -1326,7 +1327,7 @@ function _define_property$e(obj, key, value) {
1326
1327
  }
1327
1328
  return obj;
1328
1329
  }
1329
- function _object_spread$d(target) {
1330
+ function _object_spread$e(target) {
1330
1331
  for(var i = 1; i < arguments.length; i++){
1331
1332
  var source = arguments[i] != null ? arguments[i] : {};
1332
1333
  var ownKeys = Object.keys(source);
@@ -1336,12 +1337,12 @@ function _object_spread$d(target) {
1336
1337
  }));
1337
1338
  }
1338
1339
  ownKeys.forEach(function(key) {
1339
- _define_property$e(target, key, source[key]);
1340
+ _define_property$f(target, key, source[key]);
1340
1341
  });
1341
1342
  }
1342
1343
  return target;
1343
1344
  }
1344
- function ownKeys$8(object, enumerableOnly) {
1345
+ function ownKeys$9(object, enumerableOnly) {
1345
1346
  var keys = Object.keys(object);
1346
1347
  if (Object.getOwnPropertySymbols) {
1347
1348
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1349,12 +1350,12 @@ function ownKeys$8(object, enumerableOnly) {
1349
1350
  }
1350
1351
  return keys;
1351
1352
  }
1352
- function _object_spread_props$8(target, source) {
1353
+ function _object_spread_props$9(target, source) {
1353
1354
  source = source != null ? source : {};
1354
1355
  if (Object.getOwnPropertyDescriptors) {
1355
1356
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1356
1357
  } else {
1357
- ownKeys$8(Object(source)).forEach(function(key) {
1358
+ ownKeys$9(Object(source)).forEach(function(key) {
1358
1359
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1359
1360
  });
1360
1361
  }
@@ -1382,7 +1383,7 @@ function parseSelectionSet(value) {
1382
1383
  if (plugins !== undefined && (!isObject(plugins) || !("nodeKeys" in plugins) || !isStringList(plugins.nodeKeys))) return null;
1383
1384
  if (subAgents !== undefined && (!isObject(subAgents) || !("nodeKeys" in subAgents) || !isStringList(subAgents.nodeKeys))) return null;
1384
1385
  if (connectors !== undefined && (!isObject(connectors) || !("bindingIds" in connectors) || !isStringList(connectors.bindingIds))) return null;
1385
- return _object_spread$d(_object_spread_props$8(_object_spread$d({}, value), {
1386
+ return _object_spread$e(_object_spread_props$9(_object_spread$e({}, value), {
1386
1387
  skills: skills === undefined ? {
1387
1388
  ids: []
1388
1389
  } : skills,
@@ -1401,7 +1402,7 @@ function parsePromptCapabilitySelection(value) {
1401
1402
  var selection = parseSelectionSet(value);
1402
1403
  var recommended = "recommended" in value && value.recommended != null ? parseSelectionSet(value.recommended) : undefined;
1403
1404
  if (!selection || recommended === null) return null;
1404
- return _object_spread$d(_object_spread_props$8(_object_spread$d({}, selection), {
1405
+ return _object_spread$e(_object_spread_props$9(_object_spread$e({}, selection), {
1405
1406
  mode: "allowlist"
1406
1407
  }), "inheritUnselected" in value && typeof value.inheritUnselected === "boolean" ? {
1407
1408
  inheritUnselected: value.inheritUnselected
@@ -1453,7 +1454,7 @@ function parsePromptCapabilityConfig(value) {
1453
1454
  }
1454
1455
  }
1455
1456
  }
1456
- return _object_spread_props$8(_object_spread$d({}, value), {
1457
+ return _object_spread_props$9(_object_spread$e({}, value), {
1457
1458
  type: "expert_scoped_capabilities",
1458
1459
  version: 1,
1459
1460
  defaults: defaults,
@@ -1585,7 +1586,7 @@ exports.ChatMessageStepCategory = void 0;
1585
1586
  ChatMessageStepCategory["Knowledges"] = "knowledges";
1586
1587
  })(exports.ChatMessageStepCategory || (exports.ChatMessageStepCategory = {}));
1587
1588
 
1588
- function _define_property$d(obj, key, value) {
1589
+ function _define_property$e(obj, key, value) {
1589
1590
  if (key in obj) {
1590
1591
  Object.defineProperty(obj, key, {
1591
1592
  value: value,
@@ -1605,7 +1606,7 @@ function _instanceof$1(left, right) {
1605
1606
  return left instanceof right;
1606
1607
  }
1607
1608
  }
1608
- function _object_spread$c(target) {
1609
+ function _object_spread$d(target) {
1609
1610
  for(var i = 1; i < arguments.length; i++){
1610
1611
  var source = arguments[i] != null ? arguments[i] : {};
1611
1612
  var ownKeys = Object.keys(source);
@@ -1615,7 +1616,7 @@ function _object_spread$c(target) {
1615
1616
  }));
1616
1617
  }
1617
1618
  ownKeys.forEach(function(key) {
1618
- _define_property$d(target, key, source[key]);
1619
+ _define_property$e(target, key, source[key]);
1619
1620
  });
1620
1621
  }
1621
1622
  return target;
@@ -1626,12 +1627,12 @@ var CHAT_EVENT_TYPE_CONVERSATION_TITLE_SUMMARY = "conversation_title_summary";
1626
1627
  var CHAT_EVENT_TYPE_THREAD_GOAL_UPDATED = "thread_goal_updated";
1627
1628
  var CHAT_EVENT_TYPE_THREAD_GOAL_CLEARED = "thread_goal_cleared";
1628
1629
  function createConversationTitleSummaryEvent(event) {
1629
- return _object_spread$c({
1630
+ return _object_spread$d({
1630
1631
  type: CHAT_EVENT_TYPE_CONVERSATION_TITLE_SUMMARY
1631
1632
  }, event);
1632
1633
  }
1633
1634
  function createFollowUpConsumedEvent(event) {
1634
- return _object_spread$c({
1635
+ return _object_spread$d({
1635
1636
  type: CHAT_EVENT_TYPE_FOLLOW_UP_CONSUMED
1636
1637
  }, event);
1637
1638
  }
@@ -1666,7 +1667,7 @@ function toIsoString(value) {
1666
1667
  return new Date().toISOString();
1667
1668
  }
1668
1669
 
1669
- function _array_like_to_array$c(arr, len) {
1670
+ function _array_like_to_array$d(arr, len) {
1670
1671
  if (len == null || len > arr.length) len = arr.length;
1671
1672
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1672
1673
  return arr2;
@@ -1674,10 +1675,10 @@ function _array_like_to_array$c(arr, len) {
1674
1675
  function _array_with_holes$8(arr) {
1675
1676
  if (Array.isArray(arr)) return arr;
1676
1677
  }
1677
- function _array_without_holes$5(arr) {
1678
- if (Array.isArray(arr)) return _array_like_to_array$c(arr);
1678
+ function _array_without_holes$6(arr) {
1679
+ if (Array.isArray(arr)) return _array_like_to_array$d(arr);
1679
1680
  }
1680
- function _define_property$c(obj, key, value) {
1681
+ function _define_property$d(obj, key, value) {
1681
1682
  if (key in obj) {
1682
1683
  Object.defineProperty(obj, key, {
1683
1684
  value: value,
@@ -1690,7 +1691,7 @@ function _define_property$c(obj, key, value) {
1690
1691
  }
1691
1692
  return obj;
1692
1693
  }
1693
- function _iterable_to_array$7(iter) {
1694
+ function _iterable_to_array$8(iter) {
1694
1695
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1695
1696
  }
1696
1697
  function _iterable_to_array_limit$6(arr, i) {
@@ -1720,10 +1721,10 @@ function _iterable_to_array_limit$6(arr, i) {
1720
1721
  function _non_iterable_rest$8() {
1721
1722
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1722
1723
  }
1723
- function _non_iterable_spread$5() {
1724
+ function _non_iterable_spread$6() {
1724
1725
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1725
1726
  }
1726
- function _object_spread$b(target) {
1727
+ function _object_spread$c(target) {
1727
1728
  for(var i = 1; i < arguments.length; i++){
1728
1729
  var source = arguments[i] != null ? arguments[i] : {};
1729
1730
  var ownKeys = Object.keys(source);
@@ -1733,12 +1734,12 @@ function _object_spread$b(target) {
1733
1734
  }));
1734
1735
  }
1735
1736
  ownKeys.forEach(function(key) {
1736
- _define_property$c(target, key, source[key]);
1737
+ _define_property$d(target, key, source[key]);
1737
1738
  });
1738
1739
  }
1739
1740
  return target;
1740
1741
  }
1741
- function ownKeys$7(object, enumerableOnly) {
1742
+ function ownKeys$8(object, enumerableOnly) {
1742
1743
  var keys = Object.keys(object);
1743
1744
  if (Object.getOwnPropertySymbols) {
1744
1745
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1746,30 +1747,30 @@ function ownKeys$7(object, enumerableOnly) {
1746
1747
  }
1747
1748
  return keys;
1748
1749
  }
1749
- function _object_spread_props$7(target, source) {
1750
+ function _object_spread_props$8(target, source) {
1750
1751
  source = source != null ? source : {};
1751
1752
  if (Object.getOwnPropertyDescriptors) {
1752
1753
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1753
1754
  } else {
1754
- ownKeys$7(Object(source)).forEach(function(key) {
1755
+ ownKeys$8(Object(source)).forEach(function(key) {
1755
1756
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1756
1757
  });
1757
1758
  }
1758
1759
  return target;
1759
1760
  }
1760
1761
  function _sliced_to_array$6(arr, i) {
1761
- return _array_with_holes$8(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$c(arr, i) || _non_iterable_rest$8();
1762
+ return _array_with_holes$8(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$d(arr, i) || _non_iterable_rest$8();
1762
1763
  }
1763
- function _to_consumable_array$5(arr) {
1764
- return _array_without_holes$5(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$c(arr) || _non_iterable_spread$5();
1764
+ function _to_consumable_array$6(arr) {
1765
+ return _array_without_holes$6(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$d(arr) || _non_iterable_spread$6();
1765
1766
  }
1766
- function _unsupported_iterable_to_array$c(o, minLen) {
1767
+ function _unsupported_iterable_to_array$d(o, minLen) {
1767
1768
  if (!o) return;
1768
- if (typeof o === "string") return _array_like_to_array$c(o, minLen);
1769
+ if (typeof o === "string") return _array_like_to_array$d(o, minLen);
1769
1770
  var n = Object.prototype.toString.call(o).slice(8, -1);
1770
1771
  if (n === "Object" && o.constructor) n = o.constructor.name;
1771
1772
  if (n === "Map" || n === "Set") return Array.from(n);
1772
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
1773
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
1773
1774
  }
1774
1775
  exports.AssistantCode = void 0;
1775
1776
  (function(AssistantCode) {
@@ -1870,7 +1871,7 @@ function normalizeAssistantBindingToolPreferences(value) {
1870
1871
  if (!Object.keys(toolsets).length && !Object.keys(middlewares).length && !Object.keys(skills).length) {
1871
1872
  return null;
1872
1873
  }
1873
- return _object_spread$b({
1874
+ return _object_spread$c({
1874
1875
  version: 1
1875
1876
  }, Object.keys(toolsets).length ? {
1876
1877
  toolsets: toolsets
@@ -1945,11 +1946,11 @@ function updateAssistantBindingToolPreferences(preferences, sourceType, nodeKey,
1945
1946
  var disabledTools = getAssistantBindingDisabledTools(normalizedPreferences, sourceType, normalizedNodeKey);
1946
1947
  var nextDisabledTools = enabled ? disabledTools.filter(function(item) {
1947
1948
  return item !== normalizedToolName;
1948
- }) : normalizeAssistantBindingPreferenceIds(_to_consumable_array$5(disabledTools).concat([
1949
+ }) : normalizeAssistantBindingPreferenceIds(_to_consumable_array$6(disabledTools).concat([
1949
1950
  normalizedToolName
1950
1951
  ]));
1951
- var toolsets = normalizedPreferences.toolsets ? _object_spread$b({}, normalizedPreferences.toolsets) : undefined;
1952
- var middlewares = normalizedPreferences.middlewares ? _object_spread$b({}, normalizedPreferences.middlewares) : undefined;
1952
+ var toolsets = normalizedPreferences.toolsets ? _object_spread$c({}, normalizedPreferences.toolsets) : undefined;
1953
+ var middlewares = normalizedPreferences.middlewares ? _object_spread$c({}, normalizedPreferences.middlewares) : undefined;
1953
1954
  if (sourceType === "toolset") {
1954
1955
  var toolsetName = "toolsetName" in metadata ? normalizeAssistantBindingPreferenceKey(metadata.toolsetName) : "";
1955
1956
  if (!toolsetName) {
@@ -1965,14 +1966,14 @@ function updateAssistantBindingToolPreferences(preferences, sourceType, nodeKey,
1965
1966
  } else {
1966
1967
  delete nextToolsets[normalizedNodeKey];
1967
1968
  }
1968
- return normalizeAssistantBindingToolPreferences(_object_spread$b({
1969
+ return normalizeAssistantBindingToolPreferences(_object_spread$c({
1969
1970
  version: 1
1970
1971
  }, Object.keys(nextToolsets).length ? {
1971
1972
  toolsets: nextToolsets
1972
1973
  } : {}, middlewares && Object.keys(middlewares).length ? {
1973
1974
  middlewares: middlewares
1974
1975
  } : {}, normalizedPreferences.skills ? {
1975
- skills: _object_spread$b({}, normalizedPreferences.skills)
1976
+ skills: _object_spread$c({}, normalizedPreferences.skills)
1976
1977
  } : {}));
1977
1978
  }
1978
1979
  var provider = "provider" in metadata ? normalizeAssistantBindingPreferenceKey(metadata.provider) : "";
@@ -1988,14 +1989,14 @@ function updateAssistantBindingToolPreferences(preferences, sourceType, nodeKey,
1988
1989
  } else {
1989
1990
  delete nextMiddlewares[normalizedNodeKey];
1990
1991
  }
1991
- return normalizeAssistantBindingToolPreferences(_object_spread$b({
1992
+ return normalizeAssistantBindingToolPreferences(_object_spread$c({
1992
1993
  version: 1
1993
1994
  }, toolsets && Object.keys(toolsets).length ? {
1994
1995
  toolsets: toolsets
1995
1996
  } : {}, Object.keys(nextMiddlewares).length ? {
1996
1997
  middlewares: nextMiddlewares
1997
1998
  } : {}, normalizedPreferences.skills ? {
1998
- skills: _object_spread$b({}, normalizedPreferences.skills)
1999
+ skills: _object_spread$c({}, normalizedPreferences.skills)
1999
2000
  } : {}));
2000
2001
  }
2001
2002
  function updateAssistantBindingSkillPreferences(preferences, workspaceId, skillId, enabled) {
@@ -2010,10 +2011,10 @@ function updateAssistantBindingSkillPreferences(preferences, workspaceId, skillI
2010
2011
  var disabledSkillIds = getAssistantBindingDisabledSkillIds(normalizedPreferences, normalizedWorkspaceId);
2011
2012
  var nextDisabledSkillIds = enabled ? disabledSkillIds.filter(function(item) {
2012
2013
  return item !== normalizedSkillId;
2013
- }) : normalizeAssistantBindingPreferenceIds(_to_consumable_array$5(disabledSkillIds).concat([
2014
+ }) : normalizeAssistantBindingPreferenceIds(_to_consumable_array$6(disabledSkillIds).concat([
2014
2015
  normalizedSkillId
2015
2016
  ]));
2016
- var skills = normalizedPreferences.skills ? _object_spread$b({}, normalizedPreferences.skills) : {};
2017
+ var skills = normalizedPreferences.skills ? _object_spread$c({}, normalizedPreferences.skills) : {};
2017
2018
  if (nextDisabledSkillIds.length) {
2018
2019
  skills[normalizedWorkspaceId] = {
2019
2020
  workspaceId: normalizedWorkspaceId,
@@ -2022,12 +2023,12 @@ function updateAssistantBindingSkillPreferences(preferences, workspaceId, skillI
2022
2023
  } else {
2023
2024
  delete skills[normalizedWorkspaceId];
2024
2025
  }
2025
- return normalizeAssistantBindingToolPreferences(_object_spread$b({
2026
+ return normalizeAssistantBindingToolPreferences(_object_spread$c({
2026
2027
  version: 1
2027
2028
  }, normalizedPreferences.toolsets ? {
2028
- toolsets: _object_spread$b({}, normalizedPreferences.toolsets)
2029
+ toolsets: _object_spread$c({}, normalizedPreferences.toolsets)
2029
2030
  } : {}, normalizedPreferences.middlewares ? {
2030
- middlewares: _object_spread$b({}, normalizedPreferences.middlewares)
2031
+ middlewares: _object_spread$c({}, normalizedPreferences.middlewares)
2031
2032
  } : {}, Object.keys(skills).length ? {
2032
2033
  skills: skills
2033
2034
  } : {}));
@@ -2045,14 +2046,14 @@ function ensureAssistantBindingSkillWorkspacePreference(preferences, workspaceId
2045
2046
  var currentSkills = (_normalizedPreferences_skills = normalizedPreferences.skills) !== null && _normalizedPreferences_skills !== void 0 ? _normalizedPreferences_skills : {};
2046
2047
  var currentWorkspacePreference = currentSkills[normalizedWorkspaceId];
2047
2048
  var _currentWorkspacePreference_disabledSkillIds;
2048
- return _object_spread_props$7(_object_spread$b({
2049
+ return _object_spread_props$8(_object_spread$c({
2049
2050
  version: 1
2050
2051
  }, normalizedPreferences.toolsets ? {
2051
- toolsets: _object_spread$b({}, normalizedPreferences.toolsets)
2052
+ toolsets: _object_spread$c({}, normalizedPreferences.toolsets)
2052
2053
  } : {}, normalizedPreferences.middlewares ? {
2053
- middlewares: _object_spread$b({}, normalizedPreferences.middlewares)
2054
+ middlewares: _object_spread$c({}, normalizedPreferences.middlewares)
2054
2055
  } : {}), {
2055
- skills: _object_spread_props$7(_object_spread$b({}, currentSkills), _define_property$c({}, normalizedWorkspaceId, {
2056
+ skills: _object_spread_props$8(_object_spread$c({}, currentSkills), _define_property$d({}, normalizedWorkspaceId, {
2056
2057
  workspaceId: normalizeAssistantBindingPreferenceKey(currentWorkspacePreference === null || currentWorkspacePreference === void 0 ? void 0 : currentWorkspacePreference.workspaceId) || normalizedWorkspaceId,
2057
2058
  disabledSkillIds: (_currentWorkspacePreference_disabledSkillIds = currentWorkspacePreference === null || currentWorkspacePreference === void 0 ? void 0 : currentWorkspacePreference.disabledSkillIds) !== null && _currentWorkspacePreference_disabledSkillIds !== void 0 ? _currentWorkspacePreference_disabledSkillIds : []
2058
2059
  }))
@@ -2072,13 +2073,13 @@ function isSystemManagedAssistant(code) {
2072
2073
  }
2073
2074
 
2074
2075
  // Shared by Cloud and Desktop: activity changes must not move assistant entries.
2075
- function _array_like_to_array$b(arr, len) {
2076
+ function _array_like_to_array$c(arr, len) {
2076
2077
  if (len == null || len > arr.length) len = arr.length;
2077
2078
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2078
2079
  return arr2;
2079
2080
  }
2080
- function _array_without_holes$4(arr) {
2081
- if (Array.isArray(arr)) return _array_like_to_array$b(arr);
2081
+ function _array_without_holes$5(arr) {
2082
+ if (Array.isArray(arr)) return _array_like_to_array$c(arr);
2082
2083
  }
2083
2084
  function _instanceof(left, right) {
2084
2085
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
@@ -2087,22 +2088,22 @@ function _instanceof(left, right) {
2087
2088
  return left instanceof right;
2088
2089
  }
2089
2090
  }
2090
- function _iterable_to_array$6(iter) {
2091
+ function _iterable_to_array$7(iter) {
2091
2092
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2092
2093
  }
2093
- function _non_iterable_spread$4() {
2094
+ function _non_iterable_spread$5() {
2094
2095
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2095
2096
  }
2096
- function _to_consumable_array$4(arr) {
2097
- return _array_without_holes$4(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$b(arr) || _non_iterable_spread$4();
2097
+ function _to_consumable_array$5(arr) {
2098
+ return _array_without_holes$5(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$c(arr) || _non_iterable_spread$5();
2098
2099
  }
2099
- function _unsupported_iterable_to_array$b(o, minLen) {
2100
+ function _unsupported_iterable_to_array$c(o, minLen) {
2100
2101
  if (!o) return;
2101
- if (typeof o === "string") return _array_like_to_array$b(o, minLen);
2102
+ if (typeof o === "string") return _array_like_to_array$c(o, minLen);
2102
2103
  var n = Object.prototype.toString.call(o).slice(8, -1);
2103
2104
  if (n === "Object" && o.constructor) n = o.constructor.name;
2104
2105
  if (n === "Map" || n === "Set") return Array.from(n);
2105
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
2106
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
2106
2107
  }
2107
2108
  function orderAssistantXperts(items) {
2108
2109
  var orderedIds = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
@@ -2131,7 +2132,7 @@ function orderAssistantXperts(items) {
2131
2132
  var item = param.item;
2132
2133
  return item;
2133
2134
  });
2134
- return _to_consumable_array$4(unorderedItems).concat(_to_consumable_array$4(orderedIds.map(function(id) {
2135
+ return _to_consumable_array$5(unorderedItems).concat(_to_consumable_array$5(orderedIds.map(function(id) {
2135
2136
  return itemById.get(id);
2136
2137
  }).filter(function(item) {
2137
2138
  return !!item;
@@ -2145,7 +2146,7 @@ function createdAtTimestamp(item) {
2145
2146
 
2146
2147
  var ASSISTANT_USER_PREFERENCES_VERSION = 1;
2147
2148
 
2148
- function _define_property$b(obj, key, value) {
2149
+ function _define_property$c(obj, key, value) {
2149
2150
  if (key in obj) {
2150
2151
  Object.defineProperty(obj, key, {
2151
2152
  value: value,
@@ -2158,7 +2159,7 @@ function _define_property$b(obj, key, value) {
2158
2159
  }
2159
2160
  return obj;
2160
2161
  }
2161
- function _object_spread$a(target) {
2162
+ function _object_spread$b(target) {
2162
2163
  for(var i = 1; i < arguments.length; i++){
2163
2164
  var source = arguments[i] != null ? arguments[i] : {};
2164
2165
  var ownKeys = Object.keys(source);
@@ -2168,7 +2169,7 @@ function _object_spread$a(target) {
2168
2169
  }));
2169
2170
  }
2170
2171
  ownKeys.forEach(function(key) {
2171
- _define_property$b(target, key, source[key]);
2172
+ _define_property$c(target, key, source[key]);
2172
2173
  });
2173
2174
  }
2174
2175
  return target;
@@ -2300,7 +2301,7 @@ function resolveModelParameterOptions(modelOptions, rules) {
2300
2301
  var config = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2301
2302
  var _config_preserveUnknown;
2302
2303
  var preserveUnknown = (_config_preserveUnknown = config.preserveUnknown) !== null && _config_preserveUnknown !== void 0 ? _config_preserveUnknown : true;
2303
- var resolvedOptions = preserveUnknown ? _object_spread$a({}, modelOptions !== null && modelOptions !== void 0 ? modelOptions : {}) : {};
2304
+ var resolvedOptions = preserveUnknown ? _object_spread$b({}, modelOptions !== null && modelOptions !== void 0 ? modelOptions : {}) : {};
2304
2305
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2305
2306
  try {
2306
2307
  for(var _iterator = rules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
@@ -2342,6 +2343,237 @@ exports.PriceType = void 0;
2342
2343
  PriceType["OUTPUT"] = "output";
2343
2344
  })(exports.PriceType || (exports.PriceType = {}));
2344
2345
 
2346
+ exports.AiModelTypeEnum = void 0;
2347
+ (function(AiModelTypeEnum) {
2348
+ AiModelTypeEnum["REALTIME"] = "realtime";
2349
+ AiModelTypeEnum["LLM"] = "llm";
2350
+ AiModelTypeEnum["TEXT_EMBEDDING"] = "text-embedding";
2351
+ AiModelTypeEnum["RERANK"] = "rerank";
2352
+ AiModelTypeEnum["SPEECH2TEXT"] = "speech2text";
2353
+ AiModelTypeEnum["MODERATION"] = "moderation";
2354
+ AiModelTypeEnum["TTS"] = "tts";
2355
+ AiModelTypeEnum["IMAGE"] = "image";
2356
+ /** @deprecated Use IMAGE for new image-generation model providers. */ AiModelTypeEnum["TEXT2IMG"] = "text2img";
2357
+ AiModelTypeEnum["VIDEO"] = "video";
2358
+ })(exports.AiModelTypeEnum || (exports.AiModelTypeEnum = {}));
2359
+
2360
+ function _array_like_to_array$b(arr, len) {
2361
+ if (len == null || len > arr.length) len = arr.length;
2362
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2363
+ return arr2;
2364
+ }
2365
+ function _array_without_holes$4(arr) {
2366
+ if (Array.isArray(arr)) return _array_like_to_array$b(arr);
2367
+ }
2368
+ function _define_property$b(obj, key, value) {
2369
+ if (key in obj) {
2370
+ Object.defineProperty(obj, key, {
2371
+ value: value,
2372
+ enumerable: true,
2373
+ configurable: true,
2374
+ writable: true
2375
+ });
2376
+ } else {
2377
+ obj[key] = value;
2378
+ }
2379
+ return obj;
2380
+ }
2381
+ function _iterable_to_array$6(iter) {
2382
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2383
+ }
2384
+ function _non_iterable_spread$4() {
2385
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2386
+ }
2387
+ function _object_spread$a(target) {
2388
+ for(var i = 1; i < arguments.length; i++){
2389
+ var source = arguments[i] != null ? arguments[i] : {};
2390
+ var ownKeys = Object.keys(source);
2391
+ if (typeof Object.getOwnPropertySymbols === "function") {
2392
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
2393
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
2394
+ }));
2395
+ }
2396
+ ownKeys.forEach(function(key) {
2397
+ _define_property$b(target, key, source[key]);
2398
+ });
2399
+ }
2400
+ return target;
2401
+ }
2402
+ function ownKeys$7(object, enumerableOnly) {
2403
+ var keys = Object.keys(object);
2404
+ if (Object.getOwnPropertySymbols) {
2405
+ var symbols = Object.getOwnPropertySymbols(object);
2406
+ keys.push.apply(keys, symbols);
2407
+ }
2408
+ return keys;
2409
+ }
2410
+ function _object_spread_props$7(target, source) {
2411
+ source = source != null ? source : {};
2412
+ if (Object.getOwnPropertyDescriptors) {
2413
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2414
+ } else {
2415
+ ownKeys$7(Object(source)).forEach(function(key) {
2416
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2417
+ });
2418
+ }
2419
+ return target;
2420
+ }
2421
+ function _to_consumable_array$4(arr) {
2422
+ return _array_without_holes$4(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$b(arr) || _non_iterable_spread$4();
2423
+ }
2424
+ function _unsupported_iterable_to_array$b(o, minLen) {
2425
+ if (!o) return;
2426
+ if (typeof o === "string") return _array_like_to_array$b(o, minLen);
2427
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2428
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2429
+ if (n === "Map" || n === "Set") return Array.from(n);
2430
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
2431
+ }
2432
+ var discoverableModelTypes = [
2433
+ exports.AiModelTypeEnum.LLM,
2434
+ exports.AiModelTypeEnum.TEXT_EMBEDDING,
2435
+ exports.AiModelTypeEnum.RERANK
2436
+ ];
2437
+ var positiveInteger = zod.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
2438
+ var common = {
2439
+ contextSize: positiveInteger,
2440
+ maxConcurrency: positiveInteger.max(1000)
2441
+ };
2442
+ /** Saved model configuration is explicit; name heuristics are only discovery suggestions. */ var modelConfigurationSchema = zod.z.discriminatedUnion("modelType", [
2443
+ zod.z.object(_object_spread_props$7(_object_spread$a({
2444
+ modelType: zod.z.literal(exports.AiModelTypeEnum.LLM)
2445
+ }, common), {
2446
+ maxOutputTokens: positiveInteger,
2447
+ defaultMaxTokens: positiveInteger,
2448
+ features: zod.z.array(zod.z.nativeEnum(exports.ModelFeature)).max(20)
2449
+ })).strict(),
2450
+ zod.z.object(_object_spread_props$7(_object_spread$a({
2451
+ modelType: zod.z.literal(exports.AiModelTypeEnum.TEXT_EMBEDDING)
2452
+ }, common), {
2453
+ dimensions: positiveInteger.optional(),
2454
+ batchSize: positiveInteger.max(2048)
2455
+ })).strict(),
2456
+ zod.z.object(_object_spread$a({
2457
+ modelType: zod.z.literal(exports.AiModelTypeEnum.RERANK)
2458
+ }, common)).strict()
2459
+ ]).superRefine(function(value, ctx) {
2460
+ if (value.modelType === exports.AiModelTypeEnum.LLM) {
2461
+ if (value.maxOutputTokens > value.contextSize) {
2462
+ ctx.addIssue({
2463
+ code: zod.z.ZodIssueCode.custom,
2464
+ path: [
2465
+ "maxOutputTokens"
2466
+ ],
2467
+ message: "Output limit exceeds context size"
2468
+ });
2469
+ }
2470
+ if (value.defaultMaxTokens > value.maxOutputTokens) {
2471
+ ctx.addIssue({
2472
+ code: zod.z.ZodIssueCode.custom,
2473
+ path: [
2474
+ "defaultMaxTokens"
2475
+ ],
2476
+ message: "Default output exceeds output limit"
2477
+ });
2478
+ }
2479
+ }
2480
+ });
2481
+ function defaultModelConfiguration(modelType) {
2482
+ var common = {
2483
+ contextSize: 8192,
2484
+ maxConcurrency: 1
2485
+ };
2486
+ switch(modelType){
2487
+ case exports.AiModelTypeEnum.LLM:
2488
+ return _object_spread_props$7(_object_spread$a({
2489
+ modelType: modelType
2490
+ }, common), {
2491
+ maxOutputTokens: 2048,
2492
+ defaultMaxTokens: 2048,
2493
+ features: []
2494
+ });
2495
+ case exports.AiModelTypeEnum.TEXT_EMBEDDING:
2496
+ return _object_spread_props$7(_object_spread$a({
2497
+ modelType: modelType
2498
+ }, common), {
2499
+ batchSize: 16
2500
+ });
2501
+ case exports.AiModelTypeEnum.RERANK:
2502
+ return _object_spread$a({
2503
+ modelType: modelType
2504
+ }, common);
2505
+ }
2506
+ }
2507
+ /** Start with editable defaults and overlay the matching built-in YAML values. */ function configurationFromModel(modelType, model) {
2508
+ var _model_model_properties;
2509
+ var configuration = defaultModelConfiguration(modelType);
2510
+ if ((model === null || model === void 0 ? void 0 : model.model_type) && model.model_type !== modelType) return configuration;
2511
+ var context = model === null || model === void 0 ? void 0 : (_model_model_properties = model.model_properties) === null || _model_model_properties === void 0 ? void 0 : _model_model_properties[exports.ModelPropertyKey.CONTEXT_SIZE];
2512
+ if (typeof context === "number" && Number.isSafeInteger(context) && context > 0) configuration.contextSize = context;
2513
+ if (configuration.modelType === exports.AiModelTypeEnum.LLM) {
2514
+ var _model_parameter_rules;
2515
+ var rule = model === null || model === void 0 ? void 0 : (_model_parameter_rules = model.parameter_rules) === null || _model_parameter_rules === void 0 ? void 0 : _model_parameter_rules.find(function(item) {
2516
+ return item.name === "max_tokens";
2517
+ });
2518
+ if (typeof (rule === null || rule === void 0 ? void 0 : rule.max) === "number" && rule.max > 0) configuration.maxOutputTokens = Math.min(rule.max, configuration.contextSize);
2519
+ if (typeof (rule === null || rule === void 0 ? void 0 : rule.default) === "number" && rule.default > 0) configuration.defaultMaxTokens = rule.default;
2520
+ configuration.maxOutputTokens = Math.min(configuration.maxOutputTokens, configuration.contextSize);
2521
+ configuration.defaultMaxTokens = Math.min(configuration.defaultMaxTokens, configuration.maxOutputTokens);
2522
+ var _model_features;
2523
+ configuration.features = _to_consumable_array$4((_model_features = model === null || model === void 0 ? void 0 : model.features) !== null && _model_features !== void 0 ? _model_features : []);
2524
+ }
2525
+ if (configuration.modelType === exports.AiModelTypeEnum.TEXT_EMBEDDING) {
2526
+ var _model_model_properties1, _model_parameter_rules_find, _model_parameter_rules1;
2527
+ var batchSize = model === null || model === void 0 ? void 0 : (_model_model_properties1 = model.model_properties) === null || _model_model_properties1 === void 0 ? void 0 : _model_model_properties1[exports.ModelPropertyKey.MAX_CHUNKS];
2528
+ var dimensions = model === null || model === void 0 ? void 0 : (_model_parameter_rules1 = model.parameter_rules) === null || _model_parameter_rules1 === void 0 ? void 0 : (_model_parameter_rules_find = _model_parameter_rules1.find(function(item) {
2529
+ return item.name === "dimensions";
2530
+ })) === null || _model_parameter_rules_find === void 0 ? void 0 : _model_parameter_rules_find.default;
2531
+ if (typeof batchSize === "number" && Number.isSafeInteger(batchSize) && batchSize > 0 && batchSize <= 2048) {
2532
+ configuration.batchSize = batchSize;
2533
+ }
2534
+ if (typeof dimensions === "number" && Number.isSafeInteger(dimensions) && dimensions > 0) {
2535
+ configuration.dimensions = dimensions;
2536
+ }
2537
+ }
2538
+ return configuration;
2539
+ }
2540
+ function isDiscoverableModelType(value) {
2541
+ return value === exports.AiModelTypeEnum.LLM || value === exports.AiModelTypeEnum.TEXT_EMBEDDING || value === exports.AiModelTypeEnum.RERANK;
2542
+ }
2543
+ /** Parse the persisted JSON field once when entering the model configuration boundary. */ function readModelConfiguration(properties) {
2544
+ var value = properties === null || properties === void 0 ? void 0 : properties.model_configuration;
2545
+ if (value == null) return undefined;
2546
+ return modelConfigurationSchema.parse(value);
2547
+ }
2548
+ function configuredModelSource(model) {
2549
+ var _model_modelProperties, _model_modelProperties1;
2550
+ var _model_modelProperties_configuration_source;
2551
+ return (_model_modelProperties_configuration_source = (_model_modelProperties = model.modelProperties) === null || _model_modelProperties === void 0 ? void 0 : _model_modelProperties.configuration_source) !== null && _model_modelProperties_configuration_source !== void 0 ? _model_modelProperties_configuration_source : ((_model_modelProperties1 = model.modelProperties) === null || _model_modelProperties1 === void 0 ? void 0 : _model_modelProperties1.discovery_model_id) ? "discovered" : "manual";
2552
+ }
2553
+ function usesConfiguredModelCatalog(provider) {
2554
+ var _provider_options_modelDiscovery, _provider_options;
2555
+ return ((_provider_options = provider.options) === null || _provider_options === void 0 ? void 0 : (_provider_options_modelDiscovery = _provider_options.modelDiscovery) === null || _provider_options_modelDiscovery === void 0 ? void 0 : _provider_options_modelDiscovery.mode) === "configured";
2556
+ }
2557
+ /** Shared by management UI, pickers and execution authorization. Manual additions remain explicit opt-ins. */ function isConfiguredModelAvailable(provider, model) {
2558
+ var _model_modelProperties;
2559
+ if (!usesConfiguredModelCatalog(provider)) return true;
2560
+ if (!model) return false;
2561
+ var sourceId = (_model_modelProperties = model.modelProperties) === null || _model_modelProperties === void 0 ? void 0 : _model_modelProperties.discovery_model_id;
2562
+ return !sourceId || provider.options.modelDiscovery.availableModelIds.includes(sourceId);
2563
+ }
2564
+ var modelImportSchema = zod.z.object({
2565
+ models: zod.z.array(zod.z.object({
2566
+ model: zod.z.string().trim().min(1).max(512),
2567
+ configuration: modelConfigurationSchema
2568
+ }).strict()).max(1000)
2569
+ }).strict().refine(function(value) {
2570
+ return new Set(value.models.map(function(model) {
2571
+ return model.model;
2572
+ })).size === value.models.length;
2573
+ }, {
2574
+ message: "Duplicate model IDs"
2575
+ });
2576
+
2345
2577
  var THREAD_GOAL_STATUS_VALUES = [
2346
2578
  "active",
2347
2579
  "paused",
@@ -4311,6 +4543,7 @@ var PLUGIN_CONFIGURATION_STATUS = {
4311
4543
  };
4312
4544
  var PLUGIN_LOAD_STATUS = {
4313
4545
  LOADED: "loaded",
4546
+ PENDING_RESTART: "pending_restart",
4314
4547
  FAILED: "failed"
4315
4548
  };
4316
4549
  var PLUGIN_COMPONENT_TYPE = {
@@ -7530,20 +7763,6 @@ var INTEGRATION_PROVIDERS = // [IntegrationEnum.LARK]: IntegrationLarkProvider,
7530
7763
  // [IntegrationEnum.WECOM]: IntegrationWeComProvider,
7531
7764
  _define_property$1({}, exports.IntegrationEnum.GITHUB, IntegrationGitHubProvider);
7532
7765
 
7533
- exports.AiModelTypeEnum = void 0;
7534
- (function(AiModelTypeEnum) {
7535
- AiModelTypeEnum["REALTIME"] = "realtime";
7536
- AiModelTypeEnum["LLM"] = "llm";
7537
- AiModelTypeEnum["TEXT_EMBEDDING"] = "text-embedding";
7538
- AiModelTypeEnum["RERANK"] = "rerank";
7539
- AiModelTypeEnum["SPEECH2TEXT"] = "speech2text";
7540
- AiModelTypeEnum["MODERATION"] = "moderation";
7541
- AiModelTypeEnum["TTS"] = "tts";
7542
- AiModelTypeEnum["IMAGE"] = "image";
7543
- /** @deprecated Use IMAGE for new image-generation model providers. */ AiModelTypeEnum["TEXT2IMG"] = "text2img";
7544
- AiModelTypeEnum["VIDEO"] = "video";
7545
- })(exports.AiModelTypeEnum || (exports.AiModelTypeEnum = {}));
7546
-
7547
7766
  function _array_like_to_array$3(arr, len) {
7548
7767
  if (len == null || len > arr.length) len = arr.length;
7549
7768
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -8524,6 +8743,8 @@ exports.classificateDocumentCategory = classificateDocumentCategory;
8524
8743
  exports.codingExecutionViewKey = codingExecutionViewKey;
8525
8744
  exports.collectTreeLeaves = collectTreeLeaves;
8526
8745
  exports.configurableStoreNamespace = configurableStoreNamespace;
8746
+ exports.configurationFromModel = configurationFromModel;
8747
+ exports.configuredModelSource = configuredModelSource;
8527
8748
  exports.convertToUrlPath = convertToUrlPath;
8528
8749
  exports.createAgentConnections = createAgentConnections;
8529
8750
  exports.createConversationTitleSummaryEvent = createConversationTitleSummaryEvent;
@@ -8536,7 +8757,9 @@ exports.createXpertGraph = createXpertGraph;
8536
8757
  exports.createXpertNodes = createXpertNodes;
8537
8758
  exports.decodeKnowledgeSeparators = decodeKnowledgeSeparators;
8538
8759
  exports.defaultMcpToolApprovalMode = defaultMcpToolApprovalMode;
8760
+ exports.defaultModelConfiguration = defaultModelConfiguration;
8539
8761
  exports.deriveXpertMarketplaceTechnicalProfile = deriveXpertMarketplaceTechnicalProfile;
8762
+ exports.discoverableModelTypes = discoverableModelTypes;
8540
8763
  exports.ensureAssistantBindingSkillWorkspacePreference = ensureAssistantBindingSkillWorkspacePreference;
8541
8764
  exports.evidenceDrivenStrategy = evidenceDrivenStrategy;
8542
8765
  exports.executionActivityBatchSchema = executionActivityBatchSchema;
@@ -8596,7 +8819,9 @@ exports.isAssistantBindingToolEnabled = isAssistantBindingToolEnabled;
8596
8819
  exports.isAssistantBindingToolPreferencesEmpty = isAssistantBindingToolPreferencesEmpty;
8597
8820
  exports.isAudioType = isAudioType;
8598
8821
  exports.isBlank = isBlank;
8822
+ exports.isConfiguredModelAvailable = isConfiguredModelAvailable;
8599
8823
  exports.isContextCompressionComponentData = isContextCompressionComponentData;
8824
+ exports.isDiscoverableModelType = isDiscoverableModelType;
8600
8825
  exports.isDocumentKnowledgebaseType = isDocumentKnowledgebaseType;
8601
8826
  exports.isDocumentSheet = isDocumentSheet;
8602
8827
  exports.isEnableTool = isEnableTool;
@@ -8647,8 +8872,10 @@ exports.locateNodes = locateNodes;
8647
8872
  exports.mapTranslationLanguage = mapTranslationLanguage;
8648
8873
  exports.mergeMessageContentForDisplay = mergeMessageContentForDisplay;
8649
8874
  exports.messageContentText = messageContentText;
8875
+ exports.modelConfigurationSchema = modelConfigurationSchema;
8650
8876
  exports.modelExecutionEntry = modelExecutionEntry;
8651
8877
  exports.modelExecutionSourceId = modelExecutionSourceId;
8878
+ exports.modelImportSchema = modelImportSchema;
8652
8879
  exports.nonBlank = nonBlank;
8653
8880
  exports.nonNullable = nonNullable;
8654
8881
  exports.normalizeAssistantBindingToolPreferences = normalizeAssistantBindingToolPreferences;
@@ -8679,6 +8906,7 @@ exports.projectTaskReviewReportSchema = projectTaskReviewReportSchema;
8679
8906
  exports.projectTaskSpecificationDigestSchema = projectTaskSpecificationDigestSchema;
8680
8907
  exports.projectTaskSpecificationSchema = projectTaskSpecificationSchema;
8681
8908
  exports.projectTaskSpecificationSnapshotSchema = projectTaskSpecificationSnapshotSchema;
8909
+ exports.readModelConfiguration = readModelConfiguration;
8682
8910
  exports.replaceAgentInDraft = replaceAgentInDraft;
8683
8911
  exports.resolveDraftPrimaryAgent = resolveDraftPrimaryAgent;
8684
8912
  exports.resolveDraftRuntimeGraph = resolveDraftRuntimeGraph;
@@ -8693,6 +8921,7 @@ exports.stringifyMessageContent = stringifyMessageContent;
8693
8921
  exports.transformInstallation = transformInstallation;
8694
8922
  exports.updateAssistantBindingSkillPreferences = updateAssistantBindingSkillPreferences;
8695
8923
  exports.updateAssistantBindingToolPreferences = updateAssistantBindingToolPreferences;
8924
+ exports.usesConfiguredModelCatalog = usesConfiguredModelCatalog;
8696
8925
  exports.uuid = uuid;
8697
8926
  exports.validateProjectTaskGraph = validateProjectTaskGraph;
8698
8927
  exports.workflowNodeIdentifier = workflowNodeIdentifier;