@stack-spot/portal-network 0.189.0 → 0.190.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 +146 -0
- package/dist/api/account.d.ts +85 -202
- package/dist/api/account.d.ts.map +1 -1
- package/dist/api/account.js +68 -140
- package/dist/api/account.js.map +1 -1
- package/dist/api/ai.d.ts +189 -86
- package/dist/api/ai.d.ts.map +1 -1
- package/dist/api/ai.js +238 -142
- package/dist/api/ai.js.map +1 -1
- package/dist/api/cloudPlatform.d.ts +363 -188
- package/dist/api/cloudPlatform.d.ts.map +1 -1
- package/dist/api/cloudPlatform.js +253 -80
- package/dist/api/cloudPlatform.js.map +1 -1
- package/dist/api/codeShift.d.ts +5 -3
- package/dist/api/codeShift.d.ts.map +1 -1
- 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 +18 -4
- package/dist/client/account.d.ts.map +1 -1
- package/dist/client/account.js +58 -31
- package/dist/client/account.js.map +1 -1
- package/dist/client/ai.d.ts +29 -0
- package/dist/client/ai.d.ts.map +1 -1
- package/dist/client/ai.js +121 -14
- package/dist/client/ai.js.map +1 -1
- package/dist/client/cloud-platform.d.ts +128 -1
- package/dist/client/cloud-platform.d.ts.map +1 -1
- package/dist/client/cloud-platform.js +92 -2
- package/dist/client/cloud-platform.js.map +1 -1
- package/dist/client/code-shift.js +1 -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 +3 -3
- package/readme.md +2 -1
- package/src/api/account.ts +127 -392
- package/src/api/agent-tools.ts +3 -0
- package/src/api/agent.ts +2 -0
- package/src/api/ai.ts +364 -157
- package/src/api/cloudPlatform.ts +638 -264
- package/src/api/codeShift.ts +5 -3
- package/src/api/genAiInference.ts +47 -4
- package/src/api/notification.ts +2 -0
- package/src/client/account.ts +54 -38
- package/src/client/ai.ts +126 -13
- package/src/client/cloud-platform.ts +52 -2
- package/src/client/code-shift.ts +1 -1
- package/src/client/types.ts +27 -5
package/src/api/codeShift.ts
CHANGED
|
@@ -12,7 +12,7 @@ export const defaults: Oazapfts.Defaults<Oazapfts.CustomHeaders> = {
|
|
|
12
12
|
};
|
|
13
13
|
const oazapfts = Oazapfts.runtime(defaults);
|
|
14
14
|
export const servers = {};
|
|
15
|
-
export type CodeShiftRole = "list-applications" | "create-application" | "list-repository" | "create-repository" | "delete-repository" | "dispatch-module" | "create-module" | "account-settings" | "list-integration" | "create-integration" | "delete-integration" | "list-program-group" | "create-program-group" | "delete-program-group" | "view-analytics";
|
|
15
|
+
export type CodeShiftRole = "list-applications" | "create-application" | "list-repository" | "create-repository" | "delete-repository" | "dispatch-module" | "create-module" | "account-settings" | "list-integration" | "create-integration" | "delete-integration" | "list-program-group" | "create-program-group" | "delete-program-group" | "view-analytics" | "account-discovery-repos";
|
|
16
16
|
export type RolesResponse = {
|
|
17
17
|
result: boolean;
|
|
18
18
|
};
|
|
@@ -836,8 +836,9 @@ export type RepositoryLastReportStatusResponse = {
|
|
|
836
836
|
totalFilesChanged: number | null;
|
|
837
837
|
totalIssues: number | null;
|
|
838
838
|
pullRequestLink: string | null;
|
|
839
|
-
merged
|
|
839
|
+
merged?: boolean | null;
|
|
840
840
|
customerScore?: number | null;
|
|
841
|
+
languages?: string | null;
|
|
841
842
|
};
|
|
842
843
|
export type AnalyticsRepositoryLastReportStatusResponse = {
|
|
843
844
|
totalFiles?: number;
|
|
@@ -987,7 +988,7 @@ export type RepositoryDetailedReportItemResponse = {
|
|
|
987
988
|
moduleVersion?: string | null;
|
|
988
989
|
processingTimeSeconds?: number | null;
|
|
989
990
|
pullRequestLink?: string | null;
|
|
990
|
-
merged?:
|
|
991
|
+
merged?: boolean | null;
|
|
991
992
|
reportCreatedAt?: string | null;
|
|
992
993
|
reportCreatedByEmail?: string | null;
|
|
993
994
|
reportCreatedByName?: string | null;
|
|
@@ -1000,6 +1001,7 @@ export type RepositoryDetailedReportItemResponse = {
|
|
|
1000
1001
|
totalFilesCount?: number;
|
|
1001
1002
|
status?: string | null;
|
|
1002
1003
|
customerScore?: number | null;
|
|
1004
|
+
languages?: string | null;
|
|
1003
1005
|
};
|
|
1004
1006
|
export type AnalyticsRepositoryDetailedReportResponse = {
|
|
1005
1007
|
reposCount?: number;
|
|
@@ -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,13 +42,13 @@ import {
|
|
|
41
42
|
enableSecret,
|
|
42
43
|
enterpriseContact,
|
|
43
44
|
findAssociations,
|
|
44
|
-
|
|
45
|
+
findSecrets,
|
|
45
46
|
getAccess,
|
|
46
47
|
getAccount1,
|
|
47
48
|
getAccountMembers,
|
|
48
|
-
|
|
49
|
+
getAccountMembers1,
|
|
49
50
|
getAccountRateLimit,
|
|
50
|
-
|
|
51
|
+
getAccounts,
|
|
51
52
|
getAccountSso,
|
|
52
53
|
getActiveExtensionVersion,
|
|
53
54
|
getAllAccountSso,
|
|
@@ -74,10 +75,11 @@ import {
|
|
|
74
75
|
getMembers1,
|
|
75
76
|
getPartnerAccount, getPartnersSharingAllowed,
|
|
76
77
|
getPersonalAccountDetails,
|
|
78
|
+
getPersonalAccountExpirationData,
|
|
77
79
|
getPersonalClientCredentials,
|
|
78
|
-
|
|
80
|
+
getResources,
|
|
79
81
|
getResources2,
|
|
80
|
-
|
|
82
|
+
getResourcesAndActionsWithStatus,
|
|
81
83
|
getResourceTypes1,
|
|
82
84
|
getRoleGroups,
|
|
83
85
|
getRoleGroups1,
|
|
@@ -87,7 +89,8 @@ import {
|
|
|
87
89
|
getRoles1,
|
|
88
90
|
getRoles2,
|
|
89
91
|
getRoles3,
|
|
90
|
-
getRoles4,
|
|
92
|
+
getRoles4,
|
|
93
|
+
getRoles5,
|
|
91
94
|
getScmProvider,
|
|
92
95
|
getServiceCredential,
|
|
93
96
|
getServiceCredentialByIdRateLimit,
|
|
@@ -102,9 +105,10 @@ import {
|
|
|
102
105
|
listExtensions,
|
|
103
106
|
listExtensionVersions,
|
|
104
107
|
listMemberFavoritesByResource,
|
|
105
|
-
|
|
108
|
+
listScmCredentials1,
|
|
106
109
|
listScmCredentials2, partialUpdateSso, personalAccessTokenAuthorization,
|
|
107
110
|
personalContact,
|
|
111
|
+
reactivateTrialAccount,
|
|
108
112
|
removeRoleFromMember,
|
|
109
113
|
removeTrialAccount,
|
|
110
114
|
resetOtp,
|
|
@@ -222,15 +226,15 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
222
226
|
/**
|
|
223
227
|
* Gets all members (paginated).
|
|
224
228
|
*/
|
|
225
|
-
allMembers = this.infiniteQuery(
|
|
229
|
+
allMembers = this.infiniteQuery(getAccountMembers)
|
|
226
230
|
/**
|
|
227
231
|
* Gets member Groups (paginated).
|
|
228
232
|
*/
|
|
229
|
-
memberGroups = this.infiniteQuery(
|
|
233
|
+
memberGroups = this.infiniteQuery(getMemberGroups)
|
|
230
234
|
/**
|
|
231
235
|
* Gets member roles (paginated).
|
|
232
236
|
*/
|
|
233
|
-
memberRoles = this.infiniteQuery(
|
|
237
|
+
memberRoles = this.infiniteQuery(getRoles1)
|
|
234
238
|
/**
|
|
235
239
|
* Gets member resources.
|
|
236
240
|
*/
|
|
@@ -282,7 +286,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
282
286
|
/**
|
|
283
287
|
* Get all groups (paginated).
|
|
284
288
|
*/
|
|
285
|
-
allGroups = this.infiniteQuery(
|
|
289
|
+
allGroups = this.infiniteQuery(getGroups)
|
|
286
290
|
/**
|
|
287
291
|
* Creates a group.
|
|
288
292
|
*/
|
|
@@ -298,7 +302,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
298
302
|
/**
|
|
299
303
|
* Gets all members in a group (paginated).
|
|
300
304
|
*/
|
|
301
|
-
groupMembers = this.infiniteQuery(
|
|
305
|
+
groupMembers = this.infiniteQuery(getMembers)
|
|
302
306
|
/**
|
|
303
307
|
* Adds several members to a group
|
|
304
308
|
*/
|
|
@@ -310,7 +314,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
310
314
|
/**
|
|
311
315
|
* Gets all roles of a group.
|
|
312
316
|
*/
|
|
313
|
-
groupRoles = this.infiniteQuery(
|
|
317
|
+
groupRoles = this.infiniteQuery(getRoles2)
|
|
314
318
|
/**
|
|
315
319
|
* Adds several roles to a group.
|
|
316
320
|
*/
|
|
@@ -322,7 +326,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
322
326
|
/**
|
|
323
327
|
* Gets all resources of a group (paginated).
|
|
324
328
|
*/
|
|
325
|
-
groupResources = this.infiniteQuery(
|
|
329
|
+
groupResources = this.infiniteQuery(getGroupResources)
|
|
326
330
|
/**
|
|
327
331
|
* Adds several resources to a group.
|
|
328
332
|
*/
|
|
@@ -334,14 +338,14 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
334
338
|
/**
|
|
335
339
|
* Gets all roles in the account (paginated)
|
|
336
340
|
*/
|
|
337
|
-
allRoles = this.infiniteQuery(
|
|
341
|
+
allRoles = this.infiniteQuery(getRoles)
|
|
338
342
|
/**
|
|
339
343
|
* Get a role by id
|
|
340
344
|
*/
|
|
341
345
|
role = this.query({
|
|
342
346
|
name: 'account.role',
|
|
343
347
|
request: async (signal, { id }: { id: string }) => {
|
|
344
|
-
const roles = await
|
|
348
|
+
const roles = await getRoles({ filterBy: 'id', filterValue: id }, { signal })
|
|
345
349
|
if (!roles.length) throw new StackspotAPIError({ status: 404 })
|
|
346
350
|
return roles[0]
|
|
347
351
|
},
|
|
@@ -349,7 +353,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
349
353
|
/**
|
|
350
354
|
* Gets all members with the provided role (paginated)
|
|
351
355
|
*/
|
|
352
|
-
roleMembers = this.infiniteQuery(
|
|
356
|
+
roleMembers = this.infiniteQuery(getRoleMembers)
|
|
353
357
|
/**
|
|
354
358
|
* Creates a role
|
|
355
359
|
*/
|
|
@@ -369,7 +373,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
369
373
|
/**
|
|
370
374
|
* Gets all groups with the provided role (paginated)
|
|
371
375
|
*/
|
|
372
|
-
roleGroups = this.infiniteQuery(
|
|
376
|
+
roleGroups = this.infiniteQuery(getRoleGroups)
|
|
373
377
|
/**
|
|
374
378
|
* Adds a role to several groups
|
|
375
379
|
*/
|
|
@@ -377,7 +381,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
377
381
|
/**
|
|
378
382
|
* Get the actions a role is allowed to perform
|
|
379
383
|
*/
|
|
380
|
-
rolePermissions = this.infiniteQuery(
|
|
384
|
+
rolePermissions = this.infiniteQuery(getResourcesAndActionsWithStatus)
|
|
381
385
|
/**
|
|
382
386
|
* Updates a role with new list of permissions
|
|
383
387
|
*/
|
|
@@ -389,7 +393,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
389
393
|
/**
|
|
390
394
|
* Gets all resources (paginated)
|
|
391
395
|
*/
|
|
392
|
-
allResources = this.infiniteQuery(
|
|
396
|
+
allResources = this.infiniteQuery(getResources)
|
|
393
397
|
/**
|
|
394
398
|
* Gets all resource types (paginated)
|
|
395
399
|
*/
|
|
@@ -409,7 +413,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
409
413
|
/**
|
|
410
414
|
* Gets all SCM credentials (account level).
|
|
411
415
|
*/
|
|
412
|
-
allSCMCredentials = this.query(
|
|
416
|
+
allSCMCredentials = this.query(listScmCredentials1)
|
|
413
417
|
/**
|
|
414
418
|
* Gets the status for the SCM credential.
|
|
415
419
|
*
|
|
@@ -485,7 +489,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
485
489
|
/**
|
|
486
490
|
* Gets all SCM credentials for the user currently logged in.
|
|
487
491
|
*/
|
|
488
|
-
allUserSCMCredentials = this.query(
|
|
492
|
+
allUserSCMCredentials = this.query(listScmCredentials2)
|
|
489
493
|
/**
|
|
490
494
|
* Gets the SCM provider.
|
|
491
495
|
*/
|
|
@@ -623,43 +627,43 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
623
627
|
/**
|
|
624
628
|
* Get all account members with pagination
|
|
625
629
|
*/
|
|
626
|
-
allMembersWithPagination = this.query(
|
|
630
|
+
allMembersWithPagination = this.query(getAccountMembers1)
|
|
627
631
|
/**
|
|
628
632
|
* Get Members Groups By Profile
|
|
629
633
|
*/
|
|
630
|
-
allMembersGroupsByProfileWithPagination = this.query(
|
|
634
|
+
allMembersGroupsByProfileWithPagination = this.query(getMemberGroups1)
|
|
631
635
|
/**
|
|
632
636
|
* Get Members Roles By Profile
|
|
633
637
|
*/
|
|
634
|
-
allMembersRolesByProfileWithPagination = this.query(
|
|
638
|
+
allMembersRolesByProfileWithPagination = this.query(getRoles4)
|
|
635
639
|
/**
|
|
636
640
|
* Get all account groups with pagination
|
|
637
641
|
*/
|
|
638
|
-
allGroupsWithPagination = this.query(
|
|
642
|
+
allGroupsWithPagination = this.query(getGroups1)
|
|
639
643
|
/**
|
|
640
644
|
* Get all members by group with pagination
|
|
641
645
|
*/
|
|
642
|
-
allMembersByGroupWithPagination = this.query(
|
|
646
|
+
allMembersByGroupWithPagination = this.query(getMembers1)
|
|
643
647
|
/**
|
|
644
648
|
* Get all roles by groups with pagination
|
|
645
649
|
*/
|
|
646
|
-
allRolesByGroupWithPagination = this.query(
|
|
650
|
+
allRolesByGroupWithPagination = this.query(getRoles5)
|
|
647
651
|
/**
|
|
648
652
|
* Get all resources by groups with pagination
|
|
649
653
|
*/
|
|
650
|
-
allResourcesByGroupWithPagination = this.query(
|
|
654
|
+
allResourcesByGroupWithPagination = this.query(getGroupResources1)
|
|
651
655
|
/**
|
|
652
656
|
* Get all roles account with pagination
|
|
653
657
|
*/
|
|
654
|
-
allRolesWithPagination = this.query(
|
|
658
|
+
allRolesWithPagination = this.query(getRoles3)
|
|
655
659
|
/**
|
|
656
660
|
* Get all members by role with pagination
|
|
657
661
|
*/
|
|
658
|
-
allMembersByRoleWithPagination = this.query(
|
|
662
|
+
allMembersByRoleWithPagination = this.query(getRoleMembers1)
|
|
659
663
|
/**
|
|
660
664
|
* Get all groups by roles with pagination
|
|
661
665
|
*/
|
|
662
|
-
allGroupsByRoleWithPagination = this.query(
|
|
666
|
+
allGroupsByRoleWithPagination = this.query(getRoleGroups1)
|
|
663
667
|
/**
|
|
664
668
|
* Get Service Credentials
|
|
665
669
|
*/
|
|
@@ -738,15 +742,15 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
738
742
|
/**
|
|
739
743
|
* Get secrets
|
|
740
744
|
*/
|
|
741
|
-
getSecrets = this.query(
|
|
745
|
+
getSecrets = this.query(findSecrets)
|
|
742
746
|
/**
|
|
743
747
|
* Get workspace and spot secrets
|
|
744
748
|
*/
|
|
745
749
|
getWorkspaceAndSpotSecrets = this.query({
|
|
746
750
|
name: 'account.getWorkspaceAndSpotSecrets',
|
|
747
751
|
request: async (signal) => {
|
|
748
|
-
const workspaceSecrets = await
|
|
749
|
-
const spotSecrets = await
|
|
752
|
+
const workspaceSecrets = await findSecrets({ filterByScope: 'SCOPED', filterByScopedBy: 'WORKSPACE', size: 1500 }, { signal })
|
|
753
|
+
const spotSecrets = await findSecrets({ filterByScope: 'SCOPED', filterByScopedBy: 'SPOT', size: 1500 }, { signal })
|
|
750
754
|
return { workspaces: workspaceSecrets?.items, spots: spotSecrets?.items }
|
|
751
755
|
},
|
|
752
756
|
})
|
|
@@ -759,10 +763,10 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
759
763
|
*/
|
|
760
764
|
getSecretsByIds = this.query({
|
|
761
765
|
name: 'getSecretsByIds',
|
|
762
|
-
request: (signal, variables: { ids: string[]
|
|
766
|
+
request: (signal, variables: { ids: string[] }) => {
|
|
763
767
|
const requests = variables?.ids?.map((secretId) => getById({ secretId }, { signal }))
|
|
764
768
|
return Promise.all(requests)
|
|
765
|
-
}
|
|
769
|
+
},
|
|
766
770
|
})
|
|
767
771
|
|
|
768
772
|
/**
|
|
@@ -785,6 +789,10 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
785
789
|
* Disable secret
|
|
786
790
|
*/
|
|
787
791
|
disableSecret = this.mutation(disableSecret)
|
|
792
|
+
/**
|
|
793
|
+
* Cancel Secret delete
|
|
794
|
+
*/
|
|
795
|
+
cancelSecretDelete = this.mutation(cancelSecretDelete)
|
|
788
796
|
|
|
789
797
|
// TRIAL
|
|
790
798
|
/**
|
|
@@ -883,7 +891,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
883
891
|
/**
|
|
884
892
|
* Lists enterprise accounts
|
|
885
893
|
*/
|
|
886
|
-
getEnterpriseAccounts = this.query(
|
|
894
|
+
getEnterpriseAccounts = this.query(getAccounts)
|
|
887
895
|
/**
|
|
888
896
|
* Get an enterprise account
|
|
889
897
|
*/
|
|
@@ -908,6 +916,14 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
908
916
|
* Find Secret Associations
|
|
909
917
|
*/
|
|
910
918
|
findSecretAssociations = this.infiniteQuery(findAssociations, { accumulator: 'items' })
|
|
919
|
+
/**
|
|
920
|
+
* Get expiration data
|
|
921
|
+
*/
|
|
922
|
+
getExpirationData = this.query(getPersonalAccountExpirationData)
|
|
923
|
+
/**
|
|
924
|
+
* Reactive trial account
|
|
925
|
+
*/
|
|
926
|
+
reactivateTrialAccount = this.mutation(reactivateTrialAccount)
|
|
911
927
|
}
|
|
912
928
|
|
|
913
929
|
export const accountClient = new AccountClient()
|
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 []
|
|
@@ -290,7 +293,9 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
290
293
|
*/
|
|
291
294
|
async function transform(event: Partial<FixedChatResponse>, data: Partial<ChatResponseWithSteps>) {
|
|
292
295
|
const info = event.agent_info
|
|
296
|
+
|
|
293
297
|
if (!info) return
|
|
298
|
+
|
|
294
299
|
const tools = await AIClient.toolsOfAgent(request.context?.agent_id)
|
|
295
300
|
data.steps = data.steps ? [...data.steps] : []
|
|
296
301
|
|
|
@@ -303,6 +308,59 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
303
308
|
steps: info.data?.steps?.map(s => s.goal) ?? [],
|
|
304
309
|
goal: info.data?.plan_goal ?? '',
|
|
305
310
|
})
|
|
311
|
+
|
|
312
|
+
info.data?.steps.forEach(s => data.steps?.push({
|
|
313
|
+
id: s.id,
|
|
314
|
+
type: 'step',
|
|
315
|
+
status: 'pending',
|
|
316
|
+
input: s.goal,
|
|
317
|
+
attempts: [{
|
|
318
|
+
tools: s.tools?.map(t => ({
|
|
319
|
+
...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
|
|
320
|
+
executionId: t.tool_execution_id,
|
|
321
|
+
goal: t.goal,
|
|
322
|
+
})),
|
|
323
|
+
}],
|
|
324
|
+
}))
|
|
325
|
+
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (info.type === 'planning' && info.action === 'awaiting_approval') {
|
|
329
|
+
data.steps.push({
|
|
330
|
+
id: 'planning',
|
|
331
|
+
type: 'planning',
|
|
332
|
+
status: 'awaiting_approval',
|
|
333
|
+
user_question: info.data?.user_question,
|
|
334
|
+
duration: info.duration || 0,
|
|
335
|
+
steps: info.data?.steps?.map(s => s.goal) ?? [],
|
|
336
|
+
goal: info.data?.plan_goal ?? '',
|
|
337
|
+
})
|
|
338
|
+
info.data?.steps.forEach(s => data.steps?.push({
|
|
339
|
+
id: s.id,
|
|
340
|
+
type: 'step',
|
|
341
|
+
status: 'pending',
|
|
342
|
+
input: s.goal,
|
|
343
|
+
attempts: [{
|
|
344
|
+
tools: s.tools?.map(t => ({
|
|
345
|
+
...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
|
|
346
|
+
executionId: t.tool_execution_id,
|
|
347
|
+
goal: t.goal,
|
|
348
|
+
})),
|
|
349
|
+
}],
|
|
350
|
+
}))
|
|
351
|
+
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if (info.type === 'planning' && info.action === 'awaiting_approval') {
|
|
355
|
+
data.steps.push({
|
|
356
|
+
id: 'planning',
|
|
357
|
+
type: 'planning',
|
|
358
|
+
status: 'awaiting_approval',
|
|
359
|
+
user_question: info.data?.user_question,
|
|
360
|
+
duration: info.duration || 0,
|
|
361
|
+
steps: info.data?.steps?.map(s => s.goal) ?? [],
|
|
362
|
+
goal: info.data?.plan_goal ?? '',
|
|
363
|
+
})
|
|
306
364
|
info.data?.steps.forEach(s => data.steps?.push({
|
|
307
365
|
id: s.id,
|
|
308
366
|
type: 'step',
|
|
@@ -312,6 +370,7 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
312
370
|
tools: s.tools?.map(t => ({
|
|
313
371
|
...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
|
|
314
372
|
executionId: t.tool_execution_id,
|
|
373
|
+
goal: t.goal,
|
|
315
374
|
})),
|
|
316
375
|
}],
|
|
317
376
|
}))
|
|
@@ -334,27 +393,80 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
334
393
|
}
|
|
335
394
|
}
|
|
336
395
|
|
|
396
|
+
if (info.type === 'tool' && info.action === 'awaiting_approval') {
|
|
397
|
+
const tool = tools.find(({ id }) => id === info.data?.tool_id)
|
|
398
|
+
data.steps.push({
|
|
399
|
+
id: info.id,
|
|
400
|
+
type: 'tool',
|
|
401
|
+
status: 'awaiting_approval',
|
|
402
|
+
duration: info.duration || 0,
|
|
403
|
+
input: info.data?.input,
|
|
404
|
+
user_question: info.data?.user_question,
|
|
405
|
+
attempts: [{
|
|
406
|
+
tools: [{
|
|
407
|
+
executionId: info.id,
|
|
408
|
+
id: info.data?.tool_id ?? '',
|
|
409
|
+
name: tool?.name ?? '',
|
|
410
|
+
goal: tool?.goal,
|
|
411
|
+
...tool,
|
|
412
|
+
}],
|
|
413
|
+
}],
|
|
414
|
+
})
|
|
415
|
+
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
|
|
416
|
+
}
|
|
417
|
+
|
|
337
418
|
if (info.type === 'tool' && info.action === 'start') {
|
|
338
419
|
const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
|
|
339
|
-
if (!
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
420
|
+
if (!info.data) return
|
|
421
|
+
|
|
422
|
+
//There might be a tool with status awaiting_approval, so we want to inform tool has already started
|
|
423
|
+
if (!currentStep || !currentStep.attempts[0].tools) {
|
|
424
|
+
const input = formatJson(info.data.input)
|
|
425
|
+
const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
|
|
426
|
+
data.steps.push({
|
|
427
|
+
id: info.id,
|
|
428
|
+
type: 'tool',
|
|
429
|
+
status: 'running',
|
|
430
|
+
duration: info.duration || 0,
|
|
431
|
+
input: info.data?.input,
|
|
432
|
+
user_question: info.data?.user_question,
|
|
433
|
+
attempts: [{
|
|
434
|
+
tools:[{ ...tool, executionId: info.id, input }],
|
|
435
|
+
}],
|
|
350
436
|
})
|
|
437
|
+
} else {
|
|
438
|
+
const toolInFirstAttempt = currentStep.attempts[0].tools?.find(t => t.executionId === info.id)
|
|
439
|
+
//One step might have multiple tools. When in an approval mode, we might not have all the tools in the array yet.
|
|
440
|
+
//So we make sure to add any tools that are not in there.
|
|
441
|
+
if (!toolInFirstAttempt) {
|
|
442
|
+
const input = formatJson(info.data.input)
|
|
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?.push({
|
|
445
|
+
...tool,
|
|
446
|
+
executionId: info.id,
|
|
447
|
+
input,
|
|
448
|
+
})
|
|
449
|
+
} else {
|
|
450
|
+
const input = formatJson(info.data.input)
|
|
451
|
+
if (info.data.attempt === 1) {
|
|
452
|
+
toolInFirstAttempt.input = input
|
|
453
|
+
} else {
|
|
454
|
+
const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
|
|
455
|
+
currentStep.attempts[info.data.attempt-1] ??= { tools: [] }
|
|
456
|
+
currentStep.attempts[info.data.attempt-1].tools?.push({
|
|
457
|
+
...tool,
|
|
458
|
+
executionId: info.id,
|
|
459
|
+
input,
|
|
460
|
+
})
|
|
461
|
+
}
|
|
462
|
+
}
|
|
351
463
|
}
|
|
352
464
|
}
|
|
353
465
|
|
|
354
466
|
if (info.type === 'tool' && info.action === 'end') {
|
|
355
467
|
const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
|
|
356
468
|
if (!currentStep || !info.data) return
|
|
357
|
-
const tool = currentStep.attempts[info.data.attempt]?.tools?.find(t => t.executionId === info.id)
|
|
469
|
+
const tool = currentStep.attempts[info.data.attempt-1]?.tools?.find(t => t.executionId === info.id)
|
|
358
470
|
if (tool) {
|
|
359
471
|
tool.output = formatJson(info.data.output)
|
|
360
472
|
tool.duration = info.duration
|
|
@@ -366,7 +478,7 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
366
478
|
if (answerStep) answerStep.status = 'running'
|
|
367
479
|
}
|
|
368
480
|
|
|
369
|
-
if (info.type === '
|
|
481
|
+
if (info.type === 'chat' && info.action === 'end') {
|
|
370
482
|
const answerStep = last(data.steps)
|
|
371
483
|
if (answerStep) {
|
|
372
484
|
answerStep.status = 'success'
|
|
@@ -393,3 +505,4 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
393
505
|
}
|
|
394
506
|
|
|
395
507
|
export const aiClient = new AIClient()
|
|
508
|
+
|