@corti/sdk 0.1.1 → 0.1.2-agents

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 (489) hide show
  1. package/README.md +17 -0
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +11 -6
  4. package/dist/cjs/api/errors/NotFoundError.d.ts +1 -2
  5. package/dist/cjs/api/index.d.ts +4 -0
  6. package/dist/cjs/api/index.js +4 -0
  7. package/dist/cjs/api/resources/agents/client/Client.d.ts +195 -0
  8. package/dist/cjs/api/resources/agents/client/Client.js +874 -0
  9. package/dist/cjs/api/resources/agents/client/index.d.ts +2 -0
  10. package/dist/cjs/api/resources/agents/client/index.js +17 -0
  11. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateAgent.d.ts +20 -0
  12. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateAgent.js +5 -0
  13. package/dist/cjs/api/resources/agents/client/requests/AgentsGetContextRequest.d.ts +17 -0
  14. package/dist/cjs/api/resources/agents/client/requests/AgentsGetContextRequest.js +5 -0
  15. package/dist/cjs/api/resources/agents/client/requests/AgentsGetTaskRequest.d.ts +13 -0
  16. package/dist/cjs/api/resources/agents/client/requests/AgentsGetTaskRequest.js +5 -0
  17. package/dist/cjs/api/resources/agents/client/requests/AgentsListRequest.d.ts +17 -0
  18. package/dist/cjs/api/resources/agents/client/requests/AgentsListRequest.js +5 -0
  19. package/dist/cjs/api/resources/agents/client/requests/index.d.ts +4 -0
  20. package/dist/cjs/api/resources/agents/client/requests/index.js +2 -0
  21. package/dist/cjs/api/resources/agents/index.d.ts +2 -0
  22. package/dist/cjs/api/resources/agents/index.js +18 -0
  23. package/dist/cjs/api/resources/agents/types/AgentsCreateAgentExpertsItem.d.ts +13 -0
  24. package/dist/cjs/api/resources/agents/types/AgentsCreateAgentExpertsItem.js +5 -0
  25. package/dist/cjs/api/resources/agents/types/AgentsMessageSendResponse.d.ts +8 -0
  26. package/dist/cjs/api/resources/agents/types/AgentsMessageSendResponse.js +5 -0
  27. package/dist/cjs/api/resources/agents/types/AgentsMessageStreamResponse.d.ts +10 -0
  28. package/dist/cjs/api/resources/agents/types/AgentsMessageStreamResponse.js +5 -0
  29. package/dist/cjs/api/resources/agents/types/index.d.ts +3 -0
  30. package/dist/cjs/api/resources/agents/types/index.js +19 -0
  31. package/dist/cjs/api/resources/documents/client/Client.js +1 -7
  32. package/dist/cjs/api/resources/index.d.ts +3 -0
  33. package/dist/cjs/api/resources/index.js +4 -1
  34. package/dist/cjs/api/resources/recordings/client/Client.js +2 -14
  35. package/dist/cjs/api/types/AgentsAgent.d.ts +13 -0
  36. package/dist/cjs/api/types/AgentsAgent.js +5 -0
  37. package/dist/cjs/api/types/AgentsAgentCapabilities.d.ts +14 -0
  38. package/dist/cjs/api/types/AgentsAgentCapabilities.js +5 -0
  39. package/dist/cjs/api/types/AgentsAgentCard.d.ts +36 -0
  40. package/dist/cjs/api/types/AgentsAgentCard.js +5 -0
  41. package/dist/cjs/api/types/AgentsAgentCardPreferredTransport.d.ts +5 -0
  42. package/dist/cjs/api/types/AgentsAgentCardPreferredTransport.js +5 -0
  43. package/dist/cjs/api/types/AgentsAgentCardSignature.d.ts +11 -0
  44. package/dist/cjs/api/types/AgentsAgentCardSignature.js +5 -0
  45. package/dist/cjs/api/types/AgentsAgentExpertsItem.d.ts +13 -0
  46. package/dist/cjs/api/types/AgentsAgentExpertsItem.js +5 -0
  47. package/dist/cjs/api/types/AgentsAgentExtension.d.ts +13 -0
  48. package/dist/cjs/api/types/AgentsAgentExtension.js +5 -0
  49. package/dist/cjs/api/types/AgentsAgentInterface.d.ts +9 -0
  50. package/dist/cjs/api/types/AgentsAgentInterface.js +5 -0
  51. package/dist/cjs/api/types/AgentsAgentInterfaceTransport.d.ts +5 -0
  52. package/dist/cjs/api/types/AgentsAgentInterfaceTransport.js +5 -0
  53. package/dist/cjs/api/types/AgentsAgentReference.d.ts +13 -0
  54. package/dist/cjs/api/types/AgentsAgentReference.js +5 -0
  55. package/dist/cjs/api/types/AgentsAgentResponse.d.ts +5 -0
  56. package/dist/cjs/api/types/AgentsAgentResponse.js +5 -0
  57. package/dist/cjs/api/types/AgentsAgentSkill.d.ts +22 -0
  58. package/dist/cjs/api/types/AgentsAgentSkill.js +5 -0
  59. package/dist/cjs/api/types/AgentsArtifact.d.ts +18 -0
  60. package/dist/cjs/api/types/AgentsArtifact.js +5 -0
  61. package/dist/cjs/api/types/AgentsContext.d.ts +9 -0
  62. package/dist/cjs/api/types/AgentsContext.js +5 -0
  63. package/dist/cjs/api/types/AgentsContextItemsItem.d.ts +13 -0
  64. package/dist/cjs/api/types/AgentsContextItemsItem.js +5 -0
  65. package/dist/cjs/api/types/AgentsCreateExpert.d.ts +14 -0
  66. package/dist/cjs/api/types/AgentsCreateExpert.js +5 -0
  67. package/dist/cjs/api/types/AgentsCreateMcpServer.d.ts +20 -0
  68. package/dist/cjs/api/types/AgentsCreateMcpServer.js +5 -0
  69. package/dist/cjs/api/types/AgentsCreateMcpServerAuthorizationType.d.ts +12 -0
  70. package/dist/cjs/api/types/AgentsCreateMcpServerAuthorizationType.js +11 -0
  71. package/dist/cjs/api/types/AgentsCreateMcpServerTransportType.d.ts +12 -0
  72. package/dist/cjs/api/types/AgentsCreateMcpServerTransportType.js +11 -0
  73. package/dist/cjs/api/types/AgentsDataPart.d.ts +9 -0
  74. package/dist/cjs/api/types/AgentsDataPart.js +5 -0
  75. package/dist/cjs/api/types/AgentsExpert.d.ts +16 -0
  76. package/dist/cjs/api/types/AgentsExpert.js +5 -0
  77. package/dist/cjs/api/types/AgentsExpertReference.d.ts +12 -0
  78. package/dist/cjs/api/types/AgentsExpertReference.js +5 -0
  79. package/dist/cjs/api/types/AgentsFilePart.d.ts +9 -0
  80. package/dist/cjs/api/types/AgentsFilePart.js +5 -0
  81. package/dist/cjs/api/types/AgentsFilePartFile.d.ts +5 -0
  82. package/dist/cjs/api/types/AgentsFilePartFile.js +5 -0
  83. package/dist/cjs/api/types/AgentsFileWithBytes.d.ts +11 -0
  84. package/dist/cjs/api/types/AgentsFileWithBytes.js +5 -0
  85. package/dist/cjs/api/types/AgentsFileWithUri.d.ts +11 -0
  86. package/dist/cjs/api/types/AgentsFileWithUri.js +5 -0
  87. package/dist/cjs/api/types/AgentsMcpServer.d.ts +18 -0
  88. package/dist/cjs/api/types/AgentsMcpServer.js +5 -0
  89. package/dist/cjs/api/types/AgentsMcpServerAuthorizationType.d.ts +12 -0
  90. package/dist/cjs/api/types/AgentsMcpServerAuthorizationType.js +11 -0
  91. package/dist/cjs/api/types/AgentsMcpServerTransportType.d.ts +11 -0
  92. package/dist/cjs/api/types/AgentsMcpServerTransportType.js +10 -0
  93. package/dist/cjs/api/types/AgentsMessage.d.ts +22 -0
  94. package/dist/cjs/api/types/AgentsMessage.js +5 -0
  95. package/dist/cjs/api/types/AgentsMessageRole.d.ts +11 -0
  96. package/dist/cjs/api/types/AgentsMessageRole.js +10 -0
  97. package/dist/cjs/api/types/AgentsMessageSendConfiguration.d.ts +13 -0
  98. package/dist/cjs/api/types/AgentsMessageSendConfiguration.js +5 -0
  99. package/dist/cjs/api/types/AgentsMessageSendParams.d.ts +10 -0
  100. package/dist/cjs/api/types/AgentsMessageSendParams.js +5 -0
  101. package/dist/cjs/api/types/AgentsPart.d.ts +16 -0
  102. package/dist/cjs/api/types/AgentsPart.js +5 -0
  103. package/dist/cjs/api/types/AgentsPushNotificationAuthenticationInfo.d.ts +9 -0
  104. package/dist/cjs/api/types/AgentsPushNotificationAuthenticationInfo.js +5 -0
  105. package/dist/cjs/api/types/AgentsPushNotificationConfig.d.ts +13 -0
  106. package/dist/cjs/api/types/AgentsPushNotificationConfig.js +5 -0
  107. package/dist/cjs/api/types/AgentsTask.d.ts +17 -0
  108. package/dist/cjs/api/types/AgentsTask.js +5 -0
  109. package/dist/cjs/api/types/AgentsTaskArtifactUpdateEvent.d.ts +19 -0
  110. package/dist/cjs/api/types/AgentsTaskArtifactUpdateEvent.js +5 -0
  111. package/dist/cjs/api/types/AgentsTaskStatus.d.ts +12 -0
  112. package/dist/cjs/api/types/AgentsTaskStatus.js +5 -0
  113. package/dist/cjs/api/types/AgentsTaskStatusState.d.ts +18 -0
  114. package/dist/cjs/api/types/AgentsTaskStatusState.js +17 -0
  115. package/dist/cjs/api/types/AgentsTaskStatusUpdateEvent.d.ts +17 -0
  116. package/dist/cjs/api/types/AgentsTaskStatusUpdateEvent.js +5 -0
  117. package/dist/cjs/api/types/AgentsTextPart.d.ts +9 -0
  118. package/dist/cjs/api/types/AgentsTextPart.js +5 -0
  119. package/dist/cjs/api/types/AgentsTransportProtocol.d.ts +12 -0
  120. package/dist/cjs/api/types/AgentsTransportProtocol.js +11 -0
  121. package/dist/cjs/api/types/index.d.ts +43 -0
  122. package/dist/cjs/api/types/index.js +43 -0
  123. package/dist/cjs/core/index.d.ts +1 -0
  124. package/dist/cjs/core/index.js +1 -0
  125. package/dist/cjs/core/stream/Stream.d.ts +46 -0
  126. package/dist/cjs/core/stream/Stream.js +169 -0
  127. package/dist/cjs/core/stream/index.d.ts +1 -0
  128. package/dist/cjs/core/stream/index.js +5 -0
  129. package/dist/cjs/custom/CortiClient.d.ts +3 -0
  130. package/dist/cjs/custom/CortiClient.js +9 -4
  131. package/dist/cjs/custom/RefreshBearerProvider.d.ts +10 -5
  132. package/dist/cjs/custom/RefreshBearerProvider.js +1 -1
  133. package/dist/cjs/custom/index.d.ts +1 -0
  134. package/dist/cjs/custom/index.js +17 -0
  135. package/dist/cjs/serialization/resources/agents/client/index.d.ts +2 -0
  136. package/dist/cjs/serialization/resources/agents/client/index.js +41 -0
  137. package/dist/cjs/serialization/resources/agents/client/list.d.ts +11 -0
  138. package/dist/cjs/serialization/resources/agents/client/list.js +42 -0
  139. package/dist/cjs/serialization/resources/agents/client/requests/AgentsCreateAgent.d.ts +16 -0
  140. package/dist/cjs/serialization/resources/agents/client/requests/AgentsCreateAgent.js +47 -0
  141. package/dist/cjs/serialization/resources/agents/client/requests/index.d.ts +1 -0
  142. package/dist/cjs/serialization/resources/agents/client/requests/index.js +5 -0
  143. package/dist/cjs/serialization/resources/agents/index.d.ts +2 -0
  144. package/dist/cjs/serialization/resources/agents/index.js +18 -0
  145. package/dist/cjs/serialization/resources/agents/types/AgentsCreateAgentExpertsItem.d.ts +18 -0
  146. package/dist/cjs/serialization/resources/agents/types/AgentsCreateAgentExpertsItem.js +51 -0
  147. package/dist/cjs/serialization/resources/agents/types/AgentsMessageSendResponse.d.ts +15 -0
  148. package/dist/cjs/serialization/resources/agents/types/AgentsMessageSendResponse.js +46 -0
  149. package/dist/cjs/serialization/resources/agents/types/AgentsMessageStreamResponse.d.ts +19 -0
  150. package/dist/cjs/serialization/resources/agents/types/AgentsMessageStreamResponse.js +50 -0
  151. package/dist/cjs/serialization/resources/agents/types/index.d.ts +3 -0
  152. package/dist/cjs/serialization/resources/agents/types/index.js +19 -0
  153. package/dist/cjs/serialization/resources/index.d.ts +3 -0
  154. package/dist/cjs/serialization/resources/index.js +4 -1
  155. package/dist/cjs/serialization/types/AgentsAgent.d.ts +16 -0
  156. package/dist/cjs/serialization/types/AgentsAgent.js +47 -0
  157. package/dist/cjs/serialization/types/AgentsAgentCapabilities.d.ts +16 -0
  158. package/dist/cjs/serialization/types/AgentsAgentCapabilities.js +47 -0
  159. package/dist/cjs/serialization/types/AgentsAgentCard.d.ts +32 -0
  160. package/dist/cjs/serialization/types/AgentsAgentCard.js +65 -0
  161. package/dist/cjs/serialization/types/AgentsAgentCardPreferredTransport.d.ts +11 -0
  162. package/dist/cjs/serialization/types/AgentsAgentCardPreferredTransport.js +42 -0
  163. package/dist/cjs/serialization/types/AgentsAgentCardSignature.d.ts +14 -0
  164. package/dist/cjs/serialization/types/AgentsAgentCardSignature.js +45 -0
  165. package/dist/cjs/serialization/types/AgentsAgentExpertsItem.d.ts +18 -0
  166. package/dist/cjs/serialization/types/AgentsAgentExpertsItem.js +51 -0
  167. package/dist/cjs/serialization/types/AgentsAgentExtension.d.ts +15 -0
  168. package/dist/cjs/serialization/types/AgentsAgentExtension.js +46 -0
  169. package/dist/cjs/serialization/types/AgentsAgentInterface.d.ts +14 -0
  170. package/dist/cjs/serialization/types/AgentsAgentInterface.js +45 -0
  171. package/dist/cjs/serialization/types/AgentsAgentInterfaceTransport.d.ts +11 -0
  172. package/dist/cjs/serialization/types/AgentsAgentInterfaceTransport.js +42 -0
  173. package/dist/cjs/serialization/types/AgentsAgentReference.d.ts +14 -0
  174. package/dist/cjs/serialization/types/AgentsAgentReference.js +45 -0
  175. package/dist/cjs/serialization/types/AgentsAgentResponse.d.ts +12 -0
  176. package/dist/cjs/serialization/types/AgentsAgentResponse.js +43 -0
  177. package/dist/cjs/serialization/types/AgentsAgentSkill.d.ts +20 -0
  178. package/dist/cjs/serialization/types/AgentsAgentSkill.js +51 -0
  179. package/dist/cjs/serialization/types/AgentsArtifact.d.ts +18 -0
  180. package/dist/cjs/serialization/types/AgentsArtifact.js +49 -0
  181. package/dist/cjs/serialization/types/AgentsContext.d.ts +14 -0
  182. package/dist/cjs/serialization/types/AgentsContext.js +45 -0
  183. package/dist/cjs/serialization/types/AgentsContextItemsItem.d.ts +18 -0
  184. package/dist/cjs/serialization/types/AgentsContextItemsItem.js +51 -0
  185. package/dist/cjs/serialization/types/AgentsCreateExpert.d.ts +16 -0
  186. package/dist/cjs/serialization/types/AgentsCreateExpert.js +47 -0
  187. package/dist/cjs/serialization/types/AgentsCreateMcpServer.d.ts +20 -0
  188. package/dist/cjs/serialization/types/AgentsCreateMcpServer.js +51 -0
  189. package/dist/cjs/serialization/types/AgentsCreateMcpServerAuthorizationType.d.ts +10 -0
  190. package/dist/cjs/serialization/types/AgentsCreateMcpServerAuthorizationType.js +41 -0
  191. package/dist/cjs/serialization/types/AgentsCreateMcpServerTransportType.d.ts +10 -0
  192. package/dist/cjs/serialization/types/AgentsCreateMcpServerTransportType.js +41 -0
  193. package/dist/cjs/serialization/types/AgentsDataPart.d.ts +13 -0
  194. package/dist/cjs/serialization/types/AgentsDataPart.js +44 -0
  195. package/dist/cjs/serialization/types/AgentsExpert.d.ts +17 -0
  196. package/dist/cjs/serialization/types/AgentsExpert.js +48 -0
  197. package/dist/cjs/serialization/types/AgentsExpertReference.d.ts +13 -0
  198. package/dist/cjs/serialization/types/AgentsExpertReference.js +44 -0
  199. package/dist/cjs/serialization/types/AgentsFilePart.d.ts +14 -0
  200. package/dist/cjs/serialization/types/AgentsFilePart.js +45 -0
  201. package/dist/cjs/serialization/types/AgentsFilePartFile.d.ts +12 -0
  202. package/dist/cjs/serialization/types/AgentsFilePartFile.js +43 -0
  203. package/dist/cjs/serialization/types/AgentsFileWithBytes.d.ts +14 -0
  204. package/dist/cjs/serialization/types/AgentsFileWithBytes.js +45 -0
  205. package/dist/cjs/serialization/types/AgentsFileWithUri.d.ts +14 -0
  206. package/dist/cjs/serialization/types/AgentsFileWithUri.js +45 -0
  207. package/dist/cjs/serialization/types/AgentsMcpServer.d.ts +19 -0
  208. package/dist/cjs/serialization/types/AgentsMcpServer.js +50 -0
  209. package/dist/cjs/serialization/types/AgentsMcpServerAuthorizationType.d.ts +10 -0
  210. package/dist/cjs/serialization/types/AgentsMcpServerAuthorizationType.js +41 -0
  211. package/dist/cjs/serialization/types/AgentsMcpServerTransportType.d.ts +10 -0
  212. package/dist/cjs/serialization/types/AgentsMcpServerTransportType.js +41 -0
  213. package/dist/cjs/serialization/types/AgentsMessage.d.ts +21 -0
  214. package/dist/cjs/serialization/types/AgentsMessage.js +52 -0
  215. package/dist/cjs/serialization/types/AgentsMessageRole.d.ts +10 -0
  216. package/dist/cjs/serialization/types/AgentsMessageRole.js +41 -0
  217. package/dist/cjs/serialization/types/AgentsMessageSendConfiguration.d.ts +16 -0
  218. package/dist/cjs/serialization/types/AgentsMessageSendConfiguration.js +47 -0
  219. package/dist/cjs/serialization/types/AgentsMessageSendParams.d.ts +16 -0
  220. package/dist/cjs/serialization/types/AgentsMessageSendParams.js +47 -0
  221. package/dist/cjs/serialization/types/AgentsPart.d.ts +22 -0
  222. package/dist/cjs/serialization/types/AgentsPart.js +53 -0
  223. package/dist/cjs/serialization/types/AgentsPushNotificationAuthenticationInfo.d.ts +13 -0
  224. package/dist/cjs/serialization/types/AgentsPushNotificationAuthenticationInfo.js +44 -0
  225. package/dist/cjs/serialization/types/AgentsPushNotificationConfig.d.ts +16 -0
  226. package/dist/cjs/serialization/types/AgentsPushNotificationConfig.js +47 -0
  227. package/dist/cjs/serialization/types/AgentsTask.d.ts +20 -0
  228. package/dist/cjs/serialization/types/AgentsTask.js +51 -0
  229. package/dist/cjs/serialization/types/AgentsTaskArtifactUpdateEvent.d.ts +19 -0
  230. package/dist/cjs/serialization/types/AgentsTaskArtifactUpdateEvent.js +50 -0
  231. package/dist/cjs/serialization/types/AgentsTaskStatus.d.ts +16 -0
  232. package/dist/cjs/serialization/types/AgentsTaskStatus.js +47 -0
  233. package/dist/cjs/serialization/types/AgentsTaskStatusState.d.ts +10 -0
  234. package/dist/cjs/serialization/types/AgentsTaskStatusState.js +51 -0
  235. package/dist/cjs/serialization/types/AgentsTaskStatusUpdateEvent.d.ts +18 -0
  236. package/dist/cjs/serialization/types/AgentsTaskStatusUpdateEvent.js +49 -0
  237. package/dist/cjs/serialization/types/AgentsTextPart.d.ts +13 -0
  238. package/dist/cjs/serialization/types/AgentsTextPart.js +44 -0
  239. package/dist/cjs/serialization/types/AgentsTransportProtocol.d.ts +10 -0
  240. package/dist/cjs/serialization/types/AgentsTransportProtocol.js +41 -0
  241. package/dist/cjs/serialization/types/index.d.ts +43 -0
  242. package/dist/cjs/serialization/types/index.js +43 -0
  243. package/dist/cjs/version.d.ts +1 -1
  244. package/dist/cjs/version.js +1 -1
  245. package/dist/esm/Client.d.mts +3 -0
  246. package/dist/esm/Client.mjs +7 -2
  247. package/dist/esm/api/errors/NotFoundError.d.mts +1 -2
  248. package/dist/esm/api/index.d.mts +4 -0
  249. package/dist/esm/api/index.mjs +4 -0
  250. package/dist/esm/api/resources/agents/client/Client.d.mts +195 -0
  251. package/dist/esm/api/resources/agents/client/Client.mjs +837 -0
  252. package/dist/esm/api/resources/agents/client/index.d.mts +2 -0
  253. package/dist/esm/api/resources/agents/client/index.mjs +1 -0
  254. package/dist/esm/api/resources/agents/client/requests/AgentsCreateAgent.d.mts +20 -0
  255. package/dist/esm/api/resources/agents/client/requests/AgentsCreateAgent.mjs +4 -0
  256. package/dist/esm/api/resources/agents/client/requests/AgentsGetContextRequest.d.mts +17 -0
  257. package/dist/esm/api/resources/agents/client/requests/AgentsGetContextRequest.mjs +4 -0
  258. package/dist/esm/api/resources/agents/client/requests/AgentsGetTaskRequest.d.mts +13 -0
  259. package/dist/esm/api/resources/agents/client/requests/AgentsGetTaskRequest.mjs +4 -0
  260. package/dist/esm/api/resources/agents/client/requests/AgentsListRequest.d.mts +17 -0
  261. package/dist/esm/api/resources/agents/client/requests/AgentsListRequest.mjs +4 -0
  262. package/dist/esm/api/resources/agents/client/requests/index.d.mts +4 -0
  263. package/dist/esm/api/resources/agents/client/requests/index.mjs +1 -0
  264. package/dist/esm/api/resources/agents/index.d.mts +2 -0
  265. package/dist/esm/api/resources/agents/index.mjs +2 -0
  266. package/dist/esm/api/resources/agents/types/AgentsCreateAgentExpertsItem.d.mts +13 -0
  267. package/dist/esm/api/resources/agents/types/AgentsCreateAgentExpertsItem.mjs +4 -0
  268. package/dist/esm/api/resources/agents/types/AgentsMessageSendResponse.d.mts +8 -0
  269. package/dist/esm/api/resources/agents/types/AgentsMessageSendResponse.mjs +4 -0
  270. package/dist/esm/api/resources/agents/types/AgentsMessageStreamResponse.d.mts +10 -0
  271. package/dist/esm/api/resources/agents/types/AgentsMessageStreamResponse.mjs +4 -0
  272. package/dist/esm/api/resources/agents/types/index.d.mts +3 -0
  273. package/dist/esm/api/resources/agents/types/index.mjs +3 -0
  274. package/dist/esm/api/resources/documents/client/Client.mjs +1 -7
  275. package/dist/esm/api/resources/index.d.mts +3 -0
  276. package/dist/esm/api/resources/index.mjs +3 -0
  277. package/dist/esm/api/resources/recordings/client/Client.mjs +2 -14
  278. package/dist/esm/api/types/AgentsAgent.d.mts +13 -0
  279. package/dist/esm/api/types/AgentsAgent.mjs +4 -0
  280. package/dist/esm/api/types/AgentsAgentCapabilities.d.mts +14 -0
  281. package/dist/esm/api/types/AgentsAgentCapabilities.mjs +4 -0
  282. package/dist/esm/api/types/AgentsAgentCard.d.mts +36 -0
  283. package/dist/esm/api/types/AgentsAgentCard.mjs +4 -0
  284. package/dist/esm/api/types/AgentsAgentCardPreferredTransport.d.mts +5 -0
  285. package/dist/esm/api/types/AgentsAgentCardPreferredTransport.mjs +4 -0
  286. package/dist/esm/api/types/AgentsAgentCardSignature.d.mts +11 -0
  287. package/dist/esm/api/types/AgentsAgentCardSignature.mjs +4 -0
  288. package/dist/esm/api/types/AgentsAgentExpertsItem.d.mts +13 -0
  289. package/dist/esm/api/types/AgentsAgentExpertsItem.mjs +4 -0
  290. package/dist/esm/api/types/AgentsAgentExtension.d.mts +13 -0
  291. package/dist/esm/api/types/AgentsAgentExtension.mjs +4 -0
  292. package/dist/esm/api/types/AgentsAgentInterface.d.mts +9 -0
  293. package/dist/esm/api/types/AgentsAgentInterface.mjs +4 -0
  294. package/dist/esm/api/types/AgentsAgentInterfaceTransport.d.mts +5 -0
  295. package/dist/esm/api/types/AgentsAgentInterfaceTransport.mjs +4 -0
  296. package/dist/esm/api/types/AgentsAgentReference.d.mts +13 -0
  297. package/dist/esm/api/types/AgentsAgentReference.mjs +4 -0
  298. package/dist/esm/api/types/AgentsAgentResponse.d.mts +5 -0
  299. package/dist/esm/api/types/AgentsAgentResponse.mjs +4 -0
  300. package/dist/esm/api/types/AgentsAgentSkill.d.mts +22 -0
  301. package/dist/esm/api/types/AgentsAgentSkill.mjs +4 -0
  302. package/dist/esm/api/types/AgentsArtifact.d.mts +18 -0
  303. package/dist/esm/api/types/AgentsArtifact.mjs +4 -0
  304. package/dist/esm/api/types/AgentsContext.d.mts +9 -0
  305. package/dist/esm/api/types/AgentsContext.mjs +4 -0
  306. package/dist/esm/api/types/AgentsContextItemsItem.d.mts +13 -0
  307. package/dist/esm/api/types/AgentsContextItemsItem.mjs +4 -0
  308. package/dist/esm/api/types/AgentsCreateExpert.d.mts +14 -0
  309. package/dist/esm/api/types/AgentsCreateExpert.mjs +4 -0
  310. package/dist/esm/api/types/AgentsCreateMcpServer.d.mts +20 -0
  311. package/dist/esm/api/types/AgentsCreateMcpServer.mjs +4 -0
  312. package/dist/esm/api/types/AgentsCreateMcpServerAuthorizationType.d.mts +12 -0
  313. package/dist/esm/api/types/AgentsCreateMcpServerAuthorizationType.mjs +8 -0
  314. package/dist/esm/api/types/AgentsCreateMcpServerTransportType.d.mts +12 -0
  315. package/dist/esm/api/types/AgentsCreateMcpServerTransportType.mjs +8 -0
  316. package/dist/esm/api/types/AgentsDataPart.d.mts +9 -0
  317. package/dist/esm/api/types/AgentsDataPart.mjs +4 -0
  318. package/dist/esm/api/types/AgentsExpert.d.mts +16 -0
  319. package/dist/esm/api/types/AgentsExpert.mjs +4 -0
  320. package/dist/esm/api/types/AgentsExpertReference.d.mts +12 -0
  321. package/dist/esm/api/types/AgentsExpertReference.mjs +4 -0
  322. package/dist/esm/api/types/AgentsFilePart.d.mts +9 -0
  323. package/dist/esm/api/types/AgentsFilePart.mjs +4 -0
  324. package/dist/esm/api/types/AgentsFilePartFile.d.mts +5 -0
  325. package/dist/esm/api/types/AgentsFilePartFile.mjs +4 -0
  326. package/dist/esm/api/types/AgentsFileWithBytes.d.mts +11 -0
  327. package/dist/esm/api/types/AgentsFileWithBytes.mjs +4 -0
  328. package/dist/esm/api/types/AgentsFileWithUri.d.mts +11 -0
  329. package/dist/esm/api/types/AgentsFileWithUri.mjs +4 -0
  330. package/dist/esm/api/types/AgentsMcpServer.d.mts +18 -0
  331. package/dist/esm/api/types/AgentsMcpServer.mjs +4 -0
  332. package/dist/esm/api/types/AgentsMcpServerAuthorizationType.d.mts +12 -0
  333. package/dist/esm/api/types/AgentsMcpServerAuthorizationType.mjs +8 -0
  334. package/dist/esm/api/types/AgentsMcpServerTransportType.d.mts +11 -0
  335. package/dist/esm/api/types/AgentsMcpServerTransportType.mjs +7 -0
  336. package/dist/esm/api/types/AgentsMessage.d.mts +22 -0
  337. package/dist/esm/api/types/AgentsMessage.mjs +4 -0
  338. package/dist/esm/api/types/AgentsMessageRole.d.mts +11 -0
  339. package/dist/esm/api/types/AgentsMessageRole.mjs +7 -0
  340. package/dist/esm/api/types/AgentsMessageSendConfiguration.d.mts +13 -0
  341. package/dist/esm/api/types/AgentsMessageSendConfiguration.mjs +4 -0
  342. package/dist/esm/api/types/AgentsMessageSendParams.d.mts +10 -0
  343. package/dist/esm/api/types/AgentsMessageSendParams.mjs +4 -0
  344. package/dist/esm/api/types/AgentsPart.d.mts +16 -0
  345. package/dist/esm/api/types/AgentsPart.mjs +4 -0
  346. package/dist/esm/api/types/AgentsPushNotificationAuthenticationInfo.d.mts +9 -0
  347. package/dist/esm/api/types/AgentsPushNotificationAuthenticationInfo.mjs +4 -0
  348. package/dist/esm/api/types/AgentsPushNotificationConfig.d.mts +13 -0
  349. package/dist/esm/api/types/AgentsPushNotificationConfig.mjs +4 -0
  350. package/dist/esm/api/types/AgentsTask.d.mts +17 -0
  351. package/dist/esm/api/types/AgentsTask.mjs +4 -0
  352. package/dist/esm/api/types/AgentsTaskArtifactUpdateEvent.d.mts +19 -0
  353. package/dist/esm/api/types/AgentsTaskArtifactUpdateEvent.mjs +4 -0
  354. package/dist/esm/api/types/AgentsTaskStatus.d.mts +12 -0
  355. package/dist/esm/api/types/AgentsTaskStatus.mjs +4 -0
  356. package/dist/esm/api/types/AgentsTaskStatusState.d.mts +18 -0
  357. package/dist/esm/api/types/AgentsTaskStatusState.mjs +14 -0
  358. package/dist/esm/api/types/AgentsTaskStatusUpdateEvent.d.mts +17 -0
  359. package/dist/esm/api/types/AgentsTaskStatusUpdateEvent.mjs +4 -0
  360. package/dist/esm/api/types/AgentsTextPart.d.mts +9 -0
  361. package/dist/esm/api/types/AgentsTextPart.mjs +4 -0
  362. package/dist/esm/api/types/AgentsTransportProtocol.d.mts +12 -0
  363. package/dist/esm/api/types/AgentsTransportProtocol.mjs +8 -0
  364. package/dist/esm/api/types/index.d.mts +43 -0
  365. package/dist/esm/api/types/index.mjs +43 -0
  366. package/dist/esm/core/index.d.mts +1 -0
  367. package/dist/esm/core/index.mjs +1 -0
  368. package/dist/esm/core/stream/Stream.d.mts +46 -0
  369. package/dist/esm/core/stream/Stream.mjs +164 -0
  370. package/dist/esm/core/stream/index.d.mts +1 -0
  371. package/dist/esm/core/stream/index.mjs +1 -0
  372. package/dist/esm/custom/CortiClient.d.mts +3 -0
  373. package/dist/esm/custom/CortiClient.mjs +9 -4
  374. package/dist/esm/custom/RefreshBearerProvider.d.mts +10 -5
  375. package/dist/esm/custom/RefreshBearerProvider.mjs +1 -1
  376. package/dist/esm/custom/index.d.mts +1 -0
  377. package/dist/esm/custom/index.mjs +1 -0
  378. package/dist/esm/serialization/resources/agents/client/index.d.mts +2 -0
  379. package/dist/esm/serialization/resources/agents/client/index.mjs +2 -0
  380. package/dist/esm/serialization/resources/agents/client/list.d.mts +11 -0
  381. package/dist/esm/serialization/resources/agents/client/list.mjs +6 -0
  382. package/dist/esm/serialization/resources/agents/client/requests/AgentsCreateAgent.d.mts +16 -0
  383. package/dist/esm/serialization/resources/agents/client/requests/AgentsCreateAgent.mjs +11 -0
  384. package/dist/esm/serialization/resources/agents/client/requests/index.d.mts +1 -0
  385. package/dist/esm/serialization/resources/agents/client/requests/index.mjs +1 -0
  386. package/dist/esm/serialization/resources/agents/index.d.mts +2 -0
  387. package/dist/esm/serialization/resources/agents/index.mjs +2 -0
  388. package/dist/esm/serialization/resources/agents/types/AgentsCreateAgentExpertsItem.d.mts +18 -0
  389. package/dist/esm/serialization/resources/agents/types/AgentsCreateAgentExpertsItem.mjs +15 -0
  390. package/dist/esm/serialization/resources/agents/types/AgentsMessageSendResponse.d.mts +15 -0
  391. package/dist/esm/serialization/resources/agents/types/AgentsMessageSendResponse.mjs +10 -0
  392. package/dist/esm/serialization/resources/agents/types/AgentsMessageStreamResponse.d.mts +19 -0
  393. package/dist/esm/serialization/resources/agents/types/AgentsMessageStreamResponse.mjs +14 -0
  394. package/dist/esm/serialization/resources/agents/types/index.d.mts +3 -0
  395. package/dist/esm/serialization/resources/agents/types/index.mjs +3 -0
  396. package/dist/esm/serialization/resources/index.d.mts +3 -0
  397. package/dist/esm/serialization/resources/index.mjs +3 -0
  398. package/dist/esm/serialization/types/AgentsAgent.d.mts +16 -0
  399. package/dist/esm/serialization/types/AgentsAgent.mjs +11 -0
  400. package/dist/esm/serialization/types/AgentsAgentCapabilities.d.mts +16 -0
  401. package/dist/esm/serialization/types/AgentsAgentCapabilities.mjs +11 -0
  402. package/dist/esm/serialization/types/AgentsAgentCard.d.mts +32 -0
  403. package/dist/esm/serialization/types/AgentsAgentCard.mjs +29 -0
  404. package/dist/esm/serialization/types/AgentsAgentCardPreferredTransport.d.mts +11 -0
  405. package/dist/esm/serialization/types/AgentsAgentCardPreferredTransport.mjs +6 -0
  406. package/dist/esm/serialization/types/AgentsAgentCardSignature.d.mts +14 -0
  407. package/dist/esm/serialization/types/AgentsAgentCardSignature.mjs +9 -0
  408. package/dist/esm/serialization/types/AgentsAgentExpertsItem.d.mts +18 -0
  409. package/dist/esm/serialization/types/AgentsAgentExpertsItem.mjs +15 -0
  410. package/dist/esm/serialization/types/AgentsAgentExtension.d.mts +15 -0
  411. package/dist/esm/serialization/types/AgentsAgentExtension.mjs +10 -0
  412. package/dist/esm/serialization/types/AgentsAgentInterface.d.mts +14 -0
  413. package/dist/esm/serialization/types/AgentsAgentInterface.mjs +9 -0
  414. package/dist/esm/serialization/types/AgentsAgentInterfaceTransport.d.mts +11 -0
  415. package/dist/esm/serialization/types/AgentsAgentInterfaceTransport.mjs +6 -0
  416. package/dist/esm/serialization/types/AgentsAgentReference.d.mts +14 -0
  417. package/dist/esm/serialization/types/AgentsAgentReference.mjs +9 -0
  418. package/dist/esm/serialization/types/AgentsAgentResponse.d.mts +12 -0
  419. package/dist/esm/serialization/types/AgentsAgentResponse.mjs +7 -0
  420. package/dist/esm/serialization/types/AgentsAgentSkill.d.mts +20 -0
  421. package/dist/esm/serialization/types/AgentsAgentSkill.mjs +15 -0
  422. package/dist/esm/serialization/types/AgentsArtifact.d.mts +18 -0
  423. package/dist/esm/serialization/types/AgentsArtifact.mjs +13 -0
  424. package/dist/esm/serialization/types/AgentsContext.d.mts +14 -0
  425. package/dist/esm/serialization/types/AgentsContext.mjs +9 -0
  426. package/dist/esm/serialization/types/AgentsContextItemsItem.d.mts +18 -0
  427. package/dist/esm/serialization/types/AgentsContextItemsItem.mjs +15 -0
  428. package/dist/esm/serialization/types/AgentsCreateExpert.d.mts +16 -0
  429. package/dist/esm/serialization/types/AgentsCreateExpert.mjs +11 -0
  430. package/dist/esm/serialization/types/AgentsCreateMcpServer.d.mts +20 -0
  431. package/dist/esm/serialization/types/AgentsCreateMcpServer.mjs +15 -0
  432. package/dist/esm/serialization/types/AgentsCreateMcpServerAuthorizationType.d.mts +10 -0
  433. package/dist/esm/serialization/types/AgentsCreateMcpServerAuthorizationType.mjs +5 -0
  434. package/dist/esm/serialization/types/AgentsCreateMcpServerTransportType.d.mts +10 -0
  435. package/dist/esm/serialization/types/AgentsCreateMcpServerTransportType.mjs +5 -0
  436. package/dist/esm/serialization/types/AgentsDataPart.d.mts +13 -0
  437. package/dist/esm/serialization/types/AgentsDataPart.mjs +8 -0
  438. package/dist/esm/serialization/types/AgentsExpert.d.mts +17 -0
  439. package/dist/esm/serialization/types/AgentsExpert.mjs +12 -0
  440. package/dist/esm/serialization/types/AgentsExpertReference.d.mts +13 -0
  441. package/dist/esm/serialization/types/AgentsExpertReference.mjs +8 -0
  442. package/dist/esm/serialization/types/AgentsFilePart.d.mts +14 -0
  443. package/dist/esm/serialization/types/AgentsFilePart.mjs +9 -0
  444. package/dist/esm/serialization/types/AgentsFilePartFile.d.mts +12 -0
  445. package/dist/esm/serialization/types/AgentsFilePartFile.mjs +7 -0
  446. package/dist/esm/serialization/types/AgentsFileWithBytes.d.mts +14 -0
  447. package/dist/esm/serialization/types/AgentsFileWithBytes.mjs +9 -0
  448. package/dist/esm/serialization/types/AgentsFileWithUri.d.mts +14 -0
  449. package/dist/esm/serialization/types/AgentsFileWithUri.mjs +9 -0
  450. package/dist/esm/serialization/types/AgentsMcpServer.d.mts +19 -0
  451. package/dist/esm/serialization/types/AgentsMcpServer.mjs +14 -0
  452. package/dist/esm/serialization/types/AgentsMcpServerAuthorizationType.d.mts +10 -0
  453. package/dist/esm/serialization/types/AgentsMcpServerAuthorizationType.mjs +5 -0
  454. package/dist/esm/serialization/types/AgentsMcpServerTransportType.d.mts +10 -0
  455. package/dist/esm/serialization/types/AgentsMcpServerTransportType.mjs +5 -0
  456. package/dist/esm/serialization/types/AgentsMessage.d.mts +21 -0
  457. package/dist/esm/serialization/types/AgentsMessage.mjs +16 -0
  458. package/dist/esm/serialization/types/AgentsMessageRole.d.mts +10 -0
  459. package/dist/esm/serialization/types/AgentsMessageRole.mjs +5 -0
  460. package/dist/esm/serialization/types/AgentsMessageSendConfiguration.d.mts +16 -0
  461. package/dist/esm/serialization/types/AgentsMessageSendConfiguration.mjs +11 -0
  462. package/dist/esm/serialization/types/AgentsMessageSendParams.d.mts +16 -0
  463. package/dist/esm/serialization/types/AgentsMessageSendParams.mjs +11 -0
  464. package/dist/esm/serialization/types/AgentsPart.d.mts +22 -0
  465. package/dist/esm/serialization/types/AgentsPart.mjs +17 -0
  466. package/dist/esm/serialization/types/AgentsPushNotificationAuthenticationInfo.d.mts +13 -0
  467. package/dist/esm/serialization/types/AgentsPushNotificationAuthenticationInfo.mjs +8 -0
  468. package/dist/esm/serialization/types/AgentsPushNotificationConfig.d.mts +16 -0
  469. package/dist/esm/serialization/types/AgentsPushNotificationConfig.mjs +11 -0
  470. package/dist/esm/serialization/types/AgentsTask.d.mts +20 -0
  471. package/dist/esm/serialization/types/AgentsTask.mjs +15 -0
  472. package/dist/esm/serialization/types/AgentsTaskArtifactUpdateEvent.d.mts +19 -0
  473. package/dist/esm/serialization/types/AgentsTaskArtifactUpdateEvent.mjs +14 -0
  474. package/dist/esm/serialization/types/AgentsTaskStatus.d.mts +16 -0
  475. package/dist/esm/serialization/types/AgentsTaskStatus.mjs +11 -0
  476. package/dist/esm/serialization/types/AgentsTaskStatusState.d.mts +10 -0
  477. package/dist/esm/serialization/types/AgentsTaskStatusState.mjs +15 -0
  478. package/dist/esm/serialization/types/AgentsTaskStatusUpdateEvent.d.mts +18 -0
  479. package/dist/esm/serialization/types/AgentsTaskStatusUpdateEvent.mjs +13 -0
  480. package/dist/esm/serialization/types/AgentsTextPart.d.mts +13 -0
  481. package/dist/esm/serialization/types/AgentsTextPart.mjs +8 -0
  482. package/dist/esm/serialization/types/AgentsTransportProtocol.d.mts +10 -0
  483. package/dist/esm/serialization/types/AgentsTransportProtocol.mjs +5 -0
  484. package/dist/esm/serialization/types/index.d.mts +43 -0
  485. package/dist/esm/serialization/types/index.mjs +43 -0
  486. package/dist/esm/version.d.mts +1 -1
  487. package/dist/esm/version.mjs +1 -1
  488. package/package.json +1 -1
  489. package/reference.md +720 -0
@@ -0,0 +1,837 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
+ return new (P || (P = Promise))(function (resolve, reject) {
7
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11
+ });
12
+ };
13
+ import * as core from "../../../../core/index.mjs";
14
+ import * as Corti from "../../../index.mjs";
15
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
16
+ import * as serializers from "../../../../serialization/index.mjs";
17
+ import * as errors from "../../../../errors/index.mjs";
18
+ export class Agents {
19
+ constructor(_options) {
20
+ this._options = _options;
21
+ }
22
+ /**
23
+ * This endpoint retrieves a list of all agents that can be called by the Corti Agent Framework.
24
+ *
25
+ * @param {Corti.AgentsListRequest} request
26
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
27
+ *
28
+ * @throws {@link Corti.BadRequestError}
29
+ * @throws {@link Corti.UnauthorizedError}
30
+ *
31
+ * @example
32
+ * await client.agents.list()
33
+ */
34
+ list(request = {}, requestOptions) {
35
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
36
+ }
37
+ __list() {
38
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
39
+ var _a, _b, _c, _d;
40
+ const { limit, offset } = request;
41
+ const _queryParams = {};
42
+ if (limit !== undefined) {
43
+ _queryParams["limit"] = (_a = limit === null || limit === void 0 ? void 0 : limit.toString()) !== null && _a !== void 0 ? _a : null;
44
+ }
45
+ if (offset !== undefined) {
46
+ _queryParams["offset"] = (_b = offset === null || offset === void 0 ? void 0 : offset.toString()) !== null && _b !== void 0 ? _b : null;
47
+ }
48
+ const _response = yield core.fetcher({
49
+ url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment)).base, "agents"),
50
+ method: "GET",
51
+ headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({
52
+ Authorization: yield this._getAuthorizationHeader(),
53
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName,
54
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
55
+ queryParameters: _queryParams,
56
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
57
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
58
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
59
+ });
60
+ if (_response.ok) {
61
+ return {
62
+ data: serializers.agents.list.Response.parseOrThrow(_response.body, {
63
+ unrecognizedObjectKeys: "passthrough",
64
+ allowUnrecognizedUnionMembers: true,
65
+ allowUnrecognizedEnumValues: true,
66
+ skipValidation: true,
67
+ breadcrumbsPrefix: ["response"],
68
+ }),
69
+ rawResponse: _response.rawResponse,
70
+ };
71
+ }
72
+ if (_response.error.reason === "status-code") {
73
+ switch (_response.error.statusCode) {
74
+ case 400:
75
+ throw new Corti.BadRequestError(_response.error.body, _response.rawResponse);
76
+ case 401:
77
+ throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
78
+ default:
79
+ throw new errors.CortiError({
80
+ statusCode: _response.error.statusCode,
81
+ body: _response.error.body,
82
+ rawResponse: _response.rawResponse,
83
+ });
84
+ }
85
+ }
86
+ switch (_response.error.reason) {
87
+ case "non-json":
88
+ throw new errors.CortiError({
89
+ statusCode: _response.error.statusCode,
90
+ body: _response.error.rawBody,
91
+ rawResponse: _response.rawResponse,
92
+ });
93
+ case "timeout":
94
+ throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /agents.");
95
+ case "unknown":
96
+ throw new errors.CortiError({
97
+ message: _response.error.errorMessage,
98
+ rawResponse: _response.rawResponse,
99
+ });
100
+ }
101
+ });
102
+ }
103
+ /**
104
+ * This endpoint allows the creation of a new agent that can be utilized in the `POST /threads` endpoint.
105
+ *
106
+ * @param {Corti.AgentsCreateAgent} request
107
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
108
+ *
109
+ * @throws {@link Corti.BadRequestError}
110
+ * @throws {@link Corti.UnauthorizedError}
111
+ *
112
+ * @example
113
+ * await client.agents.create({
114
+ * name: "name",
115
+ * description: "description"
116
+ * })
117
+ */
118
+ create(request, requestOptions) {
119
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
120
+ }
121
+ __create(request, requestOptions) {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ var _a, _b;
124
+ const _response = yield core.fetcher({
125
+ url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment)).base, "agents"),
126
+ method: "POST",
127
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
128
+ Authorization: yield this._getAuthorizationHeader(),
129
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName,
130
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
131
+ contentType: "application/json",
132
+ requestType: "json",
133
+ body: serializers.AgentsCreateAgent.jsonOrThrow(request, {
134
+ unrecognizedObjectKeys: "strip",
135
+ omitUndefined: true,
136
+ }),
137
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
138
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
139
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
140
+ });
141
+ if (_response.ok) {
142
+ return {
143
+ data: serializers.AgentsAgent.parseOrThrow(_response.body, {
144
+ unrecognizedObjectKeys: "passthrough",
145
+ allowUnrecognizedUnionMembers: true,
146
+ allowUnrecognizedEnumValues: true,
147
+ skipValidation: true,
148
+ breadcrumbsPrefix: ["response"],
149
+ }),
150
+ rawResponse: _response.rawResponse,
151
+ };
152
+ }
153
+ if (_response.error.reason === "status-code") {
154
+ switch (_response.error.statusCode) {
155
+ case 400:
156
+ throw new Corti.BadRequestError(_response.error.body, _response.rawResponse);
157
+ case 401:
158
+ throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
159
+ default:
160
+ throw new errors.CortiError({
161
+ statusCode: _response.error.statusCode,
162
+ body: _response.error.body,
163
+ rawResponse: _response.rawResponse,
164
+ });
165
+ }
166
+ }
167
+ switch (_response.error.reason) {
168
+ case "non-json":
169
+ throw new errors.CortiError({
170
+ statusCode: _response.error.statusCode,
171
+ body: _response.error.rawBody,
172
+ rawResponse: _response.rawResponse,
173
+ });
174
+ case "timeout":
175
+ throw new errors.CortiTimeoutError("Timeout exceeded when calling POST /agents.");
176
+ case "unknown":
177
+ throw new errors.CortiError({
178
+ message: _response.error.errorMessage,
179
+ rawResponse: _response.rawResponse,
180
+ });
181
+ }
182
+ });
183
+ }
184
+ /**
185
+ * This endpoint retrieves an agent by its identifier. The agent contains information about its capabilities and the experts it can call.
186
+ *
187
+ * @param {string} id - The identifier of the agent to retrieve.
188
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
189
+ *
190
+ * @throws {@link Corti.BadRequestError}
191
+ * @throws {@link Corti.UnauthorizedError}
192
+ * @throws {@link Corti.NotFoundError}
193
+ *
194
+ * @example
195
+ * await client.agents.get("id")
196
+ */
197
+ get(id, requestOptions) {
198
+ return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
199
+ }
200
+ __get(id, requestOptions) {
201
+ return __awaiter(this, void 0, void 0, function* () {
202
+ var _a, _b;
203
+ const _response = yield core.fetcher({
204
+ url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment)).base, `agents/${encodeURIComponent(id)}`),
205
+ method: "GET",
206
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
207
+ Authorization: yield this._getAuthorizationHeader(),
208
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName,
209
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
210
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
211
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
212
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
213
+ });
214
+ if (_response.ok) {
215
+ return {
216
+ data: serializers.AgentsAgentResponse.parseOrThrow(_response.body, {
217
+ unrecognizedObjectKeys: "passthrough",
218
+ allowUnrecognizedUnionMembers: true,
219
+ allowUnrecognizedEnumValues: true,
220
+ skipValidation: true,
221
+ breadcrumbsPrefix: ["response"],
222
+ }),
223
+ rawResponse: _response.rawResponse,
224
+ };
225
+ }
226
+ if (_response.error.reason === "status-code") {
227
+ switch (_response.error.statusCode) {
228
+ case 400:
229
+ throw new Corti.BadRequestError(_response.error.body, _response.rawResponse);
230
+ case 401:
231
+ throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
232
+ case 404:
233
+ throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
234
+ default:
235
+ throw new errors.CortiError({
236
+ statusCode: _response.error.statusCode,
237
+ body: _response.error.body,
238
+ rawResponse: _response.rawResponse,
239
+ });
240
+ }
241
+ }
242
+ switch (_response.error.reason) {
243
+ case "non-json":
244
+ throw new errors.CortiError({
245
+ statusCode: _response.error.statusCode,
246
+ body: _response.error.rawBody,
247
+ rawResponse: _response.rawResponse,
248
+ });
249
+ case "timeout":
250
+ throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /agents/{id}.");
251
+ case "unknown":
252
+ throw new errors.CortiError({
253
+ message: _response.error.errorMessage,
254
+ rawResponse: _response.rawResponse,
255
+ });
256
+ }
257
+ });
258
+ }
259
+ /**
260
+ * This endpoint deletes an agent by its identifier. Once deleted, the agent can no longer be used in threads.
261
+ *
262
+ * @param {string} id - The identifier of the agent to delete.
263
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
264
+ *
265
+ * @throws {@link Corti.BadRequestError}
266
+ * @throws {@link Corti.UnauthorizedError}
267
+ * @throws {@link Corti.NotFoundError}
268
+ *
269
+ * @example
270
+ * await client.agents.delete("id")
271
+ */
272
+ delete(id, requestOptions) {
273
+ return core.HttpResponsePromise.fromPromise(this.__delete(id, requestOptions));
274
+ }
275
+ __delete(id, requestOptions) {
276
+ return __awaiter(this, void 0, void 0, function* () {
277
+ var _a, _b;
278
+ const _response = yield core.fetcher({
279
+ url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment)).base, `agents/${encodeURIComponent(id)}`),
280
+ method: "DELETE",
281
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
282
+ Authorization: yield this._getAuthorizationHeader(),
283
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName,
284
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
285
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
286
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
287
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
288
+ });
289
+ if (_response.ok) {
290
+ return { data: undefined, rawResponse: _response.rawResponse };
291
+ }
292
+ if (_response.error.reason === "status-code") {
293
+ switch (_response.error.statusCode) {
294
+ case 400:
295
+ throw new Corti.BadRequestError(_response.error.body, _response.rawResponse);
296
+ case 401:
297
+ throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
298
+ case 404:
299
+ throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
300
+ default:
301
+ throw new errors.CortiError({
302
+ statusCode: _response.error.statusCode,
303
+ body: _response.error.body,
304
+ rawResponse: _response.rawResponse,
305
+ });
306
+ }
307
+ }
308
+ switch (_response.error.reason) {
309
+ case "non-json":
310
+ throw new errors.CortiError({
311
+ statusCode: _response.error.statusCode,
312
+ body: _response.error.rawBody,
313
+ rawResponse: _response.rawResponse,
314
+ });
315
+ case "timeout":
316
+ throw new errors.CortiTimeoutError("Timeout exceeded when calling DELETE /agents/{id}.");
317
+ case "unknown":
318
+ throw new errors.CortiError({
319
+ message: _response.error.errorMessage,
320
+ rawResponse: _response.rawResponse,
321
+ });
322
+ }
323
+ });
324
+ }
325
+ /**
326
+ * This endpoint updates an existing agent. Only the fields provided in the request body will be updated; other fields will remain unchanged.
327
+ *
328
+ * @param {string} id - The identifier of the agent to update.
329
+ * @param {Corti.AgentsAgent} request
330
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
331
+ *
332
+ * @throws {@link Corti.BadRequestError}
333
+ * @throws {@link Corti.UnauthorizedError}
334
+ * @throws {@link Corti.NotFoundError}
335
+ *
336
+ * @example
337
+ * await client.agents.update("id", {
338
+ * id: "id",
339
+ * name: "name",
340
+ * description: "description"
341
+ * })
342
+ */
343
+ update(id, request, requestOptions) {
344
+ return core.HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions));
345
+ }
346
+ __update(id, request, requestOptions) {
347
+ return __awaiter(this, void 0, void 0, function* () {
348
+ var _a, _b;
349
+ const _response = yield core.fetcher({
350
+ url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment)).base, `agents/${encodeURIComponent(id)}`),
351
+ method: "PATCH",
352
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
353
+ Authorization: yield this._getAuthorizationHeader(),
354
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName,
355
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
356
+ contentType: "application/json",
357
+ requestType: "json",
358
+ body: serializers.AgentsAgent.jsonOrThrow(request, {
359
+ unrecognizedObjectKeys: "strip",
360
+ omitUndefined: true,
361
+ }),
362
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
363
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
364
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
365
+ });
366
+ if (_response.ok) {
367
+ return {
368
+ data: serializers.AgentsAgent.parseOrThrow(_response.body, {
369
+ unrecognizedObjectKeys: "passthrough",
370
+ allowUnrecognizedUnionMembers: true,
371
+ allowUnrecognizedEnumValues: true,
372
+ skipValidation: true,
373
+ breadcrumbsPrefix: ["response"],
374
+ }),
375
+ rawResponse: _response.rawResponse,
376
+ };
377
+ }
378
+ if (_response.error.reason === "status-code") {
379
+ switch (_response.error.statusCode) {
380
+ case 400:
381
+ throw new Corti.BadRequestError(_response.error.body, _response.rawResponse);
382
+ case 401:
383
+ throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
384
+ case 404:
385
+ throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
386
+ default:
387
+ throw new errors.CortiError({
388
+ statusCode: _response.error.statusCode,
389
+ body: _response.error.body,
390
+ rawResponse: _response.rawResponse,
391
+ });
392
+ }
393
+ }
394
+ switch (_response.error.reason) {
395
+ case "non-json":
396
+ throw new errors.CortiError({
397
+ statusCode: _response.error.statusCode,
398
+ body: _response.error.rawBody,
399
+ rawResponse: _response.rawResponse,
400
+ });
401
+ case "timeout":
402
+ throw new errors.CortiTimeoutError("Timeout exceeded when calling PATCH /agents/{id}.");
403
+ case "unknown":
404
+ throw new errors.CortiError({
405
+ message: _response.error.errorMessage,
406
+ rawResponse: _response.rawResponse,
407
+ });
408
+ }
409
+ });
410
+ }
411
+ /**
412
+ * This endpoint retrieves the agent card in JSON format, which provides metadata about the agent, including its name, description, and the experts it can call.
413
+ *
414
+ * @param {string} id - The identifier of the agent to retrieve the agent card for.
415
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
416
+ *
417
+ * @throws {@link Corti.BadRequestError}
418
+ * @throws {@link Corti.UnauthorizedError}
419
+ * @throws {@link Corti.NotFoundError}
420
+ *
421
+ * @example
422
+ * await client.agents.getCard("id")
423
+ */
424
+ getCard(id, requestOptions) {
425
+ return core.HttpResponsePromise.fromPromise(this.__getCard(id, requestOptions));
426
+ }
427
+ __getCard(id, requestOptions) {
428
+ return __awaiter(this, void 0, void 0, function* () {
429
+ var _a, _b;
430
+ const _response = yield core.fetcher({
431
+ url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment)).base, `agents/${encodeURIComponent(id)}/agent-card.json`),
432
+ method: "GET",
433
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
434
+ Authorization: yield this._getAuthorizationHeader(),
435
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName,
436
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
437
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
438
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
439
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
440
+ });
441
+ if (_response.ok) {
442
+ return {
443
+ data: serializers.AgentsAgentCard.parseOrThrow(_response.body, {
444
+ unrecognizedObjectKeys: "passthrough",
445
+ allowUnrecognizedUnionMembers: true,
446
+ allowUnrecognizedEnumValues: true,
447
+ skipValidation: true,
448
+ breadcrumbsPrefix: ["response"],
449
+ }),
450
+ rawResponse: _response.rawResponse,
451
+ };
452
+ }
453
+ if (_response.error.reason === "status-code") {
454
+ switch (_response.error.statusCode) {
455
+ case 400:
456
+ throw new Corti.BadRequestError(_response.error.body, _response.rawResponse);
457
+ case 401:
458
+ throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
459
+ case 404:
460
+ throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
461
+ default:
462
+ throw new errors.CortiError({
463
+ statusCode: _response.error.statusCode,
464
+ body: _response.error.body,
465
+ rawResponse: _response.rawResponse,
466
+ });
467
+ }
468
+ }
469
+ switch (_response.error.reason) {
470
+ case "non-json":
471
+ throw new errors.CortiError({
472
+ statusCode: _response.error.statusCode,
473
+ body: _response.error.rawBody,
474
+ rawResponse: _response.rawResponse,
475
+ });
476
+ case "timeout":
477
+ throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /agents/{id}/agent-card.json.");
478
+ case "unknown":
479
+ throw new errors.CortiError({
480
+ message: _response.error.errorMessage,
481
+ rawResponse: _response.rawResponse,
482
+ });
483
+ }
484
+ });
485
+ }
486
+ /**
487
+ * This endpoint sends a message to the specified agent to start or continue a task. The agent processes the message and returns a response. If the message contains a task ID that matches an ongoing task, the agent will continue that task; otherwise, it will start a new task.
488
+ *
489
+ * @param {string} id - The identifier of the agent to send the message to.
490
+ * @param {Corti.AgentsMessageSendParams} request
491
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
492
+ *
493
+ * @throws {@link Corti.BadRequestError}
494
+ * @throws {@link Corti.UnauthorizedError}
495
+ * @throws {@link Corti.NotFoundError}
496
+ *
497
+ * @example
498
+ * await client.agents.messageSend("id", {
499
+ * message: {
500
+ * role: "user",
501
+ * parts: [{
502
+ * kind: "text",
503
+ * text: "text"
504
+ * }],
505
+ * messageId: "messageId"
506
+ * }
507
+ * })
508
+ */
509
+ messageSend(id, request, requestOptions) {
510
+ return core.HttpResponsePromise.fromPromise(this.__messageSend(id, request, requestOptions));
511
+ }
512
+ __messageSend(id, request, requestOptions) {
513
+ return __awaiter(this, void 0, void 0, function* () {
514
+ var _a, _b;
515
+ const _response = yield core.fetcher({
516
+ url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment)).base, `agents/${encodeURIComponent(id)}/v1/message:send`),
517
+ method: "POST",
518
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
519
+ Authorization: yield this._getAuthorizationHeader(),
520
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName,
521
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
522
+ contentType: "application/json",
523
+ requestType: "json",
524
+ body: serializers.AgentsMessageSendParams.jsonOrThrow(request, {
525
+ unrecognizedObjectKeys: "strip",
526
+ omitUndefined: true,
527
+ }),
528
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
529
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
530
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
531
+ });
532
+ if (_response.ok) {
533
+ return {
534
+ data: serializers.AgentsMessageSendResponse.parseOrThrow(_response.body, {
535
+ unrecognizedObjectKeys: "passthrough",
536
+ allowUnrecognizedUnionMembers: true,
537
+ allowUnrecognizedEnumValues: true,
538
+ skipValidation: true,
539
+ breadcrumbsPrefix: ["response"],
540
+ }),
541
+ rawResponse: _response.rawResponse,
542
+ };
543
+ }
544
+ if (_response.error.reason === "status-code") {
545
+ switch (_response.error.statusCode) {
546
+ case 400:
547
+ throw new Corti.BadRequestError(_response.error.body, _response.rawResponse);
548
+ case 401:
549
+ throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
550
+ case 404:
551
+ throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
552
+ default:
553
+ throw new errors.CortiError({
554
+ statusCode: _response.error.statusCode,
555
+ body: _response.error.body,
556
+ rawResponse: _response.rawResponse,
557
+ });
558
+ }
559
+ }
560
+ switch (_response.error.reason) {
561
+ case "non-json":
562
+ throw new errors.CortiError({
563
+ statusCode: _response.error.statusCode,
564
+ body: _response.error.rawBody,
565
+ rawResponse: _response.rawResponse,
566
+ });
567
+ case "timeout":
568
+ throw new errors.CortiTimeoutError("Timeout exceeded when calling POST /agents/{id}/v1/message:send.");
569
+ case "unknown":
570
+ throw new errors.CortiError({
571
+ message: _response.error.errorMessage,
572
+ rawResponse: _response.rawResponse,
573
+ });
574
+ }
575
+ });
576
+ }
577
+ /**
578
+ * Sends a message to the specified agent and streams the response as it is generated. This method requires the server to have support for streaming.
579
+ */
580
+ messageStream(id, request, requestOptions) {
581
+ return core.HttpResponsePromise.fromPromise(this.__messageStream(id, request, requestOptions));
582
+ }
583
+ __messageStream(id, request, requestOptions) {
584
+ return __awaiter(this, void 0, void 0, function* () {
585
+ var _a, _b;
586
+ const _response = yield core.fetcher({
587
+ url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment)).base, `agents/${encodeURIComponent(id)}/v1/message:stream`),
588
+ method: "POST",
589
+ headers: mergeHeaders((_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, mergeOnlyDefinedHeaders({
590
+ Authorization: yield this._getAuthorizationHeader(),
591
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName,
592
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
593
+ contentType: "application/json",
594
+ requestType: "json",
595
+ body: serializers.AgentsMessageSendParams.jsonOrThrow(request, {
596
+ unrecognizedObjectKeys: "strip",
597
+ omitUndefined: true,
598
+ }),
599
+ responseType: "sse",
600
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
601
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
602
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
603
+ });
604
+ if (_response.ok) {
605
+ return {
606
+ data: new core.Stream({
607
+ stream: _response.body,
608
+ parse: (data) => __awaiter(this, void 0, void 0, function* () {
609
+ return serializers.AgentsMessageStreamResponse.parseOrThrow(data, {
610
+ unrecognizedObjectKeys: "passthrough",
611
+ allowUnrecognizedUnionMembers: true,
612
+ allowUnrecognizedEnumValues: true,
613
+ skipValidation: true,
614
+ breadcrumbsPrefix: ["response"],
615
+ });
616
+ }),
617
+ signal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
618
+ eventShape: {
619
+ type: "sse",
620
+ streamTerminator: "[DONE]",
621
+ },
622
+ }),
623
+ rawResponse: _response.rawResponse,
624
+ };
625
+ }
626
+ if (_response.error.reason === "status-code") {
627
+ switch (_response.error.statusCode) {
628
+ case 400:
629
+ throw new Corti.BadRequestError(_response.error.body, _response.rawResponse);
630
+ case 401:
631
+ throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
632
+ case 404:
633
+ throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
634
+ default:
635
+ throw new errors.CortiError({
636
+ statusCode: _response.error.statusCode,
637
+ body: _response.error.body,
638
+ rawResponse: _response.rawResponse,
639
+ });
640
+ }
641
+ }
642
+ switch (_response.error.reason) {
643
+ case "non-json":
644
+ throw new errors.CortiError({
645
+ statusCode: _response.error.statusCode,
646
+ body: _response.error.rawBody,
647
+ rawResponse: _response.rawResponse,
648
+ });
649
+ case "timeout":
650
+ throw new errors.CortiTimeoutError("Timeout exceeded when calling POST /agents/{id}/v1/message:stream.");
651
+ case "unknown":
652
+ throw new errors.CortiError({
653
+ message: _response.error.errorMessage,
654
+ rawResponse: _response.rawResponse,
655
+ });
656
+ }
657
+ });
658
+ }
659
+ /**
660
+ * This endpoint retrieves the status and details of a specific task associated with the given agent. It provides information about the task's current state, history, and any artifacts produced during its execution.
661
+ *
662
+ * @param {string} id - The identifier of the agent associated with the task.
663
+ * @param {string} taskId - The identifier of the task to retrieve.
664
+ * @param {Corti.AgentsGetTaskRequest} request
665
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
666
+ *
667
+ * @throws {@link Corti.BadRequestError}
668
+ * @throws {@link Corti.UnauthorizedError}
669
+ * @throws {@link Corti.NotFoundError}
670
+ *
671
+ * @example
672
+ * await client.agents.getTask("id", "taskId")
673
+ */
674
+ getTask(id, taskId, request = {}, requestOptions) {
675
+ return core.HttpResponsePromise.fromPromise(this.__getTask(id, taskId, request, requestOptions));
676
+ }
677
+ __getTask(id_1, taskId_1) {
678
+ return __awaiter(this, arguments, void 0, function* (id, taskId, request = {}, requestOptions) {
679
+ var _a, _b, _c;
680
+ const { historyLength } = request;
681
+ const _queryParams = {};
682
+ if (historyLength !== undefined) {
683
+ _queryParams["historyLength"] = (_a = historyLength === null || historyLength === void 0 ? void 0 : historyLength.toString()) !== null && _a !== void 0 ? _a : null;
684
+ }
685
+ const _response = yield core.fetcher({
686
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)).base, `agents/${encodeURIComponent(id)}/v1/tasks/${encodeURIComponent(taskId)}`),
687
+ method: "GET",
688
+ headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({
689
+ Authorization: yield this._getAuthorizationHeader(),
690
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName,
691
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
692
+ queryParameters: _queryParams,
693
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
694
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
695
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
696
+ });
697
+ if (_response.ok) {
698
+ return {
699
+ data: serializers.AgentsTask.parseOrThrow(_response.body, {
700
+ unrecognizedObjectKeys: "passthrough",
701
+ allowUnrecognizedUnionMembers: true,
702
+ allowUnrecognizedEnumValues: true,
703
+ skipValidation: true,
704
+ breadcrumbsPrefix: ["response"],
705
+ }),
706
+ rawResponse: _response.rawResponse,
707
+ };
708
+ }
709
+ if (_response.error.reason === "status-code") {
710
+ switch (_response.error.statusCode) {
711
+ case 400:
712
+ throw new Corti.BadRequestError(_response.error.body, _response.rawResponse);
713
+ case 401:
714
+ throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
715
+ case 404:
716
+ throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
717
+ default:
718
+ throw new errors.CortiError({
719
+ statusCode: _response.error.statusCode,
720
+ body: _response.error.body,
721
+ rawResponse: _response.rawResponse,
722
+ });
723
+ }
724
+ }
725
+ switch (_response.error.reason) {
726
+ case "non-json":
727
+ throw new errors.CortiError({
728
+ statusCode: _response.error.statusCode,
729
+ body: _response.error.rawBody,
730
+ rawResponse: _response.rawResponse,
731
+ });
732
+ case "timeout":
733
+ throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /agents/{id}/v1/tasks/{taskId}.");
734
+ case "unknown":
735
+ throw new errors.CortiError({
736
+ message: _response.error.errorMessage,
737
+ rawResponse: _response.rawResponse,
738
+ });
739
+ }
740
+ });
741
+ }
742
+ /**
743
+ * This endpoint retrieves all tasks and top-level messages associated with a specific context for the given agent.
744
+ *
745
+ * @param {string} id - The identifier of the agent associated with the context.
746
+ * @param {string} contextId - The identifier of the context (thread) to retrieve tasks for.
747
+ * @param {Corti.AgentsGetContextRequest} request
748
+ * @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
749
+ *
750
+ * @throws {@link Corti.BadRequestError}
751
+ * @throws {@link Corti.UnauthorizedError}
752
+ * @throws {@link Corti.NotFoundError}
753
+ *
754
+ * @example
755
+ * await client.agents.getContext("id", "contextId")
756
+ */
757
+ getContext(id, contextId, request = {}, requestOptions) {
758
+ return core.HttpResponsePromise.fromPromise(this.__getContext(id, contextId, request, requestOptions));
759
+ }
760
+ __getContext(id_1, contextId_1) {
761
+ return __awaiter(this, arguments, void 0, function* (id, contextId, request = {}, requestOptions) {
762
+ var _a, _b, _c, _d;
763
+ const { limit, offset } = request;
764
+ const _queryParams = {};
765
+ if (limit !== undefined) {
766
+ _queryParams["limit"] = (_a = limit === null || limit === void 0 ? void 0 : limit.toString()) !== null && _a !== void 0 ? _a : null;
767
+ }
768
+ if (offset !== undefined) {
769
+ _queryParams["offset"] = (_b = offset === null || offset === void 0 ? void 0 : offset.toString()) !== null && _b !== void 0 ? _b : null;
770
+ }
771
+ const _response = yield core.fetcher({
772
+ url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment)).base, `agents/${encodeURIComponent(id)}/v1/contexts/${encodeURIComponent(contextId)}`),
773
+ method: "GET",
774
+ headers: mergeHeaders((_d = this._options) === null || _d === void 0 ? void 0 : _d.headers, mergeOnlyDefinedHeaders({
775
+ Authorization: yield this._getAuthorizationHeader(),
776
+ "Tenant-Name": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName,
777
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
778
+ queryParameters: _queryParams,
779
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
780
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
781
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
782
+ });
783
+ if (_response.ok) {
784
+ return {
785
+ data: serializers.AgentsContext.parseOrThrow(_response.body, {
786
+ unrecognizedObjectKeys: "passthrough",
787
+ allowUnrecognizedUnionMembers: true,
788
+ allowUnrecognizedEnumValues: true,
789
+ skipValidation: true,
790
+ breadcrumbsPrefix: ["response"],
791
+ }),
792
+ rawResponse: _response.rawResponse,
793
+ };
794
+ }
795
+ if (_response.error.reason === "status-code") {
796
+ switch (_response.error.statusCode) {
797
+ case 400:
798
+ throw new Corti.BadRequestError(_response.error.body, _response.rawResponse);
799
+ case 401:
800
+ throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
801
+ case 404:
802
+ throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
803
+ default:
804
+ throw new errors.CortiError({
805
+ statusCode: _response.error.statusCode,
806
+ body: _response.error.body,
807
+ rawResponse: _response.rawResponse,
808
+ });
809
+ }
810
+ }
811
+ switch (_response.error.reason) {
812
+ case "non-json":
813
+ throw new errors.CortiError({
814
+ statusCode: _response.error.statusCode,
815
+ body: _response.error.rawBody,
816
+ rawResponse: _response.rawResponse,
817
+ });
818
+ case "timeout":
819
+ throw new errors.CortiTimeoutError("Timeout exceeded when calling GET /agents/{id}/v1/contexts/{contextId}.");
820
+ case "unknown":
821
+ throw new errors.CortiError({
822
+ message: _response.error.errorMessage,
823
+ rawResponse: _response.rawResponse,
824
+ });
825
+ }
826
+ });
827
+ }
828
+ _getAuthorizationHeader() {
829
+ return __awaiter(this, void 0, void 0, function* () {
830
+ const bearer = yield core.Supplier.get(this._options.token);
831
+ if (bearer != null) {
832
+ return `Bearer ${bearer}`;
833
+ }
834
+ return undefined;
835
+ });
836
+ }
837
+ }