@stack-spot/portal-network 1.0.0-betaadp.2 → 1.0.0-dev.1768422812092

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 (230) hide show
  1. package/CHANGELOG.md +633 -0
  2. package/dist/api/account.d.ts +413 -277
  3. package/dist/api/account.d.ts.map +1 -1
  4. package/dist/api/account.js +261 -176
  5. package/dist/api/account.js.map +1 -1
  6. package/dist/api/accountAssetManager.d.ts +309 -0
  7. package/dist/api/accountAssetManager.d.ts.map +1 -0
  8. package/dist/api/accountAssetManager.js +169 -0
  9. package/dist/api/accountAssetManager.js.map +1 -0
  10. package/dist/api/agent-tools.d.ts +243 -149
  11. package/dist/api/agent-tools.d.ts.map +1 -1
  12. package/dist/api/agent-tools.js +77 -5
  13. package/dist/api/agent-tools.js.map +1 -1
  14. package/dist/api/agent.d.ts +55 -55
  15. package/dist/api/agent.d.ts.map +1 -1
  16. package/dist/api/ai.d.ts +487 -98
  17. package/dist/api/ai.d.ts.map +1 -1
  18. package/dist/api/ai.js +427 -146
  19. package/dist/api/ai.js.map +1 -1
  20. package/dist/api/cloudPlatform.d.ts +374 -221
  21. package/dist/api/cloudPlatform.d.ts.map +1 -1
  22. package/dist/api/cloudPlatform.js +299 -93
  23. package/dist/api/cloudPlatform.js.map +1 -1
  24. package/dist/api/cloudPlatformHorizon.d.ts +178 -9
  25. package/dist/api/cloudPlatformHorizon.d.ts.map +1 -1
  26. package/dist/api/cloudPlatformHorizon.js +69 -1
  27. package/dist/api/cloudPlatformHorizon.js.map +1 -1
  28. package/dist/api/codeShift.d.ts +1125 -83
  29. package/dist/api/codeShift.d.ts.map +1 -1
  30. package/dist/api/codeShift.js +538 -16
  31. package/dist/api/codeShift.js.map +1 -1
  32. package/dist/api/dataIntegration.d.ts +291 -1
  33. package/dist/api/dataIntegration.d.ts.map +1 -1
  34. package/dist/api/dataIntegration.js +254 -0
  35. package/dist/api/dataIntegration.js.map +1 -1
  36. package/dist/api/discover.d.ts +380 -0
  37. package/dist/api/discover.d.ts.map +1 -0
  38. package/dist/api/discover.js +256 -0
  39. package/dist/api/discover.js.map +1 -0
  40. package/dist/api/edpBfa.d.ts +215 -0
  41. package/dist/api/edpBfa.d.ts.map +1 -0
  42. package/dist/api/edpBfa.js +87 -0
  43. package/dist/api/edpBfa.js.map +1 -0
  44. package/dist/api/genAiInference.d.ts +22 -2
  45. package/dist/api/genAiInference.d.ts.map +1 -1
  46. package/dist/api/genAiInference.js +22 -3
  47. package/dist/api/genAiInference.js.map +1 -1
  48. package/dist/api/workflows.d.ts +68 -5
  49. package/dist/api/workflows.d.ts.map +1 -1
  50. package/dist/api/workflows.js +16 -0
  51. package/dist/api/workflows.js.map +1 -1
  52. package/dist/api/workspaceManager.d.ts +16 -10
  53. package/dist/api/workspaceManager.d.ts.map +1 -1
  54. package/dist/api/workspaceManager.js +10 -0
  55. package/dist/api/workspaceManager.js.map +1 -1
  56. package/dist/api-addresses.d.ts +20 -18
  57. package/dist/api-addresses.d.ts.map +1 -1
  58. package/dist/api-addresses.js +81 -21
  59. package/dist/api-addresses.js.map +1 -1
  60. package/dist/apis-itau.json +241 -0
  61. package/dist/apis.json +18 -2
  62. package/dist/client/account-asset-manager.d.ts +112 -0
  63. package/dist/client/account-asset-manager.d.ts.map +1 -0
  64. package/dist/client/account-asset-manager.js +160 -0
  65. package/dist/client/account-asset-manager.js.map +1 -0
  66. package/dist/client/account.d.ts +265 -242
  67. package/dist/client/account.d.ts.map +1 -1
  68. package/dist/client/account.js +80 -34
  69. package/dist/client/account.js.map +1 -1
  70. package/dist/client/agent-tools.d.ts +166 -119
  71. package/dist/client/agent-tools.d.ts.map +1 -1
  72. package/dist/client/agent-tools.js +62 -11
  73. package/dist/client/agent-tools.js.map +1 -1
  74. package/dist/client/agent.d.ts +46 -46
  75. package/dist/client/agent.d.ts.map +1 -1
  76. package/dist/client/ai.d.ts +266 -79
  77. package/dist/client/ai.d.ts.map +1 -1
  78. package/dist/client/ai.js +262 -20
  79. package/dist/client/ai.js.map +1 -1
  80. package/dist/client/api-management.d.ts +10 -1
  81. package/dist/client/api-management.d.ts.map +1 -1
  82. package/dist/client/api-management.js +11 -2
  83. package/dist/client/api-management.js.map +1 -1
  84. package/dist/client/cloud-account.d.ts +13 -13
  85. package/dist/client/cloud-platform-horizon.d.ts +38 -19
  86. package/dist/client/cloud-platform-horizon.d.ts.map +1 -1
  87. package/dist/client/cloud-platform-horizon.js +19 -1
  88. package/dist/client/cloud-platform-horizon.js.map +1 -1
  89. package/dist/client/cloud-platform.d.ts +213 -46
  90. package/dist/client/cloud-platform.d.ts.map +1 -1
  91. package/dist/client/cloud-platform.js +168 -33
  92. package/dist/client/cloud-platform.js.map +1 -1
  93. package/dist/client/cloud-runtimes.d.ts +4 -4
  94. package/dist/client/cloud-services.d.ts +17 -17
  95. package/dist/client/cloud-services.d.ts.map +1 -1
  96. package/dist/client/code-shift.d.ts +535 -162
  97. package/dist/client/code-shift.d.ts.map +1 -1
  98. package/dist/client/code-shift.js +296 -7
  99. package/dist/client/code-shift.js.map +1 -1
  100. package/dist/client/content.d.ts +127 -132
  101. package/dist/client/content.d.ts.map +1 -1
  102. package/dist/client/data-integration.d.ts +92 -53
  103. package/dist/client/data-integration.d.ts.map +1 -1
  104. package/dist/client/data-integration.js +38 -2
  105. package/dist/client/data-integration.js.map +1 -1
  106. package/dist/client/discover.d.ts +84 -0
  107. package/dist/client/discover.d.ts.map +1 -0
  108. package/dist/client/discover.js +359 -0
  109. package/dist/client/discover.js.map +1 -0
  110. package/dist/client/edp-bfa.d.ts +16 -0
  111. package/dist/client/edp-bfa.d.ts.map +1 -0
  112. package/dist/client/edp-bfa.js +24 -0
  113. package/dist/client/edp-bfa.js.map +1 -0
  114. package/dist/client/event-bus.d.ts.map +1 -1
  115. package/dist/client/gen-ai-inference.d.ts +20 -20
  116. package/dist/client/insights.d.ts +7 -7
  117. package/dist/client/notification.d.ts +17 -10
  118. package/dist/client/notification.d.ts.map +1 -1
  119. package/dist/client/notification.js +10 -1
  120. package/dist/client/notification.js.map +1 -1
  121. package/dist/client/runtime-manager.d.ts +8 -8
  122. package/dist/client/secrets.d.ts.map +1 -1
  123. package/dist/client/secrets.js +1 -1
  124. package/dist/client/secrets.js.map +1 -1
  125. package/dist/client/types.d.ts +50 -7
  126. package/dist/client/types.d.ts.map +1 -1
  127. package/dist/client/workflow.d.ts +10 -10
  128. package/dist/client/workspace-ai.d.ts +53 -53
  129. package/dist/client/workspace-ai.d.ts.map +1 -1
  130. package/dist/client/workspace-ai.js +3 -7
  131. package/dist/client/workspace-ai.js.map +1 -1
  132. package/dist/client/workspace-manager.d.ts +115 -76
  133. package/dist/client/workspace-manager.d.ts.map +1 -1
  134. package/dist/client/workspace-manager.js +47 -2
  135. package/dist/client/workspace-manager.js.map +1 -1
  136. package/dist/client/workspace-search.d.ts +2 -2
  137. package/dist/client/workspace.d.ts +58 -105
  138. package/dist/client/workspace.d.ts.map +1 -1
  139. package/dist/error/DefaultAPIError.d.ts.map +1 -1
  140. package/dist/error/DefaultAPIError.js.map +1 -1
  141. package/dist/error/StackspotAPIError.d.ts +3 -4
  142. package/dist/error/StackspotAPIError.d.ts.map +1 -1
  143. package/dist/error/StackspotAPIError.js +3 -3
  144. package/dist/error/StackspotAPIError.js.map +1 -1
  145. package/dist/error/dictionary/accountAssetManager.d.ts +11 -0
  146. package/dist/error/dictionary/accountAssetManager.d.ts.map +1 -0
  147. package/dist/error/dictionary/accountAssetManager.js +11 -0
  148. package/dist/error/dictionary/accountAssetManager.js.map +1 -0
  149. package/dist/error/dictionary/cloud-platform.d.ts +76 -8
  150. package/dist/error/dictionary/cloud-platform.d.ts.map +1 -1
  151. package/dist/error/dictionary/cloud-platform.js +80 -12
  152. package/dist/error/dictionary/cloud-platform.js.map +1 -1
  153. package/dist/error/dictionary/workspace-ai.d.ts +9 -0
  154. package/dist/error/dictionary/workspace-ai.d.ts.map +1 -0
  155. package/dist/error/dictionary/workspace-ai.js +9 -0
  156. package/dist/error/dictionary/workspace-ai.js.map +1 -0
  157. package/dist/index.d.ts +6 -4
  158. package/dist/index.d.ts.map +1 -1
  159. package/dist/index.js +5 -3
  160. package/dist/index.js.map +1 -1
  161. package/dist/network/NetworkClient.d.ts +4 -2
  162. package/dist/network/NetworkClient.d.ts.map +1 -1
  163. package/dist/network/NetworkClient.js +16 -4
  164. package/dist/network/NetworkClient.js.map +1 -1
  165. package/dist/network/types.d.ts +2 -0
  166. package/dist/network/types.d.ts.map +1 -1
  167. package/dist/utils/StreamedJson.d.ts +3 -1
  168. package/dist/utils/StreamedJson.d.ts.map +1 -1
  169. package/dist/utils/StreamedJson.js +23 -3
  170. package/dist/utils/StreamedJson.js.map +1 -1
  171. package/package.dev.json +3 -0
  172. package/package.json +10 -9
  173. package/package.stg.json +3 -0
  174. package/readme.md +40 -1
  175. package/src/api/account.ts +701 -540
  176. package/src/api/accountAssetManager.ts +771 -0
  177. package/src/api/agent-tools.ts +332 -151
  178. package/src/api/ai.ts +891 -170
  179. package/src/api/cloudPlatform.ts +667 -298
  180. package/src/api/cloudPlatformHorizon.ts +412 -9
  181. package/src/api/codeShift.ts +2088 -97
  182. package/src/api/dataIntegration.ts +635 -1
  183. package/src/api/discover.ts +601 -0
  184. package/src/api/edpBfa.ts +472 -0
  185. package/src/api/genAiInference.ts +47 -4
  186. package/src/api/workflows.ts +100 -5
  187. package/src/api/workspaceManager.ts +25 -10
  188. package/src/api-addresses.ts +113 -38
  189. package/src/apis-itau.json +241 -0
  190. package/src/apis.json +18 -2
  191. package/src/client/account-asset-manager.ts +100 -0
  192. package/src/client/account.ts +71 -40
  193. package/src/client/agent-tools.ts +57 -17
  194. package/src/client/ai.ts +232 -20
  195. package/src/client/api-management.ts +7 -2
  196. package/src/client/cloud-platform-horizon.ts +12 -4
  197. package/src/client/cloud-platform.ts +101 -27
  198. package/src/client/code-shift.ts +196 -8
  199. package/src/client/data-integration.ts +28 -1
  200. package/src/client/discover.ts +319 -0
  201. package/src/client/edp-bfa.ts +24 -0
  202. package/src/client/notification.ts +6 -1
  203. package/src/client/secrets.ts +1 -1
  204. package/src/client/types.ts +55 -9
  205. package/src/client/workspace-ai.ts +19 -23
  206. package/src/client/workspace-manager.ts +31 -2
  207. package/src/error/DefaultAPIError.ts +5 -5
  208. package/src/error/StackspotAPIError.ts +4 -4
  209. package/src/error/dictionary/accountAssetManager.ts +12 -0
  210. package/src/error/dictionary/cloud-platform.ts +80 -12
  211. package/src/error/dictionary/workspace-ai.ts +10 -0
  212. package/src/index.ts +7 -4
  213. package/src/network/NetworkClient.ts +18 -6
  214. package/src/network/types.ts +3 -0
  215. package/src/utils/StreamedJson.tsx +19 -4
  216. package/dist/api/discovery.d.ts +0 -494
  217. package/dist/api/discovery.d.ts.map +0 -1
  218. package/dist/api/discovery.js +0 -205
  219. package/dist/api/discovery.js.map +0 -1
  220. package/dist/client/adp-mock.d.ts +0 -89
  221. package/dist/client/adp-mock.d.ts.map +0 -1
  222. package/dist/client/adp-mock.js +0 -246
  223. package/dist/client/adp-mock.js.map +0 -1
  224. package/dist/client/discovery.d.ts +0 -110
  225. package/dist/client/discovery.d.ts.map +0 -1
  226. package/dist/client/discovery.js +0 -133
  227. package/dist/client/discovery.js.map +0 -1
  228. package/src/api/discovery.ts +0 -729
  229. package/src/client/adp-mock.ts +0 -244
  230. package/src/client/discovery.ts +0 -73
package/src/client/ai.ts CHANGED
@@ -7,26 +7,33 @@ import {
7
7
  calculateNextStepV1QuickCommandsSlugStepsStepSlugCalculateNextStepPost,
8
8
  callbackV1QuickCommandsCallbackExecutionIdGet,
9
9
  conversationHistoryV1ConversationsConversationIdGet,
10
+ createAnswerForReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersPost,
10
11
  createExecutionV1QuickCommandsCreateExecutionSlugPost,
12
+ createResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsPost,
11
13
  currentV1TokensUsageCurrentGet,
12
- currentV1TokensUsageTotalGet,
13
14
  defaults,
14
15
  deleteConversationV1ConversationsConversationIdDelete,
15
16
  deleteFavoriteV1AiStacksStackIdFavoriteDelete,
16
17
  deleteFavoriteV1QuickCommandsSlugFavoriteDelete,
17
18
  deleteKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdDelete,
19
+ deleteResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdDelete,
20
+ deleteReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdDelete,
18
21
  downloadConversationV1ConversationsConversationIdDownloadGet,
19
22
  findKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdGet,
20
23
  findKnowledgeSourceV1KnowledgeSourcesSlugGet,
21
24
  formatFetchStepV1QuickCommandsSlugStepsStepSlugFetchFormatPost,
22
25
  formatResultV1QuickCommandsSlugResultFormatPost,
23
26
  getContentDependenciesV1ContentContentTypeContentIdDependenciesGet,
27
+ getFlagsV1FlagsGet,
24
28
  getQuickCommandV1QuickCommandsSlugGet,
29
+ getReviewsByResourceV1ResourcesResourceTypeSlugResourceSlugReviewsGet,
30
+ getScriptExecutionStatusV1QuickCommandsScriptExecutionsScriptExecutionIdGet,
25
31
  getUploadFormV1FileUploadFormPost,
26
32
  HttpValidationError,
27
33
  listAiStacksV1AiStacksGet,
28
34
  listAllV1QuickCommandsAllGet,
29
35
  listAllV2QuickCommandsAllGet,
36
+ listAllV3QuickCommandsGet,
30
37
  listAssociationV1WorkspaceWorkspaceIdGet,
31
38
  listConversationsV1ConversationsGet,
32
39
  listKnowledgeSourcesV1KnowledgeSourcesGet,
@@ -38,10 +45,18 @@ import {
38
45
  resetKnowledgeObjectsV1KnowledgeSourcesSlugObjectsDelete,
39
46
  runFetchStepV1QuickCommandsSlugStepsStepSlugFetchRunPost,
40
47
  searchKnowledgeSourcesV1KnowledgeSourcesSearchPost,
48
+ startScriptStepV1QuickCommandsSlugStepsStepSlugStartScriptPost,
49
+ tokensByUserV1AnalyticsTokensByUserGet,
50
+ tokensDailyUsageV1AnalyticsTokensDailyUsageGet,
51
+ totalV1TokensUsageTotalGet,
41
52
  updateQuickCommandV1QuickCommandsSlugPatch,
53
+ updateResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdPatch,
54
+ updateReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdPatch,
42
55
  updateTitleV1ConversationsConversationIdPatch,
43
56
  vectorizeCustomKnowledgeSourceV1KnowledgeSourcesSlugCustomPost,
44
57
  } from '../api/ai'
58
+
59
+
45
60
  import { StackspotAPIError } from '../error/StackspotAPIError'
46
61
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
47
62
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
@@ -49,6 +64,7 @@ import { StreamedJson } from '../utils/StreamedJson'
49
64
  import { formatJson } from '../utils/string'
50
65
  import { agentToolsClient } from './agent-tools'
51
66
  import {
67
+ AgentInfo,
52
68
  ChatAgentTool,
53
69
  ChatResponseWithSteps,
54
70
  FixedChatRequest,
@@ -59,6 +75,8 @@ import {
59
75
  StepChatStep,
60
76
  } from './types'
61
77
 
78
+ const listQAV3WithoutAuthorization = removeAuthorizationParam(listAllV3QuickCommandsGet)
79
+
62
80
  class AIClient extends ReactQueryNetworkClient {
63
81
  constructor() {
64
82
  super(getApiAddresses().ai.url, defaults)
@@ -106,7 +124,7 @@ class AIClient extends ReactQueryNetworkClient {
106
124
  /**
107
125
  * Gets total tokens usage
108
126
  */
109
- totalTokensUsage = this.query(removeAuthorizationParam(currentV1TokensUsageTotalGet))
127
+ totalTokensUsage = this.query(removeAuthorizationParam(totalV1TokensUsageTotalGet))
110
128
  /**
111
129
  * Gets current tokens usage
112
130
  */
@@ -124,6 +142,10 @@ class AIClient extends ReactQueryNetworkClient {
124
142
  * Lists all the quick commands according to filters passed as parameter (including QC with secrets).
125
143
  */
126
144
  allQuickCommands = this.query(removeAuthorizationParam(listAllV2QuickCommandsAllGet))
145
+ /**
146
+ * Lists all the quick commands according to filters passed as parameter (including QC with secrets) with pagination.
147
+ */
148
+ allQuickCommandsV3 = this.infiniteQuery(listQAV3WithoutAuthorization, { accumulator: 'items' })
127
149
  /**
128
150
  * Gets a quick command by its slug.
129
151
  */
@@ -257,6 +279,66 @@ class AIClient extends ReactQueryNetworkClient {
257
279
  * Removes the resource of type Quick Command from the list of favorites.
258
280
  */
259
281
  removeFavoriteQuickCommand = this.mutation(removeAuthorizationParam(deleteFavoriteV1QuickCommandsSlugFavoriteDelete))
282
+ /**
283
+ * Get Tokens Daily usage
284
+ */
285
+ analyticsTokensDailyUsage = this.query(removeAuthorizationParam(tokensDailyUsageV1AnalyticsTokensDailyUsageGet))
286
+ /**
287
+ * Get Tokens By User
288
+ */
289
+ analyticsTokensByUser = this.query(removeAuthorizationParam(tokensByUserV1AnalyticsTokensByUserGet))
290
+ /*
291
+ * Lists all the feature flags for this user.
292
+ */
293
+ flags = this.query(getFlagsV1FlagsGet)
294
+ /**
295
+ * Starts the execution of a script step
296
+ */
297
+ startScriptStep = this.mutation(removeAuthorizationParam(startScriptStepV1QuickCommandsSlugStepsStepSlugStartScriptPost))
298
+ /**
299
+ * Gets the status of the execution of a script step
300
+ */
301
+ getStatusScriptStep = this.query(removeAuthorizationParam(getScriptExecutionStatusV1QuickCommandsScriptExecutionsScriptExecutionIdGet))
302
+
303
+ /**
304
+ * Get reviews by resource
305
+ */
306
+ getReviewsByResource = this.query(removeAuthorizationParam(getReviewsByResourceV1ResourcesResourceTypeSlugResourceSlugReviewsGet))
307
+
308
+ /**
309
+ * Create a resource review
310
+ */
311
+ createResourceReview = this.mutation(removeAuthorizationParam(createResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsPost))
312
+
313
+ /**
314
+ * Create an answer for a review
315
+ */
316
+ createAnswerForReview = this.mutation(
317
+ removeAuthorizationParam(createAnswerForReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersPost))
318
+
319
+ /**
320
+ * Update a resource review
321
+ */
322
+ updateResourceReview = this.mutation(
323
+ removeAuthorizationParam(updateResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdPatch))
324
+
325
+ /**
326
+ * Delete a resource review
327
+ */
328
+ deleteResourceReview = this.mutation(
329
+ removeAuthorizationParam(deleteResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdDelete))
330
+
331
+ /**
332
+ * Update a review comment (answer)
333
+ */
334
+ updateReviewComment = this.mutation(
335
+ removeAuthorizationParam(updateReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdPatch))
336
+
337
+ /**
338
+ * Delete a review comment (answer)
339
+ */
340
+ deleteReviewComment = this.mutation(
341
+ removeAuthorizationParam(deleteReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdDelete))
260
342
 
261
343
  private static async toolsOfAgent(agentId?: string) {
262
344
  try {
@@ -266,6 +348,9 @@ class AIClient extends ReactQueryNetworkClient {
266
348
  agent.toolkits?.builtin_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
267
349
  if (id) tools.push({ image: kit.image_url, id, name: name || id, description })
268
350
  }))
351
+ agent.toolkits?.custom_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
352
+ if (id) tools.push({ image: kit.avatar ?? undefined, id, name: name || id, description })
353
+ }))
269
354
  return tools
270
355
  } catch {
271
356
  return []
@@ -283,6 +368,10 @@ class AIClient extends ReactQueryNetworkClient {
283
368
  { method: 'post', body: JSON.stringify(request), headers, signal: abortController.signal },
284
369
  )
285
370
 
371
+ const DYNAMIC_TOOL_ID = 'dynamic'
372
+ function isDynamicTool(info: AgentInfo) {
373
+ return info.type === 'tool' && info.id === DYNAMIC_TOOL_ID
374
+ }
286
375
  /**
287
376
  * This function treats events in the streaming that deals with the execution of tools. Since these events are not concatenated like
288
377
  * normal streamings of data, we need this separate function to deal with them. It transforms the internal data model of the
@@ -293,7 +382,7 @@ class AIClient extends ReactQueryNetworkClient {
293
382
  if (!info) return
294
383
  const tools = await AIClient.toolsOfAgent(request.context?.agent_id)
295
384
  data.steps = data.steps ? [...data.steps] : []
296
-
385
+
297
386
  if (info.type === 'planning' && info.action === 'end') {
298
387
  data.steps.push({
299
388
  id: 'planning',
@@ -303,6 +392,33 @@ class AIClient extends ReactQueryNetworkClient {
303
392
  steps: info.data?.steps?.map(s => s.goal) ?? [],
304
393
  goal: info.data?.plan_goal ?? '',
305
394
  })
395
+
396
+ info.data?.steps.forEach(s => data.steps?.push({
397
+ id: s.id,
398
+ type: 'step',
399
+ status: 'pending',
400
+ input: s.goal,
401
+ attempts: [{
402
+ tools: s.tools?.map(t => ({
403
+ ...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
404
+ executionId: t.tool_execution_id,
405
+ goal: t.goal,
406
+ })),
407
+ }],
408
+ }))
409
+ data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
410
+ }
411
+
412
+ if (info.type === 'planning' && info.action === 'awaiting_approval') {
413
+ data.steps.push({
414
+ id: 'planning',
415
+ type: 'planning',
416
+ status: 'awaiting_approval',
417
+ user_question: info.data?.user_question,
418
+ duration: info.duration || 0,
419
+ steps: info.data?.steps?.map(s => s.goal) ?? [],
420
+ goal: info.data?.plan_goal ?? '',
421
+ })
306
422
  info.data?.steps.forEach(s => data.steps?.push({
307
423
  id: s.id,
308
424
  type: 'step',
@@ -312,6 +428,7 @@ class AIClient extends ReactQueryNetworkClient {
312
428
  tools: s.tools?.map(t => ({
313
429
  ...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
314
430
  executionId: t.tool_execution_id,
431
+ goal: t.goal,
315
432
  })),
316
433
  }],
317
434
  }))
@@ -334,30 +451,121 @@ class AIClient extends ReactQueryNetworkClient {
334
451
  }
335
452
  }
336
453
 
454
+ if (info.type === 'tool_calls' && info.action === 'start') {
455
+ const hasPlanning = data.steps.find(s => s.type === 'planning')
456
+ // On the first tool_calls:start, create the synthetic planning ("dynamic") step.
457
+ if (!hasPlanning) {
458
+ const userPrompt = request.user_prompt === 'string' ? request.user_prompt : JSON.stringify(request.user_prompt)
459
+ data.steps.push({
460
+ id: 'dynamic',
461
+ type: 'planning',
462
+ status: 'success',
463
+ steps: [],
464
+ goal: userPrompt,
465
+ user_question: userPrompt,
466
+ })
467
+ }
468
+ const toolsStepId = data.steps.filter(s => s.id === 'tools' || s.id.startsWith('tools-')).length + 1
469
+ data.steps.push({
470
+ id: `tools-${toolsStepId.toString()}`,
471
+ type: 'step',
472
+ status: 'running',
473
+ attempts: [{ tools: [] }],
474
+ } as StepChatStep)
475
+ }
476
+
477
+ if (info.type === 'tool_calls' && info.action === 'end') {
478
+ const lastStep = findLast(data.steps, s => s.id === 'tools' || s.id.startsWith('tools-')) as StepChatStep
479
+ if (lastStep) {
480
+ lastStep.status = 'success'
481
+ lastStep.duration = info.duration
482
+ const lastAttemptOfLastTool = last(lastStep.attempts.map(a => a.tools).flat())
483
+ lastStep.output = lastAttemptOfLastTool?.output
484
+ }
485
+ }
486
+
487
+ if (info.type === 'tool' && info.action === 'awaiting_approval') {
488
+ const tool = tools.find(({ id }) => id === info.data?.tool_id)
489
+ data.steps.push({
490
+ id: info.id,
491
+ type: 'tool',
492
+ status: 'awaiting_approval',
493
+ duration: info.duration || 0,
494
+ input: info.data?.input,
495
+ user_question: info.data?.user_question,
496
+ attempts: [{
497
+ tools: [{
498
+ executionId: info.id,
499
+ id: info.data?.tool_id ?? '',
500
+ name: tool?.name ?? '',
501
+ goal: tool?.goal,
502
+ ...tool,
503
+ }],
504
+ }],
505
+ })
506
+ data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
507
+ }
508
+
337
509
  if (info.type === 'tool' && info.action === 'start') {
338
- const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
339
- if (!currentStep || !info.data || !currentStep.attempts[0].tools) return
340
- const toolInFirstAttempt = currentStep.attempts[0].tools.find(t => t.executionId === info.id)
341
- if (!toolInFirstAttempt) return
510
+ if (!info.data) return
342
511
  const input = formatJson(info.data.input)
343
- if (info.data.attempt === 0) {
344
- toolInFirstAttempt.input = input
345
- } else {
346
- currentStep.attempts[info.data.attempt] ??= { tools: [] }
347
- currentStep.attempts[info.data.attempt].tools?.push({
348
- ...toolInFirstAttempt,
349
- input,
512
+ const tool = findLast(tools, ({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
513
+
514
+ const currentStep = findLast(data.steps, s => s.status === 'running') as StepChatStep
515
+
516
+ //There might be a tool with status awaiting_approval, so we want to inform tool has already started
517
+ if (!currentStep || !currentStep?.attempts?.[0]?.tools) {
518
+ data.steps.push({
519
+ id: info.id,
520
+ type: 'tool',
521
+ status: 'running',
522
+ duration: info.duration || 0,
523
+ input: info.data?.input,
524
+ user_question: info.data?.user_question,
525
+ attempts: [{
526
+ tools: [{ ...tool, executionId: info.id, input }],
527
+ }],
350
528
  })
529
+ } else {
530
+ const toolInFirstAttempt = findLast(currentStep?.attempts?.[0]?.tools, t => t.executionId === info.id)
531
+ //One step might have multiple tools. When in an approval mode, we might not have all the tools in the array yet.
532
+ //For dynamic tools (id === 'dynamic'), we always push a new tool, since dynamic executions can trigger
533
+ //multiple tool runs in the same step and do not follow the planned tool structure.
534
+ //So we make sure to add any tools that are not in there, or always add for dynamic tools.
535
+ if (!toolInFirstAttempt || isDynamicTool(info)) {
536
+ currentStep.attempts?.[0].tools?.push({
537
+ ...tool,
538
+ executionId: info.id,
539
+ input,
540
+ status: 'running',
541
+ })
542
+ } else {
543
+ const input = formatJson(info.data.input)
544
+ if (info.data.attempt === 1) {
545
+ toolInFirstAttempt.input = input
546
+ } else {
547
+ currentStep.attempts[info.data.attempt - 1] ??= { tools: [] }
548
+ currentStep.attempts[info.data.attempt - 1].tools?.push({
549
+ ...tool,
550
+ executionId: info.id,
551
+ input,
552
+ })
553
+ }
554
+ }
351
555
  }
352
556
  }
353
557
 
354
558
  if (info.type === 'tool' && info.action === 'end') {
355
559
  const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
356
560
  if (!currentStep || !info.data) return
357
- const tool = currentStep.attempts[info.data.attempt]?.tools?.find(t => t.executionId === info.id)
561
+
562
+ // attempt index for tool execution starts at 0 for dynamically executed tools,while for planned tools it starts at 1
563
+ const attempt = isDynamicTool(info) ? info.data.attempt : info.data.attempt - 1
564
+ const tool = last(currentStep?.attempts?.[attempt]?.tools)
358
565
  if (tool) {
359
566
  tool.output = formatJson(info.data.output)
360
567
  tool.duration = info.duration
568
+ tool.status = 'success'
361
569
  }
362
570
  }
363
571
 
@@ -366,11 +574,14 @@ class AIClient extends ReactQueryNetworkClient {
366
574
  if (answerStep) answerStep.status = 'running'
367
575
  }
368
576
 
369
- if (info.type === 'final_answer' && info.action === 'end') {
370
- const answerStep = last(data.steps)
371
- if (answerStep) {
372
- answerStep.status = 'success'
373
- answerStep.duration = info.duration
577
+
578
+ if (info.type === 'chat' && info.action === 'end') {
579
+ const lastStep = last(data.steps)
580
+ if (lastStep?.type === 'answer') {
581
+ lastStep.status = 'success'
582
+ lastStep.duration = info.duration
583
+ } else {
584
+ data.steps.push({ id: 'answer', type: 'answer', status: 'success' })
374
585
  }
375
586
  }
376
587
  }
@@ -381,6 +592,7 @@ class AIClient extends ReactQueryNetworkClient {
381
592
  minChangeIntervalMS,
382
593
  ignoreKeys: ['agent_info'],
383
594
  transform,
595
+ textFromErrorEvent: data => data.answer ?? 'Unknown error',
384
596
  })
385
597
  }
386
598
 
@@ -1,10 +1,10 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
- import { defaults, getEntries, getEntryById, getSubEntries } from '../api/apiManagement'
2
+ import { getApiAddresses } from '../api-addresses'
3
+ import { defaults, downloadObjectArtifacts, getEntries, getEntryById, getSubEntries } from '../api/apiManagement'
3
4
  import { DefaultAPIError } from '../error/DefaultAPIError'
4
5
  import { actionDictionary } from '../error/dictionary/action'
5
6
  import { StackspotAPIError } from '../error/StackspotAPIError'
6
7
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
7
- import { getApiAddresses } from '../api-addresses'
8
8
 
9
9
  class ApiManagementClient extends ReactQueryNetworkClient {
10
10
  constructor() {
@@ -30,6 +30,11 @@ class ApiManagementClient extends ReactQueryNetworkClient {
30
30
  */
31
31
  getApiVersions = this.query(getSubEntries)
32
32
 
33
+ /**
34
+ * Gets the openAPI of one version
35
+ */
36
+ getApiVersionDocs = this.query(downloadObjectArtifacts)
37
+
33
38
  }
34
39
 
35
40
  export const apiManagementClient = new ApiManagementClient()
@@ -4,7 +4,7 @@ import { DefaultAPIError } from '../error/DefaultAPIError'
4
4
  import { StackspotAPIError } from '../error/StackspotAPIError'
5
5
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
6
6
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
7
- import { associateWithWorkspaceEnvironment, createAddon, createDeployTemplate, createOrganization, createRuntime1, createTenant1, defaults, deploy, findApplicationDeploymentById, getApplicationDeploymentHealth, getApplicationDeploymentLogs, getAssociationWorkspaceEnvironmentByRuntimeId, getOrganizationById, getOrganizations, getRuntime1, getTenant1, listAddon, listApplicationDeployments, listAssociations, listDeployTemplate, listRuntimes, listRuntimes1, listTenants, listTenants1 } from '../api/cloudPlatformHorizon'
7
+ import { associateWithWorkspaceEnvironment, createAddon, createDeployTemplate, createOrganization, createRuntime1, createTenant1, defaults, deploy, findApplicationDeploymentById, getApplicationDeploymentHealth, getApplicationDeploymentLogs, getAssociationWorkspaceEnvironmentByRuntimeId, getOrganizationById, getOrganizations, getRuntime1, getTenant1, listAddon, listApplicationDeploymentRollouts, listApplicationDeployments, listAssociations, listDeployTemplate, listRuntimes, listRuntimes1, listTenants, listTenants1, postApplicationDeploymentRolloutAction } from '../api/cloudPlatformHorizon'
8
8
  import { baseDictionary } from '../error/dictionary/base'
9
9
  import { getApiAddresses } from '../api-addresses'
10
10
 
@@ -19,7 +19,7 @@ class CloudPlatformHorizonClient extends ReactQueryNetworkClient {
19
19
  /**
20
20
  * Get a list of organizations
21
21
  */
22
- listOrganizations= this.query(removeAuthorizationParam(getOrganizations))
22
+ listOrganizations = this.query(removeAuthorizationParam(getOrganizations))
23
23
  /**
24
24
  * Get organization by id
25
25
  */
@@ -27,11 +27,11 @@ class CloudPlatformHorizonClient extends ReactQueryNetworkClient {
27
27
  /**
28
28
  * Get details of an tenant
29
29
  */
30
- getTenantById= this.query(removeAuthorizationParam(getTenant1))
30
+ getTenantById = this.query(removeAuthorizationParam(getTenant1))
31
31
  /**
32
32
  * Get details of an runtime
33
33
  */
34
- getRuntimeById= this.query(removeAuthorizationParam(getRuntime1))
34
+ getRuntimeById = this.query(removeAuthorizationParam(getRuntime1))
35
35
  /**
36
36
  * Create an tenant
37
37
  */
@@ -108,6 +108,14 @@ class CloudPlatformHorizonClient extends ReactQueryNetworkClient {
108
108
  * List runtime associations to workspace's environment
109
109
  */
110
110
  listRuntimeAssociationsToEnv = this.query(removeAuthorizationParam(listAssociations))
111
+ /**
112
+ * List of application deployments rollout
113
+ */
114
+ listApplicationDeploymentRollouts = this.query(removeAuthorizationParam(listApplicationDeploymentRollouts))
115
+ /**
116
+ * Set an action to application deployment rollout
117
+ */
118
+ deployApplicationRolloutAction = this.mutation(removeAuthorizationParam(postApplicationDeploymentRolloutAction))
111
119
  }
112
120
 
113
121
  export const cloudPlatformHorizonClient = new CloudPlatformHorizonClient()
@@ -1,21 +1,28 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
- import
3
- {
4
- acceptNetworkConnection,
2
+ import {
5
3
  createCertificate,
6
4
  createCidr,
7
5
  createDnsRecord,
8
6
  createDnsZone,
9
7
  createFolder,
10
8
  createFoundation,
11
- createInbound,
12
9
  createNetwork,
13
- createNetworkConnection,
14
10
  createProject,
11
+ createRuntime,
12
+ createTenant,
15
13
  createVpn,
16
14
  defaults,
15
+ deleteCertificate,
16
+ deleteCidr,
17
+ deleteDnsRecord,
18
+ deleteDnsZone,
19
+ deleteFolder,
20
+ deleteNetwork,
21
+ deleteProject,
22
+ deleteVpn,
17
23
  getCertificate,
18
24
  getFolder,
25
+ getFolderTags,
19
26
  getFoundation,
20
27
  getNetwork,
21
28
  getProject,
@@ -25,11 +32,18 @@ import
25
32
  listDnsRecord,
26
33
  listDnsZone,
27
34
  listFoundations,
28
- listInbound,
29
35
  listNetwork,
30
- listNetworkConnection,
36
+ listRuntime,
37
+ listTenant,
31
38
  listVpns,
32
39
  providers,
40
+ putCertificateTags,
41
+ putCidrTags,
42
+ putDnsZoneTags,
43
+ putFolderTags,
44
+ putNetworkTags,
45
+ putProjectTags,
46
+ putVpnTags,
33
47
  } from '../api/cloudPlatform'
34
48
  import { DefaultAPIError } from '../error/DefaultAPIError'
35
49
  import { StackspotAPIError } from '../error/StackspotAPIError'
@@ -122,26 +136,6 @@ class CloudPlatformClient extends ReactQueryNetworkClient {
122
136
  * Create a network
123
137
  */
124
138
  createNetwork = this.mutation(removeAuthorizationParam(createNetwork))
125
- /**
126
- * Get a list of inbounds
127
- */
128
- listInbounds = this.query(removeAuthorizationParam(listInbound))
129
- /**
130
- * Create a inbound
131
- */
132
- createInbound = this.mutation(removeAuthorizationParam(createInbound))
133
- /**
134
- * Add a network connection
135
- */
136
- addNetworkConnection = this.mutation(removeAuthorizationParam(createNetworkConnection))
137
- /**
138
- * Get a network connection request
139
- */
140
- getNetworkConnections = this.query(removeAuthorizationParam(listNetworkConnection))
141
- /**
142
- * Accept a network connection
143
- */
144
- acceptNetworkConnection = this.mutation(removeAuthorizationParam(acceptNetworkConnection))
145
139
  /**
146
140
  * Get a list of vpn's
147
141
  */
@@ -158,6 +152,86 @@ class CloudPlatformClient extends ReactQueryNetworkClient {
158
152
  * Get a network details
159
153
  */
160
154
  getNetworkById = this.query(removeAuthorizationParam(getNetwork))
155
+ /**
156
+ * Get a list of tenants
157
+ */
158
+ listTenants = this.query(removeAuthorizationParam(listTenant))
159
+ /**
160
+ * Create a tenant
161
+ */
162
+ createTenant = this.mutation(removeAuthorizationParam(createTenant))
163
+ /**
164
+ * Get a list of runtimes
165
+ */
166
+ listRuntimes = this.query(removeAuthorizationParam(listRuntime))
167
+ /**
168
+ * Create a runtime
169
+ */
170
+ createRuntime = this.mutation(removeAuthorizationParam(createRuntime))
171
+ /**
172
+ * Get a list of tags in folder
173
+ */
174
+ getFolderTags = this.query(removeAuthorizationParam(getFolderTags))
175
+ /**
176
+ * Update folder tags
177
+ */
178
+ updateFolderTags = this.mutation(removeAuthorizationParam(putFolderTags))
179
+ /**
180
+ * Update project tags
181
+ */
182
+ updateProjectTags = this.mutation(removeAuthorizationParam(putProjectTags))
183
+ /**
184
+ * Update network tags
185
+ */
186
+ updateNetworkTags = this.mutation(removeAuthorizationParam(putNetworkTags))
187
+ /**
188
+ * Update cidr tags
189
+ */
190
+ updateCidrTags = this.mutation(removeAuthorizationParam(putCidrTags))
191
+ /**
192
+ * Update dns zone tags
193
+ */
194
+ updateDnsZoneTags = this.mutation(removeAuthorizationParam(putDnsZoneTags))
195
+ /**
196
+ * Update certificate tags
197
+ */
198
+ updateCertificateTags = this.mutation(removeAuthorizationParam(putCertificateTags))
199
+ /**
200
+ * Update vpn tags
201
+ */
202
+ updateVpnTags = this.mutation(removeAuthorizationParam(putVpnTags))
203
+ /**
204
+ * Delete a folder
205
+ */
206
+ deleteFolder = this.mutation(removeAuthorizationParam(deleteFolder))
207
+ /**
208
+ * Delete a project
209
+ */
210
+ deleteProject = this.mutation(removeAuthorizationParam(deleteProject))
211
+ /**
212
+ * Delete a network
213
+ */
214
+ deleteNetwork = this.mutation(removeAuthorizationParam(deleteNetwork))
215
+ /**
216
+ * Delete a certificate
217
+ */
218
+ deleteCertificate = this.mutation(removeAuthorizationParam(deleteCertificate))
219
+ /**
220
+ * Delete a dns zone
221
+ */
222
+ deleteDnsZone = this.mutation(removeAuthorizationParam(deleteDnsZone))
223
+ /**
224
+ * Delete a dns record
225
+ */
226
+ deleteDnsRecord = this.mutation(removeAuthorizationParam(deleteDnsRecord))
227
+ /**
228
+ * Delete a VPN
229
+ */
230
+ deleteVPN = this.mutation(removeAuthorizationParam(deleteVpn))
231
+ /**
232
+ * Delete a CIDR
233
+ */
234
+ deleteCidr = this.mutation(removeAuthorizationParam(deleteCidr))
161
235
  }
162
236
 
163
237
  export const cloudPlatformClient = new CloudPlatformClient()