@xpert-ai/contracts 3.21.1 → 3.21.3

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$g(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$g(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$g(arr) || _non_iterable_spread$8();
108
109
  }
109
- function _unsupported_iterable_to_array$e(o, minLen) {
110
+ function _unsupported_iterable_to_array$g(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$g(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$g(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$f(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$f(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$f(arr) || _non_iterable_spread$7();
172
173
  }
173
- function _unsupported_iterable_to_array$d(o, minLen) {
174
+ function _unsupported_iterable_to_array$f(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$f(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$f(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,18 +1667,18 @@ 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$e(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;
1673
1674
  }
1674
- function _array_with_holes$8(arr) {
1675
+ function _array_with_holes$9(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$e(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,10 +1691,10 @@ 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
- function _iterable_to_array_limit$6(arr, i) {
1697
+ function _iterable_to_array_limit$7(arr, i) {
1697
1698
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1698
1699
  if (_i == null) return;
1699
1700
  var _arr = [];
@@ -1717,13 +1718,13 @@ function _iterable_to_array_limit$6(arr, i) {
1717
1718
  }
1718
1719
  return _arr;
1719
1720
  }
1720
- function _non_iterable_rest$8() {
1721
+ function _non_iterable_rest$9() {
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
- 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();
1761
+ function _sliced_to_array$7(arr, i) {
1762
+ return _array_with_holes$9(arr) || _iterable_to_array_limit$7(arr, i) || _unsupported_iterable_to_array$e(arr, i) || _non_iterable_rest$9();
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$e(arr) || _non_iterable_spread$6();
1765
1766
  }
1766
- function _unsupported_iterable_to_array$c(o, minLen) {
1767
+ function _unsupported_iterable_to_array$e(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$e(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$e(o, minLen);
1773
1774
  }
1774
1775
  exports.AssistantCode = void 0;
1775
1776
  (function(AssistantCode) {
@@ -1826,7 +1827,7 @@ function normalizeAssistantBindingToolPreferences(value) {
1826
1827
  }
1827
1828
  var _value_toolsets;
1828
1829
  var toolsets = Object.entries((_value_toolsets = value.toolsets) !== null && _value_toolsets !== void 0 ? _value_toolsets : {}).reduce(function(acc, param) {
1829
- var _param = _sliced_to_array$6(param, 2), key = _param[0], item = _param[1];
1830
+ var _param = _sliced_to_array$7(param, 2), key = _param[0], item = _param[1];
1830
1831
  var nodeKey = normalizeAssistantBindingPreferenceKey(key);
1831
1832
  var toolsetName = normalizeAssistantBindingPreferenceKey(item === null || item === void 0 ? void 0 : item.toolsetName);
1832
1833
  if (!nodeKey || !toolsetName) {
@@ -1841,7 +1842,7 @@ function normalizeAssistantBindingToolPreferences(value) {
1841
1842
  }, {});
1842
1843
  var _value_middlewares;
1843
1844
  var middlewares = Object.entries((_value_middlewares = value.middlewares) !== null && _value_middlewares !== void 0 ? _value_middlewares : {}).reduce(function(acc, param) {
1844
- var _param = _sliced_to_array$6(param, 2), key = _param[0], item = _param[1];
1845
+ var _param = _sliced_to_array$7(param, 2), key = _param[0], item = _param[1];
1845
1846
  var nodeKey = normalizeAssistantBindingPreferenceKey(key);
1846
1847
  var provider = normalizeAssistantBindingPreferenceKey(item === null || item === void 0 ? void 0 : item.provider);
1847
1848
  if (!nodeKey || !provider) {
@@ -1855,7 +1856,7 @@ function normalizeAssistantBindingToolPreferences(value) {
1855
1856
  }, {});
1856
1857
  var _value_skills;
1857
1858
  var skills = Object.entries((_value_skills = value.skills) !== null && _value_skills !== void 0 ? _value_skills : {}).reduce(function(acc, param) {
1858
- var _param = _sliced_to_array$6(param, 2), key = _param[0], item = _param[1];
1859
+ var _param = _sliced_to_array$7(param, 2), key = _param[0], item = _param[1];
1859
1860
  var workspaceKey = normalizeAssistantBindingPreferenceKey(key);
1860
1861
  var workspaceId = normalizeAssistantBindingPreferenceKey(item === null || item === void 0 ? void 0 : item.workspaceId) || workspaceKey;
1861
1862
  if (!workspaceKey || !workspaceId) {
@@ -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$d(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$d(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$d(arr) || _non_iterable_spread$5();
2098
2099
  }
2099
- function _unsupported_iterable_to_array$b(o, minLen) {
2100
+ function _unsupported_iterable_to_array$d(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$d(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$d(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$c(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$c(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$c(arr) || _non_iterable_spread$4();
2423
+ }
2424
+ function _unsupported_iterable_to_array$c(o, minLen) {
2425
+ if (!o) return;
2426
+ if (typeof o === "string") return _array_like_to_array$c(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$c(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",
@@ -2995,12 +3227,12 @@ var VariableOperations = [
2995
3227
  }
2996
3228
  ];
2997
3229
 
2998
- function _array_like_to_array$a(arr, len) {
3230
+ function _array_like_to_array$b(arr, len) {
2999
3231
  if (len == null || len > arr.length) len = arr.length;
3000
3232
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3001
3233
  return arr2;
3002
3234
  }
3003
- function _array_with_holes$7(arr) {
3235
+ function _array_with_holes$8(arr) {
3004
3236
  if (Array.isArray(arr)) return arr;
3005
3237
  }
3006
3238
  function _define_property$9(obj, key, value) {
@@ -3016,7 +3248,7 @@ function _define_property$9(obj, key, value) {
3016
3248
  }
3017
3249
  return obj;
3018
3250
  }
3019
- function _iterable_to_array_limit$5(arr, i) {
3251
+ function _iterable_to_array_limit$6(arr, i) {
3020
3252
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
3021
3253
  if (_i == null) return;
3022
3254
  var _arr = [];
@@ -3040,7 +3272,7 @@ function _iterable_to_array_limit$5(arr, i) {
3040
3272
  }
3041
3273
  return _arr;
3042
3274
  }
3043
- function _non_iterable_rest$7() {
3275
+ function _non_iterable_rest$8() {
3044
3276
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3045
3277
  }
3046
3278
  function _object_spread$8(target) {
@@ -3077,16 +3309,16 @@ function _object_spread_props$5(target, source) {
3077
3309
  }
3078
3310
  return target;
3079
3311
  }
3080
- function _sliced_to_array$5(arr, i) {
3081
- return _array_with_holes$7(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$7();
3312
+ function _sliced_to_array$6(arr, i) {
3313
+ return _array_with_holes$8(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$b(arr, i) || _non_iterable_rest$8();
3082
3314
  }
3083
- function _unsupported_iterable_to_array$a(o, minLen) {
3315
+ function _unsupported_iterable_to_array$b(o, minLen) {
3084
3316
  if (!o) return;
3085
- if (typeof o === "string") return _array_like_to_array$a(o, minLen);
3317
+ if (typeof o === "string") return _array_like_to_array$b(o, minLen);
3086
3318
  var n = Object.prototype.toString.call(o).slice(8, -1);
3087
3319
  if (n === "Object" && o.constructor) n = o.constructor.name;
3088
3320
  if (n === "Map" || n === "Set") return Array.from(n);
3089
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
3321
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
3090
3322
  }
3091
3323
  /**
3092
3324
  * @deprecated can use getCurrentTaskInput instead?
@@ -3168,7 +3400,7 @@ function configurableStoreNamespace(configurable) {
3168
3400
  * @param value
3169
3401
  * @returns
3170
3402
  */ function setStateVariable(state, varName, value) {
3171
- var _varName_split = _sliced_to_array$5(varName.split("."), 2), agentChannelName = _varName_split[0], variableName = _varName_split[1];
3403
+ var _varName_split = _sliced_to_array$6(varName.split("."), 2), agentChannelName = _varName_split[0], variableName = _varName_split[1];
3172
3404
  if (variableName) {
3173
3405
  var _state_agentChannelName;
3174
3406
  state[agentChannelName] = _object_spread_props$5(_object_spread$8({}, (_state_agentChannelName = state[agentChannelName]) !== null && _state_agentChannelName !== void 0 ? _state_agentChannelName : {}), _define_property$9({}, variableName, value));
@@ -3443,13 +3675,13 @@ var _retrieval_recall_contentScope;
3443
3675
  });
3444
3676
  }
3445
3677
 
3446
- function _array_like_to_array$9(arr, len) {
3678
+ function _array_like_to_array$a(arr, len) {
3447
3679
  if (len == null || len > arr.length) len = arr.length;
3448
3680
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3449
3681
  return arr2;
3450
3682
  }
3451
3683
  function _array_without_holes$3(arr) {
3452
- if (Array.isArray(arr)) return _array_like_to_array$9(arr);
3684
+ if (Array.isArray(arr)) return _array_like_to_array$a(arr);
3453
3685
  }
3454
3686
  function _iterable_to_array$5(iter) {
3455
3687
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
@@ -3458,15 +3690,15 @@ function _non_iterable_spread$3() {
3458
3690
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3459
3691
  }
3460
3692
  function _to_consumable_array$3(arr) {
3461
- return _array_without_holes$3(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$3();
3693
+ return _array_without_holes$3(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$3();
3462
3694
  }
3463
- function _unsupported_iterable_to_array$9(o, minLen) {
3695
+ function _unsupported_iterable_to_array$a(o, minLen) {
3464
3696
  if (!o) return;
3465
- if (typeof o === "string") return _array_like_to_array$9(o, minLen);
3697
+ if (typeof o === "string") return _array_like_to_array$a(o, minLen);
3466
3698
  var n = Object.prototype.toString.call(o).slice(8, -1);
3467
3699
  if (n === "Object" && o.constructor) n = o.constructor.name;
3468
3700
  if (n === "Map" || n === "Set") return Array.from(n);
3469
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
3701
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
3470
3702
  }
3471
3703
  var BUILTIN_KNOWLEDGE_PARSER = "builtin";
3472
3704
  /** Only formats with a real builtin reader; unknown binary formats are not advertised as text. */ var BUILTIN_KNOWLEDGE_FILE_TYPES = [
@@ -3556,13 +3788,13 @@ function knowledgebaseParserSelection(config, documentType) {
3556
3788
  })));
3557
3789
  }
3558
3790
 
3559
- function _array_like_to_array$8(arr, len) {
3791
+ function _array_like_to_array$9(arr, len) {
3560
3792
  if (len == null || len > arr.length) len = arr.length;
3561
3793
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3562
3794
  return arr2;
3563
3795
  }
3564
3796
  function _array_without_holes$2(arr) {
3565
- if (Array.isArray(arr)) return _array_like_to_array$8(arr);
3797
+ if (Array.isArray(arr)) return _array_like_to_array$9(arr);
3566
3798
  }
3567
3799
  function _define_property$7(obj, key, value) {
3568
3800
  if (key in obj) {
@@ -3599,15 +3831,15 @@ function _object_spread$6(target) {
3599
3831
  return target;
3600
3832
  }
3601
3833
  function _to_consumable_array$2(arr) {
3602
- return _array_without_holes$2(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$2();
3834
+ return _array_without_holes$2(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$2();
3603
3835
  }
3604
- function _unsupported_iterable_to_array$8(o, minLen) {
3836
+ function _unsupported_iterable_to_array$9(o, minLen) {
3605
3837
  if (!o) return;
3606
- if (typeof o === "string") return _array_like_to_array$8(o, minLen);
3838
+ if (typeof o === "string") return _array_like_to_array$9(o, minLen);
3607
3839
  var n = Object.prototype.toString.call(o).slice(8, -1);
3608
3840
  if (n === "Object" && o.constructor) n = o.constructor.name;
3609
3841
  if (n === "Map" || n === "Set") return Array.from(n);
3610
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
3842
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
3611
3843
  }
3612
3844
  /** Only copy configured defaults; do not turn built-in defaults into document overrides. */ function knowledgebaseDocumentParserDefaults(config, documentType) {
3613
3845
  if (!config) return {};
@@ -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 = {
@@ -4554,13 +4787,13 @@ function buildXpertMarketplaceProfileSnapshot(input, draft) {
4554
4787
  }
4555
4788
 
4556
4789
  // Helpers
4557
- function _array_like_to_array$7(arr, len) {
4790
+ function _array_like_to_array$8(arr, len) {
4558
4791
  if (len == null || len > arr.length) len = arr.length;
4559
4792
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4560
4793
  return arr2;
4561
4794
  }
4562
4795
  function _array_without_holes$1(arr) {
4563
- if (Array.isArray(arr)) return _array_like_to_array$7(arr);
4796
+ if (Array.isArray(arr)) return _array_like_to_array$8(arr);
4564
4797
  }
4565
4798
  function _define_property$5(obj, key, value) {
4566
4799
  if (key in obj) {
@@ -4643,15 +4876,15 @@ function _object_without_properties_loose$1(source, excluded) {
4643
4876
  return target;
4644
4877
  }
4645
4878
  function _to_consumable_array$1(arr) {
4646
- return _array_without_holes$1(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$1();
4879
+ return _array_without_holes$1(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$1();
4647
4880
  }
4648
- function _unsupported_iterable_to_array$7(o, minLen) {
4881
+ function _unsupported_iterable_to_array$8(o, minLen) {
4649
4882
  if (!o) return;
4650
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
4883
+ if (typeof o === "string") return _array_like_to_array$8(o, minLen);
4651
4884
  var n = Object.prototype.toString.call(o).slice(8, -1);
4652
4885
  if (n === "Object" && o.constructor) n = o.constructor.name;
4653
4886
  if (n === "Map" || n === "Set") return Array.from(n);
4654
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
4887
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
4655
4888
  }
4656
4889
  function omitXpertRelations(xpert) {
4657
4890
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -5384,30 +5617,30 @@ exports.KnowledgeGraphIndexJobStatus = void 0;
5384
5617
  var KNOWLEDGE_GRAPH_DOCUMENT_STATUS_BATCH_SIZE = 100;
5385
5618
 
5386
5619
  // Skill types
5387
- function _array_like_to_array$6(arr, len) {
5620
+ function _array_like_to_array$7(arr, len) {
5388
5621
  if (len == null || len > arr.length) len = arr.length;
5389
5622
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5390
5623
  return arr2;
5391
5624
  }
5392
- function _array_with_holes$6(arr) {
5625
+ function _array_with_holes$7(arr) {
5393
5626
  if (Array.isArray(arr)) return arr;
5394
5627
  }
5395
5628
  function _iterable_to_array$2(iter) {
5396
5629
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
5397
5630
  }
5398
- function _non_iterable_rest$6() {
5631
+ function _non_iterable_rest$7() {
5399
5632
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5400
5633
  }
5401
5634
  function _to_array$1(arr) {
5402
- return _array_with_holes$6(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_rest$6();
5635
+ return _array_with_holes$7(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_rest$7();
5403
5636
  }
5404
- function _unsupported_iterable_to_array$6(o, minLen) {
5637
+ function _unsupported_iterable_to_array$7(o, minLen) {
5405
5638
  if (!o) return;
5406
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
5639
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
5407
5640
  var n = Object.prototype.toString.call(o).slice(8, -1);
5408
5641
  if (n === "Object" && o.constructor) n = o.constructor.name;
5409
5642
  if (n === "Map" || n === "Set") return Array.from(n);
5410
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
5643
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
5411
5644
  }
5412
5645
  var RUNTIME_SKILL_CAPABILITY_ID_PREFIX = "runtime-skill/v1";
5413
5646
  function createRuntimeSkillCapabilityId(source) {
@@ -5441,15 +5674,15 @@ function genXpertSkillKey() {
5441
5674
  return letterStartSUID("Skill_");
5442
5675
  }
5443
5676
 
5444
- function _array_like_to_array$5(arr, len) {
5677
+ function _array_like_to_array$6(arr, len) {
5445
5678
  if (len == null || len > arr.length) len = arr.length;
5446
5679
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5447
5680
  return arr2;
5448
5681
  }
5449
- function _array_with_holes$5(arr) {
5682
+ function _array_with_holes$6(arr) {
5450
5683
  if (Array.isArray(arr)) return arr;
5451
5684
  }
5452
- function _iterable_to_array_limit$4(arr, i) {
5685
+ function _iterable_to_array_limit$5(arr, i) {
5453
5686
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
5454
5687
  if (_i == null) return;
5455
5688
  var _arr = [];
@@ -5473,19 +5706,19 @@ function _iterable_to_array_limit$4(arr, i) {
5473
5706
  }
5474
5707
  return _arr;
5475
5708
  }
5476
- function _non_iterable_rest$5() {
5709
+ function _non_iterable_rest$6() {
5477
5710
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5478
5711
  }
5479
- function _sliced_to_array$4(arr, i) {
5480
- return _array_with_holes$5(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
5712
+ function _sliced_to_array$5(arr, i) {
5713
+ return _array_with_holes$6(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$6();
5481
5714
  }
5482
- function _unsupported_iterable_to_array$5(o, minLen) {
5715
+ function _unsupported_iterable_to_array$6(o, minLen) {
5483
5716
  if (!o) return;
5484
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
5717
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
5485
5718
  var n = Object.prototype.toString.call(o).slice(8, -1);
5486
5719
  if (n === "Object" && o.constructor) n = o.constructor.name;
5487
5720
  if (n === "Map" || n === "Set") return Array.from(n);
5488
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
5721
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
5489
5722
  }
5490
5723
  var IGNORED_BOOLEAN_FLAGS = new Set([
5491
5724
  "-y",
@@ -5700,7 +5933,7 @@ function parseGithubSource(source) {
5700
5933
  return parseGithubUrl(raw);
5701
5934
  }
5702
5935
  if (/^[^/\s]+\/[^/\s]+$/.test(raw)) {
5703
- var _raw_split = _sliced_to_array$4(raw.split("/"), 2), owner = _raw_split[0], repoSegment = _raw_split[1];
5936
+ var _raw_split = _sliced_to_array$5(raw.split("/"), 2), owner = _raw_split[0], repoSegment = _raw_split[1];
5704
5937
  var repo = repoSegment.replace(/\.git$/i, "");
5705
5938
  if (!repo) {
5706
5939
  throw new Error("GitHub repository source must include owner and repository name");
@@ -5889,16 +6122,16 @@ function isContextCompressionComponentData(value) {
5889
6122
  "job"
5890
6123
  ];
5891
6124
 
5892
- function _array_like_to_array$4(arr, len) {
6125
+ function _array_like_to_array$5(arr, len) {
5893
6126
  if (len == null || len > arr.length) len = arr.length;
5894
6127
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5895
6128
  return arr2;
5896
6129
  }
5897
- function _array_with_holes$4(arr) {
6130
+ function _array_with_holes$5(arr) {
5898
6131
  if (Array.isArray(arr)) return arr;
5899
6132
  }
5900
6133
  function _array_without_holes(arr) {
5901
- if (Array.isArray(arr)) return _array_like_to_array$4(arr);
6134
+ if (Array.isArray(arr)) return _array_like_to_array$5(arr);
5902
6135
  }
5903
6136
  function _define_property$2(obj, key, value) {
5904
6137
  if (key in obj) {
@@ -5916,7 +6149,7 @@ function _define_property$2(obj, key, value) {
5916
6149
  function _iterable_to_array$1(iter) {
5917
6150
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
5918
6151
  }
5919
- function _iterable_to_array_limit$3(arr, i) {
6152
+ function _iterable_to_array_limit$4(arr, i) {
5920
6153
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
5921
6154
  if (_i == null) return;
5922
6155
  var _arr = [];
@@ -5940,7 +6173,7 @@ function _iterable_to_array_limit$3(arr, i) {
5940
6173
  }
5941
6174
  return _arr;
5942
6175
  }
5943
- function _non_iterable_rest$4() {
6176
+ function _non_iterable_rest$5() {
5944
6177
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5945
6178
  }
5946
6179
  function _non_iterable_spread() {
@@ -6007,19 +6240,19 @@ function _object_without_properties_loose(source, excluded) {
6007
6240
  }
6008
6241
  return target;
6009
6242
  }
6010
- function _sliced_to_array$3(arr, i) {
6011
- return _array_with_holes$4(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
6243
+ function _sliced_to_array$4(arr, i) {
6244
+ return _array_with_holes$5(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
6012
6245
  }
6013
6246
  function _to_consumable_array(arr) {
6014
- return _array_without_holes(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread();
6247
+ return _array_without_holes(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread();
6015
6248
  }
6016
- function _unsupported_iterable_to_array$4(o, minLen) {
6249
+ function _unsupported_iterable_to_array$5(o, minLen) {
6017
6250
  if (!o) return;
6018
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
6251
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
6019
6252
  var n = Object.prototype.toString.call(o).slice(8, -1);
6020
6253
  if (n === "Object" && o.constructor) n = o.constructor.name;
6021
6254
  if (n === "Map" || n === "Set") return Array.from(n);
6022
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
6255
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
6023
6256
  }
6024
6257
  function isNil(value) {
6025
6258
  return value === null || value === undefined;
@@ -6177,7 +6410,7 @@ function mergeComponentData(previous, incoming) {
6177
6410
  var _previous_data, _incoming_data;
6178
6411
  var _incoming_data1;
6179
6412
  var mergedIncomingData = Object.entries((_incoming_data1 = incoming.data) !== null && _incoming_data1 !== void 0 ? _incoming_data1 : {}).reduce(function(acc, param) {
6180
- var _param = _sliced_to_array$3(param, 2), key = _param[0], value = _param[1];
6413
+ var _param = _sliced_to_array$4(param, 2), key = _param[0], value = _param[1];
6181
6414
  if (!isNil(value)) {
6182
6415
  acc[key] = value;
6183
6416
  }
@@ -7024,6 +7257,367 @@ var projectTaskDecisionSchema = projectTaskDecisionInputSchema.extend({
7024
7257
  taskRevision: v3.z.number().int().positive()
7025
7258
  }).strict();
7026
7259
 
7260
+ var templateDependencyLocksSchema = zod.z.array(zod.z.object({
7261
+ pluginName: zod.z.string().trim().min(1).max(300),
7262
+ version: zod.z.string().trim().min(1).max(300),
7263
+ source: zod.z.object({
7264
+ kind: zod.z.literal("agent-plugin"),
7265
+ name: zod.z.string().min(1).max(300),
7266
+ digest: zod.z.string().regex(/^[a-f0-9]{64}$/),
7267
+ bindingId: zod.z.string().uuid(),
7268
+ bindingVersion: zod.z.string().min(1).max(300)
7269
+ }).strict().optional(),
7270
+ providers: zod.z.array(zod.z.object({
7271
+ kind: zod.z.enum([
7272
+ "middleware",
7273
+ "sandbox",
7274
+ "toolset"
7275
+ ]),
7276
+ key: zod.z.string().min(1).max(300)
7277
+ }).strict()).max(300).optional(),
7278
+ components: zod.z.array(zod.z.object({
7279
+ type: zod.z.enum([
7280
+ "skill",
7281
+ "mcp_server",
7282
+ "toolset",
7283
+ "app",
7284
+ "hook",
7285
+ "asset"
7286
+ ]),
7287
+ key: zod.z.string().min(1).max(128),
7288
+ hash: zod.z.string().min(1).max(300)
7289
+ }).strict()).max(300)
7290
+ }).strict()).max(200);
7291
+
7292
+ function _array_like_to_array$4(arr, len) {
7293
+ if (len == null || len > arr.length) len = arr.length;
7294
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7295
+ return arr2;
7296
+ }
7297
+ function _array_with_holes$4(arr) {
7298
+ if (Array.isArray(arr)) return arr;
7299
+ }
7300
+ function _iterable_to_array_limit$3(arr, i) {
7301
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
7302
+ if (_i == null) return;
7303
+ var _arr = [];
7304
+ var _n = true;
7305
+ var _d = false;
7306
+ var _s, _e;
7307
+ try {
7308
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
7309
+ _arr.push(_s.value);
7310
+ if (i && _arr.length === i) break;
7311
+ }
7312
+ } catch (err) {
7313
+ _d = true;
7314
+ _e = err;
7315
+ } finally{
7316
+ try {
7317
+ if (!_n && _i["return"] != null) _i["return"]();
7318
+ } finally{
7319
+ if (_d) throw _e;
7320
+ }
7321
+ }
7322
+ return _arr;
7323
+ }
7324
+ function _non_iterable_rest$4() {
7325
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
7326
+ }
7327
+ function _sliced_to_array$3(arr, i) {
7328
+ return _array_with_holes$4(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
7329
+ }
7330
+ function _unsupported_iterable_to_array$4(o, minLen) {
7331
+ if (!o) return;
7332
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
7333
+ var n = Object.prototype.toString.call(o).slice(8, -1);
7334
+ if (n === "Object" && o.constructor) n = o.constructor.name;
7335
+ if (n === "Map" || n === "Set") return Array.from(n);
7336
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
7337
+ }
7338
+ var text$1 = zod.z.string().trim().min(1).max(300);
7339
+ var key$1 = zod.z.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$/);
7340
+ var required = zod.z.boolean().default(true);
7341
+ /** Portable paths only. Volume remains responsible for canonical containment and symlink checks. */ var templateFilePathSchema = zod.z.string().min(1).max(512).refine(function(value) {
7342
+ return(// Control characters are intentionally rejected in untrusted template paths.
7343
+ // eslint-disable-next-line no-control-regex
7344
+ !/[\\:\x00-\x1f]/.test(value) && value.split("/").every(function(part) {
7345
+ return !!part && part !== "." && part !== ".." && part.toLowerCase() !== ".apps" && !part.toLowerCase().startsWith(".workspace-write-");
7346
+ }));
7347
+ });
7348
+ var fileEntrySchema = zod.z.discriminatedUnion("kind", [
7349
+ zod.z.object({
7350
+ kind: zod.z.literal("directory"),
7351
+ path: templateFilePathSchema
7352
+ }).strict(),
7353
+ zod.z.object({
7354
+ kind: zod.z.literal("file"),
7355
+ path: templateFilePathSchema,
7356
+ content: zod.z.string().max(262144),
7357
+ contentVersion: text$1,
7358
+ policy: zod.z.literal("create-only")
7359
+ }).strict(),
7360
+ zod.z.object({
7361
+ kind: zod.z.literal("ledger"),
7362
+ path: templateFilePathSchema.refine(function(path) {
7363
+ return path.endsWith(".json");
7364
+ }),
7365
+ structureVersion: text$1,
7366
+ columns: zod.z.array(zod.z.object({
7367
+ key: key$1,
7368
+ label: text$1,
7369
+ type: zod.z.enum([
7370
+ "string",
7371
+ "number",
7372
+ "boolean",
7373
+ "date"
7374
+ ])
7375
+ }).strict()).min(1).max(64),
7376
+ policy: zod.z.literal("create-only")
7377
+ }).strict()
7378
+ ]);
7379
+ var templateFilesSchema = zod.z.object({
7380
+ scope: zod.z.enum([
7381
+ "shared",
7382
+ "user"
7383
+ ]),
7384
+ entries: zod.z.array(fileEntrySchema).min(1).max(100)
7385
+ }).strict().superRefine(function(param, ctx) {
7386
+ var entries = param.entries;
7387
+ var paths = new Set();
7388
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
7389
+ try {
7390
+ var _loop = function() {
7391
+ var _step_value = _sliced_to_array$3(_step.value, 2), index = _step_value[0], entry = _step_value[1];
7392
+ var path = entry.path.toLowerCase();
7393
+ if (paths.has(path)) ctx.addIssue({
7394
+ code: "custom",
7395
+ path: [
7396
+ "entries",
7397
+ index,
7398
+ "path"
7399
+ ],
7400
+ message: "Duplicate path"
7401
+ });
7402
+ paths.add(path);
7403
+ if (entries.some(function(other) {
7404
+ return other.kind !== "directory" && path.startsWith("".concat(other.path.toLowerCase(), "/"));
7405
+ })) ctx.addIssue({
7406
+ code: "custom",
7407
+ path: [
7408
+ "entries",
7409
+ index,
7410
+ "path"
7411
+ ],
7412
+ message: "File cannot be a parent"
7413
+ });
7414
+ if (entry.kind === "ledger" && new Set(entry.columns.map(function(column) {
7415
+ return column.key;
7416
+ })).size !== entry.columns.length) ctx.addIssue({
7417
+ code: "custom",
7418
+ path: [
7419
+ "entries",
7420
+ index,
7421
+ "columns"
7422
+ ],
7423
+ message: "Duplicate column"
7424
+ });
7425
+ };
7426
+ for(var _iterator = entries.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
7427
+ } catch (err) {
7428
+ _didIteratorError = true;
7429
+ _iteratorError = err;
7430
+ } finally{
7431
+ try {
7432
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
7433
+ _iterator.return();
7434
+ }
7435
+ } finally{
7436
+ if (_didIteratorError) {
7437
+ throw _iteratorError;
7438
+ }
7439
+ }
7440
+ }
7441
+ if (entries.reduce(function(size, entry) {
7442
+ return size + (entry.kind === "file" ? entry.content.length : 0);
7443
+ }, 0) > 1048576) ctx.addIssue({
7444
+ code: "custom",
7445
+ message: "Initial content exceeds limit"
7446
+ });
7447
+ });
7448
+ /** Versioned, credential-free declarations. Missing manifest preserves the legacy template contract. */ var templateManifestV1Schema = zod.z.object({
7449
+ schemaVersion: zod.z.literal(1),
7450
+ version: text$1,
7451
+ memory: zod.z.object({
7452
+ seed: zod.z.boolean(),
7453
+ preferences: zod.z.array(key$1).max(50).default([])
7454
+ }).strict().optional(),
7455
+ skills: zod.z.array(zod.z.object({
7456
+ pluginName: text$1.optional(),
7457
+ componentKey: key$1
7458
+ }).strict()).max(100).optional(),
7459
+ files: templateFilesSchema.optional(),
7460
+ onboarding: zod.z.object({
7461
+ skill: key$1,
7462
+ required: required,
7463
+ preferences: zod.z.array(key$1).max(50).refine(function(items) {
7464
+ return new Set(items).size === items.length;
7465
+ }),
7466
+ completionCriteria: text$1
7467
+ }).strict().optional(),
7468
+ connectors: zod.z.array(zod.z.object({
7469
+ key: key$1,
7470
+ provider: text$1,
7471
+ required: required,
7472
+ purpose: text$1,
7473
+ permissions: zod.z.array(text$1).max(50)
7474
+ }).strict()).max(50).refine(function(items) {
7475
+ return new Set(items.map(function(item) {
7476
+ return item.key;
7477
+ })).size === items.length;
7478
+ }).refine(function(items) {
7479
+ return new Set(items.map(function(item) {
7480
+ return item.provider;
7481
+ })).size === items.length;
7482
+ }).optional(),
7483
+ routines: zod.z.array(zod.z.object({
7484
+ key: key$1,
7485
+ required: zod.z.boolean().default(false),
7486
+ trigger: zod.z.enum([
7487
+ "schedule",
7488
+ "event"
7489
+ ]),
7490
+ expression: text$1,
7491
+ timezone: zod.z.enum([
7492
+ "user",
7493
+ "organization"
7494
+ ]),
7495
+ skill: key$1,
7496
+ output: text$1,
7497
+ enabled: zod.z.literal(false).default(false)
7498
+ }).strict()).max(50).refine(function(items) {
7499
+ return new Set(items.map(function(item) {
7500
+ return item.key;
7501
+ })).size === items.length;
7502
+ }).optional(),
7503
+ execution: zod.z.object({
7504
+ modelFeatures: zod.z.array(zod.z.nativeEnum(exports.ModelFeature)).max(20).optional(),
7505
+ sandbox: zod.z.enum([
7506
+ "server",
7507
+ "cloud-computer"
7508
+ ]).optional(),
7509
+ localCapabilities: zod.z.array(key$1).max(20).optional(),
7510
+ offline: zod.z.enum([
7511
+ "requires-online",
7512
+ "local-only"
7513
+ ]).optional()
7514
+ }).strict().optional()
7515
+ }).strict();
7516
+ /** V2 keeps only initialization and requirements that the DSL cannot express. */ var assistantTemplateManifestSchema = templateManifestV1Schema.omit({
7517
+ memory: true,
7518
+ skills: true,
7519
+ execution: true
7520
+ }).extend({
7521
+ schemaVersion: zod.z.literal(2),
7522
+ execution: templateManifestV1Schema.shape.execution.unwrap().omit({
7523
+ sandbox: true
7524
+ }).optional()
7525
+ }).strict();
7526
+ var templateManifestSchema = zod.z.discriminatedUnion("schemaVersion", [
7527
+ templateManifestV1Schema,
7528
+ assistantTemplateManifestSchema
7529
+ ]);
7530
+
7531
+ var key = zod.z.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$/);
7532
+ var templatePreferenceValuesSchema = zod.z.record(key, zod.z.string().trim().max(2000)).refine(function(values) {
7533
+ return Object.keys(values).length <= 50;
7534
+ });
7535
+ var assistantTemplateSetupStateSchema = zod.z.object({
7536
+ revision: zod.z.number().int().nonnegative(),
7537
+ preferences: templatePreferenceValuesSchema,
7538
+ completedAt: zod.z.string().datetime().optional(),
7539
+ firstResult: zod.z.string().trim().min(1).max(4000).optional(),
7540
+ connectors: zod.z.record(key, zod.z.discriminatedUnion("choice", [
7541
+ zod.z.object({
7542
+ choice: zod.z.literal("binding"),
7543
+ bindingId: zod.z.string().uuid()
7544
+ }).strict(),
7545
+ zod.z.object({
7546
+ choice: zod.z.literal("skip")
7547
+ }).strict()
7548
+ ]))
7549
+ }).strict();
7550
+ var templateSetupUpdateSchema = zod.z.object({
7551
+ revision: zod.z.number().int().nonnegative(),
7552
+ preferences: templatePreferenceValuesSchema.optional(),
7553
+ firstResult: zod.z.string().trim().min(1).max(4000).optional(),
7554
+ connector: zod.z.object({
7555
+ key: key,
7556
+ selection: zod.z.discriminatedUnion("choice", [
7557
+ zod.z.object({
7558
+ choice: zod.z.literal("binding"),
7559
+ bindingId: zod.z.string().uuid()
7560
+ }).strict(),
7561
+ zod.z.object({
7562
+ choice: zod.z.literal("skip")
7563
+ }).strict()
7564
+ ])
7565
+ }).strict().optional()
7566
+ }).strict();
7567
+ /** Assistant execution policy, independent of template delivery metadata. Exact tool names only. */ var assistantOperationPolicySchema = zod.z.object({
7568
+ default: zod.z.enum([
7569
+ "allow",
7570
+ "approve",
7571
+ "deny"
7572
+ ]),
7573
+ rules: zod.z.array(zod.z.object({
7574
+ tool: key,
7575
+ decision: zod.z.enum([
7576
+ "allow",
7577
+ "approve",
7578
+ "deny"
7579
+ ]),
7580
+ reason: zod.z.string().trim().min(1).max(500)
7581
+ }).strict()).max(300)
7582
+ }).strict().refine(function(policy) {
7583
+ return new Set(policy.rules.map(function(rule) {
7584
+ return rule.tool;
7585
+ })).size === policy.rules.length;
7586
+ });
7587
+
7588
+ var templateActivityReadSchema = zod.z.object({
7589
+ keys: zod.z.array(zod.z.string().regex(/^[a-f0-9-]{36}:(pending|running|awaiting_approval|paused|succeeded|failed)$/)).max(50)
7590
+ }).strict();
7591
+
7592
+ var templatePublicationInputSchema = zod.z.object({
7593
+ revision: zod.z.string().regex(/^[a-f0-9]{64}$/),
7594
+ contentHash: zod.z.string().regex(/^[a-f0-9]{64}$/),
7595
+ visibility: zod.z.enum([
7596
+ "team",
7597
+ "public"
7598
+ ]),
7599
+ version: zod.z.string().trim().regex(/^\d+\.\d+\.\d+$/),
7600
+ releaseNotes: zod.z.string().trim().max(4000).default("")
7601
+ }).strict();
7602
+ var templateUpgradeSectionSchema = zod.z.enum([
7603
+ "presentation",
7604
+ "instructions",
7605
+ "runtime",
7606
+ "definition"
7607
+ ]);
7608
+ var templateUpgradeInputSchema = zod.z.object({
7609
+ targetTemplateId: zod.z.string().trim().min(1).max(500).optional(),
7610
+ revision: zod.z.string().regex(/^[a-f0-9]{64}$/),
7611
+ sourceHash: zod.z.string().regex(/^[a-f0-9]{64}$/),
7612
+ choices: zod.z.record(templateUpgradeSectionSchema, zod.z.enum([
7613
+ "keep",
7614
+ "replace"
7615
+ ]))
7616
+ }).strict();
7617
+ var templateUpgradeActionSchema = zod.z.object({
7618
+ operationId: zod.z.string().uuid()
7619
+ }).strict();
7620
+
7027
7621
  var STATE_VARIABLE_HUMAN = "human";
7028
7622
 
7029
7623
  exports.PermissionsEnum = void 0;
@@ -7127,6 +7721,93 @@ var PermissionGroups = {
7127
7721
  ]
7128
7722
  };
7129
7723
 
7724
+ var modulePermissions = [
7725
+ {
7726
+ module: "ai",
7727
+ permissions: [
7728
+ exports.AIPermissionsEnum.KNOWLEDGEBASE_EDIT,
7729
+ exports.AIPermissionsEnum.COPILOT_VIEW,
7730
+ exports.AIPermissionsEnum.COPILOT_EDIT,
7731
+ exports.AIPermissionsEnum.MODEL_USAGE_MONITOR,
7732
+ exports.AIPermissionsEnum.MODEL_ACCESS_REQUEST_VIEW,
7733
+ exports.AIPermissionsEnum.MODEL_ACCESS_REQUEST_EDIT,
7734
+ exports.AIPermissionsEnum.MODEL_GATEWAY_USE,
7735
+ exports.AIPermissionsEnum.MODEL_GATEWAY_MANAGE,
7736
+ exports.AIPermissionsEnum.XPERT_EDIT,
7737
+ exports.AIPermissionsEnum.CHAT_VIEW,
7738
+ exports.AIPermissionsEnum.EVOLUTION_VIEW,
7739
+ exports.AIPermissionsEnum.EVOLUTION_MANAGE
7740
+ ]
7741
+ },
7742
+ {
7743
+ module: "projects",
7744
+ permissions: [
7745
+ exports.AIPermissionsEnum.XPERT_PROJECT_VIEW,
7746
+ exports.AIPermissionsEnum.XPERT_PROJECT_CREATE,
7747
+ exports.AIPermissionsEnum.XPERT_PROJECT_EDIT,
7748
+ exports.AIPermissionsEnum.XPERT_PROJECT_MANAGE
7749
+ ]
7750
+ },
7751
+ {
7752
+ module: "members",
7753
+ permissions: [
7754
+ exports.PermissionsEnum.ADMIN_DASHBOARD_VIEW,
7755
+ exports.PermissionsEnum.ORG_INVITE_VIEW,
7756
+ exports.PermissionsEnum.ORG_INVITE_EDIT,
7757
+ exports.PermissionsEnum.ORG_DEMO_EDIT,
7758
+ exports.PermissionsEnum.ORG_USERS_VIEW,
7759
+ exports.PermissionsEnum.ORG_USERS_EDIT,
7760
+ exports.PermissionsEnum.ALL_ORG_VIEW,
7761
+ exports.PermissionsEnum.ALL_ORG_EDIT,
7762
+ exports.PermissionsEnum.CHANGE_SELECTED_ORGANIZATION,
7763
+ exports.PermissionsEnum.CHANGE_ROLES_PERMISSIONS,
7764
+ exports.PermissionsEnum.SUPER_ADMIN_EDIT,
7765
+ exports.PermissionsEnum.ACCESS_DELETE_ACCOUNT,
7766
+ exports.PermissionsEnum.ACCESS_DELETE_ALL_DATA,
7767
+ exports.PermissionsEnum.REFERRAL_VIEW
7768
+ ]
7769
+ },
7770
+ {
7771
+ module: "billing",
7772
+ permissions: [
7773
+ exports.AIPermissionsEnum.MEMBERSHIP_EDIT,
7774
+ exports.AIPermissionsEnum.MEMBERSHIP_USE,
7775
+ exports.AIPermissionsEnum.BILLING_PRODUCT_EDIT,
7776
+ exports.AIPermissionsEnum.BILLING_REFUND,
7777
+ exports.AIPermissionsEnum.PAYMENT_PROVIDER_EDIT
7778
+ ]
7779
+ },
7780
+ {
7781
+ module: "data",
7782
+ permissions: [
7783
+ exports.PermissionsEnum.VIEW_ALL_EMAILS,
7784
+ exports.PermissionsEnum.VIEW_ALL_EMAIL_TEMPLATES,
7785
+ exports.PermissionsEnum.INTEGRATION_EDIT,
7786
+ exports.PermissionsEnum.INTEGRATION_VIEW,
7787
+ exports.PermissionsEnum.DATA_SOURCE_VIEW,
7788
+ exports.PermissionsEnum.DATA_SOURCE_EDIT,
7789
+ exports.PermissionsEnum.BUSINESS_AREA_VIEW,
7790
+ exports.PermissionsEnum.BUSINESS_AREA_MANAGE,
7791
+ exports.PermissionsEnum.BUSINESS_AREA_ASSIGN
7792
+ ]
7793
+ },
7794
+ {
7795
+ module: "personal",
7796
+ permissions: [
7797
+ exports.PermissionsEnum.PROFILE_EDIT
7798
+ ]
7799
+ }
7800
+ ];
7801
+ var ROLE_PERMISSION_MODULES = new Map(modulePermissions.flatMap(function(param) {
7802
+ var module = param.module, permissions = param.permissions;
7803
+ return permissions.map(function(permission) {
7804
+ return [
7805
+ permission,
7806
+ module
7807
+ ];
7808
+ });
7809
+ }));
7810
+
7130
7811
  function getTagTargets(tag) {
7131
7812
  var _tag_targets;
7132
7813
  return ((_tag_targets = tag.targets) === null || _tag_targets === void 0 ? void 0 : _tag_targets.length) ? tag.targets : tag.category ? [
@@ -7530,20 +8211,6 @@ var INTEGRATION_PROVIDERS = // [IntegrationEnum.LARK]: IntegrationLarkProvider,
7530
8211
  // [IntegrationEnum.WECOM]: IntegrationWeComProvider,
7531
8212
  _define_property$1({}, exports.IntegrationEnum.GITHUB, IntegrationGitHubProvider);
7532
8213
 
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
8214
  function _array_like_to_array$3(arr, len) {
7548
8215
  if (len == null || len > arr.length) len = arr.length;
7549
8216
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -7892,9 +8559,10 @@ function isInterruptMessage(obj) {
7892
8559
  * business user represented by the current request context.
7893
8560
  */ var API_PRINCIPAL_USER_ID_HEADER = "x-principal-user-id";
7894
8561
  /**
7895
- * Stable binding kinds used to resolve long-lived technical principals.
8562
+ * Stable binding kinds used to resolve personal or resource credentials.
7896
8563
  */ exports.ApiKeyBindingType = void 0;
7897
8564
  (function(ApiKeyBindingType) {
8565
+ /** A fixed human owner, without an Assistant or workspace audience. */ ApiKeyBindingType["USER"] = "user";
7898
8566
  ApiKeyBindingType["ASSISTANT"] = "assistant";
7899
8567
  ApiKeyBindingType["WORKSPACE"] = "workspace";
7900
8568
  ApiKeyBindingType["INTEGRATION"] = "integration";
@@ -7904,6 +8572,13 @@ function isInterruptMessage(obj) {
7904
8572
  */ ApiKeyBindingType["KNOWLEDGEBASE"] = "knowledgebase";
7905
8573
  })(exports.ApiKeyBindingType || (exports.ApiKeyBindingType = {}));
7906
8574
 
8575
+ /** A personal credential uses existing API-key endpoints as its human owner, subject to their current permissions. */ var PERSONAL_API_KEY_LIFETIMES = [
8576
+ "30",
8577
+ "90",
8578
+ "365",
8579
+ "never"
8580
+ ];
8581
+
7907
8582
  exports.BusinessType = void 0;
7908
8583
  (function(BusinessType) {
7909
8584
  BusinessType["SEMANTIC_MODEL"] = "SEMANTIC_MODEL";
@@ -8433,6 +9108,7 @@ exports.MODEL_GATEWAY_MAX_CONCURRENT_REQUESTS_SETTING = MODEL_GATEWAY_MAX_CONCUR
8433
9108
  exports.MODEL_GATEWAY_REQUESTS_PER_MINUTE_SETTING = MODEL_GATEWAY_REQUESTS_PER_MINUTE_SETTING;
8434
9109
  exports.OllamaEmbeddingsProviders = OllamaEmbeddingsProviders;
8435
9110
  exports.OpenAIEmbeddingsProviders = OpenAIEmbeddingsProviders;
9111
+ exports.PERSONAL_API_KEY_LIFETIMES = PERSONAL_API_KEY_LIFETIMES;
8436
9112
  exports.PLUGIN_APPLICATION_INSTALLATION_STATUS = PLUGIN_APPLICATION_INSTALLATION_STATUS;
8437
9113
  exports.PLUGIN_APPLICATION_SCOPE = PLUGIN_APPLICATION_SCOPE;
8438
9114
  exports.PLUGIN_COMPONENT_TYPE = PLUGIN_COMPONENT_TYPE;
@@ -8450,6 +9126,7 @@ exports.PLUGIN_RESOURCE_RUNTIME_TYPE = PLUGIN_RESOURCE_RUNTIME_TYPE;
8450
9126
  exports.PLUGIN_SOURCE = PLUGIN_SOURCE;
8451
9127
  exports.PROJECT_TASK_ICON_NAMES = PROJECT_TASK_ICON_NAMES;
8452
9128
  exports.PermissionGroups = PermissionGroups;
9129
+ exports.ROLE_PERMISSION_MODULES = ROLE_PERMISSION_MODULES;
8453
9130
  exports.RUNTIME_RESTART_CONFIRMATION = RUNTIME_RESTART_CONFIRMATION;
8454
9131
  exports.RUNTIME_STREAM_INTERRUPTED_EVENT = RUNTIME_STREAM_INTERRUPTED_EVENT;
8455
9132
  exports.SANDBOX_FILE_OUTPUT_RULES = SANDBOX_FILE_OUTPUT_RULES;
@@ -8513,8 +9190,11 @@ exports.agentUniqueName = agentUniqueName;
8513
9190
  exports.allChannels = allChannels;
8514
9191
  exports.appendMessageContent = appendMessageContent;
8515
9192
  exports.appendMessagePlainText = appendMessagePlainText;
9193
+ exports.assistantOperationPolicySchema = assistantOperationPolicySchema;
8516
9194
  exports.assistantTaskGroupContext = assistantTaskGroupContext;
8517
9195
  exports.assistantTaskGroupContextSchema = assistantTaskGroupContextSchema;
9196
+ exports.assistantTemplateManifestSchema = assistantTemplateManifestSchema;
9197
+ exports.assistantTemplateSetupStateSchema = assistantTemplateSetupStateSchema;
8518
9198
  exports.buildChunkTree = buildChunkTree;
8519
9199
  exports.buildXpertMarketplaceProfileSnapshot = buildXpertMarketplaceProfileSnapshot;
8520
9200
  exports.canAllowMcpToolDirectly = canAllowMcpToolDirectly;
@@ -8524,6 +9204,8 @@ exports.classificateDocumentCategory = classificateDocumentCategory;
8524
9204
  exports.codingExecutionViewKey = codingExecutionViewKey;
8525
9205
  exports.collectTreeLeaves = collectTreeLeaves;
8526
9206
  exports.configurableStoreNamespace = configurableStoreNamespace;
9207
+ exports.configurationFromModel = configurationFromModel;
9208
+ exports.configuredModelSource = configuredModelSource;
8527
9209
  exports.convertToUrlPath = convertToUrlPath;
8528
9210
  exports.createAgentConnections = createAgentConnections;
8529
9211
  exports.createConversationTitleSummaryEvent = createConversationTitleSummaryEvent;
@@ -8536,7 +9218,9 @@ exports.createXpertGraph = createXpertGraph;
8536
9218
  exports.createXpertNodes = createXpertNodes;
8537
9219
  exports.decodeKnowledgeSeparators = decodeKnowledgeSeparators;
8538
9220
  exports.defaultMcpToolApprovalMode = defaultMcpToolApprovalMode;
9221
+ exports.defaultModelConfiguration = defaultModelConfiguration;
8539
9222
  exports.deriveXpertMarketplaceTechnicalProfile = deriveXpertMarketplaceTechnicalProfile;
9223
+ exports.discoverableModelTypes = discoverableModelTypes;
8540
9224
  exports.ensureAssistantBindingSkillWorkspacePreference = ensureAssistantBindingSkillWorkspacePreference;
8541
9225
  exports.evidenceDrivenStrategy = evidenceDrivenStrategy;
8542
9226
  exports.executionActivityBatchSchema = executionActivityBatchSchema;
@@ -8596,7 +9280,9 @@ exports.isAssistantBindingToolEnabled = isAssistantBindingToolEnabled;
8596
9280
  exports.isAssistantBindingToolPreferencesEmpty = isAssistantBindingToolPreferencesEmpty;
8597
9281
  exports.isAudioType = isAudioType;
8598
9282
  exports.isBlank = isBlank;
9283
+ exports.isConfiguredModelAvailable = isConfiguredModelAvailable;
8599
9284
  exports.isContextCompressionComponentData = isContextCompressionComponentData;
9285
+ exports.isDiscoverableModelType = isDiscoverableModelType;
8600
9286
  exports.isDocumentKnowledgebaseType = isDocumentKnowledgebaseType;
8601
9287
  exports.isDocumentSheet = isDocumentSheet;
8602
9288
  exports.isEnableTool = isEnableTool;
@@ -8647,8 +9333,10 @@ exports.locateNodes = locateNodes;
8647
9333
  exports.mapTranslationLanguage = mapTranslationLanguage;
8648
9334
  exports.mergeMessageContentForDisplay = mergeMessageContentForDisplay;
8649
9335
  exports.messageContentText = messageContentText;
9336
+ exports.modelConfigurationSchema = modelConfigurationSchema;
8650
9337
  exports.modelExecutionEntry = modelExecutionEntry;
8651
9338
  exports.modelExecutionSourceId = modelExecutionSourceId;
9339
+ exports.modelImportSchema = modelImportSchema;
8652
9340
  exports.nonBlank = nonBlank;
8653
9341
  exports.nonNullable = nonNullable;
8654
9342
  exports.normalizeAssistantBindingToolPreferences = normalizeAssistantBindingToolPreferences;
@@ -8679,6 +9367,7 @@ exports.projectTaskReviewReportSchema = projectTaskReviewReportSchema;
8679
9367
  exports.projectTaskSpecificationDigestSchema = projectTaskSpecificationDigestSchema;
8680
9368
  exports.projectTaskSpecificationSchema = projectTaskSpecificationSchema;
8681
9369
  exports.projectTaskSpecificationSnapshotSchema = projectTaskSpecificationSnapshotSchema;
9370
+ exports.readModelConfiguration = readModelConfiguration;
8682
9371
  exports.replaceAgentInDraft = replaceAgentInDraft;
8683
9372
  exports.resolveDraftPrimaryAgent = resolveDraftPrimaryAgent;
8684
9373
  exports.resolveDraftRuntimeGraph = resolveDraftRuntimeGraph;
@@ -8690,9 +9379,22 @@ exports.resolveRuntimeXpert = resolveRuntimeXpert;
8690
9379
  exports.setStateVariable = setStateVariable;
8691
9380
  exports.shortTitle = shortTitle;
8692
9381
  exports.stringifyMessageContent = stringifyMessageContent;
9382
+ exports.templateActivityReadSchema = templateActivityReadSchema;
9383
+ exports.templateDependencyLocksSchema = templateDependencyLocksSchema;
9384
+ exports.templateFilePathSchema = templateFilePathSchema;
9385
+ exports.templateFilesSchema = templateFilesSchema;
9386
+ exports.templateManifestSchema = templateManifestSchema;
9387
+ exports.templateManifestV1Schema = templateManifestV1Schema;
9388
+ exports.templatePreferenceValuesSchema = templatePreferenceValuesSchema;
9389
+ exports.templatePublicationInputSchema = templatePublicationInputSchema;
9390
+ exports.templateSetupUpdateSchema = templateSetupUpdateSchema;
9391
+ exports.templateUpgradeActionSchema = templateUpgradeActionSchema;
9392
+ exports.templateUpgradeInputSchema = templateUpgradeInputSchema;
9393
+ exports.templateUpgradeSectionSchema = templateUpgradeSectionSchema;
8693
9394
  exports.transformInstallation = transformInstallation;
8694
9395
  exports.updateAssistantBindingSkillPreferences = updateAssistantBindingSkillPreferences;
8695
9396
  exports.updateAssistantBindingToolPreferences = updateAssistantBindingToolPreferences;
9397
+ exports.usesConfiguredModelCatalog = usesConfiguredModelCatalog;
8696
9398
  exports.uuid = uuid;
8697
9399
  exports.validateProjectTaskGraph = validateProjectTaskGraph;
8698
9400
  exports.workflowNodeIdentifier = workflowNodeIdentifier;