@stack-spot/portal-network 0.188.1 → 0.189.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 +77 -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/codeShift.d.ts +31 -0
- 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/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/client/account.d.ts +29 -29
- 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 +9 -0
- package/dist/client/code-shift.d.ts.map +1 -1
- package/dist/client/code-shift.js +11 -1
- package/dist/client/code-shift.js.map +1 -1
- package/dist/client/types.d.ts +26 -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 +3 -0
- package/src/api/agent.ts +2 -0
- package/src/api/codeShift.ts +46 -0
- package/src/api/genAiInference.ts +47 -4
- package/src/api/notification.ts +2 -0
- package/src/client/account.ts +25 -28
- package/src/client/ai.ts +95 -12
- package/src/client/code-shift.ts +9 -1
- package/src/client/types.ts +27 -5
package/src/api/agent-tools.ts
CHANGED
package/src/api/agent.ts
CHANGED
package/src/api/codeShift.ts
CHANGED
|
@@ -153,6 +153,8 @@ export type PutModuleRequest = {
|
|
|
153
153
|
/** Inputs of module */
|
|
154
154
|
inputs?: InputRequest[] | null;
|
|
155
155
|
/** Module studio */
|
|
156
|
+
studio?: string | null;
|
|
157
|
+
/** Module Constants */
|
|
156
158
|
constants?: {
|
|
157
159
|
[key: string]: any;
|
|
158
160
|
} | null;
|
|
@@ -256,6 +258,11 @@ export type TargetFilesRequest = {
|
|
|
256
258
|
dependsOn?: DependsOnRequest[] | null;
|
|
257
259
|
issues?: IssuesRequest[] | null;
|
|
258
260
|
};
|
|
261
|
+
export type LanguageInfoRequest = {
|
|
262
|
+
bytes: number;
|
|
263
|
+
absolutePercentage: number;
|
|
264
|
+
relativePercentage: number;
|
|
265
|
+
};
|
|
259
266
|
export type PutReportRequest = {
|
|
260
267
|
filesCount?: number;
|
|
261
268
|
issuesCount: number;
|
|
@@ -271,6 +278,9 @@ export type PutReportRequest = {
|
|
|
271
278
|
} | null;
|
|
272
279
|
totalTokenSent?: number | null;
|
|
273
280
|
totalTokenReceived?: number | null;
|
|
281
|
+
languageBreakdown?: {
|
|
282
|
+
[key: string]: LanguageInfoRequest;
|
|
283
|
+
} | null;
|
|
274
284
|
};
|
|
275
285
|
export type ModuleResponse2 = {
|
|
276
286
|
id: string;
|
|
@@ -336,6 +346,13 @@ export type CustomerRatingResponse = {
|
|
|
336
346
|
created_by: UserResponse;
|
|
337
347
|
created_at: string;
|
|
338
348
|
};
|
|
349
|
+
export type LanguageResponse = {
|
|
350
|
+
name: string;
|
|
351
|
+
extensions: string[];
|
|
352
|
+
bytes: number;
|
|
353
|
+
relativePercentage: number;
|
|
354
|
+
absolutePercentage: number;
|
|
355
|
+
};
|
|
339
356
|
export type GetReportResponse = {
|
|
340
357
|
id: string;
|
|
341
358
|
"module": ModuleResponse2 | null;
|
|
@@ -371,6 +388,7 @@ export type GetReportResponse = {
|
|
|
371
388
|
[key: string]: any;
|
|
372
389
|
} | null;
|
|
373
390
|
customer_rating?: CustomerRatingResponse | null;
|
|
391
|
+
languages?: LanguageResponse[] | null;
|
|
374
392
|
};
|
|
375
393
|
export type GetReportResponseRead = {
|
|
376
394
|
id: string;
|
|
@@ -407,6 +425,7 @@ export type GetReportResponseRead = {
|
|
|
407
425
|
[key: string]: any;
|
|
408
426
|
} | null;
|
|
409
427
|
customer_rating?: CustomerRatingResponse | null;
|
|
428
|
+
languages?: LanguageResponse[] | null;
|
|
410
429
|
};
|
|
411
430
|
export type GetPullRequest = {
|
|
412
431
|
content: string;
|
|
@@ -542,6 +561,7 @@ export type RepositoryResponse = {
|
|
|
542
561
|
tags: string[];
|
|
543
562
|
url: string;
|
|
544
563
|
defaultBranch: string;
|
|
564
|
+
languages?: LanguageResponse[] | null;
|
|
545
565
|
};
|
|
546
566
|
export type RepositoryResponseRead = {
|
|
547
567
|
/** Repository ID */
|
|
@@ -554,6 +574,7 @@ export type RepositoryResponseRead = {
|
|
|
554
574
|
tags: string[];
|
|
555
575
|
url: string;
|
|
556
576
|
defaultBranch: string;
|
|
577
|
+
languages?: LanguageResponse[] | null;
|
|
557
578
|
};
|
|
558
579
|
export type ListRepositoryResponse = {
|
|
559
580
|
/** List of applications */
|
|
@@ -966,6 +987,7 @@ export type RepositoryDetailedReportItemResponse = {
|
|
|
966
987
|
moduleVersion?: string | null;
|
|
967
988
|
processingTimeSeconds?: number | null;
|
|
968
989
|
pullRequestLink?: string | null;
|
|
990
|
+
merged?: string | null;
|
|
969
991
|
reportCreatedAt?: string | null;
|
|
970
992
|
reportCreatedByEmail?: string | null;
|
|
971
993
|
reportCreatedByName?: string | null;
|
|
@@ -987,6 +1009,7 @@ export type AnalyticsRepositoryDetailedReportResponse = {
|
|
|
987
1009
|
changedFilesCount?: number;
|
|
988
1010
|
issuesCount?: number;
|
|
989
1011
|
processingTime95Percentile?: number | null;
|
|
1012
|
+
totalMergedPullRequests?: number;
|
|
990
1013
|
totalItems?: number;
|
|
991
1014
|
items?: RepositoryDetailedReportItemResponse[];
|
|
992
1015
|
};
|
|
@@ -3570,3 +3593,26 @@ export function searchReposScmV2V2ReposSearchScmSearchIdGet({ searchId, authoriz
|
|
|
3570
3593
|
})
|
|
3571
3594
|
}));
|
|
3572
3595
|
}
|
|
3596
|
+
/**
|
|
3597
|
+
* Download Search Repos Scm V2
|
|
3598
|
+
*/
|
|
3599
|
+
export function downloadSearchReposScmV2V2ReposSearchScmSearchIdDownloadGet({ searchId, extension, authorization }: {
|
|
3600
|
+
searchId: string;
|
|
3601
|
+
extension?: "csv" | "xlsx";
|
|
3602
|
+
authorization: string;
|
|
3603
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
3604
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
3605
|
+
status: 200;
|
|
3606
|
+
data: ResponseSearchRepoByIdResponseRead;
|
|
3607
|
+
} | {
|
|
3608
|
+
status: 422;
|
|
3609
|
+
data: HttpValidationError;
|
|
3610
|
+
}>(`/v2/repos/search-scm/${encodeURIComponent(searchId)}/download${QS.query(QS.explode({
|
|
3611
|
+
extension
|
|
3612
|
+
}))}`, {
|
|
3613
|
+
...opts,
|
|
3614
|
+
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
3615
|
+
authorization
|
|
3616
|
+
})
|
|
3617
|
+
}));
|
|
3618
|
+
}
|
|
@@ -134,6 +134,9 @@ export type UpdateLlmModelRequest = {
|
|
|
134
134
|
};
|
|
135
135
|
resources: LlmModelResourceRequest[];
|
|
136
136
|
};
|
|
137
|
+
export type GetModelByIdsRequest = {
|
|
138
|
+
model_ids: string[];
|
|
139
|
+
};
|
|
137
140
|
export type UpdateLlmModelResourceRequest = {
|
|
138
141
|
name: string;
|
|
139
142
|
is_default?: boolean;
|
|
@@ -239,6 +242,8 @@ export type ChatCompletion = {
|
|
|
239
242
|
function_call?: string | {
|
|
240
243
|
[key: string]: string;
|
|
241
244
|
} | null;
|
|
245
|
+
/** ID of an alternative model for chat completion. It should be present on available_model_ids agent attr. */
|
|
246
|
+
selected_model_id?: string | null;
|
|
242
247
|
};
|
|
243
248
|
export type ChatRequest = {
|
|
244
249
|
streaming: boolean;
|
|
@@ -246,6 +251,8 @@ export type ChatRequest = {
|
|
|
246
251
|
stackspot_knowledge?: boolean;
|
|
247
252
|
return_ks_in_response?: boolean;
|
|
248
253
|
upload_ids?: string[];
|
|
254
|
+
execution_id?: string | null;
|
|
255
|
+
selected_model?: string | null;
|
|
249
256
|
};
|
|
250
257
|
/**
|
|
251
258
|
* Health Check
|
|
@@ -469,6 +476,32 @@ export function deleteV1LlmModelsModelIdDelete({ modelId, xAccountId, authorizat
|
|
|
469
476
|
})
|
|
470
477
|
}));
|
|
471
478
|
}
|
|
479
|
+
/**
|
|
480
|
+
* Get Models List
|
|
481
|
+
*/
|
|
482
|
+
export function getModelsListV1LlmModelsListPost({ xAccountId, authorization, getModelByIdsRequest }: {
|
|
483
|
+
xAccountId?: string | null;
|
|
484
|
+
authorization: string;
|
|
485
|
+
getModelByIdsRequest: GetModelByIdsRequest;
|
|
486
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
487
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
488
|
+
status: 200;
|
|
489
|
+
data: LlmModelsResponse[];
|
|
490
|
+
} | {
|
|
491
|
+
status: 404;
|
|
492
|
+
} | {
|
|
493
|
+
status: 422;
|
|
494
|
+
data: HttpValidationError;
|
|
495
|
+
}>("/v1/llm/models-list", oazapfts.json({
|
|
496
|
+
...opts,
|
|
497
|
+
method: "POST",
|
|
498
|
+
body: getModelByIdsRequest,
|
|
499
|
+
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
500
|
+
"x-account-id": xAccountId,
|
|
501
|
+
authorization
|
|
502
|
+
})
|
|
503
|
+
})));
|
|
504
|
+
}
|
|
472
505
|
/**
|
|
473
506
|
* Save Or Update Model Resources
|
|
474
507
|
*/
|
|
@@ -549,10 +582,15 @@ export function listLlmProvidersV1LlmProvidersGet({ acceptsSelfHosted, xAccountI
|
|
|
549
582
|
/**
|
|
550
583
|
* Handle completions requests
|
|
551
584
|
*/
|
|
552
|
-
export function createCompletionsV1ChatCompletionsPost({ xRequestOrigin,
|
|
553
|
-
xRequestOrigin?: string | null;
|
|
585
|
+
export function createCompletionsV1ChatCompletionsPost({ xAccountId, authorization, xRequestOrigin, xConversationId, xMessageId, xQcExecutionId, xQcSlug, xPlatformVersion, chatCompletion }: {
|
|
554
586
|
xAccountId?: string | null;
|
|
555
587
|
authorization: string;
|
|
588
|
+
xRequestOrigin?: string | null;
|
|
589
|
+
xConversationId?: string | null;
|
|
590
|
+
xMessageId?: string | null;
|
|
591
|
+
xQcExecutionId?: string | null;
|
|
592
|
+
xQcSlug?: string | null;
|
|
593
|
+
xPlatformVersion?: string | null;
|
|
556
594
|
chatCompletion: ChatCompletion;
|
|
557
595
|
}, opts?: Oazapfts.RequestOpts) {
|
|
558
596
|
return oazapfts.ok(oazapfts.fetchJson<{
|
|
@@ -568,9 +606,14 @@ export function createCompletionsV1ChatCompletionsPost({ xRequestOrigin, xAccoun
|
|
|
568
606
|
method: "POST",
|
|
569
607
|
body: chatCompletion,
|
|
570
608
|
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
571
|
-
"x-request-origin": xRequestOrigin,
|
|
572
609
|
"x-account-id": xAccountId,
|
|
573
|
-
authorization
|
|
610
|
+
authorization,
|
|
611
|
+
"x-request-origin": xRequestOrigin,
|
|
612
|
+
"x-conversation-id": xConversationId,
|
|
613
|
+
"x-message-id": xMessageId,
|
|
614
|
+
"x-qc-execution-id": xQcExecutionId,
|
|
615
|
+
"x-qc-slug": xQcSlug,
|
|
616
|
+
"x-platform-version": xPlatformVersion
|
|
574
617
|
})
|
|
575
618
|
})));
|
|
576
619
|
}
|
package/src/api/notification.ts
CHANGED
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(getRoles1)
|
|
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(getRoles2)
|
|
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,13 +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,
|
|
66
|
-
putCustomerRatingReportV1ReportsReportIdCustomerRatingPut,
|
|
67
67
|
updateModuleServiceV1ModulesModuleIdPut,
|
|
68
|
+
downloadSearchReposScmV2V2ReposSearchScmSearchIdDownloadGet,
|
|
68
69
|
} from '../api/codeShift'
|
|
69
70
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
70
71
|
import { codeShiftDictionary } from '../error/dictionary/code-shift'
|
|
@@ -173,6 +174,7 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
173
174
|
*/
|
|
174
175
|
searchRepositoryStatus = this.query(removeAuthorizationParam(getStatusSearchReposScmServiceV1ReposSearchScmSearchRepoIdStatusGet))
|
|
175
176
|
/**
|
|
177
|
+
* @deprecated
|
|
176
178
|
* Downloads file with found repositories
|
|
177
179
|
*/
|
|
178
180
|
downloadSearchRepository = this.mutation(removeAuthorizationParam(downloadSearchReposScmServiceV1ReposSearchScmSearchRepoIdDownloadGet))
|
|
@@ -188,6 +190,12 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
188
190
|
* Gets repositories search by id (v2)
|
|
189
191
|
*/
|
|
190
192
|
getRepositoriesBySearchId = this.query(removeAuthorizationParam(searchReposScmV2V2ReposSearchScmSearchIdGet))
|
|
193
|
+
/**
|
|
194
|
+
* Downloads file with found repositories (v2)
|
|
195
|
+
*/
|
|
196
|
+
downloadSearchRepositoryV2 = this.mutation(
|
|
197
|
+
removeAuthorizationParam(downloadSearchReposScmV2V2ReposSearchScmSearchIdDownloadGet),
|
|
198
|
+
)
|
|
191
199
|
/**
|
|
192
200
|
* Validate if the user has permission.
|
|
193
201
|
* We do not use opa in this api, so this is the fn needed to check permissions.
|