@stack-spot/portal-network 0.190.0 → 0.191.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +155 -0
  2. package/dist/api/account.d.ts +4 -116
  3. package/dist/api/account.d.ts.map +1 -1
  4. package/dist/api/account.js +9 -95
  5. package/dist/api/account.js.map +1 -1
  6. package/dist/api/ai.d.ts +189 -86
  7. package/dist/api/ai.d.ts.map +1 -1
  8. package/dist/api/ai.js +238 -142
  9. package/dist/api/ai.js.map +1 -1
  10. package/dist/api/cloudPlatform.d.ts +364 -248
  11. package/dist/api/cloudPlatform.d.ts.map +1 -1
  12. package/dist/api/cloudPlatform.js +289 -109
  13. package/dist/api/cloudPlatform.js.map +1 -1
  14. package/dist/api/codeShift.d.ts +114 -42
  15. package/dist/api/codeShift.d.ts.map +1 -1
  16. package/dist/api/codeShift.js +51 -10
  17. package/dist/api/codeShift.js.map +1 -1
  18. package/dist/api/genAiInference.d.ts +22 -2
  19. package/dist/api/genAiInference.d.ts.map +1 -1
  20. package/dist/api/genAiInference.js +22 -3
  21. package/dist/api/genAiInference.js.map +1 -1
  22. package/dist/client/account.d.ts +33 -19
  23. package/dist/client/account.d.ts.map +1 -1
  24. package/dist/client/account.js +33 -15
  25. package/dist/client/account.js.map +1 -1
  26. package/dist/client/ai.d.ts +29 -0
  27. package/dist/client/ai.d.ts.map +1 -1
  28. package/dist/client/ai.js +121 -14
  29. package/dist/client/ai.js.map +1 -1
  30. package/dist/client/cloud-platform.d.ts +195 -43
  31. package/dist/client/cloud-platform.d.ts.map +1 -1
  32. package/dist/client/cloud-platform.js +159 -42
  33. package/dist/client/cloud-platform.js.map +1 -1
  34. package/dist/client/code-shift.d.ts +16 -3
  35. package/dist/client/code-shift.d.ts.map +1 -1
  36. package/dist/client/code-shift.js +10 -1
  37. package/dist/client/code-shift.js.map +1 -1
  38. package/dist/client/types.d.ts +26 -5
  39. package/dist/client/types.d.ts.map +1 -1
  40. package/package.json +3 -3
  41. package/readme.md +2 -1
  42. package/src/api/account.ts +21 -192
  43. package/src/api/agent-tools.ts +3 -0
  44. package/src/api/agent.ts +2 -0
  45. package/src/api/ai.ts +364 -157
  46. package/src/api/cloudPlatform.ts +698 -398
  47. package/src/api/codeShift.ts +194 -47
  48. package/src/api/genAiInference.ts +47 -4
  49. package/src/api/notification.ts +2 -0
  50. package/src/client/account.ts +36 -17
  51. package/src/client/ai.ts +126 -13
  52. package/src/client/cloud-platform.ts +92 -27
  53. package/src/client/code-shift.ts +6 -1
  54. package/src/client/types.ts +27 -5
@@ -46,9 +46,9 @@ import {
46
46
  getAccess,
47
47
  getAccount1,
48
48
  getAccountMembers,
49
- getAccountMembers2,
49
+ getAccountMembers1,
50
50
  getAccountRateLimit,
51
- getAccounts1,
51
+ getAccounts,
52
52
  getAccountSso,
53
53
  getActiveExtensionVersion,
54
54
  getAllAccountSso,
@@ -64,23 +64,33 @@ import {
64
64
  getFeatures3,
65
65
  getGroupById,
66
66
  getGroupResources,
67
+ getGroupResources1,
67
68
  getGroups,
69
+ getGroups1,
68
70
  getMemberById,
69
71
  getMemberGroups,
72
+ getMemberGroups1,
70
73
  getMemberPreferences,
71
74
  getMembers,
75
+ getMembers1,
72
76
  getPartnerAccount, getPartnersSharingAllowed,
73
77
  getPersonalAccountDetails,
78
+ getPersonalAccountExpirationData,
74
79
  getPersonalClientCredentials,
75
80
  getResources,
76
81
  getResources2,
77
82
  getResourcesAndActionsWithStatus,
78
83
  getResourceTypes1,
79
84
  getRoleGroups,
85
+ getRoleGroups1,
80
86
  getRoleMembers,
87
+ getRoleMembers1,
81
88
  getRoles,
82
89
  getRoles1,
83
90
  getRoles2,
91
+ getRoles3,
92
+ getRoles4,
93
+ getRoles5,
84
94
  getScmProvider,
85
95
  getServiceCredential,
86
96
  getServiceCredentialByIdRateLimit,
@@ -95,9 +105,10 @@ import {
95
105
  listExtensions,
96
106
  listExtensionVersions,
97
107
  listMemberFavoritesByResource,
98
- listScmCredentials,
108
+ listScmCredentials1,
99
109
  listScmCredentials2, partialUpdateSso, personalAccessTokenAuthorization,
100
110
  personalContact,
111
+ reactivateTrialAccount,
101
112
  removeRoleFromMember,
102
113
  removeTrialAccount,
103
114
  resetOtp,
@@ -215,7 +226,7 @@ class AccountClient extends ReactQueryNetworkClient {
215
226
  /**
216
227
  * Gets all members (paginated).
217
228
  */
218
- allMembers = this.infiniteQuery(getAccountMembers2)
229
+ allMembers = this.infiniteQuery(getAccountMembers)
219
230
  /**
220
231
  * Gets member Groups (paginated).
221
232
  */
@@ -402,7 +413,7 @@ class AccountClient extends ReactQueryNetworkClient {
402
413
  /**
403
414
  * Gets all SCM credentials (account level).
404
415
  */
405
- allSCMCredentials = this.query(listScmCredentials2)
416
+ allSCMCredentials = this.query(listScmCredentials1)
406
417
  /**
407
418
  * Gets the status for the SCM credential.
408
419
  *
@@ -478,7 +489,7 @@ class AccountClient extends ReactQueryNetworkClient {
478
489
  /**
479
490
  * Gets all SCM credentials for the user currently logged in.
480
491
  */
481
- allUserSCMCredentials = this.query(listScmCredentials)
492
+ allUserSCMCredentials = this.query(listScmCredentials2)
482
493
  /**
483
494
  * Gets the SCM provider.
484
495
  */
@@ -616,43 +627,43 @@ class AccountClient extends ReactQueryNetworkClient {
616
627
  /**
617
628
  * Get all account members with pagination
618
629
  */
619
- allMembersWithPagination = this.query(getAccountMembers)
630
+ allMembersWithPagination = this.query(getAccountMembers1)
620
631
  /**
621
632
  * Get Members Groups By Profile
622
633
  */
623
- allMembersGroupsByProfileWithPagination = this.query(getMemberGroups)
634
+ allMembersGroupsByProfileWithPagination = this.query(getMemberGroups1)
624
635
  /**
625
636
  * Get Members Roles By Profile
626
637
  */
627
- allMembersRolesByProfileWithPagination = this.query(getRoles1)
638
+ allMembersRolesByProfileWithPagination = this.query(getRoles4)
628
639
  /**
629
640
  * Get all account groups with pagination
630
641
  */
631
- allGroupsWithPagination = this.query(getGroups)
642
+ allGroupsWithPagination = this.query(getGroups1)
632
643
  /**
633
644
  * Get all members by group with pagination
634
645
  */
635
- allMembersByGroupWithPagination = this.query(getMembers)
646
+ allMembersByGroupWithPagination = this.query(getMembers1)
636
647
  /**
637
648
  * Get all roles by groups with pagination
638
649
  */
639
- allRolesByGroupWithPagination = this.query(getRoles2)
650
+ allRolesByGroupWithPagination = this.query(getRoles5)
640
651
  /**
641
652
  * Get all resources by groups with pagination
642
653
  */
643
- allResourcesByGroupWithPagination = this.query(getGroupResources)
654
+ allResourcesByGroupWithPagination = this.query(getGroupResources1)
644
655
  /**
645
656
  * Get all roles account with pagination
646
657
  */
647
- allRolesWithPagination = this.query(getRoles)
658
+ allRolesWithPagination = this.query(getRoles3)
648
659
  /**
649
660
  * Get all members by role with pagination
650
661
  */
651
- allMembersByRoleWithPagination = this.query(getRoleMembers)
662
+ allMembersByRoleWithPagination = this.query(getRoleMembers1)
652
663
  /**
653
664
  * Get all groups by roles with pagination
654
665
  */
655
- allGroupsByRoleWithPagination = this.query(getRoleGroups)
666
+ allGroupsByRoleWithPagination = this.query(getRoleGroups1)
656
667
  /**
657
668
  * Get Service Credentials
658
669
  */
@@ -880,7 +891,7 @@ class AccountClient extends ReactQueryNetworkClient {
880
891
  /**
881
892
  * Lists enterprise accounts
882
893
  */
883
- getEnterpriseAccounts = this.query(getAccounts1)
894
+ getEnterpriseAccounts = this.query(getAccounts)
884
895
  /**
885
896
  * Get an enterprise account
886
897
  */
@@ -905,6 +916,14 @@ class AccountClient extends ReactQueryNetworkClient {
905
916
  * Find Secret Associations
906
917
  */
907
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)
908
927
  }
909
928
 
910
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 (!currentStep || !info.data || !currentStep.attempts[0].tools) return
340
- const toolInFirstAttempt = currentStep.attempts[0].tools.find(t => t.executionId === info.id)
341
- if (!toolInFirstAttempt) return
342
- const input = formatJson(info.data.input)
343
- if (info.data.attempt === 0) {
344
- toolInFirstAttempt.input = input
345
- } else {
346
- currentStep.attempts[info.data.attempt] ??= { tools: [] }
347
- currentStep.attempts[info.data.attempt].tools?.push({
348
- ...toolInFirstAttempt,
349
- input,
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 === 'final_answer' && info.action === 'end') {
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
+
@@ -1,36 +1,49 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
2
  import {
3
- acceptNetworkConnection,
4
3
  createCertificate,
5
4
  createCidr,
6
5
  createDnsRecord,
7
6
  createDnsZone,
8
7
  createFolder,
9
8
  createFoundation,
10
- createInbound,
11
9
  createNetwork,
12
- createNetworkConnection,
13
10
  createProject,
11
+ createRuntime,
14
12
  createTenant,
15
13
  createVpn,
16
14
  defaults,
15
+ deleteCertificate,
16
+ deleteCidr,
17
+ deleteDnsRecord,
18
+ deleteDnsZone,
19
+ deleteFolder,
20
+ deleteNetwork,
21
+ deleteProject,
22
+ deleteVpn,
17
23
  getCertificate,
18
24
  getFolder,
25
+ getFolderTags,
19
26
  getFoundation,
20
27
  getNetwork,
21
- getProject1,
28
+ getProject,
22
29
  getVpnConfiguration,
23
30
  listCertificates,
24
31
  listCidr,
25
32
  listDnsRecord,
26
33
  listDnsZone,
27
34
  listFoundations,
28
- listInbound,
29
35
  listNetwork,
30
- listNetworkConnection,
36
+ listRuntime,
31
37
  listTenant,
32
38
  listVpns,
33
39
  providers,
40
+ putCertificateTags,
41
+ putCidrTags,
42
+ putDnsZoneTags,
43
+ putFolderTags,
44
+ putNetworkTags,
45
+ putProjectTags,
46
+ putVpnTags,
34
47
  } from '../api/cloudPlatform'
35
48
  import { DefaultAPIError } from '../error/DefaultAPIError'
36
49
  import { StackspotAPIError } from '../error/StackspotAPIError'
@@ -106,7 +119,7 @@ class CloudPlatformClient extends ReactQueryNetworkClient {
106
119
  /**
107
120
  * Get a project by id
108
121
  */
109
- getProjectById = this.query(removeAuthorizationParam(getProject1))
122
+ getProjectById = this.query(removeAuthorizationParam(getProject))
110
123
  /**
111
124
  * Get a list of dns records
112
125
  */
@@ -123,26 +136,6 @@ class CloudPlatformClient extends ReactQueryNetworkClient {
123
136
  * Create a network
124
137
  */
125
138
  createNetwork = this.mutation(removeAuthorizationParam(createNetwork))
126
- /**
127
- * Get a list of inbounds
128
- */
129
- listInbounds = this.query(removeAuthorizationParam(listInbound))
130
- /**
131
- * Create a inbound
132
- */
133
- createInbound = this.mutation(removeAuthorizationParam(createInbound))
134
- /**
135
- * Add a network connection
136
- */
137
- addNetworkConnection = this.mutation(removeAuthorizationParam(createNetworkConnection))
138
- /**
139
- * Get a network connection request
140
- */
141
- getNetworkConnections = this.query(removeAuthorizationParam(listNetworkConnection))
142
- /**
143
- * Accept a network connection
144
- */
145
- acceptNetworkConnection = this.mutation(removeAuthorizationParam(acceptNetworkConnection))
146
139
  /**
147
140
  * Get a list of vpn's
148
141
  */
@@ -167,6 +160,78 @@ class CloudPlatformClient extends ReactQueryNetworkClient {
167
160
  * Create a tenant
168
161
  */
169
162
  createTenant = this.mutation(removeAuthorizationParam(createTenant))
163
+ /**
164
+ * Get a list of runtimes
165
+ */
166
+ listRuntimes = this.query(removeAuthorizationParam(listRuntime))
167
+ /**
168
+ * Create a runtime
169
+ */
170
+ createRuntime = this.mutation(removeAuthorizationParam(createRuntime))
171
+ /**
172
+ * Get a list of tags in folder
173
+ */
174
+ getFolderTags = this.query(removeAuthorizationParam(getFolderTags))
175
+ /**
176
+ * Update folder tags
177
+ */
178
+ updateFolderTags = this.mutation(removeAuthorizationParam(putFolderTags))
179
+ /**
180
+ * Update project tags
181
+ */
182
+ updateProjectTags = this.mutation(removeAuthorizationParam(putProjectTags))
183
+ /**
184
+ * Update network tags
185
+ */
186
+ updateNetworkTags = this.mutation(removeAuthorizationParam(putNetworkTags))
187
+ /**
188
+ * Update cidr tags
189
+ */
190
+ updateCidrTags = this.mutation(removeAuthorizationParam(putCidrTags))
191
+ /**
192
+ * Update dns zone tags
193
+ */
194
+ updateDnsZoneTags = this.mutation(removeAuthorizationParam(putDnsZoneTags))
195
+ /**
196
+ * Update certificate tags
197
+ */
198
+ updateCertificateTags = this.mutation(removeAuthorizationParam(putCertificateTags))
199
+ /**
200
+ * Update vpn tags
201
+ */
202
+ updateVpnTags = this.mutation(removeAuthorizationParam(putVpnTags))
203
+ /**
204
+ * Delete a folder
205
+ */
206
+ deleteFolder = this.mutation(removeAuthorizationParam(deleteFolder))
207
+ /**
208
+ * Delete a project
209
+ */
210
+ deleteProject = this.mutation(removeAuthorizationParam(deleteProject))
211
+ /**
212
+ * Delete a network
213
+ */
214
+ deleteNetwork = this.mutation(removeAuthorizationParam(deleteNetwork))
215
+ /**
216
+ * Delete a certificate
217
+ */
218
+ deleteCertificate = this.mutation(removeAuthorizationParam(deleteCertificate))
219
+ /**
220
+ * Delete a dns zone
221
+ */
222
+ deleteDnsZone = this.mutation(removeAuthorizationParam(deleteDnsZone))
223
+ /**
224
+ * Delete a dns record
225
+ */
226
+ deleteDnsRecord = this.mutation(removeAuthorizationParam(deleteDnsRecord))
227
+ /**
228
+ * Delete a VPN
229
+ */
230
+ deleteVPN = this.mutation(removeAuthorizationParam(deleteVpn))
231
+ /**
232
+ * Delete a CIDR
233
+ */
234
+ deleteCidr = this.mutation(removeAuthorizationParam(deleteCidr))
170
235
  }
171
236
 
172
237
  export const cloudPlatformClient = new CloudPlatformClient()
@@ -58,14 +58,15 @@ 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
68
  downloadSearchReposScmV2V2ReposSearchScmSearchIdDownloadGet,
69
+ moduleFavoriteServiceAddV1ModulesModuleIdFavoritesPost,
69
70
  } from '../api/codeShift'
70
71
  import { DefaultAPIError } from '../error/DefaultAPIError'
71
72
  import { codeShiftDictionary } from '../error/dictionary/code-shift'
@@ -135,6 +136,10 @@ class CodeShift extends ReactQueryNetworkClient {
135
136
  * Updates a module.
136
137
  */
137
138
  updateModule = this.mutation(removeAuthorizationParam(updateModuleServiceV1ModulesModuleIdPut))
139
+ /**
140
+ * Adds a module to favorites.
141
+ */
142
+ addModuleToFavorites = this.mutation(removeAuthorizationParam(moduleFavoriteServiceAddV1ModulesModuleIdFavoritesPost))
138
143
  /**
139
144
  * Generates a report.
140
145
  */
@@ -185,6 +185,7 @@ export interface FixedChatRequest extends ChatRequest {
185
185
  stackspot_ai_version?: string,
186
186
  os?: string,
187
187
  upload_ids?: string[],
188
+ selected_model_id?: string,
188
189
  },
189
190
  }
190
191
 
@@ -245,6 +246,7 @@ export interface ChatAgentTool {
245
246
  image?: string,
246
247
  input?: string,
247
248
  output?: string,
249
+ goal?: string,
248
250
  }
249
251
 
250
252
  export interface ChatStepAttempt {
@@ -256,8 +258,8 @@ export interface ChatStepAttempt {
256
258
 
257
259
  export interface BaseChatStep {
258
260
  id: string,
259
- type: 'planning' | 'step' | 'answer',
260
- status: 'pending' | 'running' | 'success' | 'error',
261
+ type: 'planning' | 'step' | 'answer' | 'tool',
262
+ status: 'pending' | 'running' | 'success' | 'error' | 'awaiting_approval',
261
263
  /**
262
264
  * Duration in seconds.
263
265
  */
@@ -266,9 +268,24 @@ export interface BaseChatStep {
266
268
 
267
269
  export interface PlanningChatStep extends BaseChatStep {
268
270
  type: 'planning',
269
- status: 'success',
271
+ status: 'success' | 'awaiting_approval',
270
272
  steps: string[],
271
273
  goal: string,
274
+ user_question?: string,
275
+ }
276
+
277
+ export interface ToolChatStep extends BaseChatStep {
278
+ type: 'tool',
279
+ status: 'running' | 'success' | 'error' | 'awaiting_approval',
280
+ /**
281
+ * Each step might attempt to run for multiple times, with different inputs and outputs. If first attempt succeeds, this array will have
282
+ * only one element.
283
+ *
284
+ * This array never has less than one element, despite the step's status.
285
+ */
286
+ attempts: ChatStepAttempt[],
287
+ input?: Record<string, any>,
288
+ user_question?: string,
272
289
  }
273
290
 
274
291
  export interface StepChatStep extends BaseChatStep {
@@ -288,17 +305,19 @@ export interface AnswerChatStep extends BaseChatStep {
288
305
  type: 'answer',
289
306
  }
290
307
 
291
- export type ChatStep = PlanningChatStep | StepChatStep | AnswerChatStep
308
+ export type ChatStep = PlanningChatStep | StepChatStep | AnswerChatStep | ToolChatStep
292
309
 
293
310
  export interface BaseAgentInfo {
294
311
  type: 'chat' | 'planning' | 'step' | 'tool' | 'final_answer',
295
- action: 'start' | 'end',
312
+ action: 'start' | 'end' | 'awaiting_approval',
296
313
  duration?: number,
314
+ id: string,
297
315
  }
298
316
 
299
317
  export interface AgentTool {
300
318
  tool_id: string,
301
319
  tool_execution_id: string,
320
+ goal: string,
302
321
  }
303
322
 
304
323
  export interface PlanningAgentInfo extends BaseAgentInfo {
@@ -311,6 +330,7 @@ export interface PlanningAgentInfo extends BaseAgentInfo {
311
330
  goal: string,
312
331
  tools?: AgentTool[],
313
332
  }[],
333
+ user_question?: string,
314
334
  },
315
335
  }
316
336
 
@@ -326,6 +346,8 @@ export interface ToolAgentInfo extends BaseAgentInfo {
326
346
  input?: any,
327
347
  attempt: number,
328
348
  output?: string,
349
+ user_question?: string,
350
+ tool_id: string,
329
351
  },
330
352
  }
331
353