@stack-spot/portal-network 0.191.1 → 0.192.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 +154 -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 +109 -39
  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 +4 -0
  23. package/dist/client/account.d.ts.map +1 -1
  24. package/dist/client/account.js +10 -1
  25. package/dist/client/account.js.map +1 -1
  26. package/dist/client/ai.d.ts +46 -0
  27. package/dist/client/ai.d.ts.map +1 -1
  28. package/dist/client/ai.js +140 -15
  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 +36 -3
  35. package/dist/client/code-shift.d.ts.map +1 -1
  36. package/dist/client/code-shift.js +37 -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 +2 -2
  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 +189 -44
  48. package/src/api/genAiInference.ts +47 -4
  49. package/src/api/notification.ts +2 -0
  50. package/src/client/account.ts +5 -0
  51. package/src/client/ai.ts +136 -13
  52. package/src/client/cloud-platform.ts +92 -27
  53. package/src/client/code-shift.ts +20 -1
  54. package/src/client/types.ts +27 -5
package/src/client/ai.ts CHANGED
@@ -38,6 +38,8 @@ import {
38
38
  resetKnowledgeObjectsV1KnowledgeSourcesSlugObjectsDelete,
39
39
  runFetchStepV1QuickCommandsSlugStepsStepSlugFetchRunPost,
40
40
  searchKnowledgeSourcesV1KnowledgeSourcesSearchPost,
41
+ tokensByUserV1AnalyticsTokensByUserGet,
42
+ tokensDailyUsageV1AnalyticsTokensDailyUsageGet,
41
43
  updateQuickCommandV1QuickCommandsSlugPatch,
42
44
  updateTitleV1ConversationsConversationIdPatch,
43
45
  vectorizeCustomKnowledgeSourceV1KnowledgeSourcesSlugCustomPost,
@@ -257,6 +259,14 @@ class AIClient extends ReactQueryNetworkClient {
257
259
  * Removes the resource of type Quick Command from the list of favorites.
258
260
  */
259
261
  removeFavoriteQuickCommand = this.mutation(removeAuthorizationParam(deleteFavoriteV1QuickCommandsSlugFavoriteDelete))
262
+ /**
263
+ * Get Tokens Daily usage
264
+ */
265
+ analyticsTokensDailyUsage = this.query(removeAuthorizationParam(tokensDailyUsageV1AnalyticsTokensDailyUsageGet))
266
+ /**
267
+ * Get Tokens By User
268
+ */
269
+ analyticsTokensByUser = this.query(tokensByUserV1AnalyticsTokensByUserGet)
260
270
 
261
271
  private static async toolsOfAgent(agentId?: string) {
262
272
  try {
@@ -266,6 +276,9 @@ class AIClient extends ReactQueryNetworkClient {
266
276
  agent.toolkits?.builtin_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
267
277
  if (id) tools.push({ image: kit.image_url, id, name: name || id, description })
268
278
  }))
279
+ agent.toolkits?.custom_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
280
+ if (id) tools.push({ image: kit.avatar ?? undefined, id, name: name || id, description })
281
+ }))
269
282
  return tools
270
283
  } catch {
271
284
  return []
@@ -290,7 +303,9 @@ class AIClient extends ReactQueryNetworkClient {
290
303
  */
291
304
  async function transform(event: Partial<FixedChatResponse>, data: Partial<ChatResponseWithSteps>) {
292
305
  const info = event.agent_info
306
+
293
307
  if (!info) return
308
+
294
309
  const tools = await AIClient.toolsOfAgent(request.context?.agent_id)
295
310
  data.steps = data.steps ? [...data.steps] : []
296
311
 
@@ -303,6 +318,59 @@ class AIClient extends ReactQueryNetworkClient {
303
318
  steps: info.data?.steps?.map(s => s.goal) ?? [],
304
319
  goal: info.data?.plan_goal ?? '',
305
320
  })
321
+
322
+ info.data?.steps.forEach(s => data.steps?.push({
323
+ id: s.id,
324
+ type: 'step',
325
+ status: 'pending',
326
+ input: s.goal,
327
+ attempts: [{
328
+ tools: s.tools?.map(t => ({
329
+ ...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
330
+ executionId: t.tool_execution_id,
331
+ goal: t.goal,
332
+ })),
333
+ }],
334
+ }))
335
+ data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
336
+ }
337
+
338
+ if (info.type === 'planning' && info.action === 'awaiting_approval') {
339
+ data.steps.push({
340
+ id: 'planning',
341
+ type: 'planning',
342
+ status: 'awaiting_approval',
343
+ user_question: info.data?.user_question,
344
+ duration: info.duration || 0,
345
+ steps: info.data?.steps?.map(s => s.goal) ?? [],
346
+ goal: info.data?.plan_goal ?? '',
347
+ })
348
+ info.data?.steps.forEach(s => data.steps?.push({
349
+ id: s.id,
350
+ type: 'step',
351
+ status: 'pending',
352
+ input: s.goal,
353
+ attempts: [{
354
+ tools: s.tools?.map(t => ({
355
+ ...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
356
+ executionId: t.tool_execution_id,
357
+ goal: t.goal,
358
+ })),
359
+ }],
360
+ }))
361
+ data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
362
+ }
363
+
364
+ if (info.type === 'planning' && info.action === 'awaiting_approval') {
365
+ data.steps.push({
366
+ id: 'planning',
367
+ type: 'planning',
368
+ status: 'awaiting_approval',
369
+ user_question: info.data?.user_question,
370
+ duration: info.duration || 0,
371
+ steps: info.data?.steps?.map(s => s.goal) ?? [],
372
+ goal: info.data?.plan_goal ?? '',
373
+ })
306
374
  info.data?.steps.forEach(s => data.steps?.push({
307
375
  id: s.id,
308
376
  type: 'step',
@@ -312,6 +380,7 @@ class AIClient extends ReactQueryNetworkClient {
312
380
  tools: s.tools?.map(t => ({
313
381
  ...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
314
382
  executionId: t.tool_execution_id,
383
+ goal: t.goal,
315
384
  })),
316
385
  }],
317
386
  }))
@@ -334,27 +403,80 @@ class AIClient extends ReactQueryNetworkClient {
334
403
  }
335
404
  }
336
405
 
406
+ if (info.type === 'tool' && info.action === 'awaiting_approval') {
407
+ const tool = tools.find(({ id }) => id === info.data?.tool_id)
408
+ data.steps.push({
409
+ id: info.id,
410
+ type: 'tool',
411
+ status: 'awaiting_approval',
412
+ duration: info.duration || 0,
413
+ input: info.data?.input,
414
+ user_question: info.data?.user_question,
415
+ attempts: [{
416
+ tools: [{
417
+ executionId: info.id,
418
+ id: info.data?.tool_id ?? '',
419
+ name: tool?.name ?? '',
420
+ goal: tool?.goal,
421
+ ...tool,
422
+ }],
423
+ }],
424
+ })
425
+ data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
426
+ }
427
+
337
428
  if (info.type === 'tool' && info.action === 'start') {
338
429
  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,
430
+ if (!info.data) return
431
+
432
+ //There might be a tool with status awaiting_approval, so we want to inform tool has already started
433
+ if (!currentStep || !currentStep.attempts[0].tools) {
434
+ const input = formatJson(info.data.input)
435
+ const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
436
+ data.steps.push({
437
+ id: info.id,
438
+ type: 'tool',
439
+ status: 'running',
440
+ duration: info.duration || 0,
441
+ input: info.data?.input,
442
+ user_question: info.data?.user_question,
443
+ attempts: [{
444
+ tools:[{ ...tool, executionId: info.id, input }],
445
+ }],
350
446
  })
447
+ } else {
448
+ const toolInFirstAttempt = currentStep.attempts[0].tools?.find(t => t.executionId === info.id)
449
+ //One step might have multiple tools. When in an approval mode, we might not have all the tools in the array yet.
450
+ //So we make sure to add any tools that are not in there.
451
+ if (!toolInFirstAttempt) {
452
+ const input = formatJson(info.data.input)
453
+ const tool = tools?.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
454
+ currentStep.attempts[info.data.attempt-1].tools?.push({
455
+ ...tool,
456
+ executionId: info.id,
457
+ input,
458
+ })
459
+ } else {
460
+ const input = formatJson(info.data.input)
461
+ if (info.data.attempt === 1) {
462
+ toolInFirstAttempt.input = input
463
+ } else {
464
+ const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
465
+ currentStep.attempts[info.data.attempt-1] ??= { tools: [] }
466
+ currentStep.attempts[info.data.attempt-1].tools?.push({
467
+ ...tool,
468
+ executionId: info.id,
469
+ input,
470
+ })
471
+ }
472
+ }
351
473
  }
352
474
  }
353
475
 
354
476
  if (info.type === 'tool' && info.action === 'end') {
355
477
  const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
356
478
  if (!currentStep || !info.data) return
357
- const tool = currentStep.attempts[info.data.attempt]?.tools?.find(t => t.executionId === info.id)
479
+ const tool = currentStep.attempts[info.data.attempt-1]?.tools?.find(t => t.executionId === info.id)
358
480
  if (tool) {
359
481
  tool.output = formatJson(info.data.output)
360
482
  tool.duration = info.duration
@@ -366,7 +488,7 @@ class AIClient extends ReactQueryNetworkClient {
366
488
  if (answerStep) answerStep.status = 'running'
367
489
  }
368
490
 
369
- if (info.type === 'final_answer' && info.action === 'end') {
491
+ if (info.type === 'chat' && info.action === 'end') {
370
492
  const answerStep = last(data.steps)
371
493
  if (answerStep) {
372
494
  answerStep.status = 'success'
@@ -393,3 +515,4 @@ class AIClient extends ReactQueryNetworkClient {
393
515
  }
394
516
 
395
517
  export const aiClient = new AIClient()
518
+
@@ -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,17 @@ 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,
70
+ moduleFavoriteServiceDeleteV1ModulesModuleIdFavoritesDelete,
71
+ patHealthCheckV1ScmPatHealthCheckGet,
69
72
  } from '../api/codeShift'
70
73
  import { DefaultAPIError } from '../error/DefaultAPIError'
71
74
  import { codeShiftDictionary } from '../error/dictionary/code-shift'
@@ -123,6 +126,14 @@ class CodeShift extends ReactQueryNetworkClient {
123
126
  * Gets module by id.
124
127
  */
125
128
  module = this.query(removeAuthorizationParam(getModuleV1ModulesModuleIdGet))
129
+ /**
130
+ * Add a module in favorites.
131
+ */
132
+ addFavoriteModule = this.mutation(removeAuthorizationParam(moduleFavoriteServiceAddV1ModulesModuleIdFavoritesPost))
133
+ /**
134
+ * Remove a module from favorites.
135
+ */
136
+ removeFavoriteModule = this.mutation(removeAuthorizationParam(moduleFavoriteServiceDeleteV1ModulesModuleIdFavoritesDelete))
126
137
  /**
127
138
  * Gets module inputs.
128
139
  */
@@ -135,6 +146,10 @@ class CodeShift extends ReactQueryNetworkClient {
135
146
  * Updates a module.
136
147
  */
137
148
  updateModule = this.mutation(removeAuthorizationParam(updateModuleServiceV1ModulesModuleIdPut))
149
+ /**
150
+ * Adds a module to favorites.
151
+ */
152
+ addModuleToFavorites = this.mutation(removeAuthorizationParam(moduleFavoriteServiceAddV1ModulesModuleIdFavoritesPost))
138
153
  /**
139
154
  * Generates a report.
140
155
  */
@@ -263,6 +278,10 @@ class CodeShift extends ReactQueryNetworkClient {
263
278
  * Validates a SCM URL.
264
279
  */
265
280
  validateSCMUrl = this.mutation(removeAuthorizationParam(validateScmUrlServiceV1ReposValidateScmUrlPost))
281
+ /**
282
+ * PAT Health Check
283
+ */
284
+ checkScmPatHealth = this.query(removeAuthorizationParam(patHealthCheckV1ScmPatHealthCheckGet))
266
285
  /**
267
286
  * Get Branches for a Repository
268
287
  */
@@ -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