@stack-spot/portal-network 0.203.0 → 0.204.0-beta.1
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 +259 -0
- package/dist/api/account.d.ts +344 -91
- package/dist/api/account.d.ts.map +1 -1
- package/dist/api/account.js +203 -46
- 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 +623 -141
- package/dist/api/agent-tools.d.ts.map +1 -1
- package/dist/api/agent-tools.js +168 -45
- package/dist/api/agent-tools.js.map +1 -1
- package/dist/api/ai.d.ts +135 -24
- package/dist/api/ai.d.ts.map +1 -1
- package/dist/api/ai.js +79 -26
- package/dist/api/ai.js.map +1 -1
- package/dist/api/codeShift.d.ts +140 -10
- package/dist/api/codeShift.d.ts.map +1 -1
- package/dist/api/codeShift.js +73 -6
- package/dist/api/codeShift.js.map +1 -1
- package/dist/api/discover.d.ts +9 -6
- package/dist/api/discover.d.ts.map +1 -1
- package/dist/api/discover.js +5 -5
- 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 +49 -2
- package/dist/api/genAiInference.d.ts.map +1 -1
- package/dist/api/genAiInference.js +55 -2
- package/dist/api/genAiInference.js.map +1 -1
- package/dist/api/workspace-ai.d.ts +41 -0
- package/dist/api/workspace-ai.d.ts.map +1 -1
- package/dist/api/workspace-ai.js +34 -0
- package/dist/api/workspace-ai.js.map +1 -1
- package/dist/api-addresses.d.ts +13 -20
- package/dist/api-addresses.d.ts.map +1 -1
- package/dist/api-addresses.js +60 -17
- package/dist/api-addresses.js.map +1 -1
- package/dist/apis-itau.json +16 -0
- package/dist/apis.json +16 -0
- 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 +11 -9
- package/dist/client/account.d.ts.map +1 -1
- package/dist/client/account.js +11 -8
- package/dist/client/account.js.map +1 -1
- package/dist/client/agent-tools.d.ts +122 -3
- package/dist/client/agent-tools.d.ts.map +1 -1
- package/dist/client/agent-tools.js +105 -10
- package/dist/client/agent-tools.js.map +1 -1
- package/dist/client/ai.d.ts +149 -4
- package/dist/client/ai.d.ts.map +1 -1
- package/dist/client/ai.js +93 -208
- package/dist/client/ai.js.map +1 -1
- package/dist/client/code-shift.d.ts +54 -3
- package/dist/client/code-shift.d.ts.map +1 -1
- package/dist/client/code-shift.js +46 -1
- package/dist/client/code-shift.js.map +1 -1
- package/dist/client/data-integration.d.ts.map +1 -1
- package/dist/client/data-integration.js +8 -1
- package/dist/client/data-integration.js.map +1 -1
- package/dist/client/discover.d.ts +3 -3
- package/dist/client/discover.d.ts.map +1 -1
- package/dist/client/discover.js +4 -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/gen-ai-inference.d.ts +4 -0
- package/dist/client/gen-ai-inference.d.ts.map +1 -1
- package/dist/client/gen-ai-inference.js +267 -0
- package/dist/client/gen-ai-inference.js.map +1 -1
- package/dist/client/notification.d.ts +7 -0
- 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/types.d.ts +24 -17
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/workspace-ai.d.ts +13 -3
- package/dist/client/workspace-ai.d.ts.map +1 -1
- package/dist/client/workspace-ai.js +17 -3
- package/dist/client/workspace-ai.js.map +1 -1
- package/dist/client/workspace-manager.d.ts +24 -0
- package/dist/client/workspace-manager.d.ts.map +1 -1
- package/dist/client/workspace-manager.js +28 -1
- package/dist/client/workspace-manager.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/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/network/NetworkClient.d.ts.map +1 -1
- package/dist/network/NetworkClient.js +12 -2
- package/dist/network/NetworkClient.js.map +1 -1
- package/dist/network/types.d.ts +1 -0
- package/dist/network/types.d.ts.map +1 -1
- package/dist/utils/StreamedJson.d.ts +9 -1
- package/dist/utils/StreamedJson.d.ts.map +1 -1
- package/dist/utils/StreamedJson.js +22 -2
- package/dist/utils/StreamedJson.js.map +1 -1
- package/package.json +2 -2
- package/readme.md +39 -1
- package/src/api/account.ts +592 -165
- package/src/api/accountAssetManager.ts +771 -0
- package/src/api/agent-tools.ts +824 -188
- package/src/api/ai.ts +206 -38
- package/src/api/codeShift.ts +246 -13
- package/src/api/discover.ts +10 -10
- package/src/api/edpBfa.ts +472 -0
- package/src/api/genAiInference.ts +119 -3
- package/src/api/workspace-ai.ts +83 -0
- package/src/api-addresses.ts +93 -37
- package/src/apis-itau.json +16 -0
- package/src/apis.json +16 -0
- package/src/client/account-asset-manager.ts +100 -0
- package/src/client/account.ts +11 -7
- package/src/client/agent-tools.ts +69 -16
- package/src/client/ai.ts +60 -213
- package/src/client/code-shift.ts +29 -0
- package/src/client/data-integration.ts +9 -2
- package/src/client/discover.ts +8 -7
- package/src/client/edp-bfa.ts +24 -0
- package/src/client/gen-ai-inference.ts +281 -0
- package/src/client/notification.ts +6 -1
- package/src/client/types.ts +26 -17
- package/src/client/workspace-ai.ts +21 -6
- package/src/client/workspace-manager.ts +18 -0
- package/src/error/dictionary/accountAssetManager.ts +12 -0
- package/src/index.ts +4 -1
- package/src/network/NetworkClient.ts +13 -4
- package/src/network/types.ts +1 -0
- package/src/utils/StreamedJson.tsx +19 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpError } from '@oazapfts/runtime'
|
|
2
2
|
import { getApiAddresses } from '../api-addresses'
|
|
3
|
-
import { addFavoriteV1AgentsAgentIdFavoritePost, AgentVisibilityLevelEnum, createAgentV1AgentsPost, createToolkitToolsV1ToolkitsToolkitIdToolsPost, createToolkitV1ToolkitsPost, defaults, deleteAgentV1AgentsAgentIdDelete, deleteFavoriteV1AgentsAgentIdFavoriteDelete, deleteToolkitToolsV1ToolkitsToolkitIdToolsDelete, deleteToolkitV1ToolkitsToolkitIdDelete, editToolkitToolV1ToolkitsToolkitIdToolsToolIdPut, forkAgentV1AgentsAgentIdForkPost, forkToolkitV1ToolkitsToolkitIdForkPost, getAgentV1AgentsAgentIdGet, getPublicToolKitsV1BuiltinToolkitGet, getToolkitToolV1ToolkitsToolkitIdToolsToolIdGet, getToolkitV1ToolkitsToolkitIdGet, listAgentsUsingToolsV1ToolkitsToolkitIdToolsAgentsPost, listAgentsV1AgentsGet, listAgentsV3AgentsGet, listMcpToolsV1McpToolsToolkitIdGet, listMultiAgentsV1AgentsMultiAgentsGet, listToolkitsV1ToolkitsGet, publishAgentV1AgentsAgentIdPublishPost,
|
|
3
|
+
import { addFavoriteV1AgentsAgentIdFavoritePost, AgentVisibilityLevelEnum, createAgentV1AgentsPost, createAgentV2AgentsPost, createToolkitToolsV1ToolkitsToolkitIdToolsPost, createToolkitV1ToolkitsPost, createVersionV1AgentsAgentCoreIdVersionsPost, defaults, deleteAgentV1AgentsAgentIdDelete, deleteFavoriteV1AgentsAgentIdFavoriteDelete, deleteToolkitToolsV1ToolkitsToolkitIdToolsDelete, deleteToolkitV1ToolkitsToolkitIdDelete, deleteVersionV1AgentsAgentCoreIdVersionsVersionNumberDelete, editToolkitToolV1ToolkitsToolkitIdToolsToolIdPut, findByAgentCoreIdV2AgentsAgentCoreIdGet, forkAgentV1AgentsAgentIdForkPost, forkAgentVersionV1AgentsAgentCoreIdVersionsVersionNumberForkPost, forkToolkitV1ToolkitsToolkitIdForkPost, getAgentV1AgentsAgentIdGet, getPublicToolKitsV1BuiltinToolkitGet, getToolkitToolV1ToolkitsToolkitIdToolsToolIdGet, getToolkitV1ToolkitsToolkitIdGet, listAgentsUsingToolsV1ToolkitsToolkitIdToolsAgentsPost, listAgentsV1AgentsGet, listAgentsV3AgentsGet, listMcpToolsV1McpToolsToolkitIdGet, listMultiAgentsV1AgentsMultiAgentsGet, listToolkitsV1ToolkitsGet, listToolkitsV2ToolkitsGet, listVersionsOfAgentCoreV1AgentsAgentCoreIdVersionsGet, patchVersionRecommendedV1AgentsAgentCoreIdVersionsVersionNumberPatch, publishAgentV1AgentsAgentIdPublishPost, searchAgentsByIdsV1AgentsSearchPost, shareV1AgentsAgentIdSharePost, updateAgentV1AgentsAgentIdPatch, updateAgentV2AgentsAgentIdPatch, updateToolkitV1ToolkitsToolkitIdPatch, VisibilityLevelEnum } from '../api/agent-tools'
|
|
4
4
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
5
5
|
import { agentToolsDictionary } from '../error/dictionary/agent-tools'
|
|
6
6
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
@@ -13,6 +13,7 @@ import { workspaceAiClient } from './workspace-ai'
|
|
|
13
13
|
|
|
14
14
|
const AGENT_DEFAULT_SLUG = 'stk_flex'
|
|
15
15
|
const listAgentsV3AgentsWithoutAuthorization = removeAuthorizationParam(listAgentsV3AgentsGet)
|
|
16
|
+
const listToolkitsAuthorization = removeAuthorizationParam(listToolkitsV2ToolkitsGet)
|
|
16
17
|
|
|
17
18
|
class AgentToolsClient extends ReactQueryNetworkClient {
|
|
18
19
|
constructor() {
|
|
@@ -29,6 +30,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
29
30
|
tools = this.query(removeAuthorizationParam(getPublicToolKitsV1BuiltinToolkitGet))
|
|
30
31
|
|
|
31
32
|
/**
|
|
33
|
+
* @deprecated
|
|
32
34
|
* Create agent
|
|
33
35
|
*/
|
|
34
36
|
createAgent = this.mutation(removeAuthorizationParam(createAgentV1AgentsPost))
|
|
@@ -39,6 +41,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
39
41
|
deleteAgent = this.mutation(removeAuthorizationParam(deleteAgentV1AgentsAgentIdDelete))
|
|
40
42
|
|
|
41
43
|
/**
|
|
44
|
+
* @deprecated
|
|
42
45
|
* Updates an agent
|
|
43
46
|
*/
|
|
44
47
|
updateAgent = this.mutation(removeAuthorizationParam(updateAgentV1AgentsAgentIdPatch))
|
|
@@ -77,6 +80,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
77
80
|
availableAgentsForMultiAgentAddition = this.query(removeAuthorizationParam(listMultiAgentsV1AgentsMultiAgentsGet))
|
|
78
81
|
|
|
79
82
|
/**
|
|
83
|
+
* @deprecated
|
|
80
84
|
* Gets agent by id
|
|
81
85
|
*/
|
|
82
86
|
agent = this.query(removeAuthorizationParam(getAgentV1AgentsAgentIdGet))
|
|
@@ -84,7 +88,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
84
88
|
/**
|
|
85
89
|
* Gets agents by ids
|
|
86
90
|
*/
|
|
87
|
-
agentsByIds = this.query(removeAuthorizationParam(
|
|
91
|
+
agentsByIds = this.query(removeAuthorizationParam(searchAgentsByIdsV1AgentsSearchPost))
|
|
88
92
|
|
|
89
93
|
/**
|
|
90
94
|
* Gets the default agent slug
|
|
@@ -97,11 +101,11 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
97
101
|
agentDefault = this.query({
|
|
98
102
|
name: 'agentDefault',
|
|
99
103
|
request: async (signal) => {
|
|
100
|
-
const agentDefault = await
|
|
101
|
-
{
|
|
104
|
+
const agentDefault = await listAgentsV3AgentsGet(
|
|
105
|
+
{ filters: { visibility_list: ['built_in'], slug: this.agentDefaultSlug }, authorization: '' }, { signal },
|
|
102
106
|
)
|
|
103
107
|
|
|
104
|
-
const agentId = agentDefault?.find((agent) => agent.slug === this.agentDefaultSlug)?.id
|
|
108
|
+
const agentId = agentDefault?.items?.find((agent) => agent.slug === this.agentDefaultSlug)?.id
|
|
105
109
|
const agent = agentId ? await this.agent.query({ agentId }) : undefined
|
|
106
110
|
return agent
|
|
107
111
|
},
|
|
@@ -112,32 +116,44 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
112
116
|
*/
|
|
113
117
|
allAgents = this.query({
|
|
114
118
|
name: 'allAgents',
|
|
115
|
-
request: async (signal, variables: { visibilities: (AgentVisibilityLevel | 'all')[] }) => {
|
|
119
|
+
request: async (signal, variables: { visibilities: (AgentVisibilityLevel | 'all')[], filter?: string }) => {
|
|
116
120
|
const allVisibilities = ['account', 'built_in', 'recently_used', 'favorite', 'personal', 'shared', 'workspace'] as const
|
|
117
|
-
const visibilities = variables.visibilities.includes('all')
|
|
121
|
+
const visibilities = !variables.visibilities || variables.visibilities?.includes('all')
|
|
118
122
|
? allVisibilities
|
|
119
123
|
: variables.visibilities as Array<AgentVisibilityLevelEnum | VisibilityLevelEnum>
|
|
120
|
-
|
|
121
124
|
const shouldFetchWorkspaceAgents = visibilities.includes('workspace')
|
|
122
|
-
|
|
125
|
+
|
|
123
126
|
const workspaceAgentsPromise = shouldFetchWorkspaceAgents
|
|
124
127
|
? workspaceAiClient.workspacesContentsByType.query({ contentType: 'agent' })
|
|
125
128
|
: Promise.resolve([])
|
|
126
129
|
|
|
127
|
-
const
|
|
130
|
+
const listAgentsVisibilities = visibilities.filter((visibility) => visibility!=='workspace')
|
|
131
|
+
const listAgentsPromise = listAgentsVisibilities.length
|
|
132
|
+
? listAgentsV3AgentsGet({ filters: {
|
|
133
|
+
visibility_list: listAgentsVisibilities as (AgentVisibilityLevelEnum | VisibilityLevelEnum)[],
|
|
134
|
+
name: variables.filter,
|
|
135
|
+
},
|
|
136
|
+
authorization: '' }, { signal })
|
|
137
|
+
: Promise.resolve({ items: [] })
|
|
138
|
+
|
|
139
|
+
const [workspaceAgents, agentsByVisibility] = await Promise.all([
|
|
128
140
|
workspaceAgentsPromise,
|
|
129
|
-
|
|
141
|
+
listAgentsPromise,
|
|
130
142
|
])
|
|
131
143
|
|
|
132
144
|
const workspaceAgentsWithSpaceName = workspaceAgents.flatMap(({ agents, space_name }) =>
|
|
133
145
|
agents?.map((agent) => ({ ...agent, spaceName: space_name, builtIn: false }))) as AgentResponseWithBuiltIn[]
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
146
|
+
|
|
147
|
+
const filteredWorkspaceAgents = variables.filter ? workspaceAgentsWithSpaceName.filter((agent) =>
|
|
148
|
+
agent.name.toLowerCase().includes(variables.filter!)) :
|
|
149
|
+
workspaceAgentsWithSpaceName
|
|
150
|
+
|
|
151
|
+
const allAgents: AgentResponseWithBuiltIn[] = filteredWorkspaceAgents ?? []
|
|
152
|
+
|
|
153
|
+
agentsByVisibility.items?.forEach(agent => allAgents.push(({
|
|
138
154
|
...agent,
|
|
139
155
|
builtIn: agent?.visibility_level === 'built_in',
|
|
140
|
-
})))
|
|
156
|
+
})))
|
|
141
157
|
|
|
142
158
|
return allAgents
|
|
143
159
|
},
|
|
@@ -147,6 +163,10 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
147
163
|
* Lists all custom toolkits.
|
|
148
164
|
*/
|
|
149
165
|
toolkits = this.query(removeAuthorizationParam(listToolkitsV1ToolkitsGet))
|
|
166
|
+
/**
|
|
167
|
+
* Get list of Toolkits V2
|
|
168
|
+
*/
|
|
169
|
+
toolkitsV2 = this.infiniteQuery(listToolkitsAuthorization, { accumulator: 'items' })
|
|
150
170
|
/**
|
|
151
171
|
* Lists all tools of an MCP toolkit.
|
|
152
172
|
*/
|
|
@@ -183,6 +203,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
183
203
|
* Delete tool from Toolkit
|
|
184
204
|
*/
|
|
185
205
|
deleteToolFromToolkit = this.mutation(removeAuthorizationParam(deleteToolkitToolsV1ToolkitsToolkitIdToolsDelete))
|
|
206
|
+
|
|
186
207
|
/**
|
|
187
208
|
* Previews an uploaded open api file as a stream where each array item is an OpenAPI operation.
|
|
188
209
|
*/
|
|
@@ -220,6 +241,38 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
220
241
|
* remove an agent from favorites
|
|
221
242
|
*/
|
|
222
243
|
removeFavorite = this.mutation(removeAuthorizationParam(deleteFavoriteV1AgentsAgentIdFavoriteDelete))
|
|
244
|
+
/**
|
|
245
|
+
* Creates an agent version
|
|
246
|
+
*/
|
|
247
|
+
createAgentVersion = this.mutation(removeAuthorizationParam(createVersionV1AgentsAgentCoreIdVersionsPost))
|
|
248
|
+
/**
|
|
249
|
+
* V2 of agent creation
|
|
250
|
+
*/
|
|
251
|
+
createAgentV2 = this.mutation(removeAuthorizationParam(createAgentV2AgentsPost))
|
|
252
|
+
/**
|
|
253
|
+
* V2 of agent update
|
|
254
|
+
*/
|
|
255
|
+
updateAgentV2 = this.mutation(removeAuthorizationParam(updateAgentV2AgentsAgentIdPatch))
|
|
256
|
+
/**
|
|
257
|
+
* Update agent recommended version
|
|
258
|
+
*/
|
|
259
|
+
updateRecommendedVersion = this.mutation(removeAuthorizationParam(patchVersionRecommendedV1AgentsAgentCoreIdVersionsVersionNumberPatch))
|
|
260
|
+
/**
|
|
261
|
+
* V2 of get agent by id
|
|
262
|
+
*/
|
|
263
|
+
agentV2 = this.query(removeAuthorizationParam(findByAgentCoreIdV2AgentsAgentCoreIdGet))
|
|
264
|
+
/**
|
|
265
|
+
* Gets agent versions
|
|
266
|
+
*/
|
|
267
|
+
listAgentVersions = this.query(removeAuthorizationParam(listVersionsOfAgentCoreV1AgentsAgentCoreIdVersionsGet))
|
|
268
|
+
/**
|
|
269
|
+
* Deletes an agent version
|
|
270
|
+
*/
|
|
271
|
+
deleteVersion = this.mutation(removeAuthorizationParam(deleteVersionV1AgentsAgentCoreIdVersionsVersionNumberDelete))
|
|
272
|
+
/**
|
|
273
|
+
* Deletes an agent version
|
|
274
|
+
*/
|
|
275
|
+
forkAgentVersion = this.mutation(removeAuthorizationParam(forkAgentVersionV1AgentsAgentCoreIdVersionsVersionNumberForkPost))
|
|
223
276
|
}
|
|
224
277
|
|
|
225
278
|
export const agentToolsClient = new AgentToolsClient()
|
package/src/client/ai.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
-
import {
|
|
2
|
+
import { isArray } from 'lodash'
|
|
3
3
|
import { getApiAddresses } from '../api-addresses'
|
|
4
4
|
import {
|
|
5
5
|
addFavoriteV1AiStacksStackIdFavoritePost,
|
|
@@ -7,13 +7,17 @@ import {
|
|
|
7
7
|
calculateNextStepV1QuickCommandsSlugStepsStepSlugCalculateNextStepPost,
|
|
8
8
|
callbackV1QuickCommandsCallbackExecutionIdGet,
|
|
9
9
|
conversationHistoryV1ConversationsConversationIdGet,
|
|
10
|
+
createAnswerForReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersPost,
|
|
10
11
|
createExecutionV1QuickCommandsCreateExecutionSlugPost,
|
|
12
|
+
createResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsPost,
|
|
11
13
|
currentV1TokensUsageCurrentGet,
|
|
12
14
|
defaults,
|
|
13
15
|
deleteConversationV1ConversationsConversationIdDelete,
|
|
14
16
|
deleteFavoriteV1AiStacksStackIdFavoriteDelete,
|
|
15
17
|
deleteFavoriteV1QuickCommandsSlugFavoriteDelete,
|
|
16
18
|
deleteKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdDelete,
|
|
19
|
+
deleteResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdDelete,
|
|
20
|
+
deleteReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdDelete,
|
|
17
21
|
downloadConversationV1ConversationsConversationIdDownloadGet,
|
|
18
22
|
findKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdGet,
|
|
19
23
|
findKnowledgeSourceV1KnowledgeSourcesSlugGet,
|
|
@@ -22,12 +26,14 @@ import {
|
|
|
22
26
|
getContentDependenciesV1ContentContentTypeContentIdDependenciesGet,
|
|
23
27
|
getFlagsV1FlagsGet,
|
|
24
28
|
getQuickCommandV1QuickCommandsSlugGet,
|
|
29
|
+
getReviewsByResourceV1ResourcesResourceTypeSlugResourceSlugReviewsGet,
|
|
25
30
|
getScriptExecutionStatusV1QuickCommandsScriptExecutionsScriptExecutionIdGet,
|
|
26
31
|
getUploadFormV1FileUploadFormPost,
|
|
27
32
|
HttpValidationError,
|
|
28
33
|
listAiStacksV1AiStacksGet,
|
|
29
34
|
listAllV1QuickCommandsAllGet,
|
|
30
35
|
listAllV2QuickCommandsAllGet,
|
|
36
|
+
listAllV3QuickCommandsGet,
|
|
31
37
|
listAssociationV1WorkspaceWorkspaceIdGet,
|
|
32
38
|
listConversationsV1ConversationsGet,
|
|
33
39
|
listKnowledgeSourcesV1KnowledgeSourcesGet,
|
|
@@ -40,28 +46,29 @@ import {
|
|
|
40
46
|
runFetchStepV1QuickCommandsSlugStepsStepSlugFetchRunPost,
|
|
41
47
|
searchKnowledgeSourcesV1KnowledgeSourcesSearchPost,
|
|
42
48
|
startScriptStepV1QuickCommandsSlugStepsStepSlugStartScriptPost,
|
|
49
|
+
tokensByUserV1AnalyticsTokensByUserGet,
|
|
50
|
+
tokensDailyUsageV1AnalyticsTokensDailyUsageGet,
|
|
43
51
|
totalV1TokensUsageTotalGet,
|
|
44
52
|
updateQuickCommandV1QuickCommandsSlugPatch,
|
|
53
|
+
updateResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdPatch,
|
|
54
|
+
updateReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdPatch,
|
|
45
55
|
updateTitleV1ConversationsConversationIdPatch,
|
|
46
56
|
vectorizeCustomKnowledgeSourceV1KnowledgeSourcesSlugCustomPost,
|
|
47
57
|
} from '../api/ai'
|
|
58
|
+
|
|
59
|
+
|
|
48
60
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
49
61
|
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
50
62
|
import { removeAuthorizationParam } from '../utils/remove-authorization-param'
|
|
51
63
|
import { StreamedJson } from '../utils/StreamedJson'
|
|
52
|
-
import { formatJson } from '../utils/string'
|
|
53
|
-
import { agentToolsClient } from './agent-tools'
|
|
54
64
|
import {
|
|
55
|
-
ChatAgentTool,
|
|
56
|
-
ChatResponseWithSteps,
|
|
57
|
-
FixedChatRequest,
|
|
58
|
-
FixedChatResponse,
|
|
59
65
|
FixedConversationResponse,
|
|
60
66
|
FixedDependencyResponse,
|
|
61
67
|
ReplaceResult,
|
|
62
|
-
StepChatStep,
|
|
63
68
|
} from './types'
|
|
64
69
|
|
|
70
|
+
const listQAV3WithoutAuthorization = removeAuthorizationParam(listAllV3QuickCommandsGet)
|
|
71
|
+
|
|
65
72
|
class AIClient extends ReactQueryNetworkClient {
|
|
66
73
|
constructor() {
|
|
67
74
|
super(getApiAddresses().ai.url, defaults)
|
|
@@ -127,6 +134,10 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
127
134
|
* Lists all the quick commands according to filters passed as parameter (including QC with secrets).
|
|
128
135
|
*/
|
|
129
136
|
allQuickCommands = this.query(removeAuthorizationParam(listAllV2QuickCommandsAllGet))
|
|
137
|
+
/**
|
|
138
|
+
* Lists all the quick commands according to filters passed as parameter (including QC with secrets) with pagination.
|
|
139
|
+
*/
|
|
140
|
+
allQuickCommandsV3 = this.infiniteQuery(listQAV3WithoutAuthorization, { accumulator: 'items' })
|
|
130
141
|
/**
|
|
131
142
|
* Gets a quick command by its slug.
|
|
132
143
|
*/
|
|
@@ -261,6 +272,14 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
261
272
|
*/
|
|
262
273
|
removeFavoriteQuickCommand = this.mutation(removeAuthorizationParam(deleteFavoriteV1QuickCommandsSlugFavoriteDelete))
|
|
263
274
|
/**
|
|
275
|
+
* Get Tokens Daily usage
|
|
276
|
+
*/
|
|
277
|
+
analyticsTokensDailyUsage = this.query(removeAuthorizationParam(tokensDailyUsageV1AnalyticsTokensDailyUsageGet))
|
|
278
|
+
/**
|
|
279
|
+
* Get Tokens By User
|
|
280
|
+
*/
|
|
281
|
+
analyticsTokensByUser = this.query(removeAuthorizationParam(tokensByUserV1AnalyticsTokensByUserGet))
|
|
282
|
+
/*
|
|
264
283
|
* Lists all the feature flags for this user.
|
|
265
284
|
*/
|
|
266
285
|
flags = this.query(getFlagsV1FlagsGet)
|
|
@@ -273,217 +292,45 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
273
292
|
*/
|
|
274
293
|
getStatusScriptStep = this.query(removeAuthorizationParam(getScriptExecutionStatusV1QuickCommandsScriptExecutionsScriptExecutionIdGet))
|
|
275
294
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
const tools: (Omit<ChatAgentTool, 'duration' | 'prompt' | 'output'>)[] = []
|
|
281
|
-
agent.toolkits?.builtin_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
|
|
282
|
-
if (id) tools.push({ image: kit.image_url, id, name: name || id, description })
|
|
283
|
-
}))
|
|
284
|
-
agent.toolkits?.custom_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
|
|
285
|
-
if (id) tools.push({ image: kit.avatar ?? undefined, id, name: name || id, description })
|
|
286
|
-
}))
|
|
287
|
-
return tools
|
|
288
|
-
} catch {
|
|
289
|
-
return []
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
sendChatMessage(request: FixedChatRequest, minChangeIntervalMS?: number): StreamedJson<ChatResponseWithSteps> {
|
|
294
|
-
const abortController = new AbortController()
|
|
295
|
-
const headers = {
|
|
296
|
-
'Content-Type': 'application/json',
|
|
297
|
-
'Accept': 'text/event-stream',
|
|
298
|
-
}
|
|
299
|
-
const events = this.stream(
|
|
300
|
-
this.resolveURL('v3/chat'),
|
|
301
|
-
{ method: 'post', body: JSON.stringify(request), headers, signal: abortController.signal },
|
|
302
|
-
)
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* This function treats events in the streaming that deals with the execution of tools. Since these events are not concatenated like
|
|
306
|
-
* normal streamings of data, we need this separate function to deal with them. It transforms the internal data model of the
|
|
307
|
-
* StreamedJson object whenever an event is triggered.
|
|
308
|
-
*/
|
|
309
|
-
async function transform(event: Partial<FixedChatResponse>, data: Partial<ChatResponseWithSteps>) {
|
|
310
|
-
const info = event.agent_info
|
|
311
|
-
|
|
312
|
-
if (!info) return
|
|
313
|
-
|
|
314
|
-
const tools = await AIClient.toolsOfAgent(request.context?.agent_id)
|
|
315
|
-
data.steps = data.steps ? [...data.steps] : []
|
|
316
|
-
|
|
317
|
-
if (info.type === 'planning' && info.action === 'end') {
|
|
318
|
-
data.steps.push({
|
|
319
|
-
id: 'planning',
|
|
320
|
-
type: 'planning',
|
|
321
|
-
status: 'success',
|
|
322
|
-
duration: info.duration || 0,
|
|
323
|
-
steps: info.data?.steps?.map(s => s.goal) ?? [],
|
|
324
|
-
goal: info.data?.plan_goal ?? '',
|
|
325
|
-
})
|
|
326
|
-
|
|
327
|
-
info.data?.steps.forEach(s => data.steps?.push({
|
|
328
|
-
id: s.id,
|
|
329
|
-
type: 'step',
|
|
330
|
-
status: 'pending',
|
|
331
|
-
input: s.goal,
|
|
332
|
-
attempts: [{
|
|
333
|
-
tools: s.tools?.map(t => ({
|
|
334
|
-
...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
|
|
335
|
-
executionId: t.tool_execution_id,
|
|
336
|
-
goal: t.goal,
|
|
337
|
-
})),
|
|
338
|
-
}],
|
|
339
|
-
}))
|
|
340
|
-
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
if (info.type === 'planning' && info.action === 'awaiting_approval') {
|
|
344
|
-
data.steps.push({
|
|
345
|
-
id: 'planning',
|
|
346
|
-
type: 'planning',
|
|
347
|
-
status: 'awaiting_approval',
|
|
348
|
-
user_question: info.data?.user_question,
|
|
349
|
-
duration: info.duration || 0,
|
|
350
|
-
steps: info.data?.steps?.map(s => s.goal) ?? [],
|
|
351
|
-
goal: info.data?.plan_goal ?? '',
|
|
352
|
-
})
|
|
353
|
-
info.data?.steps.forEach(s => data.steps?.push({
|
|
354
|
-
id: s.id,
|
|
355
|
-
type: 'step',
|
|
356
|
-
status: 'pending',
|
|
357
|
-
input: s.goal,
|
|
358
|
-
attempts: [{
|
|
359
|
-
tools: s.tools?.map(t => ({
|
|
360
|
-
...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
|
|
361
|
-
executionId: t.tool_execution_id,
|
|
362
|
-
goal: t.goal,
|
|
363
|
-
})),
|
|
364
|
-
}],
|
|
365
|
-
}))
|
|
366
|
-
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
if (info.type === 'step' && info.action === 'start') {
|
|
370
|
-
const step = data.steps.find(s => s.id === info.id)
|
|
371
|
-
if (step) step.status = 'running'
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
if (info.type === 'step' && info.action === 'end') {
|
|
375
|
-
const step = data.steps.find(s => s.id === info.id) as StepChatStep
|
|
376
|
-
if (step) {
|
|
377
|
-
step.status = 'success'
|
|
378
|
-
step.duration = info.duration
|
|
379
|
-
const lastToolId = last(step.attempts[0].tools)?.id
|
|
380
|
-
const lastAttemptOfLastTool = findLast(step.attempts.map(a => a.tools).flat(), t => t?.id === lastToolId)
|
|
381
|
-
step.output = lastAttemptOfLastTool?.output
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
if (info.type === 'tool' && info.action === 'awaiting_approval') {
|
|
386
|
-
const tool = tools.find(({ id }) => id === info.data?.tool_id)
|
|
387
|
-
data.steps.push({
|
|
388
|
-
id: info.id,
|
|
389
|
-
type: 'tool',
|
|
390
|
-
status: 'awaiting_approval',
|
|
391
|
-
duration: info.duration || 0,
|
|
392
|
-
input: info.data?.input,
|
|
393
|
-
user_question: info.data?.user_question,
|
|
394
|
-
attempts: [{
|
|
395
|
-
tools: [{
|
|
396
|
-
executionId: info.id,
|
|
397
|
-
id: info.data?.tool_id ?? '',
|
|
398
|
-
name: tool?.name ?? '',
|
|
399
|
-
goal: tool?.goal,
|
|
400
|
-
...tool,
|
|
401
|
-
}],
|
|
402
|
-
}],
|
|
403
|
-
})
|
|
404
|
-
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
|
|
405
|
-
}
|
|
295
|
+
/**
|
|
296
|
+
* Get reviews by resource
|
|
297
|
+
*/
|
|
298
|
+
getReviewsByResource = this.query(removeAuthorizationParam(getReviewsByResourceV1ResourcesResourceTypeSlugResourceSlugReviewsGet))
|
|
406
299
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
300
|
+
/**
|
|
301
|
+
* Create a resource review
|
|
302
|
+
*/
|
|
303
|
+
createResourceReview = this.mutation(removeAuthorizationParam(createResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsPost))
|
|
410
304
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
id: info.id,
|
|
417
|
-
type: 'tool',
|
|
418
|
-
status: 'running',
|
|
419
|
-
duration: info.duration || 0,
|
|
420
|
-
input: info.data?.input,
|
|
421
|
-
user_question: info.data?.user_question,
|
|
422
|
-
attempts: [{
|
|
423
|
-
tools: [{ ...tool, executionId: info.id, input }],
|
|
424
|
-
}],
|
|
425
|
-
})
|
|
426
|
-
} else {
|
|
427
|
-
const toolInFirstAttempt = currentStep.attempts[0].tools?.find(t => t.executionId === info.id)
|
|
428
|
-
//One step might have multiple tools. When in an approval mode, we might not have all the tools in the array yet.
|
|
429
|
-
//So we make sure to add any tools that are not in there.
|
|
430
|
-
if (!toolInFirstAttempt) {
|
|
431
|
-
const input = formatJson(info.data.input)
|
|
432
|
-
const tool = tools?.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
|
|
433
|
-
currentStep.attempts[info.data.attempt - 1].tools?.push({
|
|
434
|
-
...tool,
|
|
435
|
-
executionId: info.id,
|
|
436
|
-
input,
|
|
437
|
-
})
|
|
438
|
-
} else {
|
|
439
|
-
const input = formatJson(info.data.input)
|
|
440
|
-
if (info.data.attempt === 1) {
|
|
441
|
-
toolInFirstAttempt.input = input
|
|
442
|
-
} else {
|
|
443
|
-
const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
|
|
444
|
-
currentStep.attempts[info.data.attempt - 1] ??= { tools: [] }
|
|
445
|
-
currentStep.attempts[info.data.attempt - 1].tools?.push({
|
|
446
|
-
...tool,
|
|
447
|
-
executionId: info.id,
|
|
448
|
-
input,
|
|
449
|
-
})
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
305
|
+
/**
|
|
306
|
+
* Create an answer for a review
|
|
307
|
+
*/
|
|
308
|
+
createAnswerForReview = this.mutation(
|
|
309
|
+
removeAuthorizationParam(createAnswerForReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersPost))
|
|
454
310
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
tool.output = formatJson(info.data.output)
|
|
461
|
-
tool.duration = info.duration
|
|
462
|
-
}
|
|
463
|
-
}
|
|
311
|
+
/**
|
|
312
|
+
* Update a resource review
|
|
313
|
+
*/
|
|
314
|
+
updateResourceReview = this.mutation(
|
|
315
|
+
removeAuthorizationParam(updateResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdPatch))
|
|
464
316
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
317
|
+
/**
|
|
318
|
+
* Delete a resource review
|
|
319
|
+
*/
|
|
320
|
+
deleteResourceReview = this.mutation(
|
|
321
|
+
removeAuthorizationParam(deleteResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdDelete))
|
|
469
322
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
323
|
+
/**
|
|
324
|
+
* Update a review comment (answer)
|
|
325
|
+
*/
|
|
326
|
+
updateReviewComment = this.mutation(
|
|
327
|
+
removeAuthorizationParam(updateReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdPatch))
|
|
478
328
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
transform,
|
|
485
|
-
})
|
|
486
|
-
}
|
|
329
|
+
/**
|
|
330
|
+
* Delete a review comment (answer)
|
|
331
|
+
*/
|
|
332
|
+
deleteReviewComment = this.mutation(
|
|
333
|
+
removeAuthorizationParam(deleteReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdDelete))
|
|
487
334
|
|
|
488
335
|
contentDependencies = this.query(removeAuthorizationParam(
|
|
489
336
|
getContentDependenciesV1ContentContentTypeContentIdDependenciesGet as ReplaceResult<
|
package/src/client/code-shift.ts
CHANGED
|
@@ -75,6 +75,11 @@ import {
|
|
|
75
75
|
createReposBatchServiceV2ReposBatchPost,
|
|
76
76
|
getImportResultV2ReposBatchImportIdGet,
|
|
77
77
|
downloadImportResultV2ReposBatchImportIdDownloadGet,
|
|
78
|
+
deleteModuleServiceV1ModulesModuleIdDelete,
|
|
79
|
+
createRepositoryServiceV2ReposPost,
|
|
80
|
+
listRepositoryServiceV2ReposGet,
|
|
81
|
+
listModuleExecutionBatchActivitiesV1ActivitiesModuleExecutionBatchGet,
|
|
82
|
+
getModuleExecutionBatchActivitiesByIdV1ActivitiesModuleExecutionBatchModuleExecutionBatchIdGet,
|
|
78
83
|
} from '../api/codeShift'
|
|
79
84
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
80
85
|
import { codeShiftDictionary } from '../error/dictionary/code-shift'
|
|
@@ -96,6 +101,10 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
96
101
|
* Creates a repository.
|
|
97
102
|
*/
|
|
98
103
|
createRepository = this.mutation(removeAuthorizationParam(createRepositoryServiceV1ReposPost))
|
|
104
|
+
/**
|
|
105
|
+
* Creates a repository (v2).
|
|
106
|
+
*/
|
|
107
|
+
createRepositoryV2 = this.mutation(removeAuthorizationParam(createRepositoryServiceV2ReposPost))
|
|
99
108
|
/**
|
|
100
109
|
* Creates repositories in batch.
|
|
101
110
|
*/
|
|
@@ -116,6 +125,10 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
116
125
|
* Gets list of repositories.
|
|
117
126
|
*/
|
|
118
127
|
repositories = this.query(removeAuthorizationParam(listRepositoryServiceV1ReposGet))
|
|
128
|
+
/**
|
|
129
|
+
* Gets list of repositories (v2).
|
|
130
|
+
*/
|
|
131
|
+
repositoriesV2 = this.query(removeAuthorizationParam(listRepositoryServiceV2ReposGet))
|
|
119
132
|
/**
|
|
120
133
|
* Gets a repository
|
|
121
134
|
*/
|
|
@@ -144,6 +157,10 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
144
157
|
* Gets module by id.
|
|
145
158
|
*/
|
|
146
159
|
module = this.query(removeAuthorizationParam(getModuleV1ModulesModuleIdGet))
|
|
160
|
+
/**
|
|
161
|
+
* Deletes a module by id.
|
|
162
|
+
*/
|
|
163
|
+
deleteModule = this.mutation(removeAuthorizationParam(deleteModuleServiceV1ModulesModuleIdDelete))
|
|
147
164
|
/**
|
|
148
165
|
* Add a module in favorites.
|
|
149
166
|
*/
|
|
@@ -428,6 +445,18 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
428
445
|
analyticsModulesExecutionTimesDownload = this.query(
|
|
429
446
|
removeAuthorizationParam(analyticsModuleExecutionTimesDownloadV1AnalyticsModulesExecutionTimesDownloadGet),
|
|
430
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
|
+
)
|
|
431
460
|
}
|
|
432
461
|
|
|
433
462
|
export const codeShiftClient = new CodeShift()
|
|
@@ -99,7 +99,14 @@ class DataIntegrationClient extends ReactQueryNetworkClient {
|
|
|
99
99
|
/**
|
|
100
100
|
* List of knowledge sources with pagination
|
|
101
101
|
*/
|
|
102
|
-
knowledgeSourcesV2 = this.infiniteQuery(listKSV2WithoutAuthorization, {
|
|
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
|
+
})
|
|
103
110
|
/**
|
|
104
111
|
* Adds the resource of type Knowledge Source to the list of favorites.
|
|
105
112
|
*/
|
|
@@ -199,7 +206,7 @@ class DataIntegrationClient extends ReactQueryNetworkClient {
|
|
|
199
206
|
* Get Indexed Files
|
|
200
207
|
*/
|
|
201
208
|
listIndexedProjectFiles = this.query(removeAuthorizationParam(getIndexedFilesV1KnowledgeSourcesKsSlugFilesGet))
|
|
202
|
-
|
|
209
|
+
|
|
203
210
|
}
|
|
204
211
|
|
|
205
212
|
export const dataIntegrationClient = new DataIntegrationClient()
|
package/src/client/discover.ts
CHANGED
|
@@ -2,16 +2,16 @@ import { HttpError } from '@oazapfts/runtime'
|
|
|
2
2
|
import { findLast, last } from 'lodash'
|
|
3
3
|
import { getApiAddresses } from '../api-addresses'
|
|
4
4
|
import { ConversationResponse } from '../api/ai'
|
|
5
|
-
import { create, create1, create2, defaults, deleteById, deleteById1, deleteById2, fetchInsights, getAll, getAll1, getAll2, getAllByHypothesis, getById, getById1, getById2, getInsightById, GetOpportunityResponse,
|
|
5
|
+
import { AiChatRequest, create, create1, create2, defaults, deleteById, deleteById1, deleteById2, fetchInsights, getAll, getAll1, getAll2, getAllByHypothesis, getById, getById1, getById2, getInsightById, GetOpportunityResponse, refreshInsights } from '../api/discover'
|
|
6
6
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
7
|
+
import { baseDictionary } from '../error/dictionary/base'
|
|
7
8
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
9
|
+
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
8
10
|
import { StreamedJson } from '../utils/StreamedJson'
|
|
9
|
-
import { baseDictionary } from '../error/dictionary/base'
|
|
10
11
|
import { formatJson } from '../utils/string'
|
|
11
|
-
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
12
|
-
import { aiClient } from './ai'
|
|
13
|
-
import { ChatAgentTool, ChatResponseWithSteps, FixedChatResponse, StepChatStep } from './types'
|
|
14
12
|
import { agentToolsClient } from './agent-tools'
|
|
13
|
+
import { aiClient } from './ai'
|
|
14
|
+
import { AgentInfo, ChatAgentTool, ChatResponseWithSteps, FixedChatResponse, StepChatStep } from './types'
|
|
15
15
|
|
|
16
16
|
export interface ChatConversionDetails extends ConversationResponse {
|
|
17
17
|
opportunityName?: string,
|
|
@@ -121,7 +121,7 @@ class DiscoverClient extends ReactQueryNetworkClient {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
|
|
124
|
-
sendChatMessage(request:
|
|
124
|
+
sendChatMessage(request: AiChatRequest & { agentId: string }, minChangeIntervalMS?: number): StreamedJson<ChatResponseWithSteps> {
|
|
125
125
|
const abortController = new AbortController()
|
|
126
126
|
const headers = {
|
|
127
127
|
'Content-Type': 'application/json',
|
|
@@ -137,7 +137,8 @@ class DiscoverClient extends ReactQueryNetworkClient {
|
|
|
137
137
|
* StreamedJson object whenever an event is triggered.
|
|
138
138
|
*/
|
|
139
139
|
async function transform(event: Partial<FixedChatResponse>, data: Partial<ChatResponseWithSteps>) {
|
|
140
|
-
|
|
140
|
+
// todo fix
|
|
141
|
+
const info = event.agent_info as unknown as AgentInfo
|
|
141
142
|
|
|
142
143
|
if (!info) return
|
|
143
144
|
|