@stack-spot/portal-network 0.182.0 → 0.184.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 +33 -0
- package/dist/api/codeShift.d.ts +76 -4
- package/dist/api/codeShift.d.ts.map +1 -1
- package/dist/api/codeShift.js +13 -0
- package/dist/api/codeShift.js.map +1 -1
- package/dist/client/ai.d.ts.map +1 -1
- package/dist/client/ai.js +84 -14
- package/dist/client/ai.js.map +1 -1
- package/dist/client/code-shift.d.ts +30 -0
- package/dist/client/code-shift.d.ts.map +1 -1
- package/dist/client/code-shift.js +37 -1
- package/dist/client/code-shift.js.map +1 -1
- package/dist/client/types.d.ts +26 -6
- package/dist/client/types.d.ts.map +1 -1
- 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/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/logs/simple-failure/01JBER7AWKACEC3Y1NF7M6PHFF/job_id_1.log +3 -0
- package/logs/simple-suspend/01JBEMQG94ADPT99MSZ7EJKGXZ/job_id_1.log +5 -0
- package/package.json +6 -6
- package/readme.md +1 -1
- package/src/api/account.ts +1 -0
- package/src/api/agent-tools.ts +3 -0
- package/src/api/agent.ts +2 -0
- package/src/api/codeShift.ts +106 -7
- package/src/api/notification.ts +2 -0
- package/src/client/ai.ts +87 -13
- package/src/client/code-shift.ts +22 -0
- package/src/client/types.ts +27 -6
- package/src/client/workspace-ai.ts +19 -23
- package/src/error/dictionary/workspace-ai.ts +10 -0
package/src/client/types.ts
CHANGED
|
@@ -245,19 +245,20 @@ export interface ChatAgentTool {
|
|
|
245
245
|
image?: string,
|
|
246
246
|
input?: string,
|
|
247
247
|
output?: string,
|
|
248
|
+
goal: string,
|
|
248
249
|
}
|
|
249
250
|
|
|
250
251
|
export interface ChatStepAttempt {
|
|
251
252
|
/**
|
|
252
253
|
* The tools used by this step.
|
|
253
254
|
*/
|
|
254
|
-
tools?: ChatAgentTool[],
|
|
255
|
+
tools?: Partial<ChatAgentTool>[],
|
|
255
256
|
}
|
|
256
257
|
|
|
257
258
|
export interface BaseChatStep {
|
|
258
259
|
id: string,
|
|
259
|
-
type: 'planning' | 'step' | 'answer',
|
|
260
|
-
status: 'pending' | 'running' | 'success' | 'error',
|
|
260
|
+
type: 'planning' | 'step' | 'answer' | 'tool',
|
|
261
|
+
status: 'pending' | 'running' | 'success' | 'error' | 'awaiting_approval',
|
|
261
262
|
/**
|
|
262
263
|
* Duration in seconds.
|
|
263
264
|
*/
|
|
@@ -266,9 +267,24 @@ export interface BaseChatStep {
|
|
|
266
267
|
|
|
267
268
|
export interface PlanningChatStep extends BaseChatStep {
|
|
268
269
|
type: 'planning',
|
|
269
|
-
status: 'success',
|
|
270
|
+
status: 'success' | 'awaiting_approval',
|
|
270
271
|
steps: string[],
|
|
271
272
|
goal: string,
|
|
273
|
+
user_question?: string,
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export interface ToolChatStep extends BaseChatStep {
|
|
277
|
+
type: 'tool',
|
|
278
|
+
status: 'running' | 'success' | 'error' | 'awaiting_approval',
|
|
279
|
+
/**
|
|
280
|
+
* Each step might attempt to run for multiple times, with different inputs and outputs. If first attempt succeeds, this array will have
|
|
281
|
+
* only one element.
|
|
282
|
+
*
|
|
283
|
+
* This array never has less than one element, despite the step's status.
|
|
284
|
+
*/
|
|
285
|
+
attempts: ChatStepAttempt[],
|
|
286
|
+
input?: Record<string, any>,
|
|
287
|
+
user_question?: string,
|
|
272
288
|
}
|
|
273
289
|
|
|
274
290
|
export interface StepChatStep extends BaseChatStep {
|
|
@@ -288,17 +304,19 @@ export interface AnswerChatStep extends BaseChatStep {
|
|
|
288
304
|
type: 'answer',
|
|
289
305
|
}
|
|
290
306
|
|
|
291
|
-
export type ChatStep = PlanningChatStep | StepChatStep | AnswerChatStep
|
|
307
|
+
export type ChatStep = PlanningChatStep | StepChatStep | AnswerChatStep | ToolChatStep
|
|
292
308
|
|
|
293
309
|
export interface BaseAgentInfo {
|
|
294
310
|
type: 'chat' | 'planning' | 'step' | 'tool' | 'final_answer',
|
|
295
|
-
action: 'start' | 'end',
|
|
311
|
+
action: 'start' | 'end' | 'awaiting_approval',
|
|
296
312
|
duration?: number,
|
|
313
|
+
id: string,
|
|
297
314
|
}
|
|
298
315
|
|
|
299
316
|
export interface AgentTool {
|
|
300
317
|
tool_id: string,
|
|
301
318
|
tool_execution_id: string,
|
|
319
|
+
goal: string,
|
|
302
320
|
}
|
|
303
321
|
|
|
304
322
|
export interface PlanningAgentInfo extends BaseAgentInfo {
|
|
@@ -311,6 +329,7 @@ export interface PlanningAgentInfo extends BaseAgentInfo {
|
|
|
311
329
|
goal: string,
|
|
312
330
|
tools?: AgentTool[],
|
|
313
331
|
}[],
|
|
332
|
+
user_question?: string,
|
|
314
333
|
},
|
|
315
334
|
}
|
|
316
335
|
|
|
@@ -326,6 +345,8 @@ export interface ToolAgentInfo extends BaseAgentInfo {
|
|
|
326
345
|
input?: any,
|
|
327
346
|
attempt: number,
|
|
328
347
|
output?: string,
|
|
348
|
+
user_question?: string,
|
|
349
|
+
tool_id: string,
|
|
329
350
|
},
|
|
330
351
|
}
|
|
331
352
|
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
deleteFavoriteV1WorkspacesWorkspaceIdFavoriteDelete,
|
|
14
14
|
deleteWorkspaceV1WorkspacesWorkspaceIdDelete,
|
|
15
15
|
getWorkspaceByIdV1WorkspacesIdGet,
|
|
16
|
-
HttpValidationError,
|
|
17
16
|
listAllByContentTypeV1WorkspacesWorkspaceIdContentTypeGet,
|
|
18
17
|
listAllContentsV1WorkspacesContentsContentTypeGet,
|
|
19
18
|
listGroupsAndMembersPermissionInWorkspaceV1WorkspacesWorkspaceIdPermissionsGet,
|
|
@@ -28,8 +27,10 @@ import {
|
|
|
28
27
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
29
28
|
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
30
29
|
import { removeAuthorizationParam } from '../utils/remove-authorization-param'
|
|
31
|
-
import { FixedAddResourceToWorkspaceAi, FixedWorkspaceAiPermissions, ReplaceResult } from './types'
|
|
32
30
|
import { getApiAddresses } from '../api-addresses'
|
|
31
|
+
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
32
|
+
import { wksAiDictionary } from '../error/dictionary/workspace-ai'
|
|
33
|
+
import { FixedAddResourceToWorkspaceAi, FixedWorkspaceAiPermissions, ReplaceResult } from './types'
|
|
33
34
|
|
|
34
35
|
class WorkspaceAiClient extends ReactQueryNetworkClient {
|
|
35
36
|
constructor() {
|
|
@@ -37,12 +38,7 @@ class WorkspaceAiClient extends ReactQueryNetworkClient {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
40
|
-
return new
|
|
41
|
-
status: error.status,
|
|
42
|
-
headers: error.headers,
|
|
43
|
-
stack: error.stack,
|
|
44
|
-
message: (error.data as HttpValidationError | undefined)?.detail?.map(d => d.msg)?.join('\n'),
|
|
45
|
-
})
|
|
41
|
+
return new DefaultAPIError(error.data, error.status, wksAiDictionary, error.headers)
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
createWorkspaceAi = this.mutation(removeAuthorizationParam(createWorkspaceV1WorkspacesPost))
|
|
@@ -50,7 +46,7 @@ class WorkspaceAiClient extends ReactQueryNetworkClient {
|
|
|
50
46
|
workspaceAi = this.query(removeAuthorizationParam(getWorkspaceByIdV1WorkspacesIdGet))
|
|
51
47
|
updateWorkspaceAi = this.mutation(removeAuthorizationParam(updateWorkspaceV1WorkspacesWorkspaceIdPatch))
|
|
52
48
|
deleteWorkspaceAi = this.mutation(removeAuthorizationParam(deleteWorkspaceV1WorkspacesWorkspaceIdDelete))
|
|
53
|
-
|
|
49
|
+
|
|
54
50
|
/**
|
|
55
51
|
* Adds a resource to the Spot.
|
|
56
52
|
*/
|
|
@@ -73,7 +69,7 @@ class WorkspaceAiClient extends ReactQueryNetworkClient {
|
|
|
73
69
|
request: (
|
|
74
70
|
signal,
|
|
75
71
|
variables: Omit<Parameters<typeof listAllByContentTypeV1WorkspacesWorkspaceIdContentTypeGet>[0],
|
|
76
|
-
|
|
72
|
+
'authorization' | 'contentType'>,
|
|
77
73
|
) =>
|
|
78
74
|
listAllByContentTypeV1WorkspacesWorkspaceIdContentTypeGet({ ...variables, contentType: 'knowledge_source', authorization: '' },
|
|
79
75
|
{ signal }) as unknown as Promise<KnowledgeSourceItemResponse[]>,
|
|
@@ -88,7 +84,7 @@ class WorkspaceAiClient extends ReactQueryNetworkClient {
|
|
|
88
84
|
request: (
|
|
89
85
|
signal,
|
|
90
86
|
variables: Omit<Parameters<typeof listAllByContentTypeV1WorkspacesWorkspaceIdContentTypeGet>[0],
|
|
91
|
-
|
|
87
|
+
'authorization' | 'contentType'>,
|
|
92
88
|
) =>
|
|
93
89
|
listAllByContentTypeV1WorkspacesWorkspaceIdContentTypeGet({ ...variables, contentType: 'stack', authorization: '' },
|
|
94
90
|
{ signal }) as unknown as Promise<GetAiStackResponse[]>,
|
|
@@ -103,7 +99,7 @@ class WorkspaceAiClient extends ReactQueryNetworkClient {
|
|
|
103
99
|
request: (
|
|
104
100
|
signal,
|
|
105
101
|
variables: Omit<Parameters<typeof listAllByContentTypeV1WorkspacesWorkspaceIdContentTypeGet>[0],
|
|
106
|
-
|
|
102
|
+
'authorization' | 'contentType'>,
|
|
107
103
|
) =>
|
|
108
104
|
listAllByContentTypeV1WorkspacesWorkspaceIdContentTypeGet({ ...variables, contentType: 'quick_command', authorization: '' },
|
|
109
105
|
{ signal }) as unknown as Promise<QuickCommandResponse[]>,
|
|
@@ -118,7 +114,7 @@ class WorkspaceAiClient extends ReactQueryNetworkClient {
|
|
|
118
114
|
request: (
|
|
119
115
|
signal,
|
|
120
116
|
variables: Omit<Parameters<typeof listAllByContentTypeV1WorkspacesWorkspaceIdContentTypeGet>[0],
|
|
121
|
-
|
|
117
|
+
'authorization' | 'contentType'>,
|
|
122
118
|
) =>
|
|
123
119
|
listAllByContentTypeV1WorkspacesWorkspaceIdContentTypeGet({ ...variables, contentType: 'agent', authorization: '' },
|
|
124
120
|
{ signal }) as unknown as Promise<AgentResponse[]>,
|
|
@@ -133,7 +129,7 @@ class WorkspaceAiClient extends ReactQueryNetworkClient {
|
|
|
133
129
|
request: (
|
|
134
130
|
signal,
|
|
135
131
|
variables: Omit<Parameters<typeof listAllByContentTypeV1WorkspacesWorkspaceIdContentTypeGet>[0],
|
|
136
|
-
|
|
132
|
+
'authorization' | 'contentType'>,
|
|
137
133
|
) =>
|
|
138
134
|
listAllByContentTypeV1WorkspacesWorkspaceIdContentTypeGet({ ...variables, contentType: 'toolkit', authorization: '' },
|
|
139
135
|
{ signal }) as unknown as Promise<CustomToolkitResponse[]>,
|
|
@@ -144,7 +140,7 @@ class WorkspaceAiClient extends ReactQueryNetworkClient {
|
|
|
144
140
|
removeContentV1WorkspacesWorkspaceIdContentTypeContentIdDelete))
|
|
145
141
|
addPermissionToWorkspaceAi = this.mutation(removeAuthorizationParam(addPermissionV1WorkspacesWorkspaceIdPermissionsPatch))
|
|
146
142
|
removePermissionToWorkspaceAi = this.mutation(removeAuthorizationParam(removePermissionV1WorkspacesWorkspaceIdPermissionsDelete))
|
|
147
|
-
|
|
143
|
+
|
|
148
144
|
/**
|
|
149
145
|
* Get group of permission on workspace AI
|
|
150
146
|
* @param search can be used to search by name
|
|
@@ -158,24 +154,24 @@ class WorkspaceAiClient extends ReactQueryNetworkClient {
|
|
|
158
154
|
* Adds the resource of type Workspace AI to the list of favorites.
|
|
159
155
|
*/
|
|
160
156
|
addFavoriteWorkspaceAi = this.mutation(removeAuthorizationParam(addFavoriteV1WorkspacesWorkspaceIdFavoritePost))
|
|
161
|
-
|
|
157
|
+
|
|
162
158
|
/**
|
|
163
159
|
* Removes the resource of type Workspace AI from the list of favorites.
|
|
164
160
|
*/
|
|
165
|
-
removeFavoriteWorkspaceAi = this.mutation(removeAuthorizationParam(deleteFavoriteV1WorkspacesWorkspaceIdFavoriteDelete))
|
|
161
|
+
removeFavoriteWorkspaceAi = this.mutation(removeAuthorizationParam(deleteFavoriteV1WorkspacesWorkspaceIdFavoriteDelete))
|
|
166
162
|
|
|
167
163
|
/**
|
|
168
164
|
* Gets all content from all workspaces to which the user has permissions.
|
|
169
165
|
*/
|
|
170
|
-
workspacesContentsByType
|
|
166
|
+
workspacesContentsByType = this.query(removeAuthorizationParam(listAllContentsV1WorkspacesContentsContentTypeGet))
|
|
171
167
|
/**
|
|
172
168
|
* Get a generated link to share a spot
|
|
173
169
|
*/
|
|
174
|
-
generateShareSpotLink
|
|
170
|
+
generateShareSpotLink = this.mutation(removeAuthorizationParam(createShareableLinkV1WorkspacesWorkspaceIdSharePost))
|
|
175
171
|
/**
|
|
176
172
|
* Get a shareable link from a spot
|
|
177
173
|
*/
|
|
178
|
-
shareableLink
|
|
174
|
+
shareableLink = this.mutation(removeAuthorizationParam(useShareableLinkV1ShareShareIdPatch))
|
|
179
175
|
/**
|
|
180
176
|
* Add permission to resource
|
|
181
177
|
*/
|
|
@@ -183,13 +179,13 @@ class WorkspaceAiClient extends ReactQueryNetworkClient {
|
|
|
183
179
|
/**
|
|
184
180
|
* Remove permission to resource
|
|
185
181
|
*/
|
|
186
|
-
removePermissionResource =
|
|
182
|
+
removePermissionResource =
|
|
187
183
|
this.mutation(removeAuthorizationParam(removePermissionV1ResourceTypeResourceTypeResourcesResourceIdentifierDelete))
|
|
188
184
|
/**
|
|
189
185
|
* List members with permission to resource
|
|
190
186
|
*/
|
|
191
|
-
listMembersResource =
|
|
187
|
+
listMembersResource =
|
|
192
188
|
this.infiniteQuery(removeAuthorizationParam(listMembersV1ResourceTypeResourceTypeResourcesResourceIdentifierMembersGet))
|
|
193
|
-
}
|
|
189
|
+
}
|
|
194
190
|
|
|
195
191
|
export const workspaceAiClient = new WorkspaceAiClient()
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Dictionary } from '@stack-spot/portal-translate'
|
|
2
|
+
|
|
3
|
+
export const wksAiDictionary = {
|
|
4
|
+
en: {
|
|
5
|
+
AGENT_1105_TOOLKIT_WITH_PERSONAL_SECRET: 'It is not possible to share the agent, as it has a tool with a personal secret. Remove the tool or replace it with an organization secret.',
|
|
6
|
+
},
|
|
7
|
+
pt: {
|
|
8
|
+
AGENT_1105_TOOLKIT_WITH_PERSONAL_SECRET: 'Não é possível compartilhar o agente, pois ele possui uma ferramenta com segredo pessoal. Remova a ferramenta ou substitua por um segredo da organização.',
|
|
9
|
+
},
|
|
10
|
+
} satisfies Dictionary
|