@stack-spot/portal-network 1.0.0-dev.1768944806600 → 1.0.0-dev.1769117840606

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 (39) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/api/accountAssetManager.d.ts +14 -10
  3. package/dist/api/accountAssetManager.d.ts.map +1 -1
  4. package/dist/api/accountAssetManager.js +5 -2
  5. package/dist/api/accountAssetManager.js.map +1 -1
  6. package/dist/api/agent-tools.d.ts +752 -164
  7. package/dist/api/agent-tools.d.ts.map +1 -1
  8. package/dist/api/agent-tools.js +203 -43
  9. package/dist/api/agent-tools.js.map +1 -1
  10. package/dist/api/ai.d.ts +3 -2
  11. package/dist/api/ai.d.ts.map +1 -1
  12. package/dist/api/ai.js +1 -2
  13. package/dist/api/ai.js.map +1 -1
  14. package/dist/api/workspace-ai.d.ts +41 -0
  15. package/dist/api/workspace-ai.d.ts.map +1 -1
  16. package/dist/api/workspace-ai.js +34 -0
  17. package/dist/api/workspace-ai.js.map +1 -1
  18. package/dist/client/account-asset-manager.d.ts +3 -0
  19. package/dist/client/account-asset-manager.d.ts.map +1 -1
  20. package/dist/client/agent-tools.d.ts +130 -3
  21. package/dist/client/agent-tools.d.ts.map +1 -1
  22. package/dist/client/agent-tools.js +105 -2
  23. package/dist/client/agent-tools.js.map +1 -1
  24. package/dist/client/ai.d.ts +72 -1
  25. package/dist/client/ai.d.ts.map +1 -1
  26. package/dist/client/ai.js +71 -6
  27. package/dist/client/ai.js.map +1 -1
  28. package/dist/client/workspace-ai.d.ts +15 -4
  29. package/dist/client/workspace-ai.d.ts.map +1 -1
  30. package/dist/client/workspace-ai.js +17 -3
  31. package/dist/client/workspace-ai.js.map +1 -1
  32. package/package.json +1 -1
  33. package/src/api/accountAssetManager.ts +18 -11
  34. package/src/api/agent-tools.ts +1259 -472
  35. package/src/api/ai.ts +3 -3
  36. package/src/api/workspace-ai.ts +83 -0
  37. package/src/client/agent-tools.ts +55 -2
  38. package/src/client/ai.ts +41 -6
  39. package/src/client/workspace-ai.ts +23 -7
package/src/api/ai.ts CHANGED
@@ -384,6 +384,7 @@ export type QuickCommandsStepPromptRequest = {
384
384
  allow_use_current_workspace?: boolean;
385
385
  knowledge_source_slugs?: string[] | null;
386
386
  agent_id?: string | null;
387
+ agent_version_number?: number | null;
387
388
  use_uploaded_files?: boolean;
388
389
  agent_built_in?: boolean | null;
389
390
  next_step_slug?: string | null;
@@ -871,6 +872,7 @@ export type ChatRequest = {
871
872
  } | null;
872
873
  user_prompt: string;
873
874
  project_id?: string | null;
875
+ agent_version_number?: number | null;
874
876
  };
875
877
  export type SourceProjectFile3 = {
876
878
  "type": "project_file";
@@ -4061,14 +4063,13 @@ export function devAssistantV3V3ChatPost({ authorization, xAccountId, xMemberId,
4061
4063
  /**
4062
4064
  * List All
4063
4065
  */
4064
- export function listAllV3QuickCommandsGet({ name, slug, size, page, visibilityList, order, isRemote, types, authorization, xAccountId, xMemberId, xUsername }: {
4066
+ export function listAllV3QuickCommandsGet({ name, slug, size, page, visibilityList, order, types, authorization, xAccountId, xMemberId, xUsername }: {
4065
4067
  name?: string | null;
4066
4068
  slug?: string | null;
4067
4069
  size?: number;
4068
4070
  page?: number;
4069
4071
  visibilityList?: VisibilityLevelEnum[] | null;
4070
4072
  order?: OrderEnum | null;
4071
- isRemote?: boolean;
4072
4073
  types?: QuickCommandTypeRequest[] | null;
4073
4074
  authorization: string;
4074
4075
  xAccountId?: string | null;
@@ -4090,7 +4091,6 @@ export function listAllV3QuickCommandsGet({ name, slug, size, page, visibilityLi
4090
4091
  page,
4091
4092
  visibility_list: visibilityList,
4092
4093
  order,
4093
- is_remote: isRemote,
4094
4094
  types
4095
4095
  }))}`, {
4096
4096
  ...opts,
@@ -84,6 +84,13 @@ export type ListWksContentsResponse = {
84
84
  [key: string]: any;
85
85
  }[] | null;
86
86
  };
87
+ export type ContentVersion = {
88
+ core_id: string;
89
+ version_number?: number | null;
90
+ };
91
+ export type AddWorkspaceContentRequestV2 = {
92
+ content_identifier: ContentVersion[];
93
+ };
87
94
  export type ActionShared = "VIEW" | "EDIT" | "GRANT_ACESS";
88
95
  export type PermissionForSharedRequest = {
89
96
  userId: string;
@@ -100,6 +107,12 @@ export type ResourceMembersResponse = {
100
107
  name: string;
101
108
  actions: string[];
102
109
  };
110
+ export type ResourceMembersPaginatedResponse = {
111
+ items: ResourceMembersResponse[];
112
+ page: number;
113
+ size: number;
114
+ total_pages: number;
115
+ };
103
116
  /**
104
117
  * Create Workspace
105
118
  */
@@ -534,6 +547,36 @@ export function listAllContentsV1WorkspacesWorkspaceIdContentsGet({ workspaceId,
534
547
  })
535
548
  }));
536
549
  }
550
+ /**
551
+ * Add Content
552
+ */
553
+ export function addContentV2WorkspacesWorkspaceIdContentTypePost({ workspaceId, contentType, authorization, xAccountId, addWorkspaceContentRequestV2 }: {
554
+ workspaceId: string;
555
+ contentType: ContentType;
556
+ authorization: string;
557
+ xAccountId?: string | null;
558
+ addWorkspaceContentRequestV2: AddWorkspaceContentRequestV2;
559
+ }, opts?: Oazapfts.RequestOpts) {
560
+ return oazapfts.ok(oazapfts.fetchJson<{
561
+ status: 200;
562
+ data: {
563
+ [key: string]: any;
564
+ };
565
+ } | {
566
+ status: 404;
567
+ } | {
568
+ status: 422;
569
+ data: HttpValidationError;
570
+ }>(`/v2/workspaces/${encodeURIComponent(workspaceId)}/${encodeURIComponent(contentType)}`, oazapfts.json({
571
+ ...opts,
572
+ method: "POST",
573
+ body: addWorkspaceContentRequestV2,
574
+ headers: oazapfts.mergeHeaders(opts?.headers, {
575
+ authorization,
576
+ "x-account-id": xAccountId
577
+ })
578
+ })));
579
+ }
537
580
  /**
538
581
  * Use Shareable Link
539
582
  */
@@ -653,6 +696,46 @@ export function listMembersV1ResourceTypeResourceTypeResourcesResourceIdentifier
653
696
  })
654
697
  }));
655
698
  }
699
+ /**
700
+ * List Members
701
+ */
702
+ export function listMembersV2ResourceTypeResourceTypeResourcesResourceIdentifierMembersGet({ resourceType, resourceIdentifier, search, filterBy, filterValue, sortBy, page, size, order, authorization, xAccountId }: {
703
+ resourceType: ContentType;
704
+ resourceIdentifier: string;
705
+ search?: string | null;
706
+ filterBy?: string | null;
707
+ filterValue?: string | null;
708
+ sortBy?: SortBy | null;
709
+ page?: number;
710
+ size?: number;
711
+ order?: OrderEnum;
712
+ authorization: string;
713
+ xAccountId?: string | null;
714
+ }, opts?: Oazapfts.RequestOpts) {
715
+ return oazapfts.ok(oazapfts.fetchJson<{
716
+ status: 200;
717
+ data: ResourceMembersPaginatedResponse;
718
+ } | {
719
+ status: 404;
720
+ } | {
721
+ status: 422;
722
+ data: HttpValidationError;
723
+ }>(`/v2/resource-type/${encodeURIComponent(resourceType)}/resources/${encodeURIComponent(resourceIdentifier)}/members${QS.query(QS.explode({
724
+ search,
725
+ filter_by: filterBy,
726
+ filter_value: filterValue,
727
+ sort_by: sortBy,
728
+ page,
729
+ size,
730
+ order
731
+ }))}`, {
732
+ ...opts,
733
+ headers: oazapfts.mergeHeaders(opts?.headers, {
734
+ authorization,
735
+ "x-account-id": xAccountId
736
+ })
737
+ }));
738
+ }
656
739
  /**
657
740
  * Healthz
658
741
  */
@@ -1,6 +1,6 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
2
  import { getApiAddresses } from '../api-addresses'
3
- import { addFavoriteV1AgentsAgentIdFavoritePost, AgentVisibilityLevelEnum, createAgentV1AgentsPost, createToolkitToolsV1ToolkitsToolkitIdToolsPost, createToolkitV1ToolkitsPost, defaults, deleteAgentV1AgentsAgentIdDelete, deleteFavoriteV1AgentsAgentIdFavoriteDelete, deleteToolkitToolsV1ToolkitsToolkitIdToolsDelete, deleteToolkitV1ToolkitsToolkitIdDelete, editToolkitToolV1ToolkitsToolkitIdToolsToolIdPut, forkAgentV1AgentsAgentIdForkPost, forkToolkitV1ToolkitsToolkitIdForkPost, getAgentV1AgentsAgentIdGet, getPublicToolKitsV1BuiltinToolkitGet, getToolkitToolV1ToolkitsToolkitIdToolsToolIdGet, getToolkitV1ToolkitsToolkitIdGet, listAgentsUsingToolsV1ToolkitsToolkitIdToolsAgentsPost, listAgentsV1AgentsGet, listAgentsV3AgentsGet, listMcpToolsV1McpToolsToolkitIdGet, listMultiAgentsV1AgentsMultiAgentsGet, listToolkitsV1ToolkitsGet, listToolkitsV2ToolkitsGet, publishAgentV1AgentsAgentIdPublishPost, searchAgentsV1AgentsSearchPost, shareV1AgentsAgentIdSharePost, updateAgentV1AgentsAgentIdPatch, updateToolkitV1ToolkitsToolkitIdPatch, VisibilityLevelEnum } from '../api/agent-tools'
3
+ import { addFavoriteV1AgentsAgentIdFavoritePost, AgentVisibilityLevelEnum, createAgentV1AgentsPost, createAgentV2AgentsPost, createToolkitToolsV1ToolkitsToolkitIdToolsPost, createToolkitV1ToolkitsPost, createVersionV1AgentsAgentCoreIdVersionsPost, defaults, deleteAgentV1AgentsAgentIdDelete, deleteFavoriteV1AgentsAgentIdFavoriteDelete, deleteToolkitToolsV1ToolkitsToolkitIdToolsDelete, deleteToolkitV1ToolkitsToolkitIdDelete, deleteVersionV1AgentsAgentCoreIdVersionsVersionNumberDelete, editToolkitToolV1ToolkitsToolkitIdToolsToolIdPut, findByAgentCoreIdV2AgentsAgentCoreIdGet, forkAgentV1AgentsAgentIdForkPost, forkAgentVersionV1AgentsAgentCoreIdVersionsVersionNumberForkPost, forkToolkitV1ToolkitsToolkitIdForkPost, getAgentV1AgentsAgentIdGet, getPublicToolKitsV1BuiltinToolkitGet, getToolkitToolV1ToolkitsToolkitIdToolsToolIdGet, getToolkitV1ToolkitsToolkitIdGet, listAgentsUsingToolsV1ToolkitsToolkitIdToolsAgentsPost, listAgentsV1AgentsGet, listAgentsV3AgentsGet, listAgentsV4AgentsGet, listMcpToolsV1McpToolsToolkitIdGet, listMultiAgentsV1AgentsMultiAgentsGet, listToolkitsV1ToolkitsGet, listToolkitsV2ToolkitsGet, listVersionsOfAgentCoreV1AgentsAgentCoreIdVersionsGet, patchVersionRecommendedV1AgentsAgentCoreIdVersionsVersionNumberPatch, publishAgentV1AgentsAgentIdPublishPost, searchAgentsByIdsV1AgentsSearchPost, searchAgentsV2AgentsSearchPost, shareV1AgentsAgentIdSharePost, updateAgentV1AgentsAgentIdPatch, updateAgentV2AgentsAgentIdPatch, updateToolkitV1ToolkitsToolkitIdPatch, VisibilityLevelEnum } from '../api/agent-tools'
4
4
  import { DefaultAPIError } from '../error/DefaultAPIError'
5
5
  import { agentToolsDictionary } from '../error/dictionary/agent-tools'
6
6
  import { StackspotAPIError } from '../error/StackspotAPIError'
@@ -13,6 +13,7 @@ import { workspaceAiClient } from './workspace-ai'
13
13
 
14
14
  const AGENT_DEFAULT_SLUG = 'stk_flex'
15
15
  const listAgentsV3AgentsWithoutAuthorization = removeAuthorizationParam(listAgentsV3AgentsGet)
16
+ const listAgentsV4 = removeAuthorizationParam(listAgentsV4AgentsGet)
16
17
  const listToolkitsAuthorization = removeAuthorizationParam(listToolkitsV2ToolkitsGet)
17
18
 
18
19
  class AgentToolsClient extends ReactQueryNetworkClient {
@@ -30,6 +31,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
30
31
  tools = this.query(removeAuthorizationParam(getPublicToolKitsV1BuiltinToolkitGet))
31
32
 
32
33
  /**
34
+ * @deprecated
33
35
  * Create agent
34
36
  */
35
37
  createAgent = this.mutation(removeAuthorizationParam(createAgentV1AgentsPost))
@@ -40,6 +42,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
40
42
  deleteAgent = this.mutation(removeAuthorizationParam(deleteAgentV1AgentsAgentIdDelete))
41
43
 
42
44
  /**
45
+ * @deprecated
43
46
  * Updates an agent
44
47
  */
45
48
  updateAgent = this.mutation(removeAuthorizationParam(updateAgentV1AgentsAgentIdPatch))
@@ -78,14 +81,16 @@ class AgentToolsClient extends ReactQueryNetworkClient {
78
81
  availableAgentsForMultiAgentAddition = this.query(removeAuthorizationParam(listMultiAgentsV1AgentsMultiAgentsGet))
79
82
 
80
83
  /**
84
+ * @deprecated
81
85
  * Gets agent by id
82
86
  */
83
87
  agent = this.query(removeAuthorizationParam(getAgentV1AgentsAgentIdGet))
84
88
 
85
89
  /**
90
+ * @deprecated
86
91
  * Gets agents by ids
87
92
  */
88
- agentsByIds = this.query(removeAuthorizationParam(searchAgentsV1AgentsSearchPost))
93
+ agentsByIds = this.query(removeAuthorizationParam(searchAgentsByIdsV1AgentsSearchPost))
89
94
 
90
95
  /**
91
96
  * Gets the default agent slug
@@ -238,6 +243,54 @@ class AgentToolsClient extends ReactQueryNetworkClient {
238
243
  * remove an agent from favorites
239
244
  */
240
245
  removeFavorite = this.mutation(removeAuthorizationParam(deleteFavoriteV1AgentsAgentIdFavoriteDelete))
246
+ /**
247
+ * Creates an agent version
248
+ */
249
+ createAgentVersion = this.mutation(removeAuthorizationParam(createVersionV1AgentsAgentCoreIdVersionsPost))
250
+ /**
251
+ * V2 of agent creation
252
+ */
253
+ createAgentV2 = this.mutation(removeAuthorizationParam(createAgentV2AgentsPost))
254
+ /**
255
+ * V2 of agent update
256
+ */
257
+ updateAgentV2 = this.mutation(removeAuthorizationParam(updateAgentV2AgentsAgentIdPatch))
258
+ /**
259
+ * Update agent recommended version
260
+ */
261
+ updateRecommendedVersion = this.mutation(removeAuthorizationParam(patchVersionRecommendedV1AgentsAgentCoreIdVersionsVersionNumberPatch))
262
+ /**
263
+ * V2 of get agent by id
264
+ */
265
+ agentV2 = this.query(removeAuthorizationParam(findByAgentCoreIdV2AgentsAgentCoreIdGet))
266
+ /**
267
+ * Deletes an agent version
268
+ */
269
+ deleteVersion = this.mutation(removeAuthorizationParam(deleteVersionV1AgentsAgentCoreIdVersionsVersionNumberDelete))
270
+ /**
271
+ * Gets agent versions
272
+ */
273
+ listAgentVersions = this.query(removeAuthorizationParam(listVersionsOfAgentCoreV1AgentsAgentCoreIdVersionsGet))
274
+ /**
275
+ * Get agents by list of ids using api v2
276
+ */
277
+ agentsByIdsV2 = this.query(removeAuthorizationParam(searchAgentsV2AgentsSearchPost))
278
+ /**
279
+ * Deletes an agent version
280
+ */
281
+ forkAgentVersion = this.mutation(removeAuthorizationParam(forkAgentVersionV1AgentsAgentCoreIdVersionsVersionNumberForkPost))
282
+ /**
283
+ * Get agents v4
284
+ */
285
+ agentsV4 = this.infiniteQuery(listAgentsV4, {
286
+ pageParamName: 'filters.page',
287
+ accumulator: 'items',
288
+ getNextPageParam: ({ variables, lastPage, lastPageParam }) => {
289
+ const size = variables.filters.size ?? 1
290
+ const parsedLastPageParam = (lastPageParam as number) ?? variables.filters.page ?? 1
291
+ return lastPage.items && lastPage.items.length < size ? undefined : parsedLastPageParam + 1
292
+ },
293
+ })
241
294
  }
242
295
 
243
296
  export const agentToolsClient = new AgentToolsClient()
package/src/client/ai.ts CHANGED
@@ -6,9 +6,11 @@ import {
6
6
  addFavoriteV1QuickCommandsSlugFavoritePost,
7
7
  calculateNextStepV1QuickCommandsSlugStepsStepSlugCalculateNextStepPost,
8
8
  callbackV1QuickCommandsCallbackExecutionIdGet,
9
+ checkQuickCommandExistsV1QuickCommandsSlugExistsGet,
9
10
  conversationHistoryV1ConversationsConversationIdGet,
10
11
  createAnswerForReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersPost,
11
12
  createExecutionV1QuickCommandsCreateExecutionSlugPost,
13
+ createQuickCommandV1QuickCommandsPost,
12
14
  createResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsPost,
13
15
  currentV1TokensUsageCurrentGet,
14
16
  defaults,
@@ -16,11 +18,15 @@ import {
16
18
  deleteFavoriteV1AiStacksStackIdFavoriteDelete,
17
19
  deleteFavoriteV1QuickCommandsSlugFavoriteDelete,
18
20
  deleteKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdDelete,
21
+ deleteKnowledgeSourceV1KnowledgeSourcesSlugDelete,
22
+ deleteQuickCommandV1QuickCommandsSlugDelete,
19
23
  deleteResourceReviewV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdDelete,
20
24
  deleteReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdDelete,
21
25
  downloadConversationV1ConversationsConversationIdDownloadGet,
22
26
  findKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdGet,
27
+ findKnowledgeSourceDependenciesV1KnowledgeSourcesSlugDependenciesGet,
23
28
  findKnowledgeSourceV1KnowledgeSourcesSlugGet,
29
+ forkV1QuickCommandsSlugForkPost,
24
30
  formatFetchStepV1QuickCommandsSlugStepsStepSlugFetchFormatPost,
25
31
  formatResultV1QuickCommandsSlugResultFormatPost,
26
32
  getContentDependenciesV1ContentContentTypeContentIdDependenciesGet,
@@ -38,6 +44,7 @@ import {
38
44
  listConversationsV1ConversationsGet,
39
45
  listKnowledgeSourcesV1KnowledgeSourcesGet,
40
46
  postEventV1EventsPost,
47
+ publishV1QuickCommandsSlugPublishPost,
41
48
  quickActionsV1QuickActionsPost,
42
49
  QuickCommandPromptResponse2,
43
50
  QuickCommandsExecutionRequest,
@@ -56,7 +63,6 @@ import {
56
63
  vectorizeCustomKnowledgeSourceV1KnowledgeSourcesSlugCustomPost,
57
64
  } from '../api/ai'
58
65
 
59
-
60
66
  import { StackspotAPIError } from '../error/StackspotAPIError'
61
67
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
62
68
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
@@ -117,6 +123,10 @@ class AIClient extends ReactQueryNetworkClient {
117
123
  */
118
124
  vectorizeCustomKS = this.mutation(
119
125
  removeAuthorizationParam(vectorizeCustomKnowledgeSourceV1KnowledgeSourcesSlugCustomPost))
126
+ /**
127
+ * Deletes a KS
128
+ */
129
+ deleteKS = this.mutation(removeAuthorizationParam(deleteKnowledgeSourceV1KnowledgeSourcesSlugDelete))
120
130
  /**
121
131
  * Lists the AI Stacks according to their visibilities.
122
132
  */
@@ -158,6 +168,26 @@ class AIClient extends ReactQueryNetworkClient {
158
168
  * Gets the execution status and result of a quick command by its execution ID.
159
169
  */
160
170
  quickCommandCallbackExecutionId = this.query(removeAuthorizationParam(callbackV1QuickCommandsCallbackExecutionIdGet))
171
+ /**
172
+ * Creates a QC
173
+ */
174
+ createQuickCommand = this.mutation(removeAuthorizationParam(createQuickCommandV1QuickCommandsPost))
175
+ /**
176
+ * Deletes a QC
177
+ */
178
+ deleteQuickCommand = this.mutation(removeAuthorizationParam(deleteQuickCommandV1QuickCommandsSlugDelete))
179
+ /**
180
+ * Forks a QC
181
+ */
182
+ forkQuickCommand = this.mutation(removeAuthorizationParam(forkV1QuickCommandsSlugForkPost))
183
+ /**
184
+ * Publishes a QC
185
+ */
186
+ publishQuickCommand = this.mutation(removeAuthorizationParam(publishV1QuickCommandsSlugPublishPost))
187
+ /**
188
+ * Check Quick Command Available slug
189
+ */
190
+ checkAvailableQuickCommandSlug = this.query(removeAuthorizationParam(checkQuickCommandExistsV1QuickCommandsSlugExistsGet))
161
191
  /**
162
192
  * Lists the knowledge sources according to filters passed as parameter.
163
193
  */
@@ -174,6 +204,10 @@ class AIClient extends ReactQueryNetworkClient {
174
204
  * Lists knowledge sources matching the provided IDs.
175
205
  */
176
206
  searchKnowledgeSources = this.query(removeAuthorizationParam(searchKnowledgeSourcesV1KnowledgeSourcesSearchPost))
207
+ /**
208
+ * Finds Knowledge Source Dependencies
209
+ */
210
+ dependenciesKnowledgeSources = this.query(removeAuthorizationParam(findKnowledgeSourceDependenciesV1KnowledgeSourcesSlugDependenciesGet))
177
211
  /**
178
212
  * Gets the chat history. This is a paginated resource.
179
213
  */
@@ -340,15 +374,16 @@ class AIClient extends ReactQueryNetworkClient {
340
374
  deleteReviewComment = this.mutation(
341
375
  removeAuthorizationParam(deleteReviewCommentV1ResourcesResourceTypeSlugResourceSlugReviewsReviewIdAnswersAnswerIdDelete))
342
376
 
343
- private static async toolsOfAgent(agentId?: string) {
377
+ private static async toolsOfAgent(agentId?: string, agent_version_number?: number) {
344
378
  try {
345
- const agent = agentId ? await agentToolsClient.agent.query({ agentId }) : undefined
379
+ const agent = agentId ? await agentToolsClient.agentV2.query({
380
+ agentCoreId: agentId, versionNumber: agent_version_number }) : undefined
346
381
  if (!agent) return []
347
382
  const tools: (Omit<ChatAgentTool, 'duration' | 'prompt' | 'output'>)[] = []
348
- agent.toolkits?.builtin_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
383
+ agent.version?.toolkits?.builtin_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
349
384
  if (id) tools.push({ image: kit.image_url, id, name: name || id, description })
350
385
  }))
351
- agent.toolkits?.custom_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
386
+ agent.version?.toolkits?.custom_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
352
387
  if (id) tools.push({ image: kit.avatar ?? undefined, id, name: name || id, description })
353
388
  }))
354
389
  return tools
@@ -380,7 +415,7 @@ class AIClient extends ReactQueryNetworkClient {
380
415
  async function transform(event: Partial<FixedChatResponse>, data: Partial<ChatResponseWithSteps>) {
381
416
  const info = event.agent_info
382
417
  if (!info) return
383
- const tools = await AIClient.toolsOfAgent(request.context?.agent_id)
418
+ const tools = await AIClient.toolsOfAgent(request.context?.agent_id, request.agent_version_number ?? undefined)
384
419
  data.steps = data.steps ? [...data.steps] : []
385
420
 
386
421
  if (info.type === 'planning' && info.action === 'end') {
@@ -1,9 +1,11 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
- import { AgentResponse } from '../api/agent'
2
+ import { getApiAddresses } from '../api-addresses'
3
3
  import { CustomToolkitResponse } from '../api/agent-tools'
4
- import { GetAiStackResponse, KnowledgeSourceItemResponse, QuickCommandResponse } from '../api/ai'
4
+ import { GetAiStackResponse, QuickCommandResponse } from '../api/ai'
5
+ import { KnowledgeSourceItemResponse } from '../api/dataIntegration'
5
6
  import {
6
7
  addContentV1WorkspacesWorkspaceIdContentTypePost,
8
+ addContentV2WorkspacesWorkspaceIdContentTypePost,
7
9
  addFavoriteV1WorkspacesWorkspaceIdFavoritePost,
8
10
  addPermissionV1ResourceTypeResourceTypeResourcesResourceIdentifierPatch,
9
11
  addPermissionV1WorkspacesWorkspaceIdPermissionsPatch,
@@ -24,13 +26,12 @@ import {
24
26
  updateWorkspaceV1WorkspacesWorkspaceIdPatch,
25
27
  useShareableLinkV1ShareShareIdPatch,
26
28
  } from '../api/workspace-ai'
29
+ import { DefaultAPIError } from '../error/DefaultAPIError'
30
+ import { wksAiDictionary } from '../error/dictionary/workspace-ai'
27
31
  import { StackspotAPIError } from '../error/StackspotAPIError'
28
32
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
29
33
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
30
- import { getApiAddresses } from '../api-addresses'
31
- import { DefaultAPIError } from '../error/DefaultAPIError'
32
- import { wksAiDictionary } from '../error/dictionary/workspace-ai'
33
- import { FixedAddResourceToWorkspaceAi, FixedWorkspaceAiPermissions, ReplaceResult } from './types'
34
+ import { AgentResponseWithBuiltIn, FixedAddResourceToWorkspaceAi, FixedWorkspaceAiPermissions, ReplaceResult } from './types'
34
35
 
35
36
  class WorkspaceAiClient extends ReactQueryNetworkClient {
36
37
  constructor() {
@@ -48,6 +49,7 @@ class WorkspaceAiClient extends ReactQueryNetworkClient {
48
49
  deleteWorkspaceAi = this.mutation(removeAuthorizationParam(deleteWorkspaceV1WorkspacesWorkspaceIdDelete))
49
50
 
50
51
  /**
52
+ * @deprecated
51
53
  * Adds a resource to the Spot.
52
54
  */
53
55
  addResourceTypeToWorkspaceAi = this.mutation({
@@ -61,6 +63,20 @@ class WorkspaceAiClient extends ReactQueryNetworkClient {
61
63
  permission: this.createPermissionFunctionFor(addContentV1WorkspacesWorkspaceIdContentTypePost),
62
64
  })
63
65
 
66
+ /**
67
+ * V2 for adding a resource to the Spot.
68
+ */
69
+ addResourceTypeV2ToSpot = this.mutation({
70
+ name: 'addResourceTypeToWorkspaceAi',
71
+ request: (
72
+ signal,
73
+ variables: Omit<Parameters<typeof addContentV2WorkspacesWorkspaceIdContentTypePost>[0], 'authorization'>,
74
+ ) =>
75
+ addContentV2WorkspacesWorkspaceIdContentTypePost({ ...variables, authorization: '' },
76
+ { signal }) as unknown as Promise<FixedAddResourceToWorkspaceAi>,
77
+ permission: this.createPermissionFunctionFor(addContentV2WorkspacesWorkspaceIdContentTypePost),
78
+ })
79
+
64
80
  /**
65
81
  * Lists all the knowledge sources in a Spot.
66
82
  */
@@ -117,7 +133,7 @@ class WorkspaceAiClient extends ReactQueryNetworkClient {
117
133
  'authorization' | 'contentType'>,
118
134
  ) =>
119
135
  listAllByContentTypeV1WorkspacesWorkspaceIdContentTypeGet({ ...variables, contentType: 'agent', authorization: '' },
120
- { signal }) as unknown as Promise<AgentResponse[]>,
136
+ { signal }) as unknown as Promise<AgentResponseWithBuiltIn[]>,
121
137
  permission: this.createPermissionFunctionFor(listAllByContentTypeV1WorkspacesWorkspaceIdContentTypeGet),
122
138
  })
123
139