mavenagi 1.2.60 → 1.2.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/BaseClient.d.ts +12 -0
  2. package/BaseClient.js +5 -3
  3. package/Client.d.ts +3 -0
  4. package/Client.js +33 -28
  5. package/api/resources/actions/client/Client.d.ts +10 -0
  6. package/api/resources/actions/client/Client.js +14 -3
  7. package/api/resources/agents/client/Client.d.ts +12 -0
  8. package/api/resources/agents/client/Client.js +16 -3
  9. package/api/resources/agents/client/requests/AgentPatchRequest.d.ts +3 -3
  10. package/api/resources/agents/types/AgentPrompting.d.ts +3 -3
  11. package/api/resources/analytics/client/Client.d.ts +14 -0
  12. package/api/resources/analytics/client/Client.js +22 -7
  13. package/api/resources/analytics/types/ConversationMedian.d.ts +4 -0
  14. package/api/resources/analytics/types/ConversationPercentile.d.ts +4 -0
  15. package/api/resources/analytics/types/RowBase.d.ts +5 -1
  16. package/api/resources/analytics/types/Series.d.ts +4 -1
  17. package/api/resources/analytics/types/TimeSeries.d.ts +5 -1
  18. package/api/resources/appDirectory/client/Client.d.ts +12 -0
  19. package/api/resources/appDirectory/client/Client.js +16 -3
  20. package/api/resources/appSettings/client/Client.d.ts +6 -0
  21. package/api/resources/appSettings/client/Client.js +8 -1
  22. package/api/resources/assets/client/Client.d.ts +4 -0
  23. package/api/resources/assets/client/Client.js +7 -2
  24. package/api/resources/charters/client/Client.d.ts +245 -0
  25. package/api/resources/charters/client/Client.js +884 -0
  26. package/api/resources/charters/client/index.d.ts +1 -0
  27. package/api/resources/charters/client/index.js +17 -0
  28. package/api/resources/charters/client/requests/CharterDeleteRequest.d.ts +20 -0
  29. package/api/resources/charters/client/requests/CharterDeleteRequest.js +3 -0
  30. package/api/resources/charters/client/requests/CharterGetAncestorsRequest.d.ts +8 -0
  31. package/api/resources/charters/client/requests/CharterGetAncestorsRequest.js +3 -0
  32. package/api/resources/charters/client/requests/CharterGetRequest.d.ts +8 -0
  33. package/api/resources/charters/client/requests/CharterGetRequest.js +3 -0
  34. package/api/resources/charters/client/requests/CharterPatchRequest.d.ts +67 -0
  35. package/api/resources/charters/client/requests/CharterPatchRequest.js +3 -0
  36. package/api/resources/charters/client/requests/index.d.ts +4 -0
  37. package/api/resources/charters/client/requests/index.js +2 -0
  38. package/api/resources/charters/exports.d.ts +2 -0
  39. package/api/resources/charters/exports.js +21 -0
  40. package/api/resources/charters/index.d.ts +1 -0
  41. package/api/resources/charters/index.js +1 -0
  42. package/api/resources/charters/types/CharterAncestorsResponse.d.ts +8 -0
  43. package/api/resources/charters/types/CharterAncestorsResponse.js +3 -0
  44. package/api/resources/charters/types/CharterBase.d.ts +14 -0
  45. package/api/resources/charters/types/CharterBase.js +3 -0
  46. package/api/resources/charters/types/CharterChildrenExclusionPolicy.d.ts +1 -1
  47. package/api/resources/charters/types/CharterChildrenExclusionPolicy.js +1 -1
  48. package/api/resources/charters/types/CharterChildrenGroup.d.ts +18 -0
  49. package/api/resources/charters/types/CharterChildrenGroup.js +3 -0
  50. package/api/resources/charters/types/CharterContent.d.ts +60 -0
  51. package/api/resources/charters/types/CharterContent.js +3 -0
  52. package/api/resources/charters/types/CharterKnowledgeBaseReference.d.ts +16 -0
  53. package/api/resources/charters/types/CharterKnowledgeBaseReference.js +3 -0
  54. package/api/resources/charters/types/CharterListChildrenRequest.d.ts +18 -0
  55. package/api/resources/charters/types/CharterListChildrenRequest.js +3 -0
  56. package/api/resources/charters/types/CharterListChildrenResponse.d.ts +55 -0
  57. package/api/resources/charters/types/CharterListChildrenResponse.js +3 -0
  58. package/api/resources/charters/types/CharterPatchReferences.d.ts +22 -0
  59. package/api/resources/charters/types/CharterPatchReferences.js +3 -0
  60. package/api/resources/charters/types/CharterReferences.d.ts +21 -0
  61. package/api/resources/charters/types/CharterReferences.js +3 -0
  62. package/api/resources/charters/types/CharterRequest.d.ts +36 -0
  63. package/api/resources/charters/types/CharterRequest.js +3 -0
  64. package/api/resources/charters/types/CharterResponse.d.ts +66 -0
  65. package/api/resources/charters/types/CharterResponse.js +3 -0
  66. package/api/resources/charters/types/CharterSearchField.d.ts +5 -0
  67. package/api/resources/charters/types/CharterSearchField.js +8 -0
  68. package/api/resources/charters/types/CharterSearchFilter.d.ts +15 -0
  69. package/api/resources/charters/types/CharterSearchFilter.js +3 -0
  70. package/api/resources/charters/types/CharterSearchRequest.d.ts +5 -0
  71. package/api/resources/charters/types/CharterSearchRequest.js +3 -0
  72. package/api/resources/charters/types/CharterSearchResponse.d.ts +36 -0
  73. package/api/resources/charters/types/CharterSearchResponse.js +3 -0
  74. package/api/resources/charters/types/CharterStatus.d.ts +2 -2
  75. package/api/resources/charters/types/CharterStatus.js +2 -2
  76. package/api/resources/charters/types/CharterSummary.d.ts +1 -9
  77. package/api/resources/charters/types/CharterType.d.ts +4 -4
  78. package/api/resources/charters/types/CharterType.js +4 -4
  79. package/api/resources/charters/types/index.d.ts +15 -0
  80. package/api/resources/charters/types/index.js +15 -0
  81. package/api/resources/commons/errors/BadRequestError.d.ts +1 -0
  82. package/api/resources/commons/errors/BadRequestError.js +1 -1
  83. package/api/resources/commons/errors/NotFoundError.d.ts +1 -0
  84. package/api/resources/commons/errors/NotFoundError.js +1 -1
  85. package/api/resources/commons/errors/PayloadTooLargeError.d.ts +1 -0
  86. package/api/resources/commons/errors/PayloadTooLargeError.js +1 -1
  87. package/api/resources/commons/errors/ServerError.d.ts +1 -0
  88. package/api/resources/commons/errors/ServerError.js +1 -1
  89. package/api/resources/commons/errors/TooManyRequestsError.d.ts +1 -0
  90. package/api/resources/commons/errors/TooManyRequestsError.js +1 -1
  91. package/api/resources/commons/types/AskType.d.ts +2 -2
  92. package/api/resources/commons/types/AskType.js +2 -2
  93. package/api/resources/commons/types/BotObjectResponse.d.ts +1 -1
  94. package/api/resources/commons/types/ConversationRound.d.ts +1 -1
  95. package/api/resources/commons/types/ConversationRound.js +1 -1
  96. package/api/resources/commons/types/IntelligentFieldPrecondition.d.ts +0 -4
  97. package/api/resources/commons/types/LlmPersona.d.ts +1 -1
  98. package/api/resources/commons/types/LlmPersona.js +1 -1
  99. package/api/resources/commons/types/MetadataComparisonCondition.d.ts +10 -0
  100. package/api/resources/commons/types/MetadataComparisonCondition.js +3 -0
  101. package/api/resources/commons/types/MetadataComparisonOperator.d.ts +22 -0
  102. package/api/resources/commons/types/MetadataComparisonOperator.js +25 -0
  103. package/api/resources/commons/types/MetadataCondition.d.ts +21 -0
  104. package/api/resources/commons/types/MetadataCondition.js +3 -0
  105. package/api/resources/commons/types/MetadataEntryCondition.d.ts +10 -0
  106. package/api/resources/commons/types/MetadataEntryCondition.js +3 -0
  107. package/api/resources/commons/types/MetadataFilter.d.ts +41 -0
  108. package/api/resources/commons/types/MetadataFilter.js +3 -0
  109. package/api/resources/commons/types/MetadataFilterGroup.d.ts +14 -0
  110. package/api/resources/commons/types/MetadataFilterGroup.js +3 -0
  111. package/api/resources/commons/types/SimulationContext.d.ts +2 -2
  112. package/api/resources/commons/types/SystemEventName.d.ts +3 -0
  113. package/api/resources/commons/types/SystemEventName.js +3 -0
  114. package/api/resources/commons/types/index.d.ts +6 -0
  115. package/api/resources/commons/types/index.js +6 -0
  116. package/api/resources/conversation/client/Client.d.ts +32 -0
  117. package/api/resources/conversation/client/Client.js +48 -17
  118. package/api/resources/conversation/types/AskRequest.d.ts +10 -10
  119. package/api/resources/conversation/types/ConversationFilter.d.ts +6 -1
  120. package/api/resources/customers/client/Client.d.ts +8 -0
  121. package/api/resources/customers/client/Client.js +12 -3
  122. package/api/resources/events/client/Client.d.ts +8 -0
  123. package/api/resources/events/client/Client.js +12 -3
  124. package/api/resources/inbox/client/Client.d.ts +16 -0
  125. package/api/resources/inbox/client/Client.js +22 -5
  126. package/api/resources/index.d.ts +1 -0
  127. package/api/resources/index.js +1 -0
  128. package/api/resources/integrations/client/Client.d.ts +2 -0
  129. package/api/resources/integrations/client/Client.js +4 -1
  130. package/api/resources/intelligentFields/client/Client.d.ts +28 -3
  131. package/api/resources/intelligentFields/client/Client.js +36 -8
  132. package/api/resources/intelligentFields/client/requests/IntelligentFieldGetRequest.d.ts +4 -0
  133. package/api/resources/intelligentFields/client/requests/IntelligentFieldPatchRequest.d.ts +13 -4
  134. package/api/resources/intelligentFields/types/EnumOption.d.ts +3 -1
  135. package/api/resources/intelligentFields/types/IntelligentFieldBase.d.ts +1 -1
  136. package/api/resources/intelligentFields/types/IntelligentFieldCore.d.ts +12 -11
  137. package/api/resources/intelligentFields/types/IntelligentFieldDetailResponse.d.ts +4 -1
  138. package/api/resources/intelligentFields/types/IntelligentFieldRequest.d.ts +4 -1
  139. package/api/resources/intelligentFields/types/IntelligentFieldStatus.d.ts +8 -1
  140. package/api/resources/intelligentFields/types/IntelligentFieldStatus.js +8 -1
  141. package/api/resources/intelligentFields/types/IntelligentFieldType.d.ts +10 -0
  142. package/api/resources/intelligentFields/types/IntelligentFieldType.js +10 -0
  143. package/api/resources/knowledge/client/Client.d.ts +32 -0
  144. package/api/resources/knowledge/client/Client.js +47 -16
  145. package/api/resources/knowledge/types/KnowledgeDocumentFilter.d.ts +13 -0
  146. package/api/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +4 -2
  147. package/api/resources/knowledge/types/KnowledgeDocumentResponse.d.ts +33 -9
  148. package/api/resources/knowledge/types/KnowledgeDocumentSearchResponse.d.ts +7 -1
  149. package/api/resources/organizations/client/Client.d.ts +12 -0
  150. package/api/resources/organizations/client/Client.js +17 -4
  151. package/api/resources/segments/client/Client.d.ts +10 -0
  152. package/api/resources/segments/client/Client.js +14 -3
  153. package/api/resources/translations/client/Client.d.ts +2 -0
  154. package/api/resources/translations/client/Client.js +4 -1
  155. package/api/resources/triggers/client/Client.d.ts +10 -0
  156. package/api/resources/triggers/client/Client.js +14 -3
  157. package/api/resources/users/client/Client.d.ts +10 -0
  158. package/api/resources/users/client/Client.js +13 -2
  159. package/api/resources/voice/client/Client.d.ts +2 -0
  160. package/api/resources/voice/client/Client.js +4 -1
  161. package/api/resources/voiceConversations/client/Client.d.ts +4 -1
  162. package/api/resources/voiceConversations/client/Client.js +2 -1
  163. package/api/resources/voiceConversations/client/Socket.d.ts +11 -0
  164. package/api/resources/voiceConversations/client/Socket.js +15 -0
  165. package/core/fetcher/Fetcher.js +9 -92
  166. package/core/fetcher/getResponseBody.js +11 -0
  167. package/core/fetcher/makePassthroughRequest.js +26 -4
  168. package/core/fetcher/redactUrl.d.ts +2 -0
  169. package/core/fetcher/redactUrl.js +88 -0
  170. package/core/fetcher/signals.js +9 -1
  171. package/core/file/file.js +3 -0
  172. package/core/form-data-utils/FormDataWrapper.js +3 -0
  173. package/core/requestBody.d.ts +12 -0
  174. package/core/requestBody.js +26 -0
  175. package/core/runtime/index.d.ts +1 -1
  176. package/core/runtime/index.js +2 -1
  177. package/core/runtime/runtime.d.ts +19 -0
  178. package/core/runtime/runtime.js +74 -2
  179. package/core/schemas/builders/schema-utils/JsonError.js +2 -2
  180. package/core/schemas/builders/schema-utils/ParseError.js +2 -2
  181. package/core/stream/Stream.d.ts +45 -1
  182. package/core/stream/Stream.js +323 -84
  183. package/core/stream/index.d.ts +1 -0
  184. package/core/url/qs.js +2 -2
  185. package/core/websocket/ws.d.ts +6 -0
  186. package/core/websocket/ws.js +14 -1
  187. package/errors/MavenAGIError.d.ts +1 -0
  188. package/errors/MavenAGIError.js +5 -1
  189. package/errors/MavenAGITimeoutError.d.ts +2 -2
  190. package/errors/MavenAGITimeoutError.js +40 -6
  191. package/package.json +2 -2
  192. package/reference.md +587 -3
  193. package/serialization/resources/charters/client/index.d.ts +1 -0
  194. package/serialization/resources/charters/client/index.js +17 -0
  195. package/serialization/resources/charters/client/requests/CharterPatchRequest.d.ts +24 -0
  196. package/serialization/resources/charters/client/requests/CharterPatchRequest.js +57 -0
  197. package/serialization/resources/charters/client/requests/index.d.ts +1 -0
  198. package/serialization/resources/charters/client/requests/index.js +5 -0
  199. package/serialization/resources/charters/index.d.ts +1 -0
  200. package/serialization/resources/charters/index.js +1 -0
  201. package/serialization/resources/charters/types/CharterAncestorsResponse.d.ts +10 -0
  202. package/serialization/resources/charters/types/CharterAncestorsResponse.js +42 -0
  203. package/serialization/resources/charters/types/CharterBase.d.ts +11 -0
  204. package/serialization/resources/charters/types/CharterBase.js +43 -0
  205. package/serialization/resources/charters/types/CharterChildrenGroup.d.ts +13 -0
  206. package/serialization/resources/charters/types/CharterChildrenGroup.js +45 -0
  207. package/serialization/resources/charters/types/CharterContent.d.ts +19 -0
  208. package/serialization/resources/charters/types/CharterContent.js +54 -0
  209. package/serialization/resources/charters/types/CharterKnowledgeBaseReference.d.ts +11 -0
  210. package/serialization/resources/charters/types/CharterKnowledgeBaseReference.js +44 -0
  211. package/serialization/resources/charters/types/CharterListChildrenRequest.d.ts +11 -0
  212. package/serialization/resources/charters/types/CharterListChildrenRequest.js +45 -0
  213. package/serialization/resources/charters/types/CharterListChildrenResponse.d.ts +11 -0
  214. package/serialization/resources/charters/types/CharterListChildrenResponse.js +45 -0
  215. package/serialization/resources/charters/types/CharterPatchReferences.d.ts +12 -0
  216. package/serialization/resources/charters/types/CharterPatchReferences.js +44 -0
  217. package/serialization/resources/charters/types/CharterReferences.d.ts +12 -0
  218. package/serialization/resources/charters/types/CharterReferences.js +44 -0
  219. package/serialization/resources/charters/types/CharterRequest.d.ts +13 -0
  220. package/serialization/resources/charters/types/CharterRequest.js +47 -0
  221. package/serialization/resources/charters/types/CharterResponse.d.ts +25 -0
  222. package/serialization/resources/charters/types/CharterResponse.js +60 -0
  223. package/serialization/resources/charters/types/CharterSearchField.d.ts +7 -0
  224. package/serialization/resources/charters/types/CharterSearchField.js +39 -0
  225. package/serialization/resources/charters/types/CharterSearchFilter.d.ts +11 -0
  226. package/serialization/resources/charters/types/CharterSearchFilter.js +43 -0
  227. package/serialization/resources/charters/types/CharterSearchRequest.d.ts +13 -0
  228. package/serialization/resources/charters/types/CharterSearchRequest.js +47 -0
  229. package/serialization/resources/charters/types/CharterSearchResponse.d.ts +11 -0
  230. package/serialization/resources/charters/types/CharterSearchResponse.js +45 -0
  231. package/serialization/resources/charters/types/CharterSummary.d.ts +0 -2
  232. package/serialization/resources/charters/types/CharterSummary.js +0 -2
  233. package/serialization/resources/charters/types/index.d.ts +15 -0
  234. package/serialization/resources/charters/types/index.js +15 -0
  235. package/serialization/resources/commons/types/MetadataComparisonCondition.d.ts +11 -0
  236. package/serialization/resources/commons/types/MetadataComparisonCondition.js +43 -0
  237. package/serialization/resources/commons/types/MetadataComparisonOperator.d.ts +7 -0
  238. package/serialization/resources/commons/types/MetadataComparisonOperator.js +39 -0
  239. package/serialization/resources/commons/types/MetadataCondition.d.ts +19 -0
  240. package/serialization/resources/commons/types/MetadataCondition.js +51 -0
  241. package/serialization/resources/commons/types/MetadataEntryCondition.d.ts +11 -0
  242. package/serialization/resources/commons/types/MetadataEntryCondition.js +43 -0
  243. package/serialization/resources/commons/types/MetadataFilter.d.ts +14 -0
  244. package/serialization/resources/commons/types/MetadataFilter.js +49 -0
  245. package/serialization/resources/commons/types/MetadataFilterGroup.d.ts +11 -0
  246. package/serialization/resources/commons/types/MetadataFilterGroup.js +44 -0
  247. package/serialization/resources/commons/types/SystemEventName.d.ts +1 -1
  248. package/serialization/resources/commons/types/SystemEventName.js +1 -0
  249. package/serialization/resources/commons/types/index.d.ts +6 -0
  250. package/serialization/resources/commons/types/index.js +6 -0
  251. package/serialization/resources/index.d.ts +1 -0
  252. package/serialization/resources/index.js +1 -0
  253. package/serialization/resources/intelligentFields/client/requests/IntelligentFieldPatchRequest.d.ts +1 -0
  254. package/serialization/resources/intelligentFields/client/requests/IntelligentFieldPatchRequest.js +1 -0
  255. package/serialization/resources/knowledge/types/KnowledgeDocumentFilter.d.ts +2 -0
  256. package/serialization/resources/knowledge/types/KnowledgeDocumentFilter.js +2 -0
  257. package/serialization/resources/knowledge/types/KnowledgeDocumentResponse.d.ts +0 -2
  258. package/serialization/resources/knowledge/types/KnowledgeDocumentResponse.js +0 -2
  259. package/serialization/resources/knowledge/types/KnowledgeDocumentSearchResponse.d.ts +2 -0
  260. package/serialization/resources/knowledge/types/KnowledgeDocumentSearchResponse.js +2 -0
  261. package/version.d.ts +1 -1
  262. package/version.js +1 -1
@@ -0,0 +1,884 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.ChartersClient = void 0;
47
+ const BaseClient_1 = require("../../../../BaseClient");
48
+ const core = __importStar(require("../../../../core"));
49
+ const headers_1 = require("../../../../core/headers");
50
+ const requestBody_1 = require("../../../../core/requestBody");
51
+ const environments = __importStar(require("../../../../environments"));
52
+ const handleNonStatusCodeError_1 = require("../../../../errors/handleNonStatusCodeError");
53
+ const errors = __importStar(require("../../../../errors/index"));
54
+ const serializers = __importStar(require("../../../../serialization/index"));
55
+ const MavenAGI = __importStar(require("../../../index"));
56
+ class ChartersClient {
57
+ constructor(options) {
58
+ this._options = (0, BaseClient_1.normalizeClientOptionsWithAuth)(options);
59
+ }
60
+ /**
61
+ * Create a new charter or update an existing one. Charters are governing
62
+ * documents that combine a precondition (when the charter applies), a manual
63
+ * (what the LLM should do), and the knowledge bases and actions the charter
64
+ * makes available.
65
+ *
66
+ * All charters in an agent form a tree (forest / multi-roots). When a
67
+ * charter is matched on a round, all its ancestor charters will be
68
+ * incorporated. Non-leaf charters are referred to as a charter group.
69
+ *
70
+ * Charters may specify a 0-indexed custom `userRank` that indicates
71
+ * preferences among its siblings. The rank is currently only meaningful
72
+ * for leaf charters as we enforce mutual exclusion among the leafs and
73
+ * pick only the highest ranked (lowest numerical value) leaf to include in
74
+ * the round. userRank may have gaps.
75
+ *
76
+ * @param {MavenAGI.CharterRequest} request
77
+ * @param {ChartersClient.RequestOptions} requestOptions - Request-specific configuration.
78
+ *
79
+ * @throws {@link MavenAGI.NotFoundError}
80
+ * @throws {@link MavenAGI.BadRequestError}
81
+ * @throws {@link MavenAGI.PayloadTooLargeError}
82
+ * @throws {@link MavenAGI.TooManyRequestsError}
83
+ * @throws {@link MavenAGI.ServerError}
84
+ * @throws {@link errors.MavenAGIError}
85
+ * @throws {@link errors.MavenAGITimeoutError}
86
+ *
87
+ * @example
88
+ * await client.charters.createOrUpdate({
89
+ * charterId: {
90
+ * referenceId: "cancellation-flow"
91
+ * },
92
+ * name: "Cancellation Flow",
93
+ * manual: "Guide the user through the cancellation process with empathy. Always confirm their intent before proceeding.",
94
+ * precondition: {
95
+ * preconditionType: "conversation",
96
+ * value: {
97
+ * conversationPreconditionType: "tags",
98
+ * tags: new Set(["cancellation"])
99
+ * }
100
+ * },
101
+ * status: "ACTIVE",
102
+ * type: "STANDARD",
103
+ * references: {
104
+ * knowledgeBases: [],
105
+ * actionIds: []
106
+ * }
107
+ * })
108
+ */
109
+ createOrUpdate(request, requestOptions) {
110
+ return core.HttpResponsePromise.fromPromise(this.__createOrUpdate(request, requestOptions));
111
+ }
112
+ __createOrUpdate(request, requestOptions) {
113
+ return __awaiter(this, void 0, void 0, function* () {
114
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
115
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
116
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
117
+ "X-Organization-Id": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationId) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationId,
118
+ "X-Agent-Id": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.agentId) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.agentId,
119
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
120
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
121
+ url: core.url.join((_h = (_g = (yield core.Supplier.get(this._options.baseUrl))) !== null && _g !== void 0 ? _g : (yield core.Supplier.get(this._options.environment))) !== null && _h !== void 0 ? _h : environments.MavenAGIEnvironment.Production, "/v1/charters"),
122
+ method: "PUT",
123
+ headers: _headers,
124
+ contentType: "application/json",
125
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
126
+ requestType: "json",
127
+ body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.CharterRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
128
+ timeoutMs: ((_l = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.timeoutInSeconds) !== null && _l !== void 0 ? _l : 60) * 1000,
129
+ maxRetries: (_m = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _m !== void 0 ? _m : (_o = this._options) === null || _o === void 0 ? void 0 : _o.maxRetries,
130
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
131
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
132
+ logging: this._options.logging,
133
+ });
134
+ if (_response.ok) {
135
+ return {
136
+ data: serializers.CharterResponse.parseOrThrow(_response.body, {
137
+ unrecognizedObjectKeys: "passthrough",
138
+ allowUnrecognizedUnionMembers: true,
139
+ allowUnrecognizedEnumValues: true,
140
+ breadcrumbsPrefix: ["response"],
141
+ }),
142
+ rawResponse: _response.rawResponse,
143
+ };
144
+ }
145
+ if (_response.error.reason === "status-code") {
146
+ switch (_response.error.statusCode) {
147
+ case 404:
148
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
149
+ unrecognizedObjectKeys: "passthrough",
150
+ allowUnrecognizedUnionMembers: true,
151
+ allowUnrecognizedEnumValues: true,
152
+ breadcrumbsPrefix: ["response"],
153
+ }), _response.rawResponse);
154
+ case 400:
155
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
156
+ unrecognizedObjectKeys: "passthrough",
157
+ allowUnrecognizedUnionMembers: true,
158
+ allowUnrecognizedEnumValues: true,
159
+ breadcrumbsPrefix: ["response"],
160
+ }), _response.rawResponse);
161
+ case 413:
162
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
163
+ unrecognizedObjectKeys: "passthrough",
164
+ allowUnrecognizedUnionMembers: true,
165
+ allowUnrecognizedEnumValues: true,
166
+ breadcrumbsPrefix: ["response"],
167
+ }), _response.rawResponse);
168
+ case 429:
169
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
170
+ unrecognizedObjectKeys: "passthrough",
171
+ allowUnrecognizedUnionMembers: true,
172
+ allowUnrecognizedEnumValues: true,
173
+ breadcrumbsPrefix: ["response"],
174
+ }), _response.rawResponse);
175
+ case 500:
176
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
177
+ unrecognizedObjectKeys: "passthrough",
178
+ allowUnrecognizedUnionMembers: true,
179
+ allowUnrecognizedEnumValues: true,
180
+ breadcrumbsPrefix: ["response"],
181
+ }), _response.rawResponse);
182
+ default:
183
+ throw new errors.MavenAGIError({
184
+ statusCode: _response.error.statusCode,
185
+ body: _response.error.body,
186
+ rawResponse: _response.rawResponse,
187
+ });
188
+ }
189
+ }
190
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/v1/charters");
191
+ });
192
+ }
193
+ /**
194
+ * Get a charter by its reference ID.
195
+ *
196
+ * @param {string} charterReferenceId - The reference ID of the charter to get. All other entity ID fields are inferred from the request.
197
+ * @param {MavenAGI.CharterGetRequest} request
198
+ * @param {ChartersClient.RequestOptions} requestOptions - Request-specific configuration.
199
+ *
200
+ * @throws {@link MavenAGI.NotFoundError}
201
+ * @throws {@link MavenAGI.BadRequestError}
202
+ * @throws {@link MavenAGI.PayloadTooLargeError}
203
+ * @throws {@link MavenAGI.TooManyRequestsError}
204
+ * @throws {@link MavenAGI.ServerError}
205
+ * @throws {@link errors.MavenAGIError}
206
+ * @throws {@link errors.MavenAGITimeoutError}
207
+ *
208
+ * @example
209
+ * await client.charters.get("cancellation-flow")
210
+ */
211
+ get(charterReferenceId, request = {}, requestOptions) {
212
+ return core.HttpResponsePromise.fromPromise(this.__get(charterReferenceId, request, requestOptions));
213
+ }
214
+ __get(charterReferenceId_1) {
215
+ return __awaiter(this, arguments, void 0, function* (charterReferenceId, request = {}, requestOptions) {
216
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
217
+ const { appId } = request;
218
+ const _queryParams = {
219
+ appId,
220
+ };
221
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
222
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
223
+ "X-Organization-Id": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationId) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationId,
224
+ "X-Agent-Id": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.agentId) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.agentId,
225
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
226
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
227
+ url: core.url.join((_h = (_g = (yield core.Supplier.get(this._options.baseUrl))) !== null && _g !== void 0 ? _g : (yield core.Supplier.get(this._options.environment))) !== null && _h !== void 0 ? _h : environments.MavenAGIEnvironment.Production, `/v1/charters/${core.url.encodePathParam(charterReferenceId)}`),
228
+ method: "GET",
229
+ headers: _headers,
230
+ queryString: core.url
231
+ .queryBuilder()
232
+ .addMany(_queryParams)
233
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
234
+ .build(),
235
+ timeoutMs: ((_l = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.timeoutInSeconds) !== null && _l !== void 0 ? _l : 60) * 1000,
236
+ maxRetries: (_m = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _m !== void 0 ? _m : (_o = this._options) === null || _o === void 0 ? void 0 : _o.maxRetries,
237
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
238
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
239
+ logging: this._options.logging,
240
+ });
241
+ if (_response.ok) {
242
+ return {
243
+ data: serializers.CharterResponse.parseOrThrow(_response.body, {
244
+ unrecognizedObjectKeys: "passthrough",
245
+ allowUnrecognizedUnionMembers: true,
246
+ allowUnrecognizedEnumValues: true,
247
+ breadcrumbsPrefix: ["response"],
248
+ }),
249
+ rawResponse: _response.rawResponse,
250
+ };
251
+ }
252
+ if (_response.error.reason === "status-code") {
253
+ switch (_response.error.statusCode) {
254
+ case 404:
255
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
256
+ unrecognizedObjectKeys: "passthrough",
257
+ allowUnrecognizedUnionMembers: true,
258
+ allowUnrecognizedEnumValues: true,
259
+ breadcrumbsPrefix: ["response"],
260
+ }), _response.rawResponse);
261
+ case 400:
262
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
263
+ unrecognizedObjectKeys: "passthrough",
264
+ allowUnrecognizedUnionMembers: true,
265
+ allowUnrecognizedEnumValues: true,
266
+ breadcrumbsPrefix: ["response"],
267
+ }), _response.rawResponse);
268
+ case 413:
269
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
270
+ unrecognizedObjectKeys: "passthrough",
271
+ allowUnrecognizedUnionMembers: true,
272
+ allowUnrecognizedEnumValues: true,
273
+ breadcrumbsPrefix: ["response"],
274
+ }), _response.rawResponse);
275
+ case 429:
276
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
277
+ unrecognizedObjectKeys: "passthrough",
278
+ allowUnrecognizedUnionMembers: true,
279
+ allowUnrecognizedEnumValues: true,
280
+ breadcrumbsPrefix: ["response"],
281
+ }), _response.rawResponse);
282
+ case 500:
283
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
284
+ unrecognizedObjectKeys: "passthrough",
285
+ allowUnrecognizedUnionMembers: true,
286
+ allowUnrecognizedEnumValues: true,
287
+ breadcrumbsPrefix: ["response"],
288
+ }), _response.rawResponse);
289
+ default:
290
+ throw new errors.MavenAGIError({
291
+ statusCode: _response.error.statusCode,
292
+ body: _response.error.body,
293
+ rawResponse: _response.rawResponse,
294
+ });
295
+ }
296
+ }
297
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/charters/{charterReferenceId}");
298
+ });
299
+ }
300
+ /**
301
+ * Update mutable fields on a charter. Only provided fields are modified.
302
+ *
303
+ * To move a charter within the tree, set `parentCharterId`.
304
+ * To promote to root level, set `parentCharterId` explicitly to null.
305
+ *
306
+ * **Status behavior**:
307
+ * - Setting `status` to `INACTIVE` applies only to the targeted charter;
308
+ * it does not cascade to descendants. However, its descendants will no
309
+ * longer be incorporated at runtime.
310
+ * - Setting `status` to `ACTIVE` applies only to the targeted charter.
311
+ * The caller is responsible for ensuring ancestor charters are also `ACTIVE`
312
+ * if the full subtree should be reachable at runtime.
313
+ *
314
+ * **userRank conflict resolution**: When `userRank` is set to a value already held by a
315
+ * sibling, siblings at that rank and above are shifted up by 1 (like linked list semantics).
316
+ * The caller does not need to manage uniqueness explicitly.
317
+ *
318
+ * @param {string} charterReferenceId - The reference ID of the charter to patch.
319
+ * @param {MavenAGI.CharterPatchRequest} request
320
+ * @param {ChartersClient.RequestOptions} requestOptions - Request-specific configuration.
321
+ *
322
+ * @throws {@link MavenAGI.NotFoundError}
323
+ * @throws {@link MavenAGI.BadRequestError}
324
+ * @throws {@link MavenAGI.PayloadTooLargeError}
325
+ * @throws {@link MavenAGI.TooManyRequestsError}
326
+ * @throws {@link MavenAGI.ServerError}
327
+ * @throws {@link errors.MavenAGIError}
328
+ * @throws {@link errors.MavenAGITimeoutError}
329
+ *
330
+ * @example
331
+ * await client.charters.patch("cancellation-flow", {
332
+ * precondition: {
333
+ * preconditionType: "conversation",
334
+ * value: {
335
+ * conversationPreconditionType: "tags",
336
+ * tags: new Set(["cancellation"])
337
+ * }
338
+ * },
339
+ * status: "ACTIVE"
340
+ * })
341
+ */
342
+ patch(charterReferenceId, request = {}, requestOptions) {
343
+ return core.HttpResponsePromise.fromPromise(this.__patch(charterReferenceId, request, requestOptions));
344
+ }
345
+ __patch(charterReferenceId_1) {
346
+ return __awaiter(this, arguments, void 0, function* (charterReferenceId, request = {}, requestOptions) {
347
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
348
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
349
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
350
+ "X-Organization-Id": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationId) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationId,
351
+ "X-Agent-Id": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.agentId) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.agentId,
352
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
353
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
354
+ url: core.url.join((_h = (_g = (yield core.Supplier.get(this._options.baseUrl))) !== null && _g !== void 0 ? _g : (yield core.Supplier.get(this._options.environment))) !== null && _h !== void 0 ? _h : environments.MavenAGIEnvironment.Production, `/v1/charters/${core.url.encodePathParam(charterReferenceId)}`),
355
+ method: "PATCH",
356
+ headers: _headers,
357
+ contentType: "application/merge-patch+json",
358
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
359
+ requestType: "json",
360
+ body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.CharterPatchRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
361
+ timeoutMs: ((_l = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.timeoutInSeconds) !== null && _l !== void 0 ? _l : 60) * 1000,
362
+ maxRetries: (_m = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _m !== void 0 ? _m : (_o = this._options) === null || _o === void 0 ? void 0 : _o.maxRetries,
363
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
364
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
365
+ logging: this._options.logging,
366
+ });
367
+ if (_response.ok) {
368
+ return {
369
+ data: serializers.CharterResponse.parseOrThrow(_response.body, {
370
+ unrecognizedObjectKeys: "passthrough",
371
+ allowUnrecognizedUnionMembers: true,
372
+ allowUnrecognizedEnumValues: true,
373
+ breadcrumbsPrefix: ["response"],
374
+ }),
375
+ rawResponse: _response.rawResponse,
376
+ };
377
+ }
378
+ if (_response.error.reason === "status-code") {
379
+ switch (_response.error.statusCode) {
380
+ case 404:
381
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
382
+ unrecognizedObjectKeys: "passthrough",
383
+ allowUnrecognizedUnionMembers: true,
384
+ allowUnrecognizedEnumValues: true,
385
+ breadcrumbsPrefix: ["response"],
386
+ }), _response.rawResponse);
387
+ case 400:
388
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
389
+ unrecognizedObjectKeys: "passthrough",
390
+ allowUnrecognizedUnionMembers: true,
391
+ allowUnrecognizedEnumValues: true,
392
+ breadcrumbsPrefix: ["response"],
393
+ }), _response.rawResponse);
394
+ case 413:
395
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
396
+ unrecognizedObjectKeys: "passthrough",
397
+ allowUnrecognizedUnionMembers: true,
398
+ allowUnrecognizedEnumValues: true,
399
+ breadcrumbsPrefix: ["response"],
400
+ }), _response.rawResponse);
401
+ case 429:
402
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
403
+ unrecognizedObjectKeys: "passthrough",
404
+ allowUnrecognizedUnionMembers: true,
405
+ allowUnrecognizedEnumValues: true,
406
+ breadcrumbsPrefix: ["response"],
407
+ }), _response.rawResponse);
408
+ case 500:
409
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
410
+ unrecognizedObjectKeys: "passthrough",
411
+ allowUnrecognizedUnionMembers: true,
412
+ allowUnrecognizedEnumValues: true,
413
+ breadcrumbsPrefix: ["response"],
414
+ }), _response.rawResponse);
415
+ default:
416
+ throw new errors.MavenAGIError({
417
+ statusCode: _response.error.statusCode,
418
+ body: _response.error.body,
419
+ rawResponse: _response.rawResponse,
420
+ });
421
+ }
422
+ }
423
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v1/charters/{charterReferenceId}");
424
+ });
425
+ }
426
+ /**
427
+ * Delete a charter and all of its descendants recursively.
428
+ *
429
+ * The charter must be set to `INACTIVE` before it can be deleted. This prevents accidental
430
+ * deletion of active charters. Descendant charters may be in any status — they will be
431
+ * soft-deleted regardless.
432
+ *
433
+ * Deleted charters are excluded from list results but can be retrieved by ID for archival purposes.
434
+ *
435
+ * Deleted charters cannot be modified.
436
+ *
437
+ * @param {string} charterReferenceId - The reference ID of the charter to delete.
438
+ * @param {MavenAGI.CharterDeleteRequest} request
439
+ * @param {ChartersClient.RequestOptions} requestOptions - Request-specific configuration.
440
+ *
441
+ * @throws {@link MavenAGI.NotFoundError}
442
+ * @throws {@link MavenAGI.BadRequestError}
443
+ * @throws {@link MavenAGI.PayloadTooLargeError}
444
+ * @throws {@link MavenAGI.TooManyRequestsError}
445
+ * @throws {@link MavenAGI.ServerError}
446
+ * @throws {@link errors.MavenAGIError}
447
+ * @throws {@link errors.MavenAGITimeoutError}
448
+ *
449
+ * @example
450
+ * await client.charters.delete("cancellation-flow")
451
+ */
452
+ delete(charterReferenceId, request = {}, requestOptions) {
453
+ return core.HttpResponsePromise.fromPromise(this.__delete(charterReferenceId, request, requestOptions));
454
+ }
455
+ __delete(charterReferenceId_1) {
456
+ return __awaiter(this, arguments, void 0, function* (charterReferenceId, request = {}, requestOptions) {
457
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
458
+ const { appId, variantReferenceId, variantAppId } = request;
459
+ const _queryParams = {
460
+ appId,
461
+ variantReferenceId,
462
+ variantAppId,
463
+ };
464
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
465
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
466
+ "X-Organization-Id": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationId) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationId,
467
+ "X-Agent-Id": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.agentId) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.agentId,
468
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
469
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
470
+ url: core.url.join((_h = (_g = (yield core.Supplier.get(this._options.baseUrl))) !== null && _g !== void 0 ? _g : (yield core.Supplier.get(this._options.environment))) !== null && _h !== void 0 ? _h : environments.MavenAGIEnvironment.Production, `/v1/charters/${core.url.encodePathParam(charterReferenceId)}`),
471
+ method: "DELETE",
472
+ headers: _headers,
473
+ queryString: core.url
474
+ .queryBuilder()
475
+ .addMany(_queryParams)
476
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
477
+ .build(),
478
+ timeoutMs: ((_l = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.timeoutInSeconds) !== null && _l !== void 0 ? _l : 60) * 1000,
479
+ maxRetries: (_m = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _m !== void 0 ? _m : (_o = this._options) === null || _o === void 0 ? void 0 : _o.maxRetries,
480
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
481
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
482
+ logging: this._options.logging,
483
+ });
484
+ if (_response.ok) {
485
+ return {
486
+ data: serializers.CharterResponse.parseOrThrow(_response.body, {
487
+ unrecognizedObjectKeys: "passthrough",
488
+ allowUnrecognizedUnionMembers: true,
489
+ allowUnrecognizedEnumValues: true,
490
+ breadcrumbsPrefix: ["response"],
491
+ }),
492
+ rawResponse: _response.rawResponse,
493
+ };
494
+ }
495
+ if (_response.error.reason === "status-code") {
496
+ switch (_response.error.statusCode) {
497
+ case 404:
498
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
499
+ unrecognizedObjectKeys: "passthrough",
500
+ allowUnrecognizedUnionMembers: true,
501
+ allowUnrecognizedEnumValues: true,
502
+ breadcrumbsPrefix: ["response"],
503
+ }), _response.rawResponse);
504
+ case 400:
505
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
506
+ unrecognizedObjectKeys: "passthrough",
507
+ allowUnrecognizedUnionMembers: true,
508
+ allowUnrecognizedEnumValues: true,
509
+ breadcrumbsPrefix: ["response"],
510
+ }), _response.rawResponse);
511
+ case 413:
512
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
513
+ unrecognizedObjectKeys: "passthrough",
514
+ allowUnrecognizedUnionMembers: true,
515
+ allowUnrecognizedEnumValues: true,
516
+ breadcrumbsPrefix: ["response"],
517
+ }), _response.rawResponse);
518
+ case 429:
519
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
520
+ unrecognizedObjectKeys: "passthrough",
521
+ allowUnrecognizedUnionMembers: true,
522
+ allowUnrecognizedEnumValues: true,
523
+ breadcrumbsPrefix: ["response"],
524
+ }), _response.rawResponse);
525
+ case 500:
526
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
527
+ unrecognizedObjectKeys: "passthrough",
528
+ allowUnrecognizedUnionMembers: true,
529
+ allowUnrecognizedEnumValues: true,
530
+ breadcrumbsPrefix: ["response"],
531
+ }), _response.rawResponse);
532
+ default:
533
+ throw new errors.MavenAGIError({
534
+ statusCode: _response.error.statusCode,
535
+ body: _response.error.body,
536
+ rawResponse: _response.rawResponse,
537
+ });
538
+ }
539
+ }
540
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v1/charters/{charterReferenceId}");
541
+ });
542
+ }
543
+ /**
544
+ * Search for charters matching the provided filters. Supports filtering by
545
+ * referenced action IDs and knowledge base IDs to find charters that make
546
+ * specific context items available.
547
+ *
548
+ * Returns both ACTIVE and INACTIVE charters (DELETED charters are excluded).
549
+ *
550
+ * Results are ordered by the `sort` field (defaults to CreatedAt). Use `sortDesc`
551
+ * to control direction (defaults to descending). An empty filter list is
552
+ * equivalent to omitting the field (no filter applied).
553
+ *
554
+ * @param {MavenAGI.CharterSearchRequest} request
555
+ * @param {ChartersClient.RequestOptions} requestOptions - Request-specific configuration.
556
+ *
557
+ * @throws {@link MavenAGI.NotFoundError}
558
+ * @throws {@link MavenAGI.BadRequestError}
559
+ * @throws {@link MavenAGI.PayloadTooLargeError}
560
+ * @throws {@link MavenAGI.TooManyRequestsError}
561
+ * @throws {@link MavenAGI.ServerError}
562
+ * @throws {@link errors.MavenAGIError}
563
+ * @throws {@link errors.MavenAGITimeoutError}
564
+ *
565
+ * @example
566
+ * await client.charters.search({
567
+ * page: 0,
568
+ * size: 20
569
+ * })
570
+ */
571
+ search(request, requestOptions) {
572
+ return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions));
573
+ }
574
+ __search(request, requestOptions) {
575
+ return __awaiter(this, void 0, void 0, function* () {
576
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
577
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
578
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
579
+ "X-Organization-Id": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationId) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationId,
580
+ "X-Agent-Id": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.agentId) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.agentId,
581
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
582
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
583
+ url: core.url.join((_h = (_g = (yield core.Supplier.get(this._options.baseUrl))) !== null && _g !== void 0 ? _g : (yield core.Supplier.get(this._options.environment))) !== null && _h !== void 0 ? _h : environments.MavenAGIEnvironment.Production, "/v1/charters/search"),
584
+ method: "POST",
585
+ headers: _headers,
586
+ contentType: "application/json",
587
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
588
+ requestType: "json",
589
+ body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.CharterSearchRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
590
+ timeoutMs: ((_l = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.timeoutInSeconds) !== null && _l !== void 0 ? _l : 60) * 1000,
591
+ maxRetries: (_m = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _m !== void 0 ? _m : (_o = this._options) === null || _o === void 0 ? void 0 : _o.maxRetries,
592
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
593
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
594
+ logging: this._options.logging,
595
+ });
596
+ if (_response.ok) {
597
+ return {
598
+ data: serializers.CharterSearchResponse.parseOrThrow(_response.body, {
599
+ unrecognizedObjectKeys: "passthrough",
600
+ allowUnrecognizedUnionMembers: true,
601
+ allowUnrecognizedEnumValues: true,
602
+ breadcrumbsPrefix: ["response"],
603
+ }),
604
+ rawResponse: _response.rawResponse,
605
+ };
606
+ }
607
+ if (_response.error.reason === "status-code") {
608
+ switch (_response.error.statusCode) {
609
+ case 404:
610
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
611
+ unrecognizedObjectKeys: "passthrough",
612
+ allowUnrecognizedUnionMembers: true,
613
+ allowUnrecognizedEnumValues: true,
614
+ breadcrumbsPrefix: ["response"],
615
+ }), _response.rawResponse);
616
+ case 400:
617
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
618
+ unrecognizedObjectKeys: "passthrough",
619
+ allowUnrecognizedUnionMembers: true,
620
+ allowUnrecognizedEnumValues: true,
621
+ breadcrumbsPrefix: ["response"],
622
+ }), _response.rawResponse);
623
+ case 413:
624
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
625
+ unrecognizedObjectKeys: "passthrough",
626
+ allowUnrecognizedUnionMembers: true,
627
+ allowUnrecognizedEnumValues: true,
628
+ breadcrumbsPrefix: ["response"],
629
+ }), _response.rawResponse);
630
+ case 429:
631
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
632
+ unrecognizedObjectKeys: "passthrough",
633
+ allowUnrecognizedUnionMembers: true,
634
+ allowUnrecognizedEnumValues: true,
635
+ breadcrumbsPrefix: ["response"],
636
+ }), _response.rawResponse);
637
+ case 500:
638
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
639
+ unrecognizedObjectKeys: "passthrough",
640
+ allowUnrecognizedUnionMembers: true,
641
+ allowUnrecognizedEnumValues: true,
642
+ breadcrumbsPrefix: ["response"],
643
+ }), _response.rawResponse);
644
+ default:
645
+ throw new errors.MavenAGIError({
646
+ statusCode: _response.error.statusCode,
647
+ body: _response.error.body,
648
+ rawResponse: _response.rawResponse,
649
+ });
650
+ }
651
+ }
652
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/charters/search");
653
+ });
654
+ }
655
+ /**
656
+ * Return a flat list containing the specified charter and all of its ancestors
657
+ * up to the root. Useful for rendering tree context around search results.
658
+ *
659
+ * Each entry is a full charter, so an ancestor's references and precondition are
660
+ * readable without a follow-up request per level.
661
+ *
662
+ * The list is always finite: charter hierarchies are acyclic, so a charter is never its own
663
+ * ancestor and the walk to the root terminates.
664
+ *
665
+ * Returns 404 if the charter does not exist or is deleted.
666
+ *
667
+ * @param {string} charterReferenceId - The reference ID of the charter. All other entity ID fields are inferred from the request.
668
+ * @param {MavenAGI.CharterGetAncestorsRequest} request
669
+ * @param {ChartersClient.RequestOptions} requestOptions - Request-specific configuration.
670
+ *
671
+ * @throws {@link MavenAGI.NotFoundError}
672
+ * @throws {@link MavenAGI.BadRequestError}
673
+ * @throws {@link MavenAGI.PayloadTooLargeError}
674
+ * @throws {@link MavenAGI.TooManyRequestsError}
675
+ * @throws {@link MavenAGI.ServerError}
676
+ * @throws {@link errors.MavenAGIError}
677
+ * @throws {@link errors.MavenAGITimeoutError}
678
+ *
679
+ * @example
680
+ * await client.charters.getAncestors("cancellation-step-1")
681
+ */
682
+ getAncestors(charterReferenceId, request = {}, requestOptions) {
683
+ return core.HttpResponsePromise.fromPromise(this.__getAncestors(charterReferenceId, request, requestOptions));
684
+ }
685
+ __getAncestors(charterReferenceId_1) {
686
+ return __awaiter(this, arguments, void 0, function* (charterReferenceId, request = {}, requestOptions) {
687
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
688
+ const { appId } = request;
689
+ const _queryParams = {
690
+ appId,
691
+ };
692
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
693
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
694
+ "X-Organization-Id": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationId) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationId,
695
+ "X-Agent-Id": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.agentId) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.agentId,
696
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
697
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
698
+ url: core.url.join((_h = (_g = (yield core.Supplier.get(this._options.baseUrl))) !== null && _g !== void 0 ? _g : (yield core.Supplier.get(this._options.environment))) !== null && _h !== void 0 ? _h : environments.MavenAGIEnvironment.Production, `/v1/charters/${core.url.encodePathParam(charterReferenceId)}/ancestors`),
699
+ method: "GET",
700
+ headers: _headers,
701
+ queryString: core.url
702
+ .queryBuilder()
703
+ .addMany(_queryParams)
704
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
705
+ .build(),
706
+ timeoutMs: ((_l = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.timeoutInSeconds) !== null && _l !== void 0 ? _l : 60) * 1000,
707
+ maxRetries: (_m = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _m !== void 0 ? _m : (_o = this._options) === null || _o === void 0 ? void 0 : _o.maxRetries,
708
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
709
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
710
+ logging: this._options.logging,
711
+ });
712
+ if (_response.ok) {
713
+ return {
714
+ data: serializers.CharterAncestorsResponse.parseOrThrow(_response.body, {
715
+ unrecognizedObjectKeys: "passthrough",
716
+ allowUnrecognizedUnionMembers: true,
717
+ allowUnrecognizedEnumValues: true,
718
+ breadcrumbsPrefix: ["response"],
719
+ }),
720
+ rawResponse: _response.rawResponse,
721
+ };
722
+ }
723
+ if (_response.error.reason === "status-code") {
724
+ switch (_response.error.statusCode) {
725
+ case 404:
726
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
727
+ unrecognizedObjectKeys: "passthrough",
728
+ allowUnrecognizedUnionMembers: true,
729
+ allowUnrecognizedEnumValues: true,
730
+ breadcrumbsPrefix: ["response"],
731
+ }), _response.rawResponse);
732
+ case 400:
733
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
734
+ unrecognizedObjectKeys: "passthrough",
735
+ allowUnrecognizedUnionMembers: true,
736
+ allowUnrecognizedEnumValues: true,
737
+ breadcrumbsPrefix: ["response"],
738
+ }), _response.rawResponse);
739
+ case 413:
740
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
741
+ unrecognizedObjectKeys: "passthrough",
742
+ allowUnrecognizedUnionMembers: true,
743
+ allowUnrecognizedEnumValues: true,
744
+ breadcrumbsPrefix: ["response"],
745
+ }), _response.rawResponse);
746
+ case 429:
747
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
748
+ unrecognizedObjectKeys: "passthrough",
749
+ allowUnrecognizedUnionMembers: true,
750
+ allowUnrecognizedEnumValues: true,
751
+ breadcrumbsPrefix: ["response"],
752
+ }), _response.rawResponse);
753
+ case 500:
754
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
755
+ unrecognizedObjectKeys: "passthrough",
756
+ allowUnrecognizedUnionMembers: true,
757
+ allowUnrecognizedEnumValues: true,
758
+ breadcrumbsPrefix: ["response"],
759
+ }), _response.rawResponse);
760
+ default:
761
+ throw new errors.MavenAGIError({
762
+ statusCode: _response.error.statusCode,
763
+ body: _response.error.body,
764
+ rawResponse: _response.rawResponse,
765
+ });
766
+ }
767
+ }
768
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/charters/{charterReferenceId}/ancestors");
769
+ });
770
+ }
771
+ /**
772
+ * Batch fetch direct children of the specified parent charters. Returns one
773
+ * group per requested parent in the same order as parentIds, with grandchild
774
+ * IDs populated on each child for expandability signals.
775
+ *
776
+ * Pass an empty parentIds list to fetch all root-level charters for the agent.
777
+ * Intended to be used for easy BFS traversal, though calling with parents
778
+ * at mixed levels are allowed. Roots and specific parents cannot be mixed
779
+ * in one request.
780
+ *
781
+ * DELETED charters are never returned.
782
+ *
783
+ * @param {MavenAGI.CharterListChildrenRequest} request
784
+ * @param {ChartersClient.RequestOptions} requestOptions - Request-specific configuration.
785
+ *
786
+ * @throws {@link MavenAGI.NotFoundError}
787
+ * @throws {@link MavenAGI.BadRequestError}
788
+ * @throws {@link MavenAGI.PayloadTooLargeError}
789
+ * @throws {@link MavenAGI.TooManyRequestsError}
790
+ * @throws {@link MavenAGI.ServerError}
791
+ * @throws {@link errors.MavenAGIError}
792
+ * @throws {@link errors.MavenAGITimeoutError}
793
+ *
794
+ * @example
795
+ * await client.charters.listChildren({
796
+ * parentIds: []
797
+ * })
798
+ */
799
+ listChildren(request, requestOptions) {
800
+ return core.HttpResponsePromise.fromPromise(this.__listChildren(request, requestOptions));
801
+ }
802
+ __listChildren(request, requestOptions) {
803
+ return __awaiter(this, void 0, void 0, function* () {
804
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
805
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
806
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
807
+ "X-Organization-Id": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationId) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationId,
808
+ "X-Agent-Id": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.agentId) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.agentId,
809
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
810
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
811
+ url: core.url.join((_h = (_g = (yield core.Supplier.get(this._options.baseUrl))) !== null && _g !== void 0 ? _g : (yield core.Supplier.get(this._options.environment))) !== null && _h !== void 0 ? _h : environments.MavenAGIEnvironment.Production, "/v1/charters/list-children"),
812
+ method: "POST",
813
+ headers: _headers,
814
+ contentType: "application/json",
815
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
816
+ requestType: "json",
817
+ body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.CharterListChildrenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
818
+ timeoutMs: ((_l = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.timeoutInSeconds) !== null && _l !== void 0 ? _l : 60) * 1000,
819
+ maxRetries: (_m = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _m !== void 0 ? _m : (_o = this._options) === null || _o === void 0 ? void 0 : _o.maxRetries,
820
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
821
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
822
+ logging: this._options.logging,
823
+ });
824
+ if (_response.ok) {
825
+ return {
826
+ data: serializers.CharterListChildrenResponse.parseOrThrow(_response.body, {
827
+ unrecognizedObjectKeys: "passthrough",
828
+ allowUnrecognizedUnionMembers: true,
829
+ allowUnrecognizedEnumValues: true,
830
+ breadcrumbsPrefix: ["response"],
831
+ }),
832
+ rawResponse: _response.rawResponse,
833
+ };
834
+ }
835
+ if (_response.error.reason === "status-code") {
836
+ switch (_response.error.statusCode) {
837
+ case 404:
838
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
839
+ unrecognizedObjectKeys: "passthrough",
840
+ allowUnrecognizedUnionMembers: true,
841
+ allowUnrecognizedEnumValues: true,
842
+ breadcrumbsPrefix: ["response"],
843
+ }), _response.rawResponse);
844
+ case 400:
845
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
846
+ unrecognizedObjectKeys: "passthrough",
847
+ allowUnrecognizedUnionMembers: true,
848
+ allowUnrecognizedEnumValues: true,
849
+ breadcrumbsPrefix: ["response"],
850
+ }), _response.rawResponse);
851
+ case 413:
852
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
853
+ unrecognizedObjectKeys: "passthrough",
854
+ allowUnrecognizedUnionMembers: true,
855
+ allowUnrecognizedEnumValues: true,
856
+ breadcrumbsPrefix: ["response"],
857
+ }), _response.rawResponse);
858
+ case 429:
859
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
860
+ unrecognizedObjectKeys: "passthrough",
861
+ allowUnrecognizedUnionMembers: true,
862
+ allowUnrecognizedEnumValues: true,
863
+ breadcrumbsPrefix: ["response"],
864
+ }), _response.rawResponse);
865
+ case 500:
866
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
867
+ unrecognizedObjectKeys: "passthrough",
868
+ allowUnrecognizedUnionMembers: true,
869
+ allowUnrecognizedEnumValues: true,
870
+ breadcrumbsPrefix: ["response"],
871
+ }), _response.rawResponse);
872
+ default:
873
+ throw new errors.MavenAGIError({
874
+ statusCode: _response.error.statusCode,
875
+ body: _response.error.body,
876
+ rawResponse: _response.rawResponse,
877
+ });
878
+ }
879
+ }
880
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/charters/list-children");
881
+ });
882
+ }
883
+ }
884
+ exports.ChartersClient = ChartersClient;