@stack-spot/portal-network 1.0.0-betaadp.3 → 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.
- package/CHANGELOG.md +633 -0
- package/dist/api/account.d.ts +413 -277
- package/dist/api/account.d.ts.map +1 -1
- package/dist/api/account.js +261 -176
- package/dist/api/account.js.map +1 -1
- package/dist/api/accountAssetManager.d.ts +309 -0
- package/dist/api/accountAssetManager.d.ts.map +1 -0
- package/dist/api/accountAssetManager.js +169 -0
- package/dist/api/accountAssetManager.js.map +1 -0
- package/dist/api/agent-tools.d.ts +243 -149
- package/dist/api/agent-tools.d.ts.map +1 -1
- package/dist/api/agent-tools.js +77 -5
- package/dist/api/agent-tools.js.map +1 -1
- package/dist/api/agent.d.ts +55 -55
- package/dist/api/agent.d.ts.map +1 -1
- package/dist/api/ai.d.ts +487 -98
- package/dist/api/ai.d.ts.map +1 -1
- package/dist/api/ai.js +427 -146
- package/dist/api/ai.js.map +1 -1
- package/dist/api/cloudPlatform.d.ts +374 -221
- package/dist/api/cloudPlatform.d.ts.map +1 -1
- package/dist/api/cloudPlatform.js +299 -93
- package/dist/api/cloudPlatform.js.map +1 -1
- package/dist/api/cloudPlatformHorizon.d.ts +178 -9
- package/dist/api/cloudPlatformHorizon.d.ts.map +1 -1
- package/dist/api/cloudPlatformHorizon.js +69 -1
- package/dist/api/cloudPlatformHorizon.js.map +1 -1
- package/dist/api/codeShift.d.ts +1125 -83
- package/dist/api/codeShift.d.ts.map +1 -1
- package/dist/api/codeShift.js +538 -16
- package/dist/api/codeShift.js.map +1 -1
- package/dist/api/dataIntegration.d.ts +291 -1
- package/dist/api/dataIntegration.d.ts.map +1 -1
- package/dist/api/dataIntegration.js +254 -0
- package/dist/api/dataIntegration.js.map +1 -1
- package/dist/api/discover.d.ts +98 -12
- package/dist/api/discover.d.ts.map +1 -1
- package/dist/api/discover.js +78 -2
- package/dist/api/discover.js.map +1 -1
- package/dist/api/edpBfa.d.ts +215 -0
- package/dist/api/edpBfa.d.ts.map +1 -0
- package/dist/api/edpBfa.js +87 -0
- package/dist/api/edpBfa.js.map +1 -0
- package/dist/api/genAiInference.d.ts +22 -2
- package/dist/api/genAiInference.d.ts.map +1 -1
- package/dist/api/genAiInference.js +22 -3
- package/dist/api/genAiInference.js.map +1 -1
- package/dist/api/workflows.d.ts +68 -5
- package/dist/api/workflows.d.ts.map +1 -1
- package/dist/api/workflows.js +16 -0
- package/dist/api/workflows.js.map +1 -1
- package/dist/api/workspaceManager.d.ts +16 -10
- package/dist/api/workspaceManager.d.ts.map +1 -1
- package/dist/api/workspaceManager.js +10 -0
- package/dist/api/workspaceManager.js.map +1 -1
- package/dist/api-addresses.d.ts +20 -18
- package/dist/api-addresses.d.ts.map +1 -1
- package/dist/api-addresses.js +81 -21
- package/dist/api-addresses.js.map +1 -1
- package/dist/apis-itau.json +241 -0
- package/dist/apis.json +17 -1
- package/dist/client/account-asset-manager.d.ts +112 -0
- package/dist/client/account-asset-manager.d.ts.map +1 -0
- package/dist/client/account-asset-manager.js +160 -0
- package/dist/client/account-asset-manager.js.map +1 -0
- package/dist/client/account.d.ts +265 -242
- package/dist/client/account.d.ts.map +1 -1
- package/dist/client/account.js +80 -34
- package/dist/client/account.js.map +1 -1
- package/dist/client/agent-tools.d.ts +166 -119
- package/dist/client/agent-tools.d.ts.map +1 -1
- package/dist/client/agent-tools.js +62 -11
- package/dist/client/agent-tools.js.map +1 -1
- package/dist/client/agent.d.ts +46 -46
- package/dist/client/agent.d.ts.map +1 -1
- package/dist/client/ai.d.ts +266 -79
- package/dist/client/ai.d.ts.map +1 -1
- package/dist/client/ai.js +262 -20
- package/dist/client/ai.js.map +1 -1
- package/dist/client/api-management.d.ts +10 -1
- package/dist/client/api-management.d.ts.map +1 -1
- package/dist/client/api-management.js +11 -2
- package/dist/client/api-management.js.map +1 -1
- package/dist/client/cloud-account.d.ts +13 -13
- package/dist/client/cloud-platform-horizon.d.ts +38 -19
- package/dist/client/cloud-platform-horizon.d.ts.map +1 -1
- package/dist/client/cloud-platform-horizon.js +19 -1
- package/dist/client/cloud-platform-horizon.js.map +1 -1
- package/dist/client/cloud-platform.d.ts +213 -46
- package/dist/client/cloud-platform.d.ts.map +1 -1
- package/dist/client/cloud-platform.js +168 -33
- package/dist/client/cloud-platform.js.map +1 -1
- package/dist/client/cloud-runtimes.d.ts +4 -4
- package/dist/client/cloud-services.d.ts +17 -17
- package/dist/client/cloud-services.d.ts.map +1 -1
- package/dist/client/code-shift.d.ts +535 -162
- package/dist/client/code-shift.d.ts.map +1 -1
- package/dist/client/code-shift.js +296 -7
- package/dist/client/code-shift.js.map +1 -1
- package/dist/client/content.d.ts +127 -132
- package/dist/client/content.d.ts.map +1 -1
- package/dist/client/data-integration.d.ts +92 -53
- package/dist/client/data-integration.d.ts.map +1 -1
- package/dist/client/data-integration.js +38 -2
- package/dist/client/data-integration.js.map +1 -1
- package/dist/client/discover.d.ts +31 -10
- package/dist/client/discover.d.ts.map +1 -1
- package/dist/client/discover.js +239 -3
- package/dist/client/discover.js.map +1 -1
- package/dist/client/edp-bfa.d.ts +16 -0
- package/dist/client/edp-bfa.d.ts.map +1 -0
- package/dist/client/edp-bfa.js +24 -0
- package/dist/client/edp-bfa.js.map +1 -0
- package/dist/client/event-bus.d.ts.map +1 -1
- package/dist/client/gen-ai-inference.d.ts +20 -20
- package/dist/client/insights.d.ts +7 -7
- package/dist/client/notification.d.ts +17 -10
- package/dist/client/notification.d.ts.map +1 -1
- package/dist/client/notification.js +10 -1
- package/dist/client/notification.js.map +1 -1
- package/dist/client/runtime-manager.d.ts +8 -8
- package/dist/client/secrets.d.ts.map +1 -1
- package/dist/client/secrets.js +1 -1
- package/dist/client/secrets.js.map +1 -1
- package/dist/client/types.d.ts +50 -7
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/workflow.d.ts +10 -10
- package/dist/client/workspace-ai.d.ts +53 -53
- package/dist/client/workspace-ai.d.ts.map +1 -1
- package/dist/client/workspace-ai.js +3 -7
- package/dist/client/workspace-ai.js.map +1 -1
- package/dist/client/workspace-manager.d.ts +115 -76
- package/dist/client/workspace-manager.d.ts.map +1 -1
- package/dist/client/workspace-manager.js +47 -2
- package/dist/client/workspace-manager.js.map +1 -1
- package/dist/client/workspace-search.d.ts +2 -2
- package/dist/client/workspace.d.ts +58 -105
- package/dist/client/workspace.d.ts.map +1 -1
- package/dist/error/DefaultAPIError.d.ts.map +1 -1
- package/dist/error/DefaultAPIError.js.map +1 -1
- package/dist/error/StackspotAPIError.d.ts +3 -4
- package/dist/error/StackspotAPIError.d.ts.map +1 -1
- package/dist/error/StackspotAPIError.js +3 -3
- package/dist/error/StackspotAPIError.js.map +1 -1
- package/dist/error/dictionary/accountAssetManager.d.ts +11 -0
- package/dist/error/dictionary/accountAssetManager.d.ts.map +1 -0
- package/dist/error/dictionary/accountAssetManager.js +11 -0
- package/dist/error/dictionary/accountAssetManager.js.map +1 -0
- package/dist/error/dictionary/cloud-platform.d.ts +76 -8
- package/dist/error/dictionary/cloud-platform.d.ts.map +1 -1
- package/dist/error/dictionary/cloud-platform.js +80 -12
- package/dist/error/dictionary/cloud-platform.js.map +1 -1
- package/dist/error/dictionary/workspace-ai.d.ts +9 -0
- package/dist/error/dictionary/workspace-ai.d.ts.map +1 -0
- package/dist/error/dictionary/workspace-ai.js +9 -0
- package/dist/error/dictionary/workspace-ai.js.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/network/NetworkClient.d.ts +4 -2
- package/dist/network/NetworkClient.d.ts.map +1 -1
- package/dist/network/NetworkClient.js +16 -4
- package/dist/network/NetworkClient.js.map +1 -1
- package/dist/network/types.d.ts +2 -0
- package/dist/network/types.d.ts.map +1 -1
- package/dist/utils/StreamedJson.d.ts +3 -1
- package/dist/utils/StreamedJson.d.ts.map +1 -1
- package/dist/utils/StreamedJson.js +23 -3
- package/dist/utils/StreamedJson.js.map +1 -1
- package/package.dev.json +3 -0
- package/package.json +10 -9
- package/package.stg.json +3 -0
- package/readme.md +40 -1
- package/src/api/account.ts +701 -540
- package/src/api/accountAssetManager.ts +771 -0
- package/src/api/agent-tools.ts +332 -151
- package/src/api/ai.ts +891 -170
- package/src/api/cloudPlatform.ts +667 -298
- package/src/api/cloudPlatformHorizon.ts +412 -9
- package/src/api/codeShift.ts +2088 -97
- package/src/api/dataIntegration.ts +635 -1
- package/src/api/discover.ts +180 -14
- package/src/api/edpBfa.ts +472 -0
- package/src/api/genAiInference.ts +47 -4
- package/src/api/workflows.ts +100 -5
- package/src/api/workspaceManager.ts +25 -10
- package/src/api-addresses.ts +113 -38
- package/src/apis-itau.json +241 -0
- package/src/apis.json +17 -1
- package/src/client/account-asset-manager.ts +100 -0
- package/src/client/account.ts +71 -40
- package/src/client/agent-tools.ts +57 -17
- package/src/client/ai.ts +232 -20
- package/src/client/api-management.ts +7 -2
- package/src/client/cloud-platform-horizon.ts +12 -4
- package/src/client/cloud-platform.ts +101 -27
- package/src/client/code-shift.ts +196 -8
- package/src/client/data-integration.ts +28 -1
- package/src/client/discover.ts +238 -5
- package/src/client/edp-bfa.ts +24 -0
- package/src/client/notification.ts +6 -1
- package/src/client/secrets.ts +1 -1
- package/src/client/types.ts +55 -9
- package/src/client/workspace-ai.ts +19 -23
- package/src/client/workspace-manager.ts +31 -2
- package/src/error/DefaultAPIError.ts +5 -5
- package/src/error/StackspotAPIError.ts +4 -4
- package/src/error/dictionary/accountAssetManager.ts +12 -0
- package/src/error/dictionary/cloud-platform.ts +80 -12
- package/src/error/dictionary/workspace-ai.ts +10 -0
- package/src/index.ts +6 -3
- package/src/network/NetworkClient.ts +18 -6
- package/src/network/types.ts +3 -0
- package/src/utils/StreamedJson.tsx +19 -4
package/src/client/code-shift.ts
CHANGED
|
@@ -48,10 +48,42 @@ import {
|
|
|
48
48
|
updateRepositoryServiceV1ReposRepositoryIdPut,
|
|
49
49
|
validateScmUrlServiceV1ReposValidateScmUrlPost,
|
|
50
50
|
listUserServiceV1UsersGet,
|
|
51
|
+
analyticsProgramGroupsDetailsV1AnalyticsProgramGroupsDetailsGet,
|
|
52
|
+
analyticsProgramGroupsDetailsDownloadV1AnalyticsProgramGroupsDetailsDownloadGet,
|
|
53
|
+
getModuleInputsV1ModulesModuleIdInputsGet,
|
|
54
|
+
analyticsRepositoryDetailedReportDownloadV1AnalyticsRepositoriesDetailsDownloadGet,
|
|
55
|
+
analyticsRepositoryDetailedReportV1AnalyticsRepositoriesDetailsGet,
|
|
56
|
+
listRepositoryDownloadServiceV1ReposDownloadGet,
|
|
57
|
+
listProgramGroupDownloadServiceV1ProgramGroupsDownloadGet,
|
|
58
|
+
getModuleV1ModulesModuleIdGet,
|
|
59
|
+
analyticsProgramGroupsTargetDetailsV1AnalyticsProgramGroupsTargetDetailsGet,
|
|
60
|
+
analyticsProgramGroupsTargetDetailsDownloadV1AnalyticsProgramGroupsTargetDetailsDownloadGet,
|
|
61
|
+
searchReposScmServiceV2ReposSearchScmPost,
|
|
62
|
+
importReposWithTagsScmServiceV2ReposSearchScmSearchIdPost,
|
|
63
|
+
searchReposScmV2V2ReposSearchScmSearchIdGet,
|
|
64
|
+
analyticsRepositoryTargetDetailsV1AnalyticsRepositoriesTargetDetailsGet,
|
|
65
|
+
analyticsRepositoryTargetDetailsDownloadV1AnalyticsRepositoriesTargetDetailsDownloadGet,
|
|
66
|
+
putCustomerRatingReportV1ReportsReportIdCustomerRatingPut,
|
|
67
|
+
updateModuleServiceV1ModulesModuleIdPut,
|
|
68
|
+
downloadSearchReposScmV2V2ReposSearchScmSearchIdDownloadGet,
|
|
69
|
+
moduleFavoriteServiceAddV1ModulesModuleIdFavoritesPost,
|
|
70
|
+
moduleFavoriteServiceDeleteV1ModulesModuleIdFavoritesDelete,
|
|
71
|
+
patHealthCheckV1ScmPatHealthCheckGet,
|
|
72
|
+
getModuleDocsV1ModulesModuleIdDocsGet,
|
|
73
|
+
analyticsModuleExecutionTimesReportV1AnalyticsModulesExecutionTimesGet,
|
|
74
|
+
analyticsModuleExecutionTimesDownloadV1AnalyticsModulesExecutionTimesDownloadGet,
|
|
75
|
+
createReposBatchServiceV2ReposBatchPost,
|
|
76
|
+
getImportResultV2ReposBatchImportIdGet,
|
|
77
|
+
downloadImportResultV2ReposBatchImportIdDownloadGet,
|
|
78
|
+
deleteModuleServiceV1ModulesModuleIdDelete,
|
|
79
|
+
createRepositoryServiceV2ReposPost,
|
|
80
|
+
listRepositoryServiceV2ReposGet,
|
|
81
|
+
listModuleExecutionBatchActivitiesV1ActivitiesModuleExecutionBatchGet,
|
|
82
|
+
getModuleExecutionBatchActivitiesByIdV1ActivitiesModuleExecutionBatchModuleExecutionBatchIdGet,
|
|
51
83
|
} from '../api/codeShift'
|
|
52
84
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
53
85
|
import { codeShiftDictionary } from '../error/dictionary/code-shift'
|
|
54
|
-
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
86
|
+
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
55
87
|
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
56
88
|
import { removeAuthorizationParam } from '../utils/remove-authorization-param'
|
|
57
89
|
import { getApiAddresses } from '../api-addresses'
|
|
@@ -69,14 +101,34 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
69
101
|
* Creates a repository.
|
|
70
102
|
*/
|
|
71
103
|
createRepository = this.mutation(removeAuthorizationParam(createRepositoryServiceV1ReposPost))
|
|
104
|
+
/**
|
|
105
|
+
* Creates a repository (v2).
|
|
106
|
+
*/
|
|
107
|
+
createRepositoryV2 = this.mutation(removeAuthorizationParam(createRepositoryServiceV2ReposPost))
|
|
72
108
|
/**
|
|
73
109
|
* Creates repositories in batch.
|
|
74
110
|
*/
|
|
75
111
|
createRepositoriesBatch = this.mutation(removeAuthorizationParam(createReposBatchServiceV1ReposBatchPost))
|
|
112
|
+
/**
|
|
113
|
+
* Imports repositories in batch.
|
|
114
|
+
*/
|
|
115
|
+
createRepositoriesBatchV2 = this.mutation(removeAuthorizationParam(createReposBatchServiceV2ReposBatchPost))
|
|
116
|
+
/**
|
|
117
|
+
* Gets the status of a batch import.
|
|
118
|
+
*/
|
|
119
|
+
getImportBatchResultsV2 = this.query(removeAuthorizationParam(getImportResultV2ReposBatchImportIdGet))
|
|
120
|
+
/**
|
|
121
|
+
* Downloads the import result for a batch.
|
|
122
|
+
*/
|
|
123
|
+
downloadImportBatchResultsV2 = this.query(removeAuthorizationParam(downloadImportResultV2ReposBatchImportIdDownloadGet))
|
|
76
124
|
/**
|
|
77
125
|
* Gets list of repositories.
|
|
78
126
|
*/
|
|
79
127
|
repositories = this.query(removeAuthorizationParam(listRepositoryServiceV1ReposGet))
|
|
128
|
+
/**
|
|
129
|
+
* Gets list of repositories (v2).
|
|
130
|
+
*/
|
|
131
|
+
repositoriesV2 = this.query(removeAuthorizationParam(listRepositoryServiceV2ReposGet))
|
|
80
132
|
/**
|
|
81
133
|
* Gets a repository
|
|
82
134
|
*/
|
|
@@ -89,6 +141,10 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
89
141
|
* Updates a repository
|
|
90
142
|
*/
|
|
91
143
|
updateRepository = this.mutation(removeAuthorizationParam(updateRepositoryServiceV1ReposRepositoryIdPut))
|
|
144
|
+
/**
|
|
145
|
+
* List Repository Download Service
|
|
146
|
+
*/
|
|
147
|
+
repositoryDownload = this.query(removeAuthorizationParam(listRepositoryDownloadServiceV1ReposDownloadGet))
|
|
92
148
|
/**
|
|
93
149
|
* Get a report for a pull request by id.
|
|
94
150
|
*/
|
|
@@ -97,14 +153,42 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
97
153
|
* Gets modules.
|
|
98
154
|
*/
|
|
99
155
|
modules = this.query(removeAuthorizationParam(listModulesServiceV1ModulesGet))
|
|
156
|
+
/**
|
|
157
|
+
* Gets module by id.
|
|
158
|
+
*/
|
|
159
|
+
module = this.query(removeAuthorizationParam(getModuleV1ModulesModuleIdGet))
|
|
160
|
+
/**
|
|
161
|
+
* Deletes a module by id.
|
|
162
|
+
*/
|
|
163
|
+
deleteModule = this.mutation(removeAuthorizationParam(deleteModuleServiceV1ModulesModuleIdDelete))
|
|
164
|
+
/**
|
|
165
|
+
* Add a module in favorites.
|
|
166
|
+
*/
|
|
167
|
+
addFavoriteModule = this.mutation(removeAuthorizationParam(moduleFavoriteServiceAddV1ModulesModuleIdFavoritesPost))
|
|
168
|
+
/**
|
|
169
|
+
* Remove a module from favorites.
|
|
170
|
+
*/
|
|
171
|
+
removeFavoriteModule = this.mutation(removeAuthorizationParam(moduleFavoriteServiceDeleteV1ModulesModuleIdFavoritesDelete))
|
|
172
|
+
/**
|
|
173
|
+
* Gets module inputs.
|
|
174
|
+
*/
|
|
175
|
+
modulesInputs = this.query(removeAuthorizationParam(getModuleInputsV1ModulesModuleIdInputsGet))
|
|
100
176
|
/**
|
|
101
177
|
* Creates a module.
|
|
102
178
|
*/
|
|
103
179
|
createModule = this.mutation(removeAuthorizationParam(createModuleServiceV1ModulesPost))
|
|
180
|
+
/**
|
|
181
|
+
* Updates a module.
|
|
182
|
+
*/
|
|
183
|
+
updateModule = this.mutation(removeAuthorizationParam(updateModuleServiceV1ModulesModuleIdPut))
|
|
104
184
|
/**
|
|
105
185
|
* Generates a report.
|
|
106
186
|
*/
|
|
107
187
|
generateReport = this.mutation(removeAuthorizationParam(dispatchModuleServiceV1ModulesDispatchesPost))
|
|
188
|
+
/**
|
|
189
|
+
* Gets module docs.
|
|
190
|
+
*/
|
|
191
|
+
moduleDocs = this.query(removeAuthorizationParam(getModuleDocsV1ModulesModuleIdDocsGet))
|
|
108
192
|
/**
|
|
109
193
|
* Gets repository reports.
|
|
110
194
|
*/
|
|
@@ -117,6 +201,12 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
117
201
|
* Downloads a report as a csv file.
|
|
118
202
|
*/
|
|
119
203
|
downloadReport = this.query(removeAuthorizationParam(downloadReportV1ReportsReportIdDownloadGet))
|
|
204
|
+
/**
|
|
205
|
+
* Put Customer Rating Report
|
|
206
|
+
*/
|
|
207
|
+
updateReportRating = this.mutation(
|
|
208
|
+
removeAuthorizationParam(putCustomerRatingReportV1ReportsReportIdCustomerRatingPut),
|
|
209
|
+
)
|
|
120
210
|
/**
|
|
121
211
|
* Gets code shift settings
|
|
122
212
|
*/
|
|
@@ -134,9 +224,28 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
134
224
|
*/
|
|
135
225
|
searchRepositoryStatus = this.query(removeAuthorizationParam(getStatusSearchReposScmServiceV1ReposSearchScmSearchRepoIdStatusGet))
|
|
136
226
|
/**
|
|
227
|
+
* @deprecated
|
|
137
228
|
* Downloads file with found repositories
|
|
138
229
|
*/
|
|
139
230
|
downloadSearchRepository = this.mutation(removeAuthorizationParam(downloadSearchReposScmServiceV1ReposSearchScmSearchRepoIdDownloadGet))
|
|
231
|
+
/**
|
|
232
|
+
* Searches for repositories (v2)
|
|
233
|
+
*/
|
|
234
|
+
searchRepositoryV2 = this.mutation(removeAuthorizationParam(searchReposScmServiceV2ReposSearchScmPost))
|
|
235
|
+
/**
|
|
236
|
+
* Imports repositories (v2)
|
|
237
|
+
*/
|
|
238
|
+
importRepositories = this.mutation(removeAuthorizationParam(importReposWithTagsScmServiceV2ReposSearchScmSearchIdPost))
|
|
239
|
+
/**
|
|
240
|
+
* Gets repositories search by id (v2)
|
|
241
|
+
*/
|
|
242
|
+
getRepositoriesBySearchId = this.query(removeAuthorizationParam(searchReposScmV2V2ReposSearchScmSearchIdGet))
|
|
243
|
+
/**
|
|
244
|
+
* Downloads file with found repositories (v2)
|
|
245
|
+
*/
|
|
246
|
+
downloadSearchRepositoryV2 = this.mutation(
|
|
247
|
+
removeAuthorizationParam(downloadSearchReposScmV2V2ReposSearchScmSearchIdDownloadGet),
|
|
248
|
+
)
|
|
140
249
|
/**
|
|
141
250
|
* Validate if the user has permission.
|
|
142
251
|
* We do not use opa in this api, so this is the fn needed to check permissions.
|
|
@@ -192,6 +301,10 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
192
301
|
* Deletes a program group.
|
|
193
302
|
*/
|
|
194
303
|
deleteProgramGroup = this.mutation(removeAuthorizationParam(deleteProgramGroupServiceV1ProgramGroupsProgramGroupIdDelete))
|
|
304
|
+
/**
|
|
305
|
+
* List Program Group Download Service
|
|
306
|
+
*/
|
|
307
|
+
programGroupDownload = this.query(removeAuthorizationParam(listProgramGroupDownloadServiceV1ProgramGroupsDownloadGet))
|
|
195
308
|
/**
|
|
196
309
|
* Gets list of tags.
|
|
197
310
|
*/
|
|
@@ -200,11 +313,14 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
200
313
|
* Validates a SCM URL.
|
|
201
314
|
*/
|
|
202
315
|
validateSCMUrl = this.mutation(removeAuthorizationParam(validateScmUrlServiceV1ReposValidateScmUrlPost))
|
|
316
|
+
/**
|
|
317
|
+
* PAT Health Check
|
|
318
|
+
*/
|
|
319
|
+
checkScmPatHealth = this.query(removeAuthorizationParam(patHealthCheckV1ScmPatHealthCheckGet))
|
|
203
320
|
/**
|
|
204
321
|
* Get Branches for a Repository
|
|
205
322
|
*/
|
|
206
323
|
getBranches = this.query(removeAuthorizationParam(listBranchesServiceV1ReposBranchesGet))
|
|
207
|
-
|
|
208
324
|
/**
|
|
209
325
|
* General Report Success And Errors
|
|
210
326
|
*/
|
|
@@ -234,9 +350,11 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
234
350
|
removeAuthorizationParam(analyticsProgramGroupsLastReportStatusV1AnalyticsProgramGroupsLastReportStatusGet),
|
|
235
351
|
)
|
|
236
352
|
/**
|
|
237
|
-
* Analytics Program Groups
|
|
353
|
+
* Analytics Program Groups Last Report Status Download
|
|
238
354
|
*/
|
|
239
|
-
|
|
355
|
+
analyticsProgramGroupsLastReportStatusDownload = this.query(
|
|
356
|
+
removeAuthorizationParam(analyticsProgramGroupsLastReportStatusDownloadV1AnalyticsProgramGroupsLastReportStatusDownloadGet),
|
|
357
|
+
)
|
|
240
358
|
/**
|
|
241
359
|
* Analytics User Usage
|
|
242
360
|
*/
|
|
@@ -252,11 +370,9 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
252
370
|
removeAuthorizationParam(analyticsRepositoryUsageDownloadV1AnalyticsRepositoriesUsageDownloadGet),
|
|
253
371
|
)
|
|
254
372
|
/**
|
|
255
|
-
* Analytics Program Groups
|
|
373
|
+
* Analytics Program Groups Usage
|
|
256
374
|
*/
|
|
257
|
-
|
|
258
|
-
removeAuthorizationParam(analyticsProgramGroupsLastReportStatusDownloadV1AnalyticsProgramGroupsLastReportStatusDownloadGet),
|
|
259
|
-
)
|
|
375
|
+
analyticsProgramGroupsUsage = this.query(removeAuthorizationParam(analyticsProgramGroupsUsageV1AnalyticsProgramGroupsUsageGet))
|
|
260
376
|
/**
|
|
261
377
|
* Analytics Program Groups Usage Download
|
|
262
378
|
*/
|
|
@@ -269,6 +385,78 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
269
385
|
getUsersService = this.query(
|
|
270
386
|
removeAuthorizationParam(listUserServiceV1UsersGet),
|
|
271
387
|
)
|
|
388
|
+
/**
|
|
389
|
+
* Analytics Program Groups Details
|
|
390
|
+
*/
|
|
391
|
+
analyticsProgramGroupsDetails = this.query(
|
|
392
|
+
removeAuthorizationParam(analyticsProgramGroupsDetailsV1AnalyticsProgramGroupsDetailsGet),
|
|
393
|
+
)
|
|
394
|
+
/**
|
|
395
|
+
* Analytics Program Groups Details Download
|
|
396
|
+
*/
|
|
397
|
+
analyticsProgramGroupsDetailsDownload = this.query(
|
|
398
|
+
removeAuthorizationParam(analyticsProgramGroupsDetailsDownloadV1AnalyticsProgramGroupsDetailsDownloadGet),
|
|
399
|
+
)
|
|
400
|
+
/**
|
|
401
|
+
* Analytics Program Groups Details
|
|
402
|
+
*/
|
|
403
|
+
analyticsRepositoryDetails = this.query(
|
|
404
|
+
removeAuthorizationParam(analyticsRepositoryDetailedReportV1AnalyticsRepositoriesDetailsGet),
|
|
405
|
+
)
|
|
406
|
+
/**
|
|
407
|
+
* Analytics Program Groups Details Download
|
|
408
|
+
*/
|
|
409
|
+
analyticsRepositoryDetailsDownload = this.query(
|
|
410
|
+
removeAuthorizationParam(analyticsRepositoryDetailedReportDownloadV1AnalyticsRepositoriesDetailsDownloadGet),
|
|
411
|
+
)
|
|
412
|
+
/**
|
|
413
|
+
* Analytics Program Groups Target Details
|
|
414
|
+
*/
|
|
415
|
+
analyticsProgramGroupsTargetDetails = this.query(
|
|
416
|
+
removeAuthorizationParam(analyticsProgramGroupsTargetDetailsV1AnalyticsProgramGroupsTargetDetailsGet),
|
|
417
|
+
)
|
|
418
|
+
/**
|
|
419
|
+
* Analytics Program Groups Target Details Download
|
|
420
|
+
*/
|
|
421
|
+
analyticsProgramGroupsTargetDetailsDownload = this.query(
|
|
422
|
+
removeAuthorizationParam(analyticsProgramGroupsTargetDetailsDownloadV1AnalyticsProgramGroupsTargetDetailsDownloadGet),
|
|
423
|
+
)
|
|
424
|
+
/**
|
|
425
|
+
* Analytics Repository Target Details
|
|
426
|
+
*/
|
|
427
|
+
analyticsRepositoryTargetDetails = this.query(
|
|
428
|
+
removeAuthorizationParam(analyticsRepositoryTargetDetailsV1AnalyticsRepositoriesTargetDetailsGet),
|
|
429
|
+
)
|
|
430
|
+
/**
|
|
431
|
+
* Analytics Repository Target Details Download
|
|
432
|
+
*/
|
|
433
|
+
analyticsRepositoryTargetDetailsDownload = this.query(
|
|
434
|
+
removeAuthorizationParam(analyticsRepositoryTargetDetailsDownloadV1AnalyticsRepositoriesTargetDetailsDownloadGet),
|
|
435
|
+
)
|
|
436
|
+
/**
|
|
437
|
+
* Analytics Modules Execution Times
|
|
438
|
+
*/
|
|
439
|
+
analyticsModulesExecutionTimes = this.query(
|
|
440
|
+
removeAuthorizationParam(analyticsModuleExecutionTimesReportV1AnalyticsModulesExecutionTimesGet),
|
|
441
|
+
)
|
|
442
|
+
/**
|
|
443
|
+
* Analytics Modules Execution Times Download
|
|
444
|
+
*/
|
|
445
|
+
analyticsModulesExecutionTimesDownload = this.query(
|
|
446
|
+
removeAuthorizationParam(analyticsModuleExecutionTimesDownloadV1AnalyticsModulesExecutionTimesDownloadGet),
|
|
447
|
+
)
|
|
448
|
+
/**
|
|
449
|
+
* List Module Execution Batch Activities
|
|
450
|
+
*/
|
|
451
|
+
activitiesModuleExecutionBatch = this.query(
|
|
452
|
+
removeAuthorizationParam(listModuleExecutionBatchActivitiesV1ActivitiesModuleExecutionBatchGet),
|
|
453
|
+
)
|
|
454
|
+
/**
|
|
455
|
+
* Get Module Execution Batch Activity by ID
|
|
456
|
+
*/
|
|
457
|
+
activityModuleExecutionBatch = this.query(
|
|
458
|
+
removeAuthorizationParam(getModuleExecutionBatchActivitiesByIdV1ActivitiesModuleExecutionBatchModuleExecutionBatchIdGet),
|
|
459
|
+
)
|
|
272
460
|
}
|
|
273
461
|
|
|
274
462
|
export const codeShiftClient = new CodeShift()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
+
import { getApiAddresses } from '../api-addresses'
|
|
2
3
|
import {
|
|
3
4
|
addFavoriteV1KnowledgeSourcesSlugFavoritePost,
|
|
4
5
|
createKsV1KnowledgeSourcesPost,
|
|
@@ -10,10 +11,13 @@ import {
|
|
|
10
11
|
findKsV1KnowledgeSourcesSlugGet,
|
|
11
12
|
forkKsV1KnowledgeSourcesSlugForkPost,
|
|
12
13
|
getFileUploadStatusV1FileUploadFileUploadIdGet,
|
|
14
|
+
getIndexedFilesV1KnowledgeSourcesKsSlugFilesGet,
|
|
13
15
|
getUploadFormV1FileUploadFormPost,
|
|
14
16
|
getUploadFormV2V2FileUploadFormPost,
|
|
15
17
|
listKosV1KnowledgeSourcesKsSlugObjectsGet,
|
|
18
|
+
listKosV2KnowledgeSourcesKsSlugObjectsGet,
|
|
16
19
|
listKsV1KnowledgeSourcesGet,
|
|
20
|
+
listKsV2KnowledgeSourcesGet,
|
|
17
21
|
publishKsV1KnowledgeSourcesSlugPublishPost,
|
|
18
22
|
resetKosV1KnowledgeSourcesKsSlugObjectsDelete,
|
|
19
23
|
saveChunkedFilesDeprecatedV1FileUploadFileUploadIdPost,
|
|
@@ -31,7 +35,10 @@ import { FileUploadError } from '../error/FileUploadError'
|
|
|
31
35
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
32
36
|
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
33
37
|
import { removeAuthorizationParam } from '../utils/remove-authorization-param'
|
|
34
|
-
|
|
38
|
+
|
|
39
|
+
const listKSV2WithoutAuthorization = removeAuthorizationParam(listKsV2KnowledgeSourcesGet)
|
|
40
|
+
const listKOV2WithoutAuthorization = removeAuthorizationParam(listKosV2KnowledgeSourcesKsSlugObjectsGet)
|
|
41
|
+
|
|
35
42
|
|
|
36
43
|
class DataIntegrationClient extends ReactQueryNetworkClient {
|
|
37
44
|
constructor() {
|
|
@@ -89,6 +96,17 @@ class DataIntegrationClient extends ReactQueryNetworkClient {
|
|
|
89
96
|
* List of knowledge sources
|
|
90
97
|
*/
|
|
91
98
|
knowledgeSources = this.query(removeAuthorizationParam(listKsV1KnowledgeSourcesGet))
|
|
99
|
+
/**
|
|
100
|
+
* List of knowledge sources with pagination
|
|
101
|
+
*/
|
|
102
|
+
knowledgeSourcesV2 = this.infiniteQuery(listKSV2WithoutAuthorization, {
|
|
103
|
+
accumulator: 'items',
|
|
104
|
+
getNextPageParam: ({ variables, lastPage, lastPageParam }) => {
|
|
105
|
+
const size = variables.size ?? 1
|
|
106
|
+
const parsedLastPageParam = (lastPageParam as number) ?? variables.page ?? 1
|
|
107
|
+
return lastPage.items && lastPage.items.length < size ? undefined : parsedLastPageParam + 1
|
|
108
|
+
},
|
|
109
|
+
})
|
|
92
110
|
/**
|
|
93
111
|
* Adds the resource of type Knowledge Source to the list of favorites.
|
|
94
112
|
*/
|
|
@@ -101,6 +119,10 @@ class DataIntegrationClient extends ReactQueryNetworkClient {
|
|
|
101
119
|
* List knowledge objects from a knowledge source
|
|
102
120
|
*/
|
|
103
121
|
listKnowledgeObjects = this.query(removeAuthorizationParam(listKosV1KnowledgeSourcesKsSlugObjectsGet))
|
|
122
|
+
/**
|
|
123
|
+
* List knowledge objects from a knowledge source with pagination
|
|
124
|
+
*/
|
|
125
|
+
listKnowledgeObjectsV2 = this.infiniteQuery(listKOV2WithoutAuthorization, { accumulator: 'items' })
|
|
104
126
|
/**
|
|
105
127
|
* Get a knowledge object by id
|
|
106
128
|
*/
|
|
@@ -180,6 +202,11 @@ class DataIntegrationClient extends ReactQueryNetworkClient {
|
|
|
180
202
|
* Delete Knowledge Object from Knowledge Source
|
|
181
203
|
*/
|
|
182
204
|
deleteKnowledgeObjectFromKnowledgeSource = this.mutation(removeAuthorizationParam(deleteKoByIdV1KnowledgeSourcesKsSlugObjectsKoIdDelete))
|
|
205
|
+
/**
|
|
206
|
+
* Get Indexed Files
|
|
207
|
+
*/
|
|
208
|
+
listIndexedProjectFiles = this.query(removeAuthorizationParam(getIndexedFilesV1KnowledgeSourcesKsSlugFilesGet))
|
|
209
|
+
|
|
183
210
|
}
|
|
184
211
|
|
|
185
212
|
export const dataIntegrationClient = new DataIntegrationClient()
|
package/src/client/discover.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
+
import { findLast, last } from 'lodash'
|
|
1
3
|
import { getApiAddresses } from '../api-addresses'
|
|
2
4
|
import { ConversationResponse } from '../api/ai'
|
|
3
|
-
import { create, create1, create2, defaults, deleteById, deleteById1, deleteById2, getAll, getAll1, getAll2, getAllByHypothesis, getById, getById1, getById2, GetOpportunityResponse } from '../api/discover'
|
|
5
|
+
import { create, create1, create2, defaults, deleteById, deleteById1, deleteById2, fetchInsights, getAll, getAll1, getAll2, getAllByHypothesis, getById, getById1, getById2, getInsightById, GetOpportunityResponse, AiChatRequest, refreshInsights } from '../api/discover'
|
|
6
|
+
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
4
7
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
8
|
+
import { StreamedJson } from '../utils/StreamedJson'
|
|
9
|
+
import { baseDictionary } from '../error/dictionary/base'
|
|
10
|
+
import { formatJson } from '../utils/string'
|
|
5
11
|
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
6
12
|
import { aiClient } from './ai'
|
|
13
|
+
import { ChatAgentTool, ChatResponseWithSteps, FixedChatResponse, StepChatStep } from './types'
|
|
14
|
+
import { agentToolsClient } from './agent-tools'
|
|
7
15
|
|
|
8
16
|
export interface ChatConversionDetails extends ConversationResponse {
|
|
9
17
|
opportunityName?: string,
|
|
@@ -15,8 +23,8 @@ class DiscoverClient extends ReactQueryNetworkClient {
|
|
|
15
23
|
super(getApiAddresses().discover.url, defaults)
|
|
16
24
|
}
|
|
17
25
|
|
|
18
|
-
protected buildStackSpotError(error:
|
|
19
|
-
return new
|
|
26
|
+
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
27
|
+
return new DefaultAPIError(error.data, error.status, baseDictionary, error.headers)
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
opportunities = this.query(getAll)
|
|
@@ -45,6 +53,19 @@ class DiscoverClient extends ReactQueryNetworkClient {
|
|
|
45
53
|
|
|
46
54
|
deleteDocument = this.mutation(deleteById2)
|
|
47
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Fetch insights
|
|
58
|
+
*/
|
|
59
|
+
insights = this.query(fetchInsights)
|
|
60
|
+
/**
|
|
61
|
+
* Refresh insights
|
|
62
|
+
*/
|
|
63
|
+
refreshInsights = this.mutation(refreshInsights)
|
|
64
|
+
/**
|
|
65
|
+
* Get Insight by Id
|
|
66
|
+
*/
|
|
67
|
+
insightById = this.query(getInsightById)
|
|
68
|
+
|
|
48
69
|
chats = this.query({
|
|
49
70
|
name: 'chats',
|
|
50
71
|
request: async (_signal, variables: { filter?: string, page?: number, size?: number }) => {
|
|
@@ -64,8 +85,8 @@ class DiscoverClient extends ReactQueryNetworkClient {
|
|
|
64
85
|
{ ...variables, page: variables.page, size: variables.size ?? 40 },
|
|
65
86
|
)
|
|
66
87
|
|
|
67
|
-
const filteredItems = variables.filter
|
|
68
|
-
? chatsHistory.filter((chat) => chat.title.toLowerCase().includes(variables.filter!.toLowerCase()))
|
|
88
|
+
const filteredItems = variables.filter
|
|
89
|
+
? chatsHistory.filter((chat) => chat.title.toLowerCase().includes(variables.filter!.toLowerCase()))
|
|
69
90
|
: chatsHistory
|
|
70
91
|
|
|
71
92
|
const enrichedChats = filteredItems?.map(chat => {
|
|
@@ -81,6 +102,218 @@ class DiscoverClient extends ReactQueryNetworkClient {
|
|
|
81
102
|
return enrichedChats as ChatConversionDetails[]
|
|
82
103
|
},
|
|
83
104
|
})
|
|
105
|
+
|
|
106
|
+
private static async toolsOfAgent(agentId?: string) {
|
|
107
|
+
try {
|
|
108
|
+
const agent = agentId ? await agentToolsClient.agent.query({ agentId }) : undefined
|
|
109
|
+
if (!agent) return []
|
|
110
|
+
const tools: (Omit<ChatAgentTool, 'duration' | 'prompt' | 'output'>)[] = []
|
|
111
|
+
agent.toolkits?.builtin_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
|
|
112
|
+
if (id) tools.push({ image: kit.image_url, id, name: name || id, description })
|
|
113
|
+
}))
|
|
114
|
+
agent.toolkits?.custom_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
|
|
115
|
+
if (id) tools.push({ image: kit.avatar ?? undefined, id, name: name || id, description })
|
|
116
|
+
}))
|
|
117
|
+
return tools
|
|
118
|
+
} catch {
|
|
119
|
+
return []
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
sendChatMessage(request: AiChatRequest & { agentId: string }, minChangeIntervalMS?: number): StreamedJson<ChatResponseWithSteps> {
|
|
125
|
+
const abortController = new AbortController()
|
|
126
|
+
const headers = {
|
|
127
|
+
'Content-Type': 'application/json',
|
|
128
|
+
'Accept': 'text/event-stream',
|
|
129
|
+
}
|
|
130
|
+
const events = this.stream(
|
|
131
|
+
this.resolveURL('/v2/ai/chat'),
|
|
132
|
+
{ method: 'post', body: JSON.stringify(request), headers, signal: abortController.signal },
|
|
133
|
+
)
|
|
134
|
+
/**
|
|
135
|
+
* This function treats events in the streaming that deals with the execution of tools. Since these events are not concatenated like
|
|
136
|
+
* normal streamings of data, we need this separate function to deal with them. It transforms the internal data model of the
|
|
137
|
+
* StreamedJson object whenever an event is triggered.
|
|
138
|
+
*/
|
|
139
|
+
async function transform(event: Partial<FixedChatResponse>, data: Partial<ChatResponseWithSteps>) {
|
|
140
|
+
const info = event.agent_info
|
|
141
|
+
|
|
142
|
+
if (!info) return
|
|
143
|
+
|
|
144
|
+
const tools = await DiscoverClient.toolsOfAgent(request.agentId)
|
|
145
|
+
data.steps = data.steps ? [...data.steps] : []
|
|
146
|
+
|
|
147
|
+
if (info.type === 'planning' && info.action === 'end') {
|
|
148
|
+
data.steps.push({
|
|
149
|
+
id: 'planning',
|
|
150
|
+
type: 'planning',
|
|
151
|
+
status: 'success',
|
|
152
|
+
duration: info.duration || 0,
|
|
153
|
+
steps: info.data?.steps?.map(s => s.goal) ?? [],
|
|
154
|
+
goal: info.data?.plan_goal ?? '',
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
info.data?.steps.forEach(s => data.steps?.push({
|
|
158
|
+
id: s.id,
|
|
159
|
+
type: 'step',
|
|
160
|
+
status: 'pending',
|
|
161
|
+
input: s.goal,
|
|
162
|
+
attempts: [{
|
|
163
|
+
tools: s.tools?.map(t => ({
|
|
164
|
+
...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
|
|
165
|
+
executionId: t.tool_execution_id,
|
|
166
|
+
goal: t.goal,
|
|
167
|
+
})),
|
|
168
|
+
}],
|
|
169
|
+
}))
|
|
170
|
+
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (info.type === 'planning' && info.action === 'awaiting_approval') {
|
|
174
|
+
data.steps.push({
|
|
175
|
+
id: 'planning',
|
|
176
|
+
type: 'planning',
|
|
177
|
+
status: 'awaiting_approval',
|
|
178
|
+
user_question: info.data?.user_question,
|
|
179
|
+
duration: info.duration || 0,
|
|
180
|
+
steps: info.data?.steps?.map(s => s.goal) ?? [],
|
|
181
|
+
goal: info.data?.plan_goal ?? '',
|
|
182
|
+
})
|
|
183
|
+
info.data?.steps.forEach(s => data.steps?.push({
|
|
184
|
+
id: s.id,
|
|
185
|
+
type: 'step',
|
|
186
|
+
status: 'pending',
|
|
187
|
+
input: s.goal,
|
|
188
|
+
attempts: [{
|
|
189
|
+
tools: s.tools?.map(t => ({
|
|
190
|
+
...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
|
|
191
|
+
executionId: t.tool_execution_id,
|
|
192
|
+
goal: t.goal,
|
|
193
|
+
})),
|
|
194
|
+
}],
|
|
195
|
+
}))
|
|
196
|
+
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (info.type === 'step' && info.action === 'start') {
|
|
200
|
+
const step = data.steps.find(s => s.id === info.id)
|
|
201
|
+
if (step) step.status = 'running'
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (info.type === 'step' && info.action === 'end') {
|
|
205
|
+
const step = data.steps.find(s => s.id === info.id) as StepChatStep
|
|
206
|
+
if (step) {
|
|
207
|
+
step.status = 'success'
|
|
208
|
+
step.duration = info.duration
|
|
209
|
+
const lastToolId = last(step.attempts[0].tools)?.id
|
|
210
|
+
const lastAttemptOfLastTool = findLast(step.attempts.map(a => a.tools).flat(), t => t?.id === lastToolId)
|
|
211
|
+
step.output = lastAttemptOfLastTool?.output
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (info.type === 'tool' && info.action === 'awaiting_approval') {
|
|
216
|
+
const tool = tools.find(({ id }) => id === info.data?.tool_id)
|
|
217
|
+
data.steps.push({
|
|
218
|
+
id: info.id,
|
|
219
|
+
type: 'tool',
|
|
220
|
+
status: 'awaiting_approval',
|
|
221
|
+
duration: info.duration || 0,
|
|
222
|
+
input: info.data?.input,
|
|
223
|
+
user_question: info.data?.user_question,
|
|
224
|
+
attempts: [{
|
|
225
|
+
tools: [{
|
|
226
|
+
executionId: info.id,
|
|
227
|
+
id: info.data?.tool_id ?? '',
|
|
228
|
+
name: tool?.name ?? '',
|
|
229
|
+
goal: tool?.goal,
|
|
230
|
+
...tool,
|
|
231
|
+
}],
|
|
232
|
+
}],
|
|
233
|
+
})
|
|
234
|
+
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (info.type === 'tool' && info.action === 'start') {
|
|
238
|
+
const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
|
|
239
|
+
if (!info.data) return
|
|
240
|
+
|
|
241
|
+
//There might be a tool with status awaiting_approval, so we want to inform tool has already started
|
|
242
|
+
if (!currentStep || !currentStep.attempts[0].tools) {
|
|
243
|
+
const input = formatJson(info.data.input)
|
|
244
|
+
const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
|
|
245
|
+
data.steps.push({
|
|
246
|
+
id: info.id,
|
|
247
|
+
type: 'tool',
|
|
248
|
+
status: 'running',
|
|
249
|
+
duration: info.duration || 0,
|
|
250
|
+
input: info.data?.input,
|
|
251
|
+
user_question: info.data?.user_question,
|
|
252
|
+
attempts: [{
|
|
253
|
+
tools: [{ ...tool, executionId: info.id, input }],
|
|
254
|
+
}],
|
|
255
|
+
})
|
|
256
|
+
} else {
|
|
257
|
+
const toolInFirstAttempt = currentStep.attempts[0].tools?.find(t => t.executionId === info.id)
|
|
258
|
+
//One step might have multiple tools. When in an approval mode, we might not have all the tools in the array yet.
|
|
259
|
+
//So we make sure to add any tools that are not in there.
|
|
260
|
+
if (!toolInFirstAttempt) {
|
|
261
|
+
const input = formatJson(info.data.input)
|
|
262
|
+
const tool = tools?.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
|
|
263
|
+
currentStep.attempts[info.data.attempt - 1].tools?.push({
|
|
264
|
+
...tool,
|
|
265
|
+
executionId: info.id,
|
|
266
|
+
input,
|
|
267
|
+
})
|
|
268
|
+
} else {
|
|
269
|
+
const input = formatJson(info.data.input)
|
|
270
|
+
if (info.data.attempt === 1) {
|
|
271
|
+
toolInFirstAttempt.input = input
|
|
272
|
+
} else {
|
|
273
|
+
const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
|
|
274
|
+
currentStep.attempts[info.data.attempt - 1] ??= { tools: [] }
|
|
275
|
+
currentStep.attempts[info.data.attempt - 1].tools?.push({
|
|
276
|
+
...tool,
|
|
277
|
+
executionId: info.id,
|
|
278
|
+
input,
|
|
279
|
+
})
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (info.type === 'tool' && info.action === 'end') {
|
|
286
|
+
const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
|
|
287
|
+
if (!currentStep || !info.data) return
|
|
288
|
+
const tool = currentStep.attempts[info.data.attempt - 1]?.tools?.find(t => t.executionId === info.id)
|
|
289
|
+
if (tool) {
|
|
290
|
+
tool.output = formatJson(info.data.output)
|
|
291
|
+
tool.duration = info.duration
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (info.type === 'final_answer' && info.action === 'start') {
|
|
296
|
+
const answerStep = last(data.steps)
|
|
297
|
+
if (answerStep) answerStep.status = 'running'
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (info.type === 'chat' && info.action === 'end') {
|
|
301
|
+
const answerStep = last(data.steps)
|
|
302
|
+
if (answerStep) {
|
|
303
|
+
answerStep.status = 'success'
|
|
304
|
+
answerStep.duration = info.duration
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return new StreamedJson({
|
|
310
|
+
eventsPromise: events,
|
|
311
|
+
abortController,
|
|
312
|
+
minChangeIntervalMS,
|
|
313
|
+
ignoreKeys: ['agent_info'],
|
|
314
|
+
transform,
|
|
315
|
+
})
|
|
316
|
+
}
|
|
84
317
|
}
|
|
85
318
|
|
|
86
319
|
export const discoverClient = new DiscoverClient()
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
+
import { getApiAddresses } from '../api-addresses'
|
|
3
|
+
import { defaults, executeCodeWorkflow } from '../api/edpBfa'
|
|
4
|
+
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
5
|
+
import { baseDictionary } from '../error/dictionary/base'
|
|
6
|
+
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
7
|
+
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
8
|
+
|
|
9
|
+
class EdpBfaClient extends ReactQueryNetworkClient {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(getApiAddresses().edpBfa.url, defaults)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
15
|
+
return new DefaultAPIError(error.data, error.status, baseDictionary, error.headers)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Triggers an workflow to generate code.
|
|
20
|
+
*/
|
|
21
|
+
generateCode = this.mutation(executeCodeWorkflow)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const edpBfaClient = new EdpBfaClient()
|