@stack-spot/portal-network 0.187.0 → 0.188.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 +86 -0
- package/dist/api/account.d.ts +197 -202
- package/dist/api/account.d.ts.map +1 -1
- package/dist/api/account.js +154 -140
- package/dist/api/account.js.map +1 -1
- package/dist/api/agent-tools.d.ts +13 -0
- package/dist/api/agent-tools.d.ts.map +1 -1
- package/dist/api/agent-tools.js.map +1 -1
- package/dist/api/codeShift.d.ts +45 -9
- 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/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/client/account.d.ts +30 -32
- package/dist/client/account.d.ts.map +1 -1
- package/dist/client/account.js +26 -17
- package/dist/client/account.js.map +1 -1
- package/dist/client/ai.d.ts.map +1 -1
- package/dist/client/ai.js +93 -13
- package/dist/client/ai.js.map +1 -1
- package/dist/client/code-shift.d.ts +27 -1
- package/dist/client/code-shift.d.ts.map +1 -1
- package/dist/client/code-shift.js +29 -1
- package/dist/client/code-shift.js.map +1 -1
- package/dist/client/types.d.ts +25 -5
- package/dist/client/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/readme.md +2 -1
- package/src/api/account.ts +299 -392
- package/src/api/agent-tools.ts +16 -0
- package/src/api/agent.ts +2 -0
- package/src/api/codeShift.ts +60 -9
- package/src/api/notification.ts +2 -0
- package/src/api/workflows.ts +100 -5
- package/src/client/account.ts +25 -28
- package/src/client/ai.ts +95 -12
- package/src/client/code-shift.ts +20 -0
- package/src/client/types.ts +26 -5
package/src/client/account.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
bindRoles,
|
|
12
12
|
bindToGroups,
|
|
13
13
|
bindToRoles,
|
|
14
|
+
cancelSecretDelete,
|
|
14
15
|
create,
|
|
15
16
|
create1,
|
|
16
17
|
createAccountRole, createExtension, createExtensionLink,
|
|
@@ -41,7 +42,7 @@ import {
|
|
|
41
42
|
enableSecret,
|
|
42
43
|
enterpriseContact,
|
|
43
44
|
findAssociations,
|
|
44
|
-
|
|
45
|
+
findSecrets,
|
|
45
46
|
getAccess,
|
|
46
47
|
getAccount1,
|
|
47
48
|
getAccountMembers,
|
|
@@ -63,31 +64,23 @@ import {
|
|
|
63
64
|
getFeatures3,
|
|
64
65
|
getGroupById,
|
|
65
66
|
getGroupResources,
|
|
66
|
-
getGroupResources1,
|
|
67
67
|
getGroups,
|
|
68
|
-
getGroups1,
|
|
69
68
|
getMemberById,
|
|
70
69
|
getMemberGroups,
|
|
71
|
-
getMemberGroups1,
|
|
72
70
|
getMemberPreferences,
|
|
73
71
|
getMembers,
|
|
74
|
-
getMembers1,
|
|
75
72
|
getPartnerAccount, getPartnersSharingAllowed,
|
|
76
73
|
getPersonalAccountDetails,
|
|
77
74
|
getPersonalClientCredentials,
|
|
78
|
-
|
|
75
|
+
getResources,
|
|
79
76
|
getResources2,
|
|
80
|
-
|
|
77
|
+
getResourcesAndActionsWithStatus,
|
|
81
78
|
getResourceTypes1,
|
|
82
79
|
getRoleGroups,
|
|
83
|
-
getRoleGroups1,
|
|
84
80
|
getRoleMembers,
|
|
85
|
-
getRoleMembers1,
|
|
86
81
|
getRoles,
|
|
87
82
|
getRoles1,
|
|
88
83
|
getRoles2,
|
|
89
|
-
getRoles3,
|
|
90
|
-
getRoles4, getRoles5,
|
|
91
84
|
getScmProvider,
|
|
92
85
|
getServiceCredential,
|
|
93
86
|
getServiceCredentialByIdRateLimit,
|
|
@@ -226,11 +219,11 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
226
219
|
/**
|
|
227
220
|
* Gets member Groups (paginated).
|
|
228
221
|
*/
|
|
229
|
-
memberGroups = this.infiniteQuery(
|
|
222
|
+
memberGroups = this.infiniteQuery(getMemberGroups)
|
|
230
223
|
/**
|
|
231
224
|
* Gets member roles (paginated).
|
|
232
225
|
*/
|
|
233
|
-
memberRoles = this.infiniteQuery(
|
|
226
|
+
memberRoles = this.infiniteQuery(getRoles)
|
|
234
227
|
/**
|
|
235
228
|
* Gets member resources.
|
|
236
229
|
*/
|
|
@@ -282,7 +275,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
282
275
|
/**
|
|
283
276
|
* Get all groups (paginated).
|
|
284
277
|
*/
|
|
285
|
-
allGroups = this.infiniteQuery(
|
|
278
|
+
allGroups = this.infiniteQuery(getGroups)
|
|
286
279
|
/**
|
|
287
280
|
* Creates a group.
|
|
288
281
|
*/
|
|
@@ -298,7 +291,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
298
291
|
/**
|
|
299
292
|
* Gets all members in a group (paginated).
|
|
300
293
|
*/
|
|
301
|
-
groupMembers = this.infiniteQuery(
|
|
294
|
+
groupMembers = this.infiniteQuery(getMembers)
|
|
302
295
|
/**
|
|
303
296
|
* Adds several members to a group
|
|
304
297
|
*/
|
|
@@ -310,7 +303,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
310
303
|
/**
|
|
311
304
|
* Gets all roles of a group.
|
|
312
305
|
*/
|
|
313
|
-
groupRoles = this.infiniteQuery(
|
|
306
|
+
groupRoles = this.infiniteQuery(getRoles)
|
|
314
307
|
/**
|
|
315
308
|
* Adds several roles to a group.
|
|
316
309
|
*/
|
|
@@ -322,7 +315,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
322
315
|
/**
|
|
323
316
|
* Gets all resources of a group (paginated).
|
|
324
317
|
*/
|
|
325
|
-
groupResources = this.infiniteQuery(
|
|
318
|
+
groupResources = this.infiniteQuery(getGroupResources)
|
|
326
319
|
/**
|
|
327
320
|
* Adds several resources to a group.
|
|
328
321
|
*/
|
|
@@ -334,14 +327,14 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
334
327
|
/**
|
|
335
328
|
* Gets all roles in the account (paginated)
|
|
336
329
|
*/
|
|
337
|
-
allRoles = this.infiniteQuery(
|
|
330
|
+
allRoles = this.infiniteQuery(getRoles)
|
|
338
331
|
/**
|
|
339
332
|
* Get a role by id
|
|
340
333
|
*/
|
|
341
334
|
role = this.query({
|
|
342
335
|
name: 'account.role',
|
|
343
336
|
request: async (signal, { id }: { id: string }) => {
|
|
344
|
-
const roles = await
|
|
337
|
+
const roles = await getRoles({ filterBy: 'id', filterValue: id }, { signal })
|
|
345
338
|
if (!roles.length) throw new StackspotAPIError({ status: 404 })
|
|
346
339
|
return roles[0]
|
|
347
340
|
},
|
|
@@ -349,7 +342,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
349
342
|
/**
|
|
350
343
|
* Gets all members with the provided role (paginated)
|
|
351
344
|
*/
|
|
352
|
-
roleMembers = this.infiniteQuery(
|
|
345
|
+
roleMembers = this.infiniteQuery(getRoleMembers)
|
|
353
346
|
/**
|
|
354
347
|
* Creates a role
|
|
355
348
|
*/
|
|
@@ -369,7 +362,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
369
362
|
/**
|
|
370
363
|
* Gets all groups with the provided role (paginated)
|
|
371
364
|
*/
|
|
372
|
-
roleGroups = this.infiniteQuery(
|
|
365
|
+
roleGroups = this.infiniteQuery(getRoleGroups)
|
|
373
366
|
/**
|
|
374
367
|
* Adds a role to several groups
|
|
375
368
|
*/
|
|
@@ -377,7 +370,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
377
370
|
/**
|
|
378
371
|
* Get the actions a role is allowed to perform
|
|
379
372
|
*/
|
|
380
|
-
rolePermissions = this.infiniteQuery(
|
|
373
|
+
rolePermissions = this.infiniteQuery(getResourcesAndActionsWithStatus)
|
|
381
374
|
/**
|
|
382
375
|
* Updates a role with new list of permissions
|
|
383
376
|
*/
|
|
@@ -389,7 +382,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
389
382
|
/**
|
|
390
383
|
* Gets all resources (paginated)
|
|
391
384
|
*/
|
|
392
|
-
allResources = this.infiniteQuery(
|
|
385
|
+
allResources = this.infiniteQuery(getResources)
|
|
393
386
|
/**
|
|
394
387
|
* Gets all resource types (paginated)
|
|
395
388
|
*/
|
|
@@ -738,15 +731,15 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
738
731
|
/**
|
|
739
732
|
* Get secrets
|
|
740
733
|
*/
|
|
741
|
-
getSecrets = this.query(
|
|
734
|
+
getSecrets = this.query(findSecrets)
|
|
742
735
|
/**
|
|
743
736
|
* Get workspace and spot secrets
|
|
744
737
|
*/
|
|
745
738
|
getWorkspaceAndSpotSecrets = this.query({
|
|
746
739
|
name: 'account.getWorkspaceAndSpotSecrets',
|
|
747
740
|
request: async (signal) => {
|
|
748
|
-
const workspaceSecrets = await
|
|
749
|
-
const spotSecrets = await
|
|
741
|
+
const workspaceSecrets = await findSecrets({ filterByScope: 'SCOPED', filterByScopedBy: 'WORKSPACE', size: 1500 }, { signal })
|
|
742
|
+
const spotSecrets = await findSecrets({ filterByScope: 'SCOPED', filterByScopedBy: 'SPOT', size: 1500 }, { signal })
|
|
750
743
|
return { workspaces: workspaceSecrets?.items, spots: spotSecrets?.items }
|
|
751
744
|
},
|
|
752
745
|
})
|
|
@@ -759,10 +752,10 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
759
752
|
*/
|
|
760
753
|
getSecretsByIds = this.query({
|
|
761
754
|
name: 'getSecretsByIds',
|
|
762
|
-
request: (signal, variables: { ids: string[]
|
|
755
|
+
request: (signal, variables: { ids: string[] }) => {
|
|
763
756
|
const requests = variables?.ids?.map((secretId) => getById({ secretId }, { signal }))
|
|
764
757
|
return Promise.all(requests)
|
|
765
|
-
}
|
|
758
|
+
},
|
|
766
759
|
})
|
|
767
760
|
|
|
768
761
|
/**
|
|
@@ -785,6 +778,10 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
785
778
|
* Disable secret
|
|
786
779
|
*/
|
|
787
780
|
disableSecret = this.mutation(disableSecret)
|
|
781
|
+
/**
|
|
782
|
+
* Cancel Secret delete
|
|
783
|
+
*/
|
|
784
|
+
cancelSecretDelete = this.mutation(cancelSecretDelete)
|
|
788
785
|
|
|
789
786
|
// TRIAL
|
|
790
787
|
/**
|
package/src/client/ai.ts
CHANGED
|
@@ -266,6 +266,9 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
266
266
|
agent.toolkits?.builtin_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
|
|
267
267
|
if (id) tools.push({ image: kit.image_url, id, name: name || id, description })
|
|
268
268
|
}))
|
|
269
|
+
agent.toolkits?.custom_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
|
|
270
|
+
if (id) tools.push({ image: kit.avatar ?? undefined, id, name: name || id, description })
|
|
271
|
+
}))
|
|
269
272
|
return tools
|
|
270
273
|
} catch {
|
|
271
274
|
return []
|
|
@@ -303,6 +306,33 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
303
306
|
steps: info.data?.steps?.map(s => s.goal) ?? [],
|
|
304
307
|
goal: info.data?.plan_goal ?? '',
|
|
305
308
|
})
|
|
309
|
+
|
|
310
|
+
info.data?.steps.forEach(s => data.steps?.push({
|
|
311
|
+
id: s.id,
|
|
312
|
+
type: 'step',
|
|
313
|
+
status: 'pending',
|
|
314
|
+
input: s.goal,
|
|
315
|
+
attempts: [{
|
|
316
|
+
tools: s.tools?.map(t => ({
|
|
317
|
+
...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
|
|
318
|
+
executionId: t.tool_execution_id,
|
|
319
|
+
goal: t.goal,
|
|
320
|
+
})),
|
|
321
|
+
}],
|
|
322
|
+
}))
|
|
323
|
+
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (info.type === 'planning' && info.action === 'awaiting_approval') {
|
|
327
|
+
data.steps.push({
|
|
328
|
+
id: 'planning',
|
|
329
|
+
type: 'planning',
|
|
330
|
+
status: 'awaiting_approval',
|
|
331
|
+
user_question: info.data?.user_question,
|
|
332
|
+
duration: info.duration || 0,
|
|
333
|
+
steps: info.data?.steps?.map(s => s.goal) ?? [],
|
|
334
|
+
goal: info.data?.plan_goal ?? '',
|
|
335
|
+
})
|
|
306
336
|
info.data?.steps.forEach(s => data.steps?.push({
|
|
307
337
|
id: s.id,
|
|
308
338
|
type: 'step',
|
|
@@ -312,6 +342,7 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
312
342
|
tools: s.tools?.map(t => ({
|
|
313
343
|
...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
|
|
314
344
|
executionId: t.tool_execution_id,
|
|
345
|
+
goal: t.goal,
|
|
315
346
|
})),
|
|
316
347
|
}],
|
|
317
348
|
}))
|
|
@@ -334,27 +365,78 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
334
365
|
}
|
|
335
366
|
}
|
|
336
367
|
|
|
368
|
+
if (info.type === 'tool' && info.action === 'awaiting_approval') {
|
|
369
|
+
const tool = tools.find(({ id }) => id === info.data?.tool_id)
|
|
370
|
+
data.steps.push({
|
|
371
|
+
id: info.id,
|
|
372
|
+
type: 'tool',
|
|
373
|
+
status: 'awaiting_approval',
|
|
374
|
+
duration: info.duration || 0,
|
|
375
|
+
input: info.data?.input,
|
|
376
|
+
user_question: info.data?.user_question,
|
|
377
|
+
attempts: [{
|
|
378
|
+
tools: [{
|
|
379
|
+
executionId: info.id,
|
|
380
|
+
id: info.data?.tool_id ?? '',
|
|
381
|
+
name: tool?.name ?? '',
|
|
382
|
+
goal: tool?.goal,
|
|
383
|
+
...tool,
|
|
384
|
+
}],
|
|
385
|
+
}],
|
|
386
|
+
})
|
|
387
|
+
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
|
|
388
|
+
}
|
|
389
|
+
|
|
337
390
|
if (info.type === 'tool' && info.action === 'start') {
|
|
338
391
|
const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
|
|
339
|
-
if (!
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
392
|
+
if (!info.data) return
|
|
393
|
+
|
|
394
|
+
//There might be a tool with status awaiting_approval, so we want to inform tool has already started
|
|
395
|
+
if (!currentStep || !currentStep.attempts[0].tools) {
|
|
396
|
+
const input = formatJson(info.data.input)
|
|
397
|
+
const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
|
|
398
|
+
data.steps.push({
|
|
399
|
+
id: info.id,
|
|
400
|
+
type: 'tool',
|
|
401
|
+
status: 'running',
|
|
402
|
+
duration: info.duration || 0,
|
|
403
|
+
input: info.data?.input,
|
|
404
|
+
user_question: info.data?.user_question,
|
|
405
|
+
attempts: [{
|
|
406
|
+
tools:[{ ...tool, executionId: info.id, input }],
|
|
407
|
+
}],
|
|
350
408
|
})
|
|
409
|
+
} else {
|
|
410
|
+
const toolInFirstAttempt = currentStep.attempts[0].tools?.find(t => t.executionId === info.id)
|
|
411
|
+
//One step might have multiple tools. When in an approval mode, we might not have all the tools in the array yet.
|
|
412
|
+
//So we make sure to add any tools that are not in there.
|
|
413
|
+
if (!toolInFirstAttempt) {
|
|
414
|
+
const input = formatJson(info.data.input)
|
|
415
|
+
const tool = tools?.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
|
|
416
|
+
currentStep.attempts[info.data.attempt-1].tools?.push({
|
|
417
|
+
...tool,
|
|
418
|
+
input,
|
|
419
|
+
})
|
|
420
|
+
} else {
|
|
421
|
+
const input = formatJson(info.data.input)
|
|
422
|
+
if (info.data.attempt === 1) {
|
|
423
|
+
toolInFirstAttempt.input = input
|
|
424
|
+
} else {
|
|
425
|
+
const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
|
|
426
|
+
currentStep.attempts[info.data.attempt-1] ??= { tools: [] }
|
|
427
|
+
currentStep.attempts[info.data.attempt-1].tools?.push({
|
|
428
|
+
...tool,
|
|
429
|
+
input,
|
|
430
|
+
})
|
|
431
|
+
}
|
|
432
|
+
}
|
|
351
433
|
}
|
|
352
434
|
}
|
|
353
435
|
|
|
354
436
|
if (info.type === 'tool' && info.action === 'end') {
|
|
355
437
|
const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
|
|
356
438
|
if (!currentStep || !info.data) return
|
|
357
|
-
const tool = currentStep.attempts[info.data.attempt]?.tools?.find(t => t.executionId === info.id)
|
|
439
|
+
const tool = currentStep.attempts[info.data.attempt-1]?.tools?.find(t => t.executionId === info.id)
|
|
358
440
|
if (tool) {
|
|
359
441
|
tool.output = formatJson(info.data.output)
|
|
360
442
|
tool.duration = info.duration
|
|
@@ -393,3 +475,4 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
393
475
|
}
|
|
394
476
|
|
|
395
477
|
export const aiClient = new AIClient()
|
|
478
|
+
|
package/src/client/code-shift.ts
CHANGED
|
@@ -58,11 +58,14 @@ import {
|
|
|
58
58
|
getModuleV1ModulesModuleIdGet,
|
|
59
59
|
analyticsProgramGroupsTargetDetailsV1AnalyticsProgramGroupsTargetDetailsGet,
|
|
60
60
|
analyticsProgramGroupsTargetDetailsDownloadV1AnalyticsProgramGroupsTargetDetailsDownloadGet,
|
|
61
|
+
putCustomerRatingReportV1ReportsReportIdCustomerRatingPut,
|
|
61
62
|
searchReposScmServiceV2ReposSearchScmPost,
|
|
62
63
|
importReposWithTagsScmServiceV2ReposSearchScmSearchIdPost,
|
|
63
64
|
searchReposScmV2V2ReposSearchScmSearchIdGet,
|
|
64
65
|
analyticsRepositoryTargetDetailsV1AnalyticsRepositoriesTargetDetailsGet,
|
|
65
66
|
analyticsRepositoryTargetDetailsDownloadV1AnalyticsRepositoriesTargetDetailsDownloadGet,
|
|
67
|
+
updateModuleServiceV1ModulesModuleIdPut,
|
|
68
|
+
downloadSearchReposScmV2V2ReposSearchScmSearchIdDownloadGet,
|
|
66
69
|
} from '../api/codeShift'
|
|
67
70
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
68
71
|
import { codeShiftDictionary } from '../error/dictionary/code-shift'
|
|
@@ -128,6 +131,10 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
128
131
|
* Creates a module.
|
|
129
132
|
*/
|
|
130
133
|
createModule = this.mutation(removeAuthorizationParam(createModuleServiceV1ModulesPost))
|
|
134
|
+
/**
|
|
135
|
+
* Updates a module.
|
|
136
|
+
*/
|
|
137
|
+
updateModule = this.mutation(removeAuthorizationParam(updateModuleServiceV1ModulesModuleIdPut))
|
|
131
138
|
/**
|
|
132
139
|
* Generates a report.
|
|
133
140
|
*/
|
|
@@ -144,6 +151,12 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
144
151
|
* Downloads a report as a csv file.
|
|
145
152
|
*/
|
|
146
153
|
downloadReport = this.query(removeAuthorizationParam(downloadReportV1ReportsReportIdDownloadGet))
|
|
154
|
+
/**
|
|
155
|
+
* Put Customer Rating Report
|
|
156
|
+
*/
|
|
157
|
+
updateReportRating = this.mutation(
|
|
158
|
+
removeAuthorizationParam(putCustomerRatingReportV1ReportsReportIdCustomerRatingPut),
|
|
159
|
+
)
|
|
147
160
|
/**
|
|
148
161
|
* Gets code shift settings
|
|
149
162
|
*/
|
|
@@ -161,6 +174,7 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
161
174
|
*/
|
|
162
175
|
searchRepositoryStatus = this.query(removeAuthorizationParam(getStatusSearchReposScmServiceV1ReposSearchScmSearchRepoIdStatusGet))
|
|
163
176
|
/**
|
|
177
|
+
* @deprecated
|
|
164
178
|
* Downloads file with found repositories
|
|
165
179
|
*/
|
|
166
180
|
downloadSearchRepository = this.mutation(removeAuthorizationParam(downloadSearchReposScmServiceV1ReposSearchScmSearchRepoIdDownloadGet))
|
|
@@ -176,6 +190,12 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
176
190
|
* Gets repositories search by id (v2)
|
|
177
191
|
*/
|
|
178
192
|
getRepositoriesBySearchId = this.query(removeAuthorizationParam(searchReposScmV2V2ReposSearchScmSearchIdGet))
|
|
193
|
+
/**
|
|
194
|
+
* Downloads file with found repositories (v2)
|
|
195
|
+
*/
|
|
196
|
+
downloadSearchRepositoryV2 = this.mutation(
|
|
197
|
+
removeAuthorizationParam(downloadSearchReposScmV2V2ReposSearchScmSearchIdDownloadGet),
|
|
198
|
+
)
|
|
179
199
|
/**
|
|
180
200
|
* Validate if the user has permission.
|
|
181
201
|
* We do not use opa in this api, so this is the fn needed to check permissions.
|
package/src/client/types.ts
CHANGED
|
@@ -245,6 +245,7 @@ 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 {
|
|
@@ -256,8 +257,8 @@ export interface ChatStepAttempt {
|
|
|
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
|
|