mavenagi 1.2.71 → 1.2.73

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 (424) hide show
  1. package/BaseClient.js +2 -2
  2. package/Client.d.ts +3 -0
  3. package/Client.js +47 -42
  4. package/api/resources/agentVariants/client/Client.d.ts +484 -0
  5. package/api/resources/agentVariants/client/Client.js +1888 -0
  6. package/api/resources/agentVariants/client/index.d.ts +1 -0
  7. package/api/resources/agentVariants/client/index.js +17 -0
  8. package/api/resources/agentVariants/client/requests/AgentVariantBaseGetRequest.d.ts +8 -0
  9. package/api/resources/agentVariants/client/requests/AgentVariantBaseGetRequest.js +3 -0
  10. package/api/resources/agentVariants/client/requests/AgentVariantCommitRequest.d.ts +27 -0
  11. package/api/resources/agentVariants/client/requests/AgentVariantCommitRequest.js +3 -0
  12. package/api/resources/agentVariants/client/requests/AgentVariantDeleteRequest.d.ts +8 -0
  13. package/api/resources/agentVariants/client/requests/AgentVariantDeleteRequest.js +3 -0
  14. package/api/resources/agentVariants/client/requests/DiscardWorkingSetEditsRequest.d.ts +10 -0
  15. package/api/resources/agentVariants/client/requests/DiscardWorkingSetEditsRequest.js +3 -0
  16. package/api/resources/agentVariants/client/requests/GetEntityEditByIdRequest.d.ts +17 -0
  17. package/api/resources/agentVariants/client/requests/GetEntityEditByIdRequest.js +3 -0
  18. package/api/resources/agentVariants/client/requests/GetSettingEditRequest.d.ts +13 -0
  19. package/api/resources/agentVariants/client/requests/GetSettingEditRequest.js +3 -0
  20. package/api/resources/agentVariants/client/requests/GetTrafficConfigRequest.d.ts +8 -0
  21. package/api/resources/agentVariants/client/requests/GetTrafficConfigRequest.js +3 -0
  22. package/api/resources/agentVariants/client/requests/ListTrafficConfigsRequest.d.ts +12 -0
  23. package/api/resources/agentVariants/client/requests/ListTrafficConfigsRequest.js +3 -0
  24. package/api/resources/agentVariants/client/requests/PatchAgentVariantRequest.d.ts +15 -0
  25. package/api/resources/agentVariants/client/requests/PatchAgentVariantRequest.js +3 -0
  26. package/api/resources/agentVariants/client/requests/WorkingSetDiffRequest.d.ts +8 -0
  27. package/api/resources/agentVariants/client/requests/WorkingSetDiffRequest.js +3 -0
  28. package/api/resources/agentVariants/client/requests/index.d.ts +10 -0
  29. package/api/resources/agentVariants/client/requests/index.js +2 -0
  30. package/api/resources/agentVariants/exports.d.ts +2 -0
  31. package/api/resources/agentVariants/exports.js +21 -0
  32. package/api/resources/agentVariants/index.d.ts +2 -0
  33. package/api/resources/agentVariants/index.js +18 -0
  34. package/api/resources/agentVariants/types/AddedCharterDiff.d.ts +5 -0
  35. package/api/resources/agentVariants/types/AddedCharterDiff.js +3 -0
  36. package/api/resources/agentVariants/types/AddedIntelligentFieldDiff.d.ts +5 -0
  37. package/api/resources/agentVariants/types/AddedIntelligentFieldDiff.js +3 -0
  38. package/api/resources/agentVariants/types/AgentSettingEdits.d.ts +16 -0
  39. package/api/resources/agentVariants/types/AgentSettingEdits.js +3 -0
  40. package/api/resources/agentVariants/types/AgentSettingsDiff.d.ts +12 -0
  41. package/api/resources/agentVariants/types/AgentSettingsDiff.js +3 -0
  42. package/api/resources/agentVariants/types/AgentVariantCompareRequest.d.ts +14 -0
  43. package/api/resources/agentVariants/types/AgentVariantCompareRequest.js +3 -0
  44. package/api/resources/agentVariants/types/AgentVariantCompareResponse.d.ts +78 -0
  45. package/api/resources/agentVariants/types/AgentVariantCompareResponse.js +3 -0
  46. package/api/resources/agentVariants/types/AgentVariantDiff.d.ts +9 -0
  47. package/api/resources/agentVariants/types/AgentVariantDiff.js +3 -0
  48. package/api/resources/agentVariants/types/AgentVariantFilter.d.ts +9 -0
  49. package/api/resources/agentVariants/types/AgentVariantFilter.js +3 -0
  50. package/api/resources/agentVariants/types/AgentVariantListRequest.d.ts +3 -0
  51. package/api/resources/agentVariants/types/AgentVariantListRequest.js +3 -0
  52. package/api/resources/agentVariants/types/AgentVariantRequest.d.ts +28 -0
  53. package/api/resources/agentVariants/types/AgentVariantRequest.js +3 -0
  54. package/api/resources/agentVariants/types/AgentVariantResponse.d.ts +43 -0
  55. package/api/resources/agentVariants/types/AgentVariantResponse.js +3 -0
  56. package/api/resources/agentVariants/types/AgentVariantSearchResult.d.ts +7 -0
  57. package/api/resources/agentVariants/types/AgentVariantSearchResult.js +3 -0
  58. package/api/resources/agentVariants/types/AgentVariantSortField.d.ts +6 -0
  59. package/api/resources/agentVariants/types/AgentVariantSortField.js +9 -0
  60. package/api/resources/agentVariants/types/AgentVariantStatus.d.ts +9 -0
  61. package/api/resources/agentVariants/types/AgentVariantStatus.js +12 -0
  62. package/api/resources/agentVariants/types/AgentVariantTraffic.d.ts +7 -0
  63. package/api/resources/agentVariants/types/AgentVariantTraffic.js +3 -0
  64. package/api/resources/agentVariants/types/AgentVariantsSearchRequest.d.ts +6 -0
  65. package/api/resources/agentVariants/types/AgentVariantsSearchRequest.js +3 -0
  66. package/api/resources/agentVariants/types/AgentVariantsSearchResponse.d.ts +63 -0
  67. package/api/resources/agentVariants/types/AgentVariantsSearchResponse.js +3 -0
  68. package/api/resources/agentVariants/types/CharterDiff.d.ts +29 -0
  69. package/api/resources/agentVariants/types/CharterDiff.js +3 -0
  70. package/api/resources/agentVariants/types/CharterEntityEdit.d.ts +5 -0
  71. package/api/resources/agentVariants/types/CharterEntityEdit.js +3 -0
  72. package/api/resources/agentVariants/types/DeletedCharterDiff.d.ts +5 -0
  73. package/api/resources/agentVariants/types/DeletedCharterDiff.js +3 -0
  74. package/api/resources/agentVariants/types/DeletedIntelligentFieldDiff.d.ts +5 -0
  75. package/api/resources/agentVariants/types/DeletedIntelligentFieldDiff.js +3 -0
  76. package/api/resources/agentVariants/types/EntityEdit.d.ts +16 -0
  77. package/api/resources/agentVariants/types/EntityEdit.js +3 -0
  78. package/api/resources/agentVariants/types/EntityEditResponse.d.ts +7 -0
  79. package/api/resources/agentVariants/types/EntityEditResponse.js +3 -0
  80. package/api/resources/agentVariants/types/IntelligentFieldDiff.d.ts +27 -0
  81. package/api/resources/agentVariants/types/IntelligentFieldDiff.js +3 -0
  82. package/api/resources/agentVariants/types/IntelligentFieldEntityEdit.d.ts +5 -0
  83. package/api/resources/agentVariants/types/IntelligentFieldEntityEdit.js +3 -0
  84. package/api/resources/agentVariants/types/ListAgentVariantsResponse.d.ts +42 -0
  85. package/api/resources/agentVariants/types/ListAgentVariantsResponse.js +3 -0
  86. package/api/resources/agentVariants/types/ListTrafficConfigsResponse.d.ts +5 -0
  87. package/api/resources/agentVariants/types/ListTrafficConfigsResponse.js +3 -0
  88. package/api/resources/agentVariants/types/ModifiedCharterDiff.d.ts +7 -0
  89. package/api/resources/agentVariants/types/ModifiedCharterDiff.js +3 -0
  90. package/api/resources/agentVariants/types/ModifiedIntelligentFieldDiff.d.ts +7 -0
  91. package/api/resources/agentVariants/types/ModifiedIntelligentFieldDiff.js +3 -0
  92. package/api/resources/agentVariants/types/TrafficAllocation.d.ts +15 -0
  93. package/api/resources/agentVariants/types/TrafficAllocation.js +3 -0
  94. package/api/resources/agentVariants/types/TrafficConfigResponse.d.ts +16 -0
  95. package/api/resources/agentVariants/types/TrafficConfigResponse.js +3 -0
  96. package/api/resources/agentVariants/types/TrafficFraction.d.ts +4 -0
  97. package/api/resources/agentVariants/types/TrafficFraction.js +3 -0
  98. package/api/resources/agentVariants/types/TrafficRule.d.ts +9 -0
  99. package/api/resources/agentVariants/types/TrafficRule.js +3 -0
  100. package/api/resources/agentVariants/types/UpdateTrafficConfigRequest.d.ts +7 -0
  101. package/api/resources/agentVariants/types/UpdateTrafficConfigRequest.js +3 -0
  102. package/api/resources/agentVariants/types/WorkingSetDiffResponse.d.ts +12 -0
  103. package/api/resources/agentVariants/types/WorkingSetDiffResponse.js +3 -0
  104. package/api/resources/agentVariants/types/index.d.ts +35 -0
  105. package/api/resources/agentVariants/types/index.js +51 -0
  106. package/api/resources/agents/client/Client.d.ts +62 -0
  107. package/api/resources/agents/client/Client.js +234 -0
  108. package/api/resources/agents/client/requests/AgentPatchRequest.d.ts +8 -3
  109. package/api/resources/agents/client/requests/GetVersionedAgentSettingsRequest.d.ts +10 -0
  110. package/api/resources/agents/client/requests/GetVersionedAgentSettingsRequest.js +3 -0
  111. package/api/resources/agents/client/requests/VersionedAgentSettingsPatchRequest.d.ts +17 -0
  112. package/api/resources/agents/client/requests/VersionedAgentSettingsPatchRequest.js +3 -0
  113. package/api/resources/agents/client/requests/index.d.ts +2 -0
  114. package/api/resources/agents/types/Agent.d.ts +9 -1
  115. package/api/resources/agents/types/AgentMigrations.d.ts +20 -0
  116. package/api/resources/agents/types/AgentMigrations.js +3 -0
  117. package/api/resources/agents/types/AgentMigrationsPatch.d.ts +7 -0
  118. package/api/resources/agents/types/AgentMigrationsPatch.js +3 -0
  119. package/api/resources/agents/types/AgentPrompting.d.ts +1 -1
  120. package/api/resources/agents/types/AgentSettingName.d.ts +6 -0
  121. package/api/resources/agents/types/AgentSettingName.js +9 -0
  122. package/api/resources/agents/types/VersionedAgentSettings.d.ts +13 -0
  123. package/api/resources/agents/types/VersionedAgentSettings.js +3 -0
  124. package/api/resources/agents/types/VersionedEntityTypeOrSetting.d.ts +5 -0
  125. package/api/resources/agents/types/VersionedEntityTypeOrSetting.js +3 -0
  126. package/api/resources/agents/types/index.d.ts +5 -0
  127. package/api/resources/agents/types/index.js +5 -0
  128. package/api/resources/analytics/client/Client.d.ts +1 -1
  129. package/api/resources/analytics/client/Client.js +1 -1
  130. package/api/resources/analytics/types/AgentUserTableRequest.d.ts +2 -0
  131. package/api/resources/analytics/types/ConversationAnalyticsRequest.d.ts +7 -1
  132. package/api/resources/analytics/types/ConversationTableRequest.d.ts +7 -1
  133. package/api/resources/analytics/types/EventTableRequest.d.ts +1 -0
  134. package/api/resources/analytics/types/GroupByBase.d.ts +1 -1
  135. package/api/resources/analytics/types/TimeInterval.d.ts +11 -0
  136. package/api/resources/analytics/types/TimeInterval.js +11 -0
  137. package/api/resources/appDirectory/client/Client.d.ts +41 -2
  138. package/api/resources/appDirectory/client/Client.js +49 -2
  139. package/api/resources/appDirectory/types/InstallDirectoryAppRequest.d.ts +27 -5
  140. package/api/resources/appSettings/client/Client.d.ts +11 -4
  141. package/api/resources/appSettings/client/Client.js +11 -4
  142. package/api/resources/capabilities/client/Client.d.ts +3 -3
  143. package/api/resources/capabilities/client/Client.js +3 -3
  144. package/api/resources/capabilities/types/CapabilityExecutionCompletionReason.d.ts +4 -0
  145. package/api/resources/capabilities/types/CapabilityExecutionCompletionReason.js +4 -0
  146. package/api/resources/charters/client/Client.d.ts +8 -1
  147. package/api/resources/charters/client/Client.js +8 -1
  148. package/api/resources/charters/client/requests/CharterPatchRequest.d.ts +7 -4
  149. package/api/resources/charters/types/CharterBase.d.ts +5 -3
  150. package/api/resources/charters/types/CharterEdit.d.ts +18 -0
  151. package/api/resources/charters/types/CharterEdit.js +3 -0
  152. package/api/resources/charters/types/CharterPayload.d.ts +10 -0
  153. package/api/resources/charters/types/CharterPayload.js +3 -0
  154. package/api/resources/charters/types/CharterResponse.d.ts +17 -2
  155. package/api/resources/charters/types/CharterSummary.d.ts +17 -2
  156. package/api/resources/charters/types/index.d.ts +2 -0
  157. package/api/resources/charters/types/index.js +2 -0
  158. package/api/resources/commons/types/BotLogicKnowledgeItem.d.ts +2 -0
  159. package/api/resources/commons/types/BotResponseMetadata.d.ts +5 -0
  160. package/api/resources/commons/types/CapabilityBase.d.ts +4 -0
  161. package/api/resources/commons/types/ErrorReason.d.ts +2 -2
  162. package/api/resources/commons/types/ErrorReason.js +2 -2
  163. package/api/resources/commons/types/FieldCondition.d.ts +3 -2
  164. package/api/resources/commons/types/IntelligentFieldPrecondition.d.ts +9 -1
  165. package/api/resources/commons/types/MetadataPrecondition.d.ts +27 -3
  166. package/api/resources/commons/types/PresenceOperator.d.ts +2 -1
  167. package/api/resources/commons/types/PresenceOperator.js +2 -1
  168. package/api/resources/commons/types/ResolutionStatus.d.ts +9 -5
  169. package/api/resources/commons/types/ResolutionStatus.js +9 -5
  170. package/api/resources/commons/types/SimulationContext.d.ts +5 -0
  171. package/api/resources/commons/types/SimulationSetupFields.d.ts +2 -3
  172. package/api/resources/commons/types/SystemEventName.d.ts +6 -0
  173. package/api/resources/commons/types/SystemEventName.js +6 -0
  174. package/api/resources/commons/types/TagsPrecondition.d.ts +12 -1
  175. package/api/resources/conversation/client/Client.d.ts +20 -0
  176. package/api/resources/conversation/client/Client.js +20 -0
  177. package/api/resources/conversation/client/requests/ConversationGetRequest.d.ts +1 -1
  178. package/api/resources/conversation/types/ConversationRequest.d.ts +2 -1
  179. package/api/resources/conversation/types/NumericConversationField.d.ts +13 -0
  180. package/api/resources/conversation/types/NumericConversationField.js +13 -0
  181. package/api/resources/developersCommons/types/MarketplaceAppDetail.d.ts +3 -2
  182. package/api/resources/index.d.ts +5 -0
  183. package/api/resources/index.js +6 -1
  184. package/api/resources/intelligentFields/client/Client.d.ts +13 -4
  185. package/api/resources/intelligentFields/client/Client.js +13 -4
  186. package/api/resources/intelligentFields/types/IntelligentFieldBase.d.ts +1 -1
  187. package/api/resources/intelligentFields/types/IntelligentFieldEdit.d.ts +16 -0
  188. package/api/resources/intelligentFields/types/IntelligentFieldEdit.js +3 -0
  189. package/api/resources/intelligentFields/types/IntelligentFieldPayload.d.ts +12 -0
  190. package/api/resources/intelligentFields/types/IntelligentFieldPayload.js +3 -0
  191. package/api/resources/intelligentFields/types/IntelligentFieldResponse.d.ts +3 -4
  192. package/api/resources/intelligentFields/types/index.d.ts +2 -0
  193. package/api/resources/intelligentFields/types/index.js +2 -0
  194. package/api/resources/knowledge/client/Client.d.ts +33 -2
  195. package/api/resources/knowledge/client/Client.js +33 -2
  196. package/api/resources/knowledge/types/KnowledgeBaseResponse.d.ts +4 -0
  197. package/api/resources/knowledge/types/KnowledgeBaseType.d.ts +2 -0
  198. package/api/resources/knowledge/types/KnowledgeBaseType.js +2 -0
  199. package/api/resources/knowledge/types/KnowledgeBaseVersion.d.ts +4 -0
  200. package/api/resources/knowledge/types/KnowledgeDocumentSearchResponse.d.ts +4 -0
  201. package/api/resources/organizations/types/Organization.d.ts +8 -0
  202. package/api/resources/triggers/client/Client.d.ts +6 -1
  203. package/api/resources/triggers/client/Client.js +6 -1
  204. package/api/resources/triggers/client/requests/PartialUpdateRequest.d.ts +6 -0
  205. package/api/resources/triggers/types/DebounceWait.d.ts +14 -0
  206. package/api/resources/triggers/types/DebounceWait.js +3 -0
  207. package/api/resources/triggers/types/DelayWait.d.ts +13 -0
  208. package/api/resources/triggers/types/DelayWait.js +3 -0
  209. package/api/resources/triggers/types/EventTriggerBase.d.ts +21 -0
  210. package/api/resources/triggers/types/EventTriggerResponse.d.ts +12 -0
  211. package/api/resources/triggers/types/IntervalSchedule.d.ts +17 -0
  212. package/api/resources/triggers/types/IntervalSchedule.js +3 -0
  213. package/api/resources/triggers/types/ScheduleInterval.d.ts +9 -0
  214. package/api/resources/triggers/types/ScheduleInterval.js +12 -0
  215. package/api/resources/triggers/types/ScheduleSpec.d.ts +11 -0
  216. package/api/resources/triggers/types/ScheduleSpec.js +3 -0
  217. package/api/resources/triggers/types/TimeSpan.d.ts +10 -0
  218. package/api/resources/triggers/types/TimeSpan.js +3 -0
  219. package/api/resources/triggers/types/TimeSpanUnit.d.ts +7 -0
  220. package/api/resources/triggers/types/TimeSpanUnit.js +10 -0
  221. package/api/resources/triggers/types/TriggerRateLimit.d.ts +20 -0
  222. package/api/resources/triggers/types/TriggerRateLimit.js +3 -0
  223. package/api/resources/triggers/types/TriggerSchedule.d.ts +30 -0
  224. package/api/resources/triggers/types/TriggerSchedule.js +3 -0
  225. package/api/resources/triggers/types/TriggerWait.d.ts +16 -0
  226. package/api/resources/triggers/types/TriggerWait.js +3 -0
  227. package/api/resources/triggers/types/TriggerWaitBase.d.ts +9 -0
  228. package/api/resources/triggers/types/TriggerWaitBase.js +3 -0
  229. package/api/resources/triggers/types/index.d.ts +11 -0
  230. package/api/resources/triggers/types/index.js +11 -0
  231. package/api/resources/users/client/Client.d.ts +1 -3
  232. package/api/resources/users/client/Client.js +1 -3
  233. package/api/resources/workingSet/index.d.ts +1 -0
  234. package/api/resources/workingSet/index.js +17 -0
  235. package/api/resources/workingSet/types/VariantDebugInfo.d.ts +15 -0
  236. package/api/resources/workingSet/types/VariantDebugInfo.js +3 -0
  237. package/api/resources/workingSet/types/index.d.ts +1 -0
  238. package/api/resources/workingSet/types/index.js +17 -0
  239. package/package.json +1 -1
  240. package/reference.md +1542 -15
  241. package/serialization/resources/agentVariants/client/index.d.ts +1 -0
  242. package/serialization/resources/agentVariants/client/index.js +17 -0
  243. package/serialization/resources/agentVariants/client/requests/AgentVariantCommitRequest.d.ts +15 -0
  244. package/serialization/resources/agentVariants/client/requests/AgentVariantCommitRequest.js +47 -0
  245. package/serialization/resources/agentVariants/client/requests/GetEntityEditByIdRequest.d.ts +11 -0
  246. package/serialization/resources/agentVariants/client/requests/GetEntityEditByIdRequest.js +43 -0
  247. package/serialization/resources/agentVariants/client/requests/GetSettingEditRequest.d.ts +11 -0
  248. package/serialization/resources/agentVariants/client/requests/GetSettingEditRequest.js +43 -0
  249. package/serialization/resources/agentVariants/client/requests/PatchAgentVariantRequest.d.ts +13 -0
  250. package/serialization/resources/agentVariants/client/requests/PatchAgentVariantRequest.js +45 -0
  251. package/serialization/resources/agentVariants/client/requests/WorkingSetDiffRequest.d.ts +9 -0
  252. package/serialization/resources/agentVariants/client/requests/WorkingSetDiffRequest.js +41 -0
  253. package/serialization/resources/agentVariants/client/requests/index.d.ts +5 -0
  254. package/serialization/resources/agentVariants/client/requests/index.js +13 -0
  255. package/serialization/resources/agentVariants/index.d.ts +2 -0
  256. package/serialization/resources/agentVariants/index.js +18 -0
  257. package/serialization/resources/agentVariants/types/AddedCharterDiff.d.ts +10 -0
  258. package/serialization/resources/agentVariants/types/AddedCharterDiff.js +42 -0
  259. package/serialization/resources/agentVariants/types/AddedIntelligentFieldDiff.d.ts +10 -0
  260. package/serialization/resources/agentVariants/types/AddedIntelligentFieldDiff.js +42 -0
  261. package/serialization/resources/agentVariants/types/AgentSettingEdits.d.ts +17 -0
  262. package/serialization/resources/agentVariants/types/AgentSettingEdits.js +49 -0
  263. package/serialization/resources/agentVariants/types/AgentSettingsDiff.d.ts +13 -0
  264. package/serialization/resources/agentVariants/types/AgentSettingsDiff.js +45 -0
  265. package/serialization/resources/agentVariants/types/AgentVariantCompareRequest.d.ts +14 -0
  266. package/serialization/resources/agentVariants/types/AgentVariantCompareRequest.js +46 -0
  267. package/serialization/resources/agentVariants/types/AgentVariantCompareResponse.d.ts +13 -0
  268. package/serialization/resources/agentVariants/types/AgentVariantCompareResponse.js +45 -0
  269. package/serialization/resources/agentVariants/types/AgentVariantDiff.d.ts +14 -0
  270. package/serialization/resources/agentVariants/types/AgentVariantDiff.js +46 -0
  271. package/serialization/resources/agentVariants/types/AgentVariantFilter.d.ts +13 -0
  272. package/serialization/resources/agentVariants/types/AgentVariantFilter.js +45 -0
  273. package/serialization/resources/agentVariants/types/AgentVariantListRequest.d.ts +9 -0
  274. package/serialization/resources/agentVariants/types/AgentVariantListRequest.js +40 -0
  275. package/serialization/resources/agentVariants/types/AgentVariantRequest.d.ts +14 -0
  276. package/serialization/resources/agentVariants/types/AgentVariantRequest.js +46 -0
  277. package/serialization/resources/agentVariants/types/AgentVariantResponse.d.ts +21 -0
  278. package/serialization/resources/agentVariants/types/AgentVariantResponse.js +53 -0
  279. package/serialization/resources/agentVariants/types/AgentVariantSearchResult.d.ts +12 -0
  280. package/serialization/resources/agentVariants/types/AgentVariantSearchResult.js +46 -0
  281. package/serialization/resources/agentVariants/types/AgentVariantSortField.d.ts +7 -0
  282. package/serialization/resources/agentVariants/types/AgentVariantSortField.js +39 -0
  283. package/serialization/resources/agentVariants/types/AgentVariantStatus.d.ts +7 -0
  284. package/serialization/resources/agentVariants/types/AgentVariantStatus.js +39 -0
  285. package/serialization/resources/agentVariants/types/AgentVariantTraffic.d.ts +11 -0
  286. package/serialization/resources/agentVariants/types/AgentVariantTraffic.js +43 -0
  287. package/serialization/resources/agentVariants/types/AgentVariantsSearchRequest.d.ts +13 -0
  288. package/serialization/resources/agentVariants/types/AgentVariantsSearchRequest.js +47 -0
  289. package/serialization/resources/agentVariants/types/AgentVariantsSearchResponse.d.ts +11 -0
  290. package/serialization/resources/agentVariants/types/AgentVariantsSearchResponse.js +45 -0
  291. package/serialization/resources/agentVariants/types/CharterDiff.d.ts +19 -0
  292. package/serialization/resources/agentVariants/types/CharterDiff.js +51 -0
  293. package/serialization/resources/agentVariants/types/CharterEntityEdit.d.ts +10 -0
  294. package/serialization/resources/agentVariants/types/CharterEntityEdit.js +42 -0
  295. package/serialization/resources/agentVariants/types/DeletedCharterDiff.d.ts +10 -0
  296. package/serialization/resources/agentVariants/types/DeletedCharterDiff.js +42 -0
  297. package/serialization/resources/agentVariants/types/DeletedIntelligentFieldDiff.d.ts +10 -0
  298. package/serialization/resources/agentVariants/types/DeletedIntelligentFieldDiff.js +42 -0
  299. package/serialization/resources/agentVariants/types/EntityEdit.d.ts +15 -0
  300. package/serialization/resources/agentVariants/types/EntityEdit.js +49 -0
  301. package/serialization/resources/agentVariants/types/EntityEditResponse.d.ts +12 -0
  302. package/serialization/resources/agentVariants/types/EntityEditResponse.js +44 -0
  303. package/serialization/resources/agentVariants/types/IntelligentFieldDiff.d.ts +19 -0
  304. package/serialization/resources/agentVariants/types/IntelligentFieldDiff.js +51 -0
  305. package/serialization/resources/agentVariants/types/IntelligentFieldEntityEdit.d.ts +10 -0
  306. package/serialization/resources/agentVariants/types/IntelligentFieldEntityEdit.js +42 -0
  307. package/serialization/resources/agentVariants/types/ListAgentVariantsResponse.d.ts +11 -0
  308. package/serialization/resources/agentVariants/types/ListAgentVariantsResponse.js +45 -0
  309. package/serialization/resources/agentVariants/types/ListTrafficConfigsResponse.d.ts +11 -0
  310. package/serialization/resources/agentVariants/types/ListTrafficConfigsResponse.js +45 -0
  311. package/serialization/resources/agentVariants/types/ModifiedCharterDiff.d.ts +11 -0
  312. package/serialization/resources/agentVariants/types/ModifiedCharterDiff.js +43 -0
  313. package/serialization/resources/agentVariants/types/ModifiedIntelligentFieldDiff.d.ts +11 -0
  314. package/serialization/resources/agentVariants/types/ModifiedIntelligentFieldDiff.js +43 -0
  315. package/serialization/resources/agentVariants/types/TrafficAllocation.d.ts +11 -0
  316. package/serialization/resources/agentVariants/types/TrafficAllocation.js +47 -0
  317. package/serialization/resources/agentVariants/types/TrafficConfigResponse.d.ts +16 -0
  318. package/serialization/resources/agentVariants/types/TrafficConfigResponse.js +48 -0
  319. package/serialization/resources/agentVariants/types/TrafficFraction.d.ts +9 -0
  320. package/serialization/resources/agentVariants/types/TrafficFraction.js +41 -0
  321. package/serialization/resources/agentVariants/types/TrafficRule.d.ts +12 -0
  322. package/serialization/resources/agentVariants/types/TrafficRule.js +44 -0
  323. package/serialization/resources/agentVariants/types/UpdateTrafficConfigRequest.d.ts +11 -0
  324. package/serialization/resources/agentVariants/types/UpdateTrafficConfigRequest.js +43 -0
  325. package/serialization/resources/agentVariants/types/WorkingSetDiffResponse.d.ts +13 -0
  326. package/serialization/resources/agentVariants/types/WorkingSetDiffResponse.js +45 -0
  327. package/serialization/resources/agentVariants/types/index.d.ts +35 -0
  328. package/serialization/resources/agentVariants/types/index.js +51 -0
  329. package/serialization/resources/agents/client/requests/AgentPatchRequest.d.ts +2 -0
  330. package/serialization/resources/agents/client/requests/AgentPatchRequest.js +2 -0
  331. package/serialization/resources/agents/client/requests/VersionedAgentSettingsPatchRequest.d.ts +12 -0
  332. package/serialization/resources/agents/client/requests/VersionedAgentSettingsPatchRequest.js +44 -0
  333. package/serialization/resources/agents/client/requests/index.d.ts +1 -0
  334. package/serialization/resources/agents/client/requests/index.js +3 -1
  335. package/serialization/resources/agents/types/Agent.d.ts +6 -0
  336. package/serialization/resources/agents/types/Agent.js +6 -0
  337. package/serialization/resources/agents/types/AgentMigrations.d.ts +11 -0
  338. package/serialization/resources/agents/types/AgentMigrations.js +43 -0
  339. package/serialization/resources/agents/types/AgentMigrationsPatch.d.ts +9 -0
  340. package/serialization/resources/agents/types/AgentMigrationsPatch.js +41 -0
  341. package/serialization/resources/agents/types/AgentSettingName.d.ts +7 -0
  342. package/serialization/resources/agents/types/AgentSettingName.js +42 -0
  343. package/serialization/resources/agents/types/VersionedAgentSettings.d.ts +10 -0
  344. package/serialization/resources/agents/types/VersionedAgentSettings.js +42 -0
  345. package/serialization/resources/agents/types/VersionedEntityTypeOrSetting.d.ts +9 -0
  346. package/serialization/resources/agents/types/VersionedEntityTypeOrSetting.js +41 -0
  347. package/serialization/resources/agents/types/index.d.ts +5 -0
  348. package/serialization/resources/agents/types/index.js +5 -0
  349. package/serialization/resources/capabilities/types/CapabilityExecutionCompletionReason.d.ts +1 -1
  350. package/serialization/resources/capabilities/types/CapabilityExecutionCompletionReason.js +1 -0
  351. package/serialization/resources/charters/types/CharterEdit.d.ts +17 -0
  352. package/serialization/resources/charters/types/CharterEdit.js +49 -0
  353. package/serialization/resources/charters/types/CharterPayload.d.ts +11 -0
  354. package/serialization/resources/charters/types/CharterPayload.js +45 -0
  355. package/serialization/resources/charters/types/CharterResponse.d.ts +3 -0
  356. package/serialization/resources/charters/types/CharterResponse.js +3 -0
  357. package/serialization/resources/charters/types/CharterSummary.d.ts +3 -0
  358. package/serialization/resources/charters/types/CharterSummary.js +3 -0
  359. package/serialization/resources/charters/types/index.d.ts +2 -0
  360. package/serialization/resources/charters/types/index.js +2 -0
  361. package/serialization/resources/commons/types/CapabilityBase.d.ts +3 -0
  362. package/serialization/resources/commons/types/CapabilityBase.js +3 -0
  363. package/serialization/resources/commons/types/MetadataPrecondition.d.ts +2 -0
  364. package/serialization/resources/commons/types/MetadataPrecondition.js +2 -0
  365. package/serialization/resources/commons/types/SystemEventName.d.ts +1 -1
  366. package/serialization/resources/commons/types/SystemEventName.js +2 -0
  367. package/serialization/resources/conversation/types/NumericConversationField.d.ts +1 -1
  368. package/serialization/resources/conversation/types/NumericConversationField.js +1 -0
  369. package/serialization/resources/index.d.ts +5 -0
  370. package/serialization/resources/index.js +6 -1
  371. package/serialization/resources/intelligentFields/types/IntelligentFieldEdit.d.ts +17 -0
  372. package/serialization/resources/intelligentFields/types/IntelligentFieldEdit.js +49 -0
  373. package/serialization/resources/intelligentFields/types/IntelligentFieldPayload.d.ts +13 -0
  374. package/serialization/resources/intelligentFields/types/IntelligentFieldPayload.js +47 -0
  375. package/serialization/resources/intelligentFields/types/IntelligentFieldResponse.d.ts +0 -3
  376. package/serialization/resources/intelligentFields/types/IntelligentFieldResponse.js +0 -3
  377. package/serialization/resources/intelligentFields/types/index.d.ts +2 -0
  378. package/serialization/resources/intelligentFields/types/index.js +2 -0
  379. package/serialization/resources/knowledge/types/KnowledgeBaseResponse.d.ts +3 -0
  380. package/serialization/resources/knowledge/types/KnowledgeBaseResponse.js +3 -0
  381. package/serialization/resources/knowledge/types/KnowledgeBaseVersion.d.ts +3 -0
  382. package/serialization/resources/knowledge/types/KnowledgeBaseVersion.js +3 -0
  383. package/serialization/resources/knowledge/types/KnowledgeDocumentSearchResponse.d.ts +3 -0
  384. package/serialization/resources/knowledge/types/KnowledgeDocumentSearchResponse.js +3 -0
  385. package/serialization/resources/organizations/types/Organization.d.ts +5 -0
  386. package/serialization/resources/organizations/types/Organization.js +5 -0
  387. package/serialization/resources/triggers/client/requests/PartialUpdateRequest.d.ts +6 -0
  388. package/serialization/resources/triggers/client/requests/PartialUpdateRequest.js +6 -0
  389. package/serialization/resources/triggers/types/DebounceWait.d.ts +11 -0
  390. package/serialization/resources/triggers/types/DebounceWait.js +45 -0
  391. package/serialization/resources/triggers/types/DelayWait.d.ts +11 -0
  392. package/serialization/resources/triggers/types/DelayWait.js +45 -0
  393. package/serialization/resources/triggers/types/EventTriggerBase.d.ts +6 -0
  394. package/serialization/resources/triggers/types/EventTriggerBase.js +6 -0
  395. package/serialization/resources/triggers/types/EventTriggerResponse.d.ts +2 -0
  396. package/serialization/resources/triggers/types/EventTriggerResponse.js +2 -0
  397. package/serialization/resources/triggers/types/IntervalSchedule.d.ts +14 -0
  398. package/serialization/resources/triggers/types/IntervalSchedule.js +46 -0
  399. package/serialization/resources/triggers/types/ScheduleInterval.d.ts +7 -0
  400. package/serialization/resources/triggers/types/ScheduleInterval.js +39 -0
  401. package/serialization/resources/triggers/types/ScheduleSpec.d.ts +11 -0
  402. package/serialization/resources/triggers/types/ScheduleSpec.js +47 -0
  403. package/serialization/resources/triggers/types/TimeSpan.d.ts +11 -0
  404. package/serialization/resources/triggers/types/TimeSpan.js +43 -0
  405. package/serialization/resources/triggers/types/TimeSpanUnit.d.ts +7 -0
  406. package/serialization/resources/triggers/types/TimeSpanUnit.js +39 -0
  407. package/serialization/resources/triggers/types/TriggerRateLimit.d.ts +13 -0
  408. package/serialization/resources/triggers/types/TriggerRateLimit.js +45 -0
  409. package/serialization/resources/triggers/types/TriggerSchedule.d.ts +12 -0
  410. package/serialization/resources/triggers/types/TriggerSchedule.js +44 -0
  411. package/serialization/resources/triggers/types/TriggerWait.d.ts +15 -0
  412. package/serialization/resources/triggers/types/TriggerWait.js +49 -0
  413. package/serialization/resources/triggers/types/TriggerWaitBase.d.ts +10 -0
  414. package/serialization/resources/triggers/types/TriggerWaitBase.js +42 -0
  415. package/serialization/resources/triggers/types/index.d.ts +11 -0
  416. package/serialization/resources/triggers/types/index.js +11 -0
  417. package/serialization/resources/workingSet/index.d.ts +1 -0
  418. package/serialization/resources/workingSet/index.js +17 -0
  419. package/serialization/resources/workingSet/types/VariantDebugInfo.d.ts +10 -0
  420. package/serialization/resources/workingSet/types/VariantDebugInfo.js +42 -0
  421. package/serialization/resources/workingSet/types/index.d.ts +1 -0
  422. package/serialization/resources/workingSet/types/index.js +17 -0
  423. package/version.d.ts +1 -1
  424. package/version.js +1 -1
@@ -0,0 +1,1888 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
46
+ var t = {};
47
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
48
+ t[p] = s[p];
49
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
50
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
51
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
52
+ t[p[i]] = s[p[i]];
53
+ }
54
+ return t;
55
+ };
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.AgentVariantsClient = void 0;
58
+ const BaseClient_1 = require("../../../../BaseClient");
59
+ const core = __importStar(require("../../../../core"));
60
+ const headers_1 = require("../../../../core/headers");
61
+ const requestBody_1 = require("../../../../core/requestBody");
62
+ const environments = __importStar(require("../../../../environments"));
63
+ const handleNonStatusCodeError_1 = require("../../../../errors/handleNonStatusCodeError");
64
+ const errors = __importStar(require("../../../../errors/index"));
65
+ const serializers = __importStar(require("../../../../serialization/index"));
66
+ const MavenAGI = __importStar(require("../../../index"));
67
+ class AgentVariantsClient {
68
+ constructor(options) {
69
+ this._options = (0, BaseClient_1.normalizeClientOptionsWithAuth)(options);
70
+ }
71
+ /**
72
+ * Creates a new agent variant, optionally based on an existing variant, or updates it if it already exists.
73
+ *
74
+ * If a baseVariantId is provided, the new variant is forked from the specified base variant: it shares the base's configuration and starts with an empty working set. A variant's base is fixed when it is created: an update must pass the same baseVariantId (or omit it, if the variant has no base), and is otherwise rejected.
75
+ *
76
+ * Updating an existing agent variant sets its title and description, clearing the description if the request omits it, and leaves its status unchanged. Updating a deleted one resurrects it in place as an ACTIVE variant, keeping its original ID, creation metadata, and configuration. Creating or resurrecting a variant needs an ACTIVE base (reason `VARIANT_NOT_ACTIVE` otherwise), so resurrect a deleted base variant before its children. Updating an existing variant doesn't, so a retried create still succeeds after its base is archived.
77
+ *
78
+ * Creating or resurrecting a variant is rejected with reason `VARIANT_LIMIT_REACHED` while the agent is at its limit of ACTIVE variants (25 by default; the error message gives the agent's limit). Archived and deleted variants don't count, so archive one to make room. Updating an existing ACTIVE variant isn't limited.
79
+ *
80
+ * The response includes the details of the created or updated agent variant.
81
+ *
82
+ * <Note>**Required permission:** `edit:agents`</Note>
83
+ *
84
+ * @param {MavenAGI.AgentVariantRequest} request
85
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
86
+ *
87
+ * @throws {@link MavenAGI.NotFoundError}
88
+ * @throws {@link MavenAGI.BadRequestError}
89
+ * @throws {@link MavenAGI.PayloadTooLargeError}
90
+ * @throws {@link MavenAGI.TooManyRequestsError}
91
+ * @throws {@link MavenAGI.ServerError}
92
+ * @throws {@link errors.MavenAGIError}
93
+ * @throws {@link errors.MavenAGITimeoutError}
94
+ *
95
+ * @example
96
+ * await client.agentVariants.createOrUpdate({
97
+ * baseVariantId: {
98
+ * referenceId: "variant_456",
99
+ * appId: "zendesk",
100
+ * type: "AGENT_VARIANT"
101
+ * },
102
+ * variantId: {
103
+ * referenceId: "variant_789"
104
+ * },
105
+ * title: "Support agent Working 2",
106
+ * description: ""
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/agent-variants"),
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.AgentVariantRequest.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.AgentVariantResponse.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/agent-variants");
191
+ });
192
+ }
193
+ /**
194
+ * List all agent variants for an agent
195
+ *
196
+ * <Note>**Required permission:** `read:agents`</Note>
197
+ *
198
+ * @param {MavenAGI.AgentVariantListRequest} request
199
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
200
+ *
201
+ * @throws {@link MavenAGI.NotFoundError}
202
+ * @throws {@link MavenAGI.BadRequestError}
203
+ * @throws {@link MavenAGI.PayloadTooLargeError}
204
+ * @throws {@link MavenAGI.TooManyRequestsError}
205
+ * @throws {@link MavenAGI.ServerError}
206
+ * @throws {@link errors.MavenAGIError}
207
+ * @throws {@link errors.MavenAGITimeoutError}
208
+ *
209
+ * @example
210
+ * await client.agentVariants.list({
211
+ * page: 0,
212
+ * size: 20,
213
+ * sortDesc: true
214
+ * })
215
+ */
216
+ list(request, requestOptions) {
217
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
218
+ }
219
+ __list(request, requestOptions) {
220
+ return __awaiter(this, void 0, void 0, function* () {
221
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
222
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
223
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
224
+ "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,
225
+ "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,
226
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
227
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
228
+ 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/agent-variants/list"),
229
+ method: "POST",
230
+ headers: _headers,
231
+ contentType: "application/json",
232
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
233
+ requestType: "json",
234
+ body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.AgentVariantListRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
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.ListAgentVariantsResponse.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, "POST", "/v1/agent-variants/list");
298
+ });
299
+ }
300
+ /**
301
+ * Search an agent's variants, most recently updated first by default. A variant must match every filter given; omitting `filter` returns every ACTIVE variant.
302
+ *
303
+ * Each result carries the variant's traffic in the agent's latest traffic configuration revision and the number of edits staged in its working set.
304
+ *
305
+ * <Note>**Required permission:** `read:agents`</Note>
306
+ *
307
+ * @param {MavenAGI.AgentVariantsSearchRequest} request
308
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
309
+ *
310
+ * @throws {@link MavenAGI.NotFoundError}
311
+ * @throws {@link MavenAGI.BadRequestError}
312
+ * @throws {@link MavenAGI.PayloadTooLargeError}
313
+ * @throws {@link MavenAGI.TooManyRequestsError}
314
+ * @throws {@link MavenAGI.ServerError}
315
+ * @throws {@link errors.MavenAGIError}
316
+ * @throws {@link errors.MavenAGITimeoutError}
317
+ *
318
+ * @example
319
+ * await client.agentVariants.search({
320
+ * filter: {
321
+ * live: true
322
+ * }
323
+ * })
324
+ */
325
+ search(request, requestOptions) {
326
+ return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions));
327
+ }
328
+ __search(request, requestOptions) {
329
+ return __awaiter(this, void 0, void 0, function* () {
330
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
331
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
332
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
333
+ "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,
334
+ "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,
335
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
336
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
337
+ 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/agent-variants/search"),
338
+ method: "POST",
339
+ headers: _headers,
340
+ contentType: "application/json",
341
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
342
+ requestType: "json",
343
+ body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.AgentVariantsSearchRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
344
+ 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,
345
+ 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,
346
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
347
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
348
+ logging: this._options.logging,
349
+ });
350
+ if (_response.ok) {
351
+ return {
352
+ data: serializers.AgentVariantsSearchResponse.parseOrThrow(_response.body, {
353
+ unrecognizedObjectKeys: "passthrough",
354
+ allowUnrecognizedUnionMembers: true,
355
+ allowUnrecognizedEnumValues: true,
356
+ breadcrumbsPrefix: ["response"],
357
+ }),
358
+ rawResponse: _response.rawResponse,
359
+ };
360
+ }
361
+ if (_response.error.reason === "status-code") {
362
+ switch (_response.error.statusCode) {
363
+ case 404:
364
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
365
+ unrecognizedObjectKeys: "passthrough",
366
+ allowUnrecognizedUnionMembers: true,
367
+ allowUnrecognizedEnumValues: true,
368
+ breadcrumbsPrefix: ["response"],
369
+ }), _response.rawResponse);
370
+ case 400:
371
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
372
+ unrecognizedObjectKeys: "passthrough",
373
+ allowUnrecognizedUnionMembers: true,
374
+ allowUnrecognizedEnumValues: true,
375
+ breadcrumbsPrefix: ["response"],
376
+ }), _response.rawResponse);
377
+ case 413:
378
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
379
+ unrecognizedObjectKeys: "passthrough",
380
+ allowUnrecognizedUnionMembers: true,
381
+ allowUnrecognizedEnumValues: true,
382
+ breadcrumbsPrefix: ["response"],
383
+ }), _response.rawResponse);
384
+ case 429:
385
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
386
+ unrecognizedObjectKeys: "passthrough",
387
+ allowUnrecognizedUnionMembers: true,
388
+ allowUnrecognizedEnumValues: true,
389
+ breadcrumbsPrefix: ["response"],
390
+ }), _response.rawResponse);
391
+ case 500:
392
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
393
+ unrecognizedObjectKeys: "passthrough",
394
+ allowUnrecognizedUnionMembers: true,
395
+ allowUnrecognizedEnumValues: true,
396
+ breadcrumbsPrefix: ["response"],
397
+ }), _response.rawResponse);
398
+ default:
399
+ throw new errors.MavenAGIError({
400
+ statusCode: _response.error.statusCode,
401
+ body: _response.error.body,
402
+ rawResponse: _response.rawResponse,
403
+ });
404
+ }
405
+ }
406
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/agent-variants/search");
407
+ });
408
+ }
409
+ /**
410
+ * Retrieve the details of a specific agent variant by its ID
411
+ *
412
+ * <Note>**Required permission:** `read:agents`</Note>
413
+ *
414
+ * @param {string} variantReferenceId - The referenceId of the agent variant to retrieve.
415
+ * @param {MavenAGI.AgentVariantBaseGetRequest} request
416
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
417
+ *
418
+ * @throws {@link MavenAGI.NotFoundError}
419
+ * @throws {@link MavenAGI.BadRequestError}
420
+ * @throws {@link MavenAGI.PayloadTooLargeError}
421
+ * @throws {@link MavenAGI.TooManyRequestsError}
422
+ * @throws {@link MavenAGI.ServerError}
423
+ * @throws {@link errors.MavenAGIError}
424
+ * @throws {@link errors.MavenAGITimeoutError}
425
+ *
426
+ * @example
427
+ * await client.agentVariants.get("variantReferenceId_123")
428
+ */
429
+ get(variantReferenceId, request = {}, requestOptions) {
430
+ return core.HttpResponsePromise.fromPromise(this.__get(variantReferenceId, request, requestOptions));
431
+ }
432
+ __get(variantReferenceId_1) {
433
+ return __awaiter(this, arguments, void 0, function* (variantReferenceId, request = {}, requestOptions) {
434
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
435
+ const { appId } = request;
436
+ const _queryParams = {
437
+ appId,
438
+ };
439
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
440
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
441
+ "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,
442
+ "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,
443
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
444
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
445
+ 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/agent-variants/${core.url.encodePathParam(variantReferenceId, errors.MavenAGIError)}`),
446
+ method: "GET",
447
+ headers: _headers,
448
+ queryString: core.url
449
+ .queryBuilder()
450
+ .addMany(_queryParams)
451
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
452
+ .build(),
453
+ 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,
454
+ 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,
455
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
456
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
457
+ logging: this._options.logging,
458
+ });
459
+ if (_response.ok) {
460
+ return {
461
+ data: serializers.AgentVariantResponse.parseOrThrow(_response.body, {
462
+ unrecognizedObjectKeys: "passthrough",
463
+ allowUnrecognizedUnionMembers: true,
464
+ allowUnrecognizedEnumValues: true,
465
+ breadcrumbsPrefix: ["response"],
466
+ }),
467
+ rawResponse: _response.rawResponse,
468
+ };
469
+ }
470
+ if (_response.error.reason === "status-code") {
471
+ switch (_response.error.statusCode) {
472
+ case 404:
473
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
474
+ unrecognizedObjectKeys: "passthrough",
475
+ allowUnrecognizedUnionMembers: true,
476
+ allowUnrecognizedEnumValues: true,
477
+ breadcrumbsPrefix: ["response"],
478
+ }), _response.rawResponse);
479
+ case 400:
480
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
481
+ unrecognizedObjectKeys: "passthrough",
482
+ allowUnrecognizedUnionMembers: true,
483
+ allowUnrecognizedEnumValues: true,
484
+ breadcrumbsPrefix: ["response"],
485
+ }), _response.rawResponse);
486
+ case 413:
487
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
488
+ unrecognizedObjectKeys: "passthrough",
489
+ allowUnrecognizedUnionMembers: true,
490
+ allowUnrecognizedEnumValues: true,
491
+ breadcrumbsPrefix: ["response"],
492
+ }), _response.rawResponse);
493
+ case 429:
494
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
495
+ unrecognizedObjectKeys: "passthrough",
496
+ allowUnrecognizedUnionMembers: true,
497
+ allowUnrecognizedEnumValues: true,
498
+ breadcrumbsPrefix: ["response"],
499
+ }), _response.rawResponse);
500
+ case 500:
501
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
502
+ unrecognizedObjectKeys: "passthrough",
503
+ allowUnrecognizedUnionMembers: true,
504
+ allowUnrecognizedEnumValues: true,
505
+ breadcrumbsPrefix: ["response"],
506
+ }), _response.rawResponse);
507
+ default:
508
+ throw new errors.MavenAGIError({
509
+ statusCode: _response.error.statusCode,
510
+ body: _response.error.body,
511
+ rawResponse: _response.rawResponse,
512
+ });
513
+ }
514
+ }
515
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/agent-variants/{variantReferenceId}");
516
+ });
517
+ }
518
+ /**
519
+ * Update a specific agent variant's metadata, such as description or status. The request body can include any of the updatable fields.
520
+ *
521
+ * A deleted variant can't be patched (reason `VARIANT_NOT_ACTIVE`). Bring it back with createOrUpdate instead, which resurrects it (its base, if it has one, must be ACTIVE).
522
+ *
523
+ * Setting an archived variant's status back to ACTIVE is rejected with reason `VARIANT_LIMIT_REACHED` while the agent is at its limit of ACTIVE variants.
524
+ *
525
+ * <Note>**Required permission:** `edit:agents`</Note>
526
+ *
527
+ * @param {string} variantReferenceId - The referenceId of the agent variant to patch.
528
+ * @param {MavenAGI.PatchAgentVariantRequest} request
529
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
530
+ *
531
+ * @throws {@link MavenAGI.NotFoundError}
532
+ * @throws {@link MavenAGI.BadRequestError}
533
+ * @throws {@link MavenAGI.PayloadTooLargeError}
534
+ * @throws {@link MavenAGI.TooManyRequestsError}
535
+ * @throws {@link MavenAGI.ServerError}
536
+ * @throws {@link errors.MavenAGIError}
537
+ * @throws {@link errors.MavenAGITimeoutError}
538
+ *
539
+ * @example
540
+ * await client.agentVariants.patch("variantReferenceId")
541
+ */
542
+ patch(variantReferenceId, request = {}, requestOptions) {
543
+ return core.HttpResponsePromise.fromPromise(this.__patch(variantReferenceId, request, requestOptions));
544
+ }
545
+ __patch(variantReferenceId_1) {
546
+ return __awaiter(this, arguments, void 0, function* (variantReferenceId, request = {}, requestOptions) {
547
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
548
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
549
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
550
+ "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,
551
+ "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,
552
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
553
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
554
+ 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/agent-variants/${core.url.encodePathParam(variantReferenceId, errors.MavenAGIError)}`),
555
+ method: "PATCH",
556
+ headers: _headers,
557
+ contentType: "application/merge-patch+json",
558
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
559
+ requestType: "json",
560
+ body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.PatchAgentVariantRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
561
+ 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,
562
+ 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,
563
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
564
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
565
+ logging: this._options.logging,
566
+ });
567
+ if (_response.ok) {
568
+ return {
569
+ data: serializers.AgentVariantResponse.parseOrThrow(_response.body, {
570
+ unrecognizedObjectKeys: "passthrough",
571
+ allowUnrecognizedUnionMembers: true,
572
+ allowUnrecognizedEnumValues: true,
573
+ breadcrumbsPrefix: ["response"],
574
+ }),
575
+ rawResponse: _response.rawResponse,
576
+ };
577
+ }
578
+ if (_response.error.reason === "status-code") {
579
+ switch (_response.error.statusCode) {
580
+ case 404:
581
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
582
+ unrecognizedObjectKeys: "passthrough",
583
+ allowUnrecognizedUnionMembers: true,
584
+ allowUnrecognizedEnumValues: true,
585
+ breadcrumbsPrefix: ["response"],
586
+ }), _response.rawResponse);
587
+ case 400:
588
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
589
+ unrecognizedObjectKeys: "passthrough",
590
+ allowUnrecognizedUnionMembers: true,
591
+ allowUnrecognizedEnumValues: true,
592
+ breadcrumbsPrefix: ["response"],
593
+ }), _response.rawResponse);
594
+ case 413:
595
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
596
+ unrecognizedObjectKeys: "passthrough",
597
+ allowUnrecognizedUnionMembers: true,
598
+ allowUnrecognizedEnumValues: true,
599
+ breadcrumbsPrefix: ["response"],
600
+ }), _response.rawResponse);
601
+ case 429:
602
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
603
+ unrecognizedObjectKeys: "passthrough",
604
+ allowUnrecognizedUnionMembers: true,
605
+ allowUnrecognizedEnumValues: true,
606
+ breadcrumbsPrefix: ["response"],
607
+ }), _response.rawResponse);
608
+ case 500:
609
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
610
+ unrecognizedObjectKeys: "passthrough",
611
+ allowUnrecognizedUnionMembers: true,
612
+ allowUnrecognizedEnumValues: true,
613
+ breadcrumbsPrefix: ["response"],
614
+ }), _response.rawResponse);
615
+ default:
616
+ throw new errors.MavenAGIError({
617
+ statusCode: _response.error.statusCode,
618
+ body: _response.error.body,
619
+ rawResponse: _response.rawResponse,
620
+ });
621
+ }
622
+ }
623
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v1/agent-variants/{variantReferenceId}");
624
+ });
625
+ }
626
+ /**
627
+ * Adds a new traffic configuration revision for the agent in the request context. Traffic
628
+ * configuration is agent-wide: each rule names the variant it routes to, and the rules
629
+ * together define how the agent's live traffic is split across its variants.
630
+ *
631
+ * Revisions are never overwritten in place: each call inserts a new revision as the successor to the agent's current one. `expectedRevisionSequence` is required once a revision already exists and acts as a compare-and-swap guard -- it must match the agent's current revision sequence or the call is rejected, ensuring only one caller's update is accepted as the successor to the revision it actually observed.
632
+ *
633
+ * Every rule's variant must be ACTIVE and have no staged edits in its working set (`VARIANT_HAS_STAGED_EDITS`), even at 0%. The rules must route all of the agent's traffic: their percentages sum to 100, so an empty list is rejected. A revision holds only the split; there is no production or default variant, and a read or write that names no variant is rejected while its entity type is versioned (`VARIANT_REQUIRED`).
634
+ *
635
+ * Traffic can be changed only while at least one entity type is versioned for the agent (see the agent's `migrations.versionedEntityTypes`). Otherwise the call is rejected with 501.
636
+ *
637
+ * Shown in Agent Designer as "Traffic Control".
638
+ *
639
+ * <Note>**Required permission:** `edit:agents`</Note>
640
+ *
641
+ * @param {MavenAGI.UpdateTrafficConfigRequest} request
642
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
643
+ *
644
+ * @throws {@link MavenAGI.NotFoundError}
645
+ * @throws {@link MavenAGI.BadRequestError}
646
+ * @throws {@link MavenAGI.PayloadTooLargeError}
647
+ * @throws {@link MavenAGI.TooManyRequestsError}
648
+ * @throws {@link MavenAGI.ServerError}
649
+ * @throws {@link errors.MavenAGIError}
650
+ * @throws {@link errors.MavenAGITimeoutError}
651
+ *
652
+ * @example
653
+ * await client.agentVariants.updateTrafficConfig({
654
+ * rules: [{
655
+ * variantId: {
656
+ * organizationId: "organizationId",
657
+ * agentId: "agentId",
658
+ * type: "AGENT",
659
+ * appId: "appId",
660
+ * referenceId: "x"
661
+ * },
662
+ * percentage: 1.1,
663
+ * condition: "condition"
664
+ * }, {
665
+ * variantId: {
666
+ * organizationId: "organizationId",
667
+ * agentId: "agentId",
668
+ * type: "AGENT",
669
+ * appId: "appId",
670
+ * referenceId: "x"
671
+ * },
672
+ * percentage: 1.1,
673
+ * condition: "condition"
674
+ * }]
675
+ * })
676
+ */
677
+ updateTrafficConfig(request, requestOptions) {
678
+ return core.HttpResponsePromise.fromPromise(this.__updateTrafficConfig(request, requestOptions));
679
+ }
680
+ __updateTrafficConfig(request, requestOptions) {
681
+ return __awaiter(this, void 0, void 0, function* () {
682
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
683
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
684
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
685
+ "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,
686
+ "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,
687
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
688
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
689
+ 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/agent-variants/traffic-config"),
690
+ method: "PUT",
691
+ headers: _headers,
692
+ contentType: "application/json",
693
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
694
+ requestType: "json",
695
+ body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.UpdateTrafficConfigRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
696
+ 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,
697
+ 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,
698
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
699
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
700
+ logging: this._options.logging,
701
+ });
702
+ if (_response.ok) {
703
+ return {
704
+ data: serializers.TrafficConfigResponse.parseOrThrow(_response.body, {
705
+ unrecognizedObjectKeys: "passthrough",
706
+ allowUnrecognizedUnionMembers: true,
707
+ allowUnrecognizedEnumValues: true,
708
+ breadcrumbsPrefix: ["response"],
709
+ }),
710
+ rawResponse: _response.rawResponse,
711
+ };
712
+ }
713
+ if (_response.error.reason === "status-code") {
714
+ switch (_response.error.statusCode) {
715
+ case 404:
716
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
717
+ unrecognizedObjectKeys: "passthrough",
718
+ allowUnrecognizedUnionMembers: true,
719
+ allowUnrecognizedEnumValues: true,
720
+ breadcrumbsPrefix: ["response"],
721
+ }), _response.rawResponse);
722
+ case 400:
723
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
724
+ unrecognizedObjectKeys: "passthrough",
725
+ allowUnrecognizedUnionMembers: true,
726
+ allowUnrecognizedEnumValues: true,
727
+ breadcrumbsPrefix: ["response"],
728
+ }), _response.rawResponse);
729
+ case 413:
730
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
731
+ unrecognizedObjectKeys: "passthrough",
732
+ allowUnrecognizedUnionMembers: true,
733
+ allowUnrecognizedEnumValues: true,
734
+ breadcrumbsPrefix: ["response"],
735
+ }), _response.rawResponse);
736
+ case 429:
737
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
738
+ unrecognizedObjectKeys: "passthrough",
739
+ allowUnrecognizedUnionMembers: true,
740
+ allowUnrecognizedEnumValues: true,
741
+ breadcrumbsPrefix: ["response"],
742
+ }), _response.rawResponse);
743
+ case 500:
744
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
745
+ unrecognizedObjectKeys: "passthrough",
746
+ allowUnrecognizedUnionMembers: true,
747
+ allowUnrecognizedEnumValues: true,
748
+ breadcrumbsPrefix: ["response"],
749
+ }), _response.rawResponse);
750
+ default:
751
+ throw new errors.MavenAGIError({
752
+ statusCode: _response.error.statusCode,
753
+ body: _response.error.body,
754
+ rawResponse: _response.rawResponse,
755
+ });
756
+ }
757
+ }
758
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/v1/agent-variants/traffic-config");
759
+ });
760
+ }
761
+ /**
762
+ * Get a specific traffic configuration revision of the agent in the request context.
763
+ *
764
+ * <Note>**Required permission:** `read:agents`</Note>
765
+ *
766
+ * @param {string} trafficConfigReferenceId - The unique identifier of the traffic configuration to retrieve.
767
+ * @param {MavenAGI.GetTrafficConfigRequest} request
768
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
769
+ *
770
+ * @throws {@link MavenAGI.NotFoundError}
771
+ * @throws {@link MavenAGI.BadRequestError}
772
+ * @throws {@link MavenAGI.PayloadTooLargeError}
773
+ * @throws {@link MavenAGI.TooManyRequestsError}
774
+ * @throws {@link MavenAGI.ServerError}
775
+ * @throws {@link errors.MavenAGIError}
776
+ * @throws {@link errors.MavenAGITimeoutError}
777
+ *
778
+ * @example
779
+ * await client.agentVariants.getTrafficConfig("trafficConfigReferenceId")
780
+ */
781
+ getTrafficConfig(trafficConfigReferenceId, request = {}, requestOptions) {
782
+ return core.HttpResponsePromise.fromPromise(this.__getTrafficConfig(trafficConfigReferenceId, request, requestOptions));
783
+ }
784
+ __getTrafficConfig(trafficConfigReferenceId_1) {
785
+ return __awaiter(this, arguments, void 0, function* (trafficConfigReferenceId, request = {}, requestOptions) {
786
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
787
+ const { trafficConfigAppId } = request;
788
+ const _queryParams = {
789
+ trafficConfigAppId,
790
+ };
791
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
792
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
793
+ "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,
794
+ "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,
795
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
796
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
797
+ 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/agent-variants/traffic-config/${core.url.encodePathParam(trafficConfigReferenceId, errors.MavenAGIError)}`),
798
+ method: "GET",
799
+ headers: _headers,
800
+ queryString: core.url
801
+ .queryBuilder()
802
+ .addMany(_queryParams)
803
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
804
+ .build(),
805
+ 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,
806
+ 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,
807
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
808
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
809
+ logging: this._options.logging,
810
+ });
811
+ if (_response.ok) {
812
+ return {
813
+ data: serializers.TrafficConfigResponse.parseOrThrow(_response.body, {
814
+ unrecognizedObjectKeys: "passthrough",
815
+ allowUnrecognizedUnionMembers: true,
816
+ allowUnrecognizedEnumValues: true,
817
+ breadcrumbsPrefix: ["response"],
818
+ }),
819
+ rawResponse: _response.rawResponse,
820
+ };
821
+ }
822
+ if (_response.error.reason === "status-code") {
823
+ switch (_response.error.statusCode) {
824
+ case 404:
825
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
826
+ unrecognizedObjectKeys: "passthrough",
827
+ allowUnrecognizedUnionMembers: true,
828
+ allowUnrecognizedEnumValues: true,
829
+ breadcrumbsPrefix: ["response"],
830
+ }), _response.rawResponse);
831
+ case 400:
832
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
833
+ unrecognizedObjectKeys: "passthrough",
834
+ allowUnrecognizedUnionMembers: true,
835
+ allowUnrecognizedEnumValues: true,
836
+ breadcrumbsPrefix: ["response"],
837
+ }), _response.rawResponse);
838
+ case 413:
839
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
840
+ unrecognizedObjectKeys: "passthrough",
841
+ allowUnrecognizedUnionMembers: true,
842
+ allowUnrecognizedEnumValues: true,
843
+ breadcrumbsPrefix: ["response"],
844
+ }), _response.rawResponse);
845
+ case 429:
846
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
847
+ unrecognizedObjectKeys: "passthrough",
848
+ allowUnrecognizedUnionMembers: true,
849
+ allowUnrecognizedEnumValues: true,
850
+ breadcrumbsPrefix: ["response"],
851
+ }), _response.rawResponse);
852
+ case 500:
853
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
854
+ unrecognizedObjectKeys: "passthrough",
855
+ allowUnrecognizedUnionMembers: true,
856
+ allowUnrecognizedEnumValues: true,
857
+ breadcrumbsPrefix: ["response"],
858
+ }), _response.rawResponse);
859
+ default:
860
+ throw new errors.MavenAGIError({
861
+ statusCode: _response.error.statusCode,
862
+ body: _response.error.body,
863
+ rawResponse: _response.rawResponse,
864
+ });
865
+ }
866
+ }
867
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/agent-variants/traffic-config/{trafficConfigReferenceId}");
868
+ });
869
+ }
870
+ /**
871
+ * Get the traffic configuration currently routing live traffic for the agent in the request context.
872
+ *
873
+ * <Note>**Required permission:** `read:agents`</Note>
874
+ *
875
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
876
+ *
877
+ * @throws {@link MavenAGI.NotFoundError}
878
+ * @throws {@link MavenAGI.BadRequestError}
879
+ * @throws {@link MavenAGI.PayloadTooLargeError}
880
+ * @throws {@link MavenAGI.TooManyRequestsError}
881
+ * @throws {@link MavenAGI.ServerError}
882
+ * @throws {@link errors.MavenAGIError}
883
+ * @throws {@link errors.MavenAGITimeoutError}
884
+ *
885
+ * @example
886
+ * await client.agentVariants.getActiveTrafficConfig()
887
+ */
888
+ getActiveTrafficConfig(requestOptions) {
889
+ return core.HttpResponsePromise.fromPromise(this.__getActiveTrafficConfig(requestOptions));
890
+ }
891
+ __getActiveTrafficConfig(requestOptions) {
892
+ return __awaiter(this, void 0, void 0, function* () {
893
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
894
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
895
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
896
+ "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,
897
+ "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,
898
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
899
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
900
+ 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/agent-variants/traffic-config/active"),
901
+ method: "GET",
902
+ headers: _headers,
903
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
904
+ 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,
905
+ 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,
906
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
907
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
908
+ logging: this._options.logging,
909
+ });
910
+ if (_response.ok) {
911
+ return {
912
+ data: serializers.TrafficConfigResponse.parseOrThrow(_response.body, {
913
+ unrecognizedObjectKeys: "passthrough",
914
+ allowUnrecognizedUnionMembers: true,
915
+ allowUnrecognizedEnumValues: true,
916
+ breadcrumbsPrefix: ["response"],
917
+ }),
918
+ rawResponse: _response.rawResponse,
919
+ };
920
+ }
921
+ if (_response.error.reason === "status-code") {
922
+ switch (_response.error.statusCode) {
923
+ case 404:
924
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
925
+ unrecognizedObjectKeys: "passthrough",
926
+ allowUnrecognizedUnionMembers: true,
927
+ allowUnrecognizedEnumValues: true,
928
+ breadcrumbsPrefix: ["response"],
929
+ }), _response.rawResponse);
930
+ case 400:
931
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
932
+ unrecognizedObjectKeys: "passthrough",
933
+ allowUnrecognizedUnionMembers: true,
934
+ allowUnrecognizedEnumValues: true,
935
+ breadcrumbsPrefix: ["response"],
936
+ }), _response.rawResponse);
937
+ case 413:
938
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
939
+ unrecognizedObjectKeys: "passthrough",
940
+ allowUnrecognizedUnionMembers: true,
941
+ allowUnrecognizedEnumValues: true,
942
+ breadcrumbsPrefix: ["response"],
943
+ }), _response.rawResponse);
944
+ case 429:
945
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
946
+ unrecognizedObjectKeys: "passthrough",
947
+ allowUnrecognizedUnionMembers: true,
948
+ allowUnrecognizedEnumValues: true,
949
+ breadcrumbsPrefix: ["response"],
950
+ }), _response.rawResponse);
951
+ case 500:
952
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
953
+ unrecognizedObjectKeys: "passthrough",
954
+ allowUnrecognizedUnionMembers: true,
955
+ allowUnrecognizedEnumValues: true,
956
+ breadcrumbsPrefix: ["response"],
957
+ }), _response.rawResponse);
958
+ default:
959
+ throw new errors.MavenAGIError({
960
+ statusCode: _response.error.statusCode,
961
+ body: _response.error.body,
962
+ rawResponse: _response.rawResponse,
963
+ });
964
+ }
965
+ }
966
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/agent-variants/traffic-config/active");
967
+ });
968
+ }
969
+ /**
970
+ * List the traffic configuration revisions of the agent in the request context, newest first by default.
971
+ *
972
+ * <Note>**Required permission:** `read:agents`</Note>
973
+ *
974
+ * @param {MavenAGI.ListTrafficConfigsRequest} request
975
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
976
+ *
977
+ * @throws {@link MavenAGI.NotFoundError}
978
+ * @throws {@link MavenAGI.BadRequestError}
979
+ * @throws {@link MavenAGI.PayloadTooLargeError}
980
+ * @throws {@link MavenAGI.TooManyRequestsError}
981
+ * @throws {@link MavenAGI.ServerError}
982
+ * @throws {@link errors.MavenAGIError}
983
+ * @throws {@link errors.MavenAGITimeoutError}
984
+ *
985
+ * @example
986
+ * await client.agentVariants.listTrafficConfigs()
987
+ */
988
+ listTrafficConfigs(request = {}, requestOptions) {
989
+ return core.HttpResponsePromise.fromPromise(this.__listTrafficConfigs(request, requestOptions));
990
+ }
991
+ __listTrafficConfigs() {
992
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
993
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
994
+ const { page, size, sortDesc } = request;
995
+ const _queryParams = {
996
+ page,
997
+ size,
998
+ sortDesc,
999
+ };
1000
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1001
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
1002
+ "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,
1003
+ "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,
1004
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1005
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
1006
+ 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/agent-variants/traffic-configs"),
1007
+ method: "POST",
1008
+ headers: _headers,
1009
+ queryString: core.url
1010
+ .queryBuilder()
1011
+ .addMany(_queryParams)
1012
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
1013
+ .build(),
1014
+ 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,
1015
+ 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,
1016
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1017
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
1018
+ logging: this._options.logging,
1019
+ });
1020
+ if (_response.ok) {
1021
+ return {
1022
+ data: serializers.ListTrafficConfigsResponse.parseOrThrow(_response.body, {
1023
+ unrecognizedObjectKeys: "passthrough",
1024
+ allowUnrecognizedUnionMembers: true,
1025
+ allowUnrecognizedEnumValues: true,
1026
+ breadcrumbsPrefix: ["response"],
1027
+ }),
1028
+ rawResponse: _response.rawResponse,
1029
+ };
1030
+ }
1031
+ if (_response.error.reason === "status-code") {
1032
+ switch (_response.error.statusCode) {
1033
+ case 404:
1034
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1035
+ unrecognizedObjectKeys: "passthrough",
1036
+ allowUnrecognizedUnionMembers: true,
1037
+ allowUnrecognizedEnumValues: true,
1038
+ breadcrumbsPrefix: ["response"],
1039
+ }), _response.rawResponse);
1040
+ case 400:
1041
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1042
+ unrecognizedObjectKeys: "passthrough",
1043
+ allowUnrecognizedUnionMembers: true,
1044
+ allowUnrecognizedEnumValues: true,
1045
+ breadcrumbsPrefix: ["response"],
1046
+ }), _response.rawResponse);
1047
+ case 413:
1048
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1049
+ unrecognizedObjectKeys: "passthrough",
1050
+ allowUnrecognizedUnionMembers: true,
1051
+ allowUnrecognizedEnumValues: true,
1052
+ breadcrumbsPrefix: ["response"],
1053
+ }), _response.rawResponse);
1054
+ case 429:
1055
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1056
+ unrecognizedObjectKeys: "passthrough",
1057
+ allowUnrecognizedUnionMembers: true,
1058
+ allowUnrecognizedEnumValues: true,
1059
+ breadcrumbsPrefix: ["response"],
1060
+ }), _response.rawResponse);
1061
+ case 500:
1062
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1063
+ unrecognizedObjectKeys: "passthrough",
1064
+ allowUnrecognizedUnionMembers: true,
1065
+ allowUnrecognizedEnumValues: true,
1066
+ breadcrumbsPrefix: ["response"],
1067
+ }), _response.rawResponse);
1068
+ default:
1069
+ throw new errors.MavenAGIError({
1070
+ statusCode: _response.error.statusCode,
1071
+ body: _response.error.body,
1072
+ rawResponse: _response.rawResponse,
1073
+ });
1074
+ }
1075
+ }
1076
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/agent-variants/traffic-configs");
1077
+ });
1078
+ }
1079
+ /**
1080
+ * Get the edit staged for one entity in an agent variant's working set. A 404 means nothing is staged for it. `entityId.type` must be `INTELLIGENT_FIELD` or `CHARTER`; any other type is rejected with a 400. A versioned agent setting's staged edit is read with `getSettingEdit`.
1081
+ *
1082
+ * <Note>**Required permission:** `read:agents`</Note>
1083
+ *
1084
+ * @param {string} variantReferenceId - The referenceId of the agent variant.
1085
+ * @param {MavenAGI.GetEntityEditByIdRequest} request
1086
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
1087
+ *
1088
+ * @throws {@link MavenAGI.NotFoundError}
1089
+ * @throws {@link MavenAGI.BadRequestError}
1090
+ * @throws {@link MavenAGI.PayloadTooLargeError}
1091
+ * @throws {@link MavenAGI.TooManyRequestsError}
1092
+ * @throws {@link MavenAGI.ServerError}
1093
+ * @throws {@link errors.MavenAGIError}
1094
+ * @throws {@link errors.MavenAGITimeoutError}
1095
+ *
1096
+ * @example
1097
+ * await client.agentVariants.getEntityEdit("variantReferenceId", {
1098
+ * entityId: {
1099
+ * type: "AGENT",
1100
+ * appId: "appId",
1101
+ * referenceId: "x"
1102
+ * }
1103
+ * })
1104
+ */
1105
+ getEntityEdit(variantReferenceId, request, requestOptions) {
1106
+ return core.HttpResponsePromise.fromPromise(this.__getEntityEdit(variantReferenceId, request, requestOptions));
1107
+ }
1108
+ __getEntityEdit(variantReferenceId, request, requestOptions) {
1109
+ return __awaiter(this, void 0, void 0, function* () {
1110
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1111
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1112
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
1113
+ "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,
1114
+ "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,
1115
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1116
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
1117
+ 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/agent-variants/${core.url.encodePathParam(variantReferenceId, errors.MavenAGIError)}/working-set/entity`),
1118
+ method: "POST",
1119
+ headers: _headers,
1120
+ contentType: "application/json",
1121
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
1122
+ requestType: "json",
1123
+ body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.GetEntityEditByIdRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
1124
+ 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,
1125
+ 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,
1126
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1127
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
1128
+ logging: this._options.logging,
1129
+ });
1130
+ if (_response.ok) {
1131
+ return {
1132
+ data: serializers.EntityEditResponse.parseOrThrow(_response.body, {
1133
+ unrecognizedObjectKeys: "passthrough",
1134
+ allowUnrecognizedUnionMembers: true,
1135
+ allowUnrecognizedEnumValues: true,
1136
+ breadcrumbsPrefix: ["response"],
1137
+ }),
1138
+ rawResponse: _response.rawResponse,
1139
+ };
1140
+ }
1141
+ if (_response.error.reason === "status-code") {
1142
+ switch (_response.error.statusCode) {
1143
+ case 404:
1144
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1145
+ unrecognizedObjectKeys: "passthrough",
1146
+ allowUnrecognizedUnionMembers: true,
1147
+ allowUnrecognizedEnumValues: true,
1148
+ breadcrumbsPrefix: ["response"],
1149
+ }), _response.rawResponse);
1150
+ case 400:
1151
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1152
+ unrecognizedObjectKeys: "passthrough",
1153
+ allowUnrecognizedUnionMembers: true,
1154
+ allowUnrecognizedEnumValues: true,
1155
+ breadcrumbsPrefix: ["response"],
1156
+ }), _response.rawResponse);
1157
+ case 413:
1158
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1159
+ unrecognizedObjectKeys: "passthrough",
1160
+ allowUnrecognizedUnionMembers: true,
1161
+ allowUnrecognizedEnumValues: true,
1162
+ breadcrumbsPrefix: ["response"],
1163
+ }), _response.rawResponse);
1164
+ case 429:
1165
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1166
+ unrecognizedObjectKeys: "passthrough",
1167
+ allowUnrecognizedUnionMembers: true,
1168
+ allowUnrecognizedEnumValues: true,
1169
+ breadcrumbsPrefix: ["response"],
1170
+ }), _response.rawResponse);
1171
+ case 500:
1172
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1173
+ unrecognizedObjectKeys: "passthrough",
1174
+ allowUnrecognizedUnionMembers: true,
1175
+ allowUnrecognizedEnumValues: true,
1176
+ breadcrumbsPrefix: ["response"],
1177
+ }), _response.rawResponse);
1178
+ default:
1179
+ throw new errors.MavenAGIError({
1180
+ statusCode: _response.error.statusCode,
1181
+ body: _response.error.body,
1182
+ rawResponse: _response.rawResponse,
1183
+ });
1184
+ }
1185
+ }
1186
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/agent-variants/{variantReferenceId}/working-set/entity");
1187
+ });
1188
+ }
1189
+ /**
1190
+ * Get the edit staged for one versioned agent setting in an agent variant's working set, the `getEntityEdit` counterpart for settings. A 404 means nothing is staged for it.
1191
+ *
1192
+ * <Note>**Required permission:** `read:agents`</Note>
1193
+ *
1194
+ * @param {string} variantReferenceId - The referenceId of the agent variant.
1195
+ * @param {MavenAGI.GetSettingEditRequest} request
1196
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
1197
+ *
1198
+ * @throws {@link MavenAGI.NotFoundError}
1199
+ * @throws {@link MavenAGI.BadRequestError}
1200
+ * @throws {@link MavenAGI.PayloadTooLargeError}
1201
+ * @throws {@link MavenAGI.TooManyRequestsError}
1202
+ * @throws {@link MavenAGI.ServerError}
1203
+ * @throws {@link errors.MavenAGIError}
1204
+ * @throws {@link errors.MavenAGITimeoutError}
1205
+ *
1206
+ * @example
1207
+ * await client.agentVariants.getSettingEdit("variantReferenceId", {
1208
+ * setting: "SYSTEM_FALLBACK_MESSAGE"
1209
+ * })
1210
+ */
1211
+ getSettingEdit(variantReferenceId, request, requestOptions) {
1212
+ return core.HttpResponsePromise.fromPromise(this.__getSettingEdit(variantReferenceId, request, requestOptions));
1213
+ }
1214
+ __getSettingEdit(variantReferenceId, request, requestOptions) {
1215
+ return __awaiter(this, void 0, void 0, function* () {
1216
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1217
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1218
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
1219
+ "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,
1220
+ "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,
1221
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1222
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
1223
+ 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/agent-variants/${core.url.encodePathParam(variantReferenceId, errors.MavenAGIError)}/working-set/setting`),
1224
+ method: "POST",
1225
+ headers: _headers,
1226
+ contentType: "application/json",
1227
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
1228
+ requestType: "json",
1229
+ body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.GetSettingEditRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
1230
+ 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,
1231
+ 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,
1232
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1233
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
1234
+ logging: this._options.logging,
1235
+ });
1236
+ if (_response.ok) {
1237
+ return {
1238
+ data: serializers.AgentSettingEdits.parseOrThrow(_response.body, {
1239
+ unrecognizedObjectKeys: "passthrough",
1240
+ allowUnrecognizedUnionMembers: true,
1241
+ allowUnrecognizedEnumValues: true,
1242
+ breadcrumbsPrefix: ["response"],
1243
+ }),
1244
+ rawResponse: _response.rawResponse,
1245
+ };
1246
+ }
1247
+ if (_response.error.reason === "status-code") {
1248
+ switch (_response.error.statusCode) {
1249
+ case 404:
1250
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1251
+ unrecognizedObjectKeys: "passthrough",
1252
+ allowUnrecognizedUnionMembers: true,
1253
+ allowUnrecognizedEnumValues: true,
1254
+ breadcrumbsPrefix: ["response"],
1255
+ }), _response.rawResponse);
1256
+ case 400:
1257
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1258
+ unrecognizedObjectKeys: "passthrough",
1259
+ allowUnrecognizedUnionMembers: true,
1260
+ allowUnrecognizedEnumValues: true,
1261
+ breadcrumbsPrefix: ["response"],
1262
+ }), _response.rawResponse);
1263
+ case 413:
1264
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1265
+ unrecognizedObjectKeys: "passthrough",
1266
+ allowUnrecognizedUnionMembers: true,
1267
+ allowUnrecognizedEnumValues: true,
1268
+ breadcrumbsPrefix: ["response"],
1269
+ }), _response.rawResponse);
1270
+ case 429:
1271
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1272
+ unrecognizedObjectKeys: "passthrough",
1273
+ allowUnrecognizedUnionMembers: true,
1274
+ allowUnrecognizedEnumValues: true,
1275
+ breadcrumbsPrefix: ["response"],
1276
+ }), _response.rawResponse);
1277
+ case 500:
1278
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1279
+ unrecognizedObjectKeys: "passthrough",
1280
+ allowUnrecognizedUnionMembers: true,
1281
+ allowUnrecognizedEnumValues: true,
1282
+ breadcrumbsPrefix: ["response"],
1283
+ }), _response.rawResponse);
1284
+ default:
1285
+ throw new errors.MavenAGIError({
1286
+ statusCode: _response.error.statusCode,
1287
+ body: _response.error.body,
1288
+ rawResponse: _response.rawResponse,
1289
+ });
1290
+ }
1291
+ }
1292
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/agent-variants/{variantReferenceId}/working-set/setting");
1293
+ });
1294
+ }
1295
+ /**
1296
+ * Shows what committing an agent variant's working set would change. For each intelligent field that would change, returns one `IntelligentFieldDiff`, and for each charter one `CharterDiff`: `before` is it as the variant's snapshot has it, and `after` is it once the staged edits are applied. Each list is ordered as `compare` orders it. `agentSettings` holds the versioned agent settings the same way, and is absent when the working set changes none.
1297
+ *
1298
+ * A field or charter the working set deletes is `deleted`. One created and deleted within the same working set doesn't appear.
1299
+ *
1300
+ * To read one entity's staged edit, use `getEntityEdit`, or `getSettingEdit` for a versioned agent setting.
1301
+ *
1302
+ * <Note>**Required permission:** `read:agents`</Note>
1303
+ *
1304
+ * @param {string} variantReferenceId - The referenceId of the agent variant whose working set to diff.
1305
+ * @param {MavenAGI.WorkingSetDiffRequest} request
1306
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
1307
+ *
1308
+ * @throws {@link MavenAGI.NotFoundError}
1309
+ * @throws {@link MavenAGI.BadRequestError}
1310
+ * @throws {@link MavenAGI.PayloadTooLargeError}
1311
+ * @throws {@link MavenAGI.TooManyRequestsError}
1312
+ * @throws {@link MavenAGI.ServerError}
1313
+ * @throws {@link errors.MavenAGIError}
1314
+ * @throws {@link errors.MavenAGITimeoutError}
1315
+ *
1316
+ * @example
1317
+ * await client.agentVariants.diffWorkingSet("variantReferenceId")
1318
+ */
1319
+ diffWorkingSet(variantReferenceId, request = {}, requestOptions) {
1320
+ return core.HttpResponsePromise.fromPromise(this.__diffWorkingSet(variantReferenceId, request, requestOptions));
1321
+ }
1322
+ __diffWorkingSet(variantReferenceId_1) {
1323
+ return __awaiter(this, arguments, void 0, function* (variantReferenceId, request = {}, requestOptions) {
1324
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1325
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1326
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
1327
+ "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,
1328
+ "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,
1329
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1330
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
1331
+ 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/agent-variants/${core.url.encodePathParam(variantReferenceId, errors.MavenAGIError)}/working-set/diff`),
1332
+ method: "POST",
1333
+ headers: _headers,
1334
+ contentType: "application/json",
1335
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
1336
+ requestType: "json",
1337
+ body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.WorkingSetDiffRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
1338
+ 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,
1339
+ 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,
1340
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1341
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
1342
+ logging: this._options.logging,
1343
+ });
1344
+ if (_response.ok) {
1345
+ return {
1346
+ data: serializers.WorkingSetDiffResponse.parseOrThrow(_response.body, {
1347
+ unrecognizedObjectKeys: "passthrough",
1348
+ allowUnrecognizedUnionMembers: true,
1349
+ allowUnrecognizedEnumValues: true,
1350
+ breadcrumbsPrefix: ["response"],
1351
+ }),
1352
+ rawResponse: _response.rawResponse,
1353
+ };
1354
+ }
1355
+ if (_response.error.reason === "status-code") {
1356
+ switch (_response.error.statusCode) {
1357
+ case 404:
1358
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1359
+ unrecognizedObjectKeys: "passthrough",
1360
+ allowUnrecognizedUnionMembers: true,
1361
+ allowUnrecognizedEnumValues: true,
1362
+ breadcrumbsPrefix: ["response"],
1363
+ }), _response.rawResponse);
1364
+ case 400:
1365
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1366
+ unrecognizedObjectKeys: "passthrough",
1367
+ allowUnrecognizedUnionMembers: true,
1368
+ allowUnrecognizedEnumValues: true,
1369
+ breadcrumbsPrefix: ["response"],
1370
+ }), _response.rawResponse);
1371
+ case 413:
1372
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1373
+ unrecognizedObjectKeys: "passthrough",
1374
+ allowUnrecognizedUnionMembers: true,
1375
+ allowUnrecognizedEnumValues: true,
1376
+ breadcrumbsPrefix: ["response"],
1377
+ }), _response.rawResponse);
1378
+ case 429:
1379
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1380
+ unrecognizedObjectKeys: "passthrough",
1381
+ allowUnrecognizedUnionMembers: true,
1382
+ allowUnrecognizedEnumValues: true,
1383
+ breadcrumbsPrefix: ["response"],
1384
+ }), _response.rawResponse);
1385
+ case 500:
1386
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1387
+ unrecognizedObjectKeys: "passthrough",
1388
+ allowUnrecognizedUnionMembers: true,
1389
+ allowUnrecognizedEnumValues: true,
1390
+ breadcrumbsPrefix: ["response"],
1391
+ }), _response.rawResponse);
1392
+ default:
1393
+ throw new errors.MavenAGIError({
1394
+ statusCode: _response.error.statusCode,
1395
+ body: _response.error.body,
1396
+ rawResponse: _response.rawResponse,
1397
+ });
1398
+ }
1399
+ }
1400
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/agent-variants/{variantReferenceId}/working-set/diff");
1401
+ });
1402
+ }
1403
+ /**
1404
+ * Discards every edit staged in an agent variant's working set, returning the variant to its
1405
+ * committed configuration. Unrecoverable: the discarded edits are gone.
1406
+ *
1407
+ * Succeeds with the variant unchanged when the working set is already empty. Published
1408
+ * versions of the affected entities are untouched -- only the staged edits are removed.
1409
+ *
1410
+ * Pass `expectedWorkingSetRevision` to discard only what you last read: if an edit was staged
1411
+ * since, the request fails with reason `STALE_WORKING_SET` and nothing is discarded. An
1412
+ * empty working set succeeds whatever revision is passed, so resending a discard is safe.
1413
+ *
1414
+ * <Note>**Required permission:** `edit:agents`</Note>
1415
+ *
1416
+ * @param {string} variantReferenceId - The referenceId of the agent variant whose working set should be discarded.
1417
+ * @param {MavenAGI.DiscardWorkingSetEditsRequest} request
1418
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
1419
+ *
1420
+ * @throws {@link MavenAGI.NotFoundError}
1421
+ * @throws {@link MavenAGI.BadRequestError}
1422
+ * @throws {@link MavenAGI.PayloadTooLargeError}
1423
+ * @throws {@link MavenAGI.TooManyRequestsError}
1424
+ * @throws {@link MavenAGI.ServerError}
1425
+ * @throws {@link errors.MavenAGIError}
1426
+ * @throws {@link errors.MavenAGITimeoutError}
1427
+ *
1428
+ * @example
1429
+ * await client.agentVariants.discardEdits("variantReferenceId_123")
1430
+ */
1431
+ discardEdits(variantReferenceId, request = {}, requestOptions) {
1432
+ return core.HttpResponsePromise.fromPromise(this.__discardEdits(variantReferenceId, request, requestOptions));
1433
+ }
1434
+ __discardEdits(variantReferenceId_1) {
1435
+ return __awaiter(this, arguments, void 0, function* (variantReferenceId, request = {}, requestOptions) {
1436
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1437
+ const { appId, expectedWorkingSetRevision } = request;
1438
+ const _queryParams = {
1439
+ appId,
1440
+ expectedWorkingSetRevision,
1441
+ };
1442
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1443
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
1444
+ "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,
1445
+ "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,
1446
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1447
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
1448
+ 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/agent-variants/${core.url.encodePathParam(variantReferenceId, errors.MavenAGIError)}/working-set`),
1449
+ method: "DELETE",
1450
+ headers: _headers,
1451
+ queryString: core.url
1452
+ .queryBuilder()
1453
+ .addMany(_queryParams)
1454
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
1455
+ .build(),
1456
+ 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,
1457
+ 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,
1458
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1459
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
1460
+ logging: this._options.logging,
1461
+ });
1462
+ if (_response.ok) {
1463
+ return {
1464
+ data: serializers.AgentVariantResponse.parseOrThrow(_response.body, {
1465
+ unrecognizedObjectKeys: "passthrough",
1466
+ allowUnrecognizedUnionMembers: true,
1467
+ allowUnrecognizedEnumValues: true,
1468
+ breadcrumbsPrefix: ["response"],
1469
+ }),
1470
+ rawResponse: _response.rawResponse,
1471
+ };
1472
+ }
1473
+ if (_response.error.reason === "status-code") {
1474
+ switch (_response.error.statusCode) {
1475
+ case 404:
1476
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1477
+ unrecognizedObjectKeys: "passthrough",
1478
+ allowUnrecognizedUnionMembers: true,
1479
+ allowUnrecognizedEnumValues: true,
1480
+ breadcrumbsPrefix: ["response"],
1481
+ }), _response.rawResponse);
1482
+ case 400:
1483
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1484
+ unrecognizedObjectKeys: "passthrough",
1485
+ allowUnrecognizedUnionMembers: true,
1486
+ allowUnrecognizedEnumValues: true,
1487
+ breadcrumbsPrefix: ["response"],
1488
+ }), _response.rawResponse);
1489
+ case 413:
1490
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1491
+ unrecognizedObjectKeys: "passthrough",
1492
+ allowUnrecognizedUnionMembers: true,
1493
+ allowUnrecognizedEnumValues: true,
1494
+ breadcrumbsPrefix: ["response"],
1495
+ }), _response.rawResponse);
1496
+ case 429:
1497
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1498
+ unrecognizedObjectKeys: "passthrough",
1499
+ allowUnrecognizedUnionMembers: true,
1500
+ allowUnrecognizedEnumValues: true,
1501
+ breadcrumbsPrefix: ["response"],
1502
+ }), _response.rawResponse);
1503
+ case 500:
1504
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1505
+ unrecognizedObjectKeys: "passthrough",
1506
+ allowUnrecognizedUnionMembers: true,
1507
+ allowUnrecognizedEnumValues: true,
1508
+ breadcrumbsPrefix: ["response"],
1509
+ }), _response.rawResponse);
1510
+ default:
1511
+ throw new errors.MavenAGIError({
1512
+ statusCode: _response.error.statusCode,
1513
+ body: _response.error.body,
1514
+ rawResponse: _response.rawResponse,
1515
+ });
1516
+ }
1517
+ }
1518
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v1/agent-variants/{variantReferenceId}/working-set");
1519
+ });
1520
+ }
1521
+ /**
1522
+ * Delete an agent variant, and every variant forked from it. A deleted variant is marked DELETED, not erased: `createOrUpdate` with the same ID resurrects it with its configuration. Rejected while the variant has live traffic (reason `CANNOT_ARCHIVE_LIVE_VARIANT`) or while any variant forked from it is ACTIVE.
1523
+ *
1524
+ * <Note>**Required permission:** `edit:agents`</Note>
1525
+ *
1526
+ * @param {string} variantReferenceId - The referenceId of the agent variant to delete.
1527
+ * @param {MavenAGI.AgentVariantDeleteRequest} request
1528
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
1529
+ *
1530
+ * @throws {@link MavenAGI.NotFoundError}
1531
+ * @throws {@link MavenAGI.BadRequestError}
1532
+ * @throws {@link MavenAGI.PayloadTooLargeError}
1533
+ * @throws {@link MavenAGI.TooManyRequestsError}
1534
+ * @throws {@link MavenAGI.ServerError}
1535
+ * @throws {@link errors.MavenAGIError}
1536
+ * @throws {@link errors.MavenAGITimeoutError}
1537
+ *
1538
+ * @example
1539
+ * await client.agentVariants.delete("variantReferenceId_123")
1540
+ */
1541
+ delete(variantReferenceId, request = {}, requestOptions) {
1542
+ return core.HttpResponsePromise.fromPromise(this.__delete(variantReferenceId, request, requestOptions));
1543
+ }
1544
+ __delete(variantReferenceId_1) {
1545
+ return __awaiter(this, arguments, void 0, function* (variantReferenceId, request = {}, requestOptions) {
1546
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1547
+ const { appId } = request;
1548
+ const _queryParams = {
1549
+ appId,
1550
+ };
1551
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1552
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
1553
+ "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,
1554
+ "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,
1555
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1556
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
1557
+ 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/agent-variants/${core.url.encodePathParam(variantReferenceId, errors.MavenAGIError)}`),
1558
+ method: "DELETE",
1559
+ headers: _headers,
1560
+ queryString: core.url
1561
+ .queryBuilder()
1562
+ .addMany(_queryParams)
1563
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
1564
+ .build(),
1565
+ 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,
1566
+ 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,
1567
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1568
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
1569
+ logging: this._options.logging,
1570
+ });
1571
+ if (_response.ok) {
1572
+ return {
1573
+ data: serializers.AgentVariantResponse.parseOrThrow(_response.body, {
1574
+ unrecognizedObjectKeys: "passthrough",
1575
+ allowUnrecognizedUnionMembers: true,
1576
+ allowUnrecognizedEnumValues: true,
1577
+ breadcrumbsPrefix: ["response"],
1578
+ }),
1579
+ rawResponse: _response.rawResponse,
1580
+ };
1581
+ }
1582
+ if (_response.error.reason === "status-code") {
1583
+ switch (_response.error.statusCode) {
1584
+ case 404:
1585
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1586
+ unrecognizedObjectKeys: "passthrough",
1587
+ allowUnrecognizedUnionMembers: true,
1588
+ allowUnrecognizedEnumValues: true,
1589
+ breadcrumbsPrefix: ["response"],
1590
+ }), _response.rawResponse);
1591
+ case 400:
1592
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1593
+ unrecognizedObjectKeys: "passthrough",
1594
+ allowUnrecognizedUnionMembers: true,
1595
+ allowUnrecognizedEnumValues: true,
1596
+ breadcrumbsPrefix: ["response"],
1597
+ }), _response.rawResponse);
1598
+ case 413:
1599
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1600
+ unrecognizedObjectKeys: "passthrough",
1601
+ allowUnrecognizedUnionMembers: true,
1602
+ allowUnrecognizedEnumValues: true,
1603
+ breadcrumbsPrefix: ["response"],
1604
+ }), _response.rawResponse);
1605
+ case 429:
1606
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1607
+ unrecognizedObjectKeys: "passthrough",
1608
+ allowUnrecognizedUnionMembers: true,
1609
+ allowUnrecognizedEnumValues: true,
1610
+ breadcrumbsPrefix: ["response"],
1611
+ }), _response.rawResponse);
1612
+ case 500:
1613
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1614
+ unrecognizedObjectKeys: "passthrough",
1615
+ allowUnrecognizedUnionMembers: true,
1616
+ allowUnrecognizedEnumValues: true,
1617
+ breadcrumbsPrefix: ["response"],
1618
+ }), _response.rawResponse);
1619
+ default:
1620
+ throw new errors.MavenAGIError({
1621
+ statusCode: _response.error.statusCode,
1622
+ body: _response.error.body,
1623
+ rawResponse: _response.rawResponse,
1624
+ });
1625
+ }
1626
+ }
1627
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v1/agent-variants/{variantReferenceId}");
1628
+ });
1629
+ }
1630
+ /**
1631
+ * Commits the source variant's staged edits: creates a new agent variant, named by `newVariantId`, whose configuration is the source's plus the edits staged in its working set. The source keeps its own configuration. The response describes the new variant.
1632
+ *
1633
+ * The new variant's base is the source's base, even if that base has since been archived, so it takes the source's place next to the same variants. Its `committedFromVariantId` names the source. It's created in the calling app. By default the source's working set is cleared; pass `clearWorkingSet: false` to keep it.
1634
+ *
1635
+ * Pass `archiveSource: true` to replace the source: the source is archived in the same transaction that creates the new variant, so either both happen or neither does. The source then no longer counts toward the agent's limit of ACTIVE variants, so a replace succeeds at the limit.
1636
+ *
1637
+ * Mint a new `newVariantId` for each commit. A request naming a variant that already exists, deleted ones included, is rejected, so a resend after a lost response fails with `VARIANT_ALREADY_EXISTS`: read the variant by `newVariantId` to see what the first attempt committed.
1638
+ *
1639
+ * Rejections:
1640
+ * - `VARIANT_NOT_ACTIVE`: the source is archived or deleted.
1641
+ * - `STALE_WORKING_SET`: `expectedWorkingSetRevision` isn't the source's current `workingSetRevision`. Re-read the working set and retry.
1642
+ * - `WORKING_SET_HAS_UNVERSIONED_EDITS`: the working set holds edits of an entity type or agent setting that isn't versioned for the agent now. This can only happen after Maven turns versioning off for the agent; contact Maven support.
1643
+ * - `NOTHING_TO_COMMIT`: the staged edits don't change the source's configuration.
1644
+ * - `VARIANT_ALREADY_EXISTS`: a variant named `newVariantId` already exists.
1645
+ * - `CANNOT_ARCHIVE_LIVE_VARIANT`: `archiveSource` is true and the source has live traffic, so it can't be archived. Move its traffic elsewhere, or commit without `archiveSource`.
1646
+ * - `VARIANT_LIMIT_REACHED`: the agent is at its limit of ACTIVE variants (25 by default; the error message gives the agent's limit), and the new variant would exceed it. A commit with `archiveSource: true` doesn't add one, so it isn't refused at the limit. Otherwise, archive or delete a variant, then retry.
1647
+ *
1648
+ * `archiveSource: true` can't be combined with `clearWorkingSet: false` (a 400 with no reason), since the kept edits would be left on an archived variant.
1649
+ *
1650
+ * Shown in Agent Designer as "Publish".
1651
+ *
1652
+ * <Note>**Required permission:** `edit:agents`</Note>
1653
+ *
1654
+ * @param {string} variantReferenceId - The referenceId of the agent variant whose staged edits to commit.
1655
+ * @param {MavenAGI.AgentVariantCommitRequest} request
1656
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
1657
+ *
1658
+ * @throws {@link MavenAGI.NotFoundError}
1659
+ * @throws {@link MavenAGI.BadRequestError}
1660
+ * @throws {@link MavenAGI.PayloadTooLargeError}
1661
+ * @throws {@link MavenAGI.TooManyRequestsError}
1662
+ * @throws {@link MavenAGI.ServerError}
1663
+ * @throws {@link errors.MavenAGIError}
1664
+ * @throws {@link errors.MavenAGITimeoutError}
1665
+ *
1666
+ * @example
1667
+ * await client.agentVariants.commit("variantReferenceId", {
1668
+ * newVariantId: {
1669
+ * referenceId: "x"
1670
+ * },
1671
+ * expectedWorkingSetRevision: 1000000,
1672
+ * title: "title"
1673
+ * })
1674
+ */
1675
+ commit(variantReferenceId, request, requestOptions) {
1676
+ return core.HttpResponsePromise.fromPromise(this.__commit(variantReferenceId, request, requestOptions));
1677
+ }
1678
+ __commit(variantReferenceId, request, requestOptions) {
1679
+ return __awaiter(this, void 0, void 0, function* () {
1680
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1681
+ const { appId } = request, _body = __rest(request, ["appId"]);
1682
+ const _queryParams = {
1683
+ appId,
1684
+ };
1685
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1686
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
1687
+ "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,
1688
+ "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,
1689
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1690
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
1691
+ 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/agent-variants/commit/${core.url.encodePathParam(variantReferenceId, errors.MavenAGIError)}`),
1692
+ method: "POST",
1693
+ headers: _headers,
1694
+ contentType: "application/json",
1695
+ queryString: core.url
1696
+ .queryBuilder()
1697
+ .addMany(_queryParams)
1698
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
1699
+ .build(),
1700
+ requestType: "json",
1701
+ body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.AgentVariantCommitRequest.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
1702
+ 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,
1703
+ 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,
1704
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1705
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
1706
+ logging: this._options.logging,
1707
+ });
1708
+ if (_response.ok) {
1709
+ return {
1710
+ data: serializers.AgentVariantResponse.parseOrThrow(_response.body, {
1711
+ unrecognizedObjectKeys: "passthrough",
1712
+ allowUnrecognizedUnionMembers: true,
1713
+ allowUnrecognizedEnumValues: true,
1714
+ breadcrumbsPrefix: ["response"],
1715
+ }),
1716
+ rawResponse: _response.rawResponse,
1717
+ };
1718
+ }
1719
+ if (_response.error.reason === "status-code") {
1720
+ switch (_response.error.statusCode) {
1721
+ case 404:
1722
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1723
+ unrecognizedObjectKeys: "passthrough",
1724
+ allowUnrecognizedUnionMembers: true,
1725
+ allowUnrecognizedEnumValues: true,
1726
+ breadcrumbsPrefix: ["response"],
1727
+ }), _response.rawResponse);
1728
+ case 400:
1729
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1730
+ unrecognizedObjectKeys: "passthrough",
1731
+ allowUnrecognizedUnionMembers: true,
1732
+ allowUnrecognizedEnumValues: true,
1733
+ breadcrumbsPrefix: ["response"],
1734
+ }), _response.rawResponse);
1735
+ case 413:
1736
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1737
+ unrecognizedObjectKeys: "passthrough",
1738
+ allowUnrecognizedUnionMembers: true,
1739
+ allowUnrecognizedEnumValues: true,
1740
+ breadcrumbsPrefix: ["response"],
1741
+ }), _response.rawResponse);
1742
+ case 429:
1743
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1744
+ unrecognizedObjectKeys: "passthrough",
1745
+ allowUnrecognizedUnionMembers: true,
1746
+ allowUnrecognizedEnumValues: true,
1747
+ breadcrumbsPrefix: ["response"],
1748
+ }), _response.rawResponse);
1749
+ case 500:
1750
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1751
+ unrecognizedObjectKeys: "passthrough",
1752
+ allowUnrecognizedUnionMembers: true,
1753
+ allowUnrecognizedEnumValues: true,
1754
+ breadcrumbsPrefix: ["response"],
1755
+ }), _response.rawResponse);
1756
+ default:
1757
+ throw new errors.MavenAGIError({
1758
+ statusCode: _response.error.statusCode,
1759
+ body: _response.error.body,
1760
+ rawResponse: _response.rawResponse,
1761
+ });
1762
+ }
1763
+ }
1764
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/agent-variants/commit/{variantReferenceId}");
1765
+ });
1766
+ }
1767
+ /**
1768
+ * Compares the intelligent fields, charters and versioned agent settings in two variants' snapshots: what changed going from `fromVariantId`, the baseline, to `toVariantId`, as `git diff <from> <to>` reads. So comparing from a variant's `baseVariantId` to the variant shows what the variant changed. Staged edits aren't included; diff those with `diffWorkingSet`.
1769
+ *
1770
+ * Each field that differs is one `IntelligentFieldDiff`, and each charter one `CharterDiff`, oldest change first: `before` is it as `fromVariantId` has it and `after` as `toVariantId` has it. `agentSettings` holds every versioned agent setting on each side when any differs, and is absent when none does. A field or charter at a DELETED version counts as absent, so one deleted in `toVariantId` is `deleted`.
1771
+ *
1772
+ * `entityId` narrows the differences to one intelligent field or charter, and `setting` to one versioned agent setting; naming both is rejected with a 400.
1773
+ *
1774
+ * Either variant can be archived or deleted. Comparing a variant with itself returns no differences.
1775
+ *
1776
+ * <Note>**Required permission:** `read:agents`</Note>
1777
+ *
1778
+ * @param {MavenAGI.AgentVariantCompareRequest} request
1779
+ * @param {AgentVariantsClient.RequestOptions} requestOptions - Request-specific configuration.
1780
+ *
1781
+ * @throws {@link MavenAGI.NotFoundError}
1782
+ * @throws {@link MavenAGI.BadRequestError}
1783
+ * @throws {@link MavenAGI.PayloadTooLargeError}
1784
+ * @throws {@link MavenAGI.TooManyRequestsError}
1785
+ * @throws {@link MavenAGI.ServerError}
1786
+ * @throws {@link errors.MavenAGIError}
1787
+ * @throws {@link errors.MavenAGITimeoutError}
1788
+ *
1789
+ * @example
1790
+ * await client.agentVariants.compare({
1791
+ * fromVariantId: {
1792
+ * referenceId: "variant_123",
1793
+ * appId: "zendesk",
1794
+ * type: "AGENT_VARIANT"
1795
+ * },
1796
+ * toVariantId: {
1797
+ * referenceId: "variant_456",
1798
+ * appId: "zendesk",
1799
+ * type: "AGENT_VARIANT"
1800
+ * }
1801
+ * })
1802
+ */
1803
+ compare(request, requestOptions) {
1804
+ return core.HttpResponsePromise.fromPromise(this.__compare(request, requestOptions));
1805
+ }
1806
+ __compare(request, requestOptions) {
1807
+ return __awaiter(this, void 0, void 0, function* () {
1808
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
1809
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
1810
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
1811
+ "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,
1812
+ "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,
1813
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
1814
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
1815
+ 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/agent-variants/compare"),
1816
+ method: "POST",
1817
+ headers: _headers,
1818
+ contentType: "application/json",
1819
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
1820
+ requestType: "json",
1821
+ body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.AgentVariantCompareRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
1822
+ 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,
1823
+ 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,
1824
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1825
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
1826
+ logging: this._options.logging,
1827
+ });
1828
+ if (_response.ok) {
1829
+ return {
1830
+ data: serializers.AgentVariantCompareResponse.parseOrThrow(_response.body, {
1831
+ unrecognizedObjectKeys: "passthrough",
1832
+ allowUnrecognizedUnionMembers: true,
1833
+ allowUnrecognizedEnumValues: true,
1834
+ breadcrumbsPrefix: ["response"],
1835
+ }),
1836
+ rawResponse: _response.rawResponse,
1837
+ };
1838
+ }
1839
+ if (_response.error.reason === "status-code") {
1840
+ switch (_response.error.statusCode) {
1841
+ case 404:
1842
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1843
+ unrecognizedObjectKeys: "passthrough",
1844
+ allowUnrecognizedUnionMembers: true,
1845
+ allowUnrecognizedEnumValues: true,
1846
+ breadcrumbsPrefix: ["response"],
1847
+ }), _response.rawResponse);
1848
+ case 400:
1849
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1850
+ unrecognizedObjectKeys: "passthrough",
1851
+ allowUnrecognizedUnionMembers: true,
1852
+ allowUnrecognizedEnumValues: true,
1853
+ breadcrumbsPrefix: ["response"],
1854
+ }), _response.rawResponse);
1855
+ case 413:
1856
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1857
+ unrecognizedObjectKeys: "passthrough",
1858
+ allowUnrecognizedUnionMembers: true,
1859
+ allowUnrecognizedEnumValues: true,
1860
+ breadcrumbsPrefix: ["response"],
1861
+ }), _response.rawResponse);
1862
+ case 429:
1863
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1864
+ unrecognizedObjectKeys: "passthrough",
1865
+ allowUnrecognizedUnionMembers: true,
1866
+ allowUnrecognizedEnumValues: true,
1867
+ breadcrumbsPrefix: ["response"],
1868
+ }), _response.rawResponse);
1869
+ case 500:
1870
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
1871
+ unrecognizedObjectKeys: "passthrough",
1872
+ allowUnrecognizedUnionMembers: true,
1873
+ allowUnrecognizedEnumValues: true,
1874
+ breadcrumbsPrefix: ["response"],
1875
+ }), _response.rawResponse);
1876
+ default:
1877
+ throw new errors.MavenAGIError({
1878
+ statusCode: _response.error.statusCode,
1879
+ body: _response.error.body,
1880
+ rawResponse: _response.rawResponse,
1881
+ });
1882
+ }
1883
+ }
1884
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/agent-variants/compare");
1885
+ });
1886
+ }
1887
+ }
1888
+ exports.AgentVariantsClient = AgentVariantsClient;