@stack-spot/portal-network 0.200.0 → 0.202.0

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/src/client/ai.ts CHANGED
@@ -9,7 +9,6 @@ import {
9
9
  conversationHistoryV1ConversationsConversationIdGet,
10
10
  createExecutionV1QuickCommandsCreateExecutionSlugPost,
11
11
  currentV1TokensUsageCurrentGet,
12
- currentV1TokensUsageTotalGet,
13
12
  defaults,
14
13
  deleteConversationV1ConversationsConversationIdDelete,
15
14
  deleteFavoriteV1AiStacksStackIdFavoriteDelete,
@@ -21,7 +20,9 @@ import {
21
20
  formatFetchStepV1QuickCommandsSlugStepsStepSlugFetchFormatPost,
22
21
  formatResultV1QuickCommandsSlugResultFormatPost,
23
22
  getContentDependenciesV1ContentContentTypeContentIdDependenciesGet,
23
+ getFlagsV1FlagsGet,
24
24
  getQuickCommandV1QuickCommandsSlugGet,
25
+ getScriptExecutionStatusV1QuickCommandsScriptExecutionsScriptExecutionIdGet,
25
26
  getUploadFormV1FileUploadFormPost,
26
27
  HttpValidationError,
27
28
  listAiStacksV1AiStacksGet,
@@ -38,6 +39,8 @@ import {
38
39
  resetKnowledgeObjectsV1KnowledgeSourcesSlugObjectsDelete,
39
40
  runFetchStepV1QuickCommandsSlugStepsStepSlugFetchRunPost,
40
41
  searchKnowledgeSourcesV1KnowledgeSourcesSearchPost,
42
+ startScriptStepV1QuickCommandsSlugStepsStepSlugStartScriptPost,
43
+ totalV1TokensUsageTotalGet,
41
44
  updateQuickCommandV1QuickCommandsSlugPatch,
42
45
  updateTitleV1ConversationsConversationIdPatch,
43
46
  vectorizeCustomKnowledgeSourceV1KnowledgeSourcesSlugCustomPost,
@@ -106,7 +109,7 @@ class AIClient extends ReactQueryNetworkClient {
106
109
  /**
107
110
  * Gets total tokens usage
108
111
  */
109
- totalTokensUsage = this.query(removeAuthorizationParam(currentV1TokensUsageTotalGet))
112
+ totalTokensUsage = this.query(removeAuthorizationParam(totalV1TokensUsageTotalGet))
110
113
  /**
111
114
  * Gets current tokens usage
112
115
  */
@@ -257,6 +260,18 @@ class AIClient extends ReactQueryNetworkClient {
257
260
  * Removes the resource of type Quick Command from the list of favorites.
258
261
  */
259
262
  removeFavoriteQuickCommand = this.mutation(removeAuthorizationParam(deleteFavoriteV1QuickCommandsSlugFavoriteDelete))
263
+ /**
264
+ * Lists all the feature flags for this user.
265
+ */
266
+ flags = this.query(getFlagsV1FlagsGet)
267
+ /**
268
+ * Starts the execution of a script step
269
+ */
270
+ startScriptStep = this.mutation(removeAuthorizationParam(startScriptStepV1QuickCommandsSlugStepsStepSlugStartScriptPost))
271
+ /**
272
+ * Gets the status of the execution of a script step
273
+ */
274
+ getStatusScriptStep = this.query(removeAuthorizationParam(getScriptExecutionStatusV1QuickCommandsScriptExecutionsScriptExecutionIdGet))
260
275
 
261
276
  private static async toolsOfAgent(agentId?: string) {
262
277
  try {
@@ -308,7 +323,7 @@ class AIClient extends ReactQueryNetworkClient {
308
323
  steps: info.data?.steps?.map(s => s.goal) ?? [],
309
324
  goal: info.data?.plan_goal ?? '',
310
325
  })
311
-
326
+
312
327
  info.data?.steps.forEach(s => data.steps?.push({
313
328
  id: s.id,
314
329
  type: 'step',
@@ -368,7 +383,7 @@ class AIClient extends ReactQueryNetworkClient {
368
383
  }
369
384
 
370
385
  if (info.type === 'tool' && info.action === 'awaiting_approval') {
371
- const tool = tools.find(({ id }) => id === info.data?.tool_id)
386
+ const tool = tools.find(({ id }) => id === info.data?.tool_id)
372
387
  data.steps.push({
373
388
  id: info.id,
374
389
  type: 'tool',
@@ -392,7 +407,7 @@ class AIClient extends ReactQueryNetworkClient {
392
407
  if (info.type === 'tool' && info.action === 'start') {
393
408
  const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
394
409
  if (!info.data) return
395
-
410
+
396
411
  //There might be a tool with status awaiting_approval, so we want to inform tool has already started
397
412
  if (!currentStep || !currentStep.attempts[0].tools) {
398
413
  const input = formatJson(info.data.input)
@@ -405,7 +420,7 @@ class AIClient extends ReactQueryNetworkClient {
405
420
  input: info.data?.input,
406
421
  user_question: info.data?.user_question,
407
422
  attempts: [{
408
- tools:[{ ...tool, executionId: info.id, input }],
423
+ tools: [{ ...tool, executionId: info.id, input }],
409
424
  }],
410
425
  })
411
426
  } else {
@@ -415,7 +430,7 @@ class AIClient extends ReactQueryNetworkClient {
415
430
  if (!toolInFirstAttempt) {
416
431
  const input = formatJson(info.data.input)
417
432
  const tool = tools?.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
418
- currentStep.attempts[info.data.attempt-1].tools?.push({
433
+ currentStep.attempts[info.data.attempt - 1].tools?.push({
419
434
  ...tool,
420
435
  executionId: info.id,
421
436
  input,
@@ -426,8 +441,8 @@ class AIClient extends ReactQueryNetworkClient {
426
441
  toolInFirstAttempt.input = input
427
442
  } else {
428
443
  const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
429
- currentStep.attempts[info.data.attempt-1] ??= { tools: [] }
430
- currentStep.attempts[info.data.attempt-1].tools?.push({
444
+ currentStep.attempts[info.data.attempt - 1] ??= { tools: [] }
445
+ currentStep.attempts[info.data.attempt - 1].tools?.push({
431
446
  ...tool,
432
447
  executionId: info.id,
433
448
  input,
@@ -440,7 +455,7 @@ class AIClient extends ReactQueryNetworkClient {
440
455
  if (info.type === 'tool' && info.action === 'end') {
441
456
  const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
442
457
  if (!currentStep || !info.data) return
443
- const tool = currentStep.attempts[info.data.attempt-1]?.tools?.find(t => t.executionId === info.id)
458
+ const tool = currentStep.attempts[info.data.attempt - 1]?.tools?.find(t => t.executionId === info.id)
444
459
  if (tool) {
445
460
  tool.output = formatJson(info.data.output)
446
461
  tool.duration = info.duration
@@ -1,11 +1,11 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
2
 
3
+ import { getApiAddresses } from '../api-addresses'
3
4
  import { createKey, defaults, deleteKey, deleteSecretValue, editKey, encrypt, getAll1, getAvailability, updateSecretValue } from '../api/secrets'
4
5
  import { DefaultAPIError } from '../error/DefaultAPIError'
5
6
  import { secretsDictionary } from '../error/dictionary/secrets'
6
7
  import { StackspotAPIError } from '../error/StackspotAPIError'
7
8
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
8
- import { getApiAddresses } from '../api-addresses'
9
9
 
10
10
  class SecretClient extends ReactQueryNetworkClient {
11
11
  constructor() {