@stack-spot/portal-network 0.149.0-beta.1 → 0.149.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.
@@ -260,15 +260,6 @@ export type DeleteToolsRequest = {
260
260
  /** List of tool IDs to be deleted from the toolkit */
261
261
  tool_ids: string[];
262
262
  };
263
- export type ListAgentsUsingToolsRequest = {
264
- /** List of tool IDs to find agents that use at least one of them */
265
- tool_ids: string[];
266
- };
267
- export type AgentUsingToolsResponse = {
268
- id: string;
269
- name: string;
270
- avatar?: string | null;
271
- };
272
263
  export type AssignCustomToolsAgentRequest = {
273
264
  toolkit_id: string;
274
265
  tools_ids: string[];
@@ -321,7 +312,7 @@ export type ExecuteAgentToolRequest = {
321
312
  export type AgentToolExecutionResponse = {
322
313
  result: string;
323
314
  };
324
- export type AgentVisibilityLevelEnum = "built_in" | "recently_used";
315
+ export type AgentVisibilityLevelEnum = "built_in";
325
316
  export type KnowledgeSourcesConfig = {
326
317
  knowledge_sources: string[];
327
318
  max_number_of_kos?: number;
@@ -337,7 +328,7 @@ export type ListAgentResponse = {
337
328
  created_at: string | null;
338
329
  visibility_level: string;
339
330
  avatar: string | null;
340
- suggested_prompts: string[] | null;
331
+ conversation_starter: string[] | null;
341
332
  knowledge_sources_config: KnowledgeSourcesConfig;
342
333
  "type"?: string;
343
334
  system_prompt?: string;
@@ -474,20 +465,6 @@ export type AgentModel = {
474
465
  updated_by?: string | null;
475
466
  updated_at?: string | null;
476
467
  };
477
- export type ListAgentResponseV2 = {
478
- id: string;
479
- name: string;
480
- slug: string;
481
- created_by: string | null;
482
- created_at: string | null;
483
- visibility_level: string;
484
- avatar: string | null;
485
- conversation_starter: string[] | null;
486
- knowledge_sources_config: KnowledgeSourcesConfig;
487
- "type"?: string;
488
- system_prompt?: string;
489
- creator_name?: string;
490
- };
491
468
  export type InternalListToolkitsRequest = {
492
469
  /** List of toolkit IDs to retrieve */
493
470
  toolkit_ids: string[];
@@ -910,39 +887,6 @@ export function splitUploadedFilePreviewV1ToolkitsToolsPreviewFileUploadIdGet({
910
887
  })
911
888
  }));
912
889
  }
913
- /**
914
- * List Agents Using Tools
915
- */
916
- export function listAgentsUsingToolsV1ToolkitsToolkitIdToolsAgentsPost({ toolkitId, xAccountId, xUsername, xUserId, xUserFullName, authorization, listAgentsUsingToolsRequest }: {
917
- toolkitId: string;
918
- xAccountId?: string | null;
919
- xUsername?: string | null;
920
- xUserId?: string | null;
921
- xUserFullName?: string | null;
922
- authorization: string;
923
- listAgentsUsingToolsRequest: ListAgentsUsingToolsRequest;
924
- }, opts?: Oazapfts.RequestOpts) {
925
- return oazapfts.ok(oazapfts.fetchJson<{
926
- status: 200;
927
- data: AgentUsingToolsResponse[];
928
- } | {
929
- status: 404;
930
- } | {
931
- status: 422;
932
- data: HttpValidationError;
933
- }>(`/v1/toolkits/${encodeURIComponent(toolkitId)}/tools/agents`, oazapfts.json({
934
- ...opts,
935
- method: "POST",
936
- body: listAgentsUsingToolsRequest,
937
- headers: oazapfts.mergeHeaders(opts?.headers, {
938
- "x-account-id": xAccountId,
939
- "x-username": xUsername,
940
- "x-user-id": xUserId,
941
- "x-user-full-name": xUserFullName,
942
- authorization
943
- })
944
- })));
945
- }
946
890
  /**
947
891
  * Assign Tools
948
892
  */
@@ -1329,78 +1273,6 @@ export function publishAgentV1AgentsAgentIdPublishPost({ agentId }: {
1329
1273
  method: "POST"
1330
1274
  }));
1331
1275
  }
1332
- /**
1333
- * List Agents
1334
- */
1335
- export function listAgentsV2AgentsGet({ name, slug, visibility, size, page, xAccountId, xUsername, xUserId, xUserFullName, authorization }: {
1336
- name?: string | null;
1337
- slug?: string | null;
1338
- visibility?: AgentVisibilityLevelEnum | VisibilityLevelEnum;
1339
- size?: number;
1340
- page?: number;
1341
- xAccountId?: string | null;
1342
- xUsername?: string | null;
1343
- xUserId?: string | null;
1344
- xUserFullName?: string | null;
1345
- authorization: string;
1346
- }, opts?: Oazapfts.RequestOpts) {
1347
- return oazapfts.ok(oazapfts.fetchJson<{
1348
- status: 200;
1349
- data: ListAgentResponseV2[];
1350
- } | {
1351
- status: 404;
1352
- } | {
1353
- status: 422;
1354
- data: HttpValidationError;
1355
- }>(`/v2/agents${QS.query(QS.explode({
1356
- name,
1357
- slug,
1358
- visibility,
1359
- size,
1360
- page
1361
- }))}`, {
1362
- ...opts,
1363
- headers: oazapfts.mergeHeaders(opts?.headers, {
1364
- "x-account-id": xAccountId,
1365
- "x-username": xUsername,
1366
- "x-user-id": xUserId,
1367
- "x-user-full-name": xUserFullName,
1368
- authorization
1369
- })
1370
- }));
1371
- }
1372
- /**
1373
- * Search Agents
1374
- */
1375
- export function searchAgentsV2AgentsSearchPost({ xAccountId, xUsername, xUserId, xUserFullName, authorization, searchAgentsRequest }: {
1376
- xAccountId?: string | null;
1377
- xUsername?: string | null;
1378
- xUserId?: string | null;
1379
- xUserFullName?: string | null;
1380
- authorization: string;
1381
- searchAgentsRequest: SearchAgentsRequest;
1382
- }, opts?: Oazapfts.RequestOpts) {
1383
- return oazapfts.ok(oazapfts.fetchJson<{
1384
- status: 200;
1385
- data: ListAgentResponseV2[];
1386
- } | {
1387
- status: 404;
1388
- } | {
1389
- status: 422;
1390
- data: HttpValidationError;
1391
- }>("/v2/agents/search", oazapfts.json({
1392
- ...opts,
1393
- method: "POST",
1394
- body: searchAgentsRequest,
1395
- headers: oazapfts.mergeHeaders(opts?.headers, {
1396
- "x-account-id": xAccountId,
1397
- "x-username": xUsername,
1398
- "x-user-id": xUserId,
1399
- "x-user-full-name": xUserFullName,
1400
- authorization
1401
- })
1402
- })));
1403
- }
1404
1276
  /**
1405
1277
  * Internal List Toolkits By Ids
1406
1278
  */
@@ -15,7 +15,7 @@ export const servers = {
15
15
  generatedServerUrl: "https://discover-discover-core.dev.stackspot.com"
16
16
  };
17
17
  export type OpportunityResponse = {
18
- id?: string;
18
+ id: string;
19
19
  name?: string;
20
20
  "number"?: string;
21
21
  createdAt?: string;
@@ -25,14 +25,14 @@ export type OpportunityResponse = {
25
25
  };
26
26
  };
27
27
  export type HypothesisResponse = {
28
- id?: string;
29
- opportunity?: OpportunityResponse;
30
- name?: string;
28
+ id: string;
29
+ opportunity: OpportunityResponse;
30
+ name: string;
31
31
  description?: string;
32
- "number"?: string;
33
- status?: "TO_DO" | "PRIORITIZED" | "IN_EXPERIMENTATION" | "VALIDATED" | "DISCARDED" | "CANCELED";
32
+ "number": string;
33
+ status: "TO_DO" | "PRIORITIZED" | "IN_EXPERIMENTATION" | "VALIDATED" | "DISCARDED" | "CANCELED";
34
34
  createdAt?: string;
35
- createdBy?: string;
35
+ createdBy: string;
36
36
  updatedAt?: string;
37
37
  updatedBy?: string;
38
38
  };
@@ -43,144 +43,188 @@ export type HypothesisUpdateRequest = {
43
43
  status?: string;
44
44
  };
45
45
  export type SortResponse = {
46
- direction?: string;
47
- nullHandling?: string;
48
- ascending?: boolean;
49
- property?: string;
50
- ignoreCase?: boolean;
46
+ direction: string;
47
+ nullHandling: string;
48
+ ascending: boolean;
49
+ property: string;
50
+ ignoreCase: boolean;
51
51
  };
52
52
  export type PageableResponse = {
53
- offset?: number;
54
- sort?: SortResponse[];
55
- paged?: boolean;
56
- pageSize?: number;
57
- pageNumber?: number;
58
- unpaged?: boolean;
53
+ offset: number;
54
+ sort: SortResponse[];
55
+ paged: boolean;
56
+ pageSize: number;
57
+ pageNumber: number;
58
+ unpaged: boolean;
59
59
  };
60
60
  export type PageResponseHypothesisResponse = {
61
- totalElements?: number;
62
- totalPages?: number;
63
- first?: boolean;
64
- last?: boolean;
65
- size?: number;
66
- content?: HypothesisResponse[];
67
- "number"?: number;
68
- sort?: SortResponse[];
69
- numberOfElements?: number;
70
- pageable?: PageableResponse;
71
- empty?: boolean;
61
+ totalElements: number;
62
+ totalPages: number;
63
+ first: boolean;
64
+ last: boolean;
65
+ size: number;
66
+ content: HypothesisResponse[];
67
+ "number": number;
68
+ sort: SortResponse[];
69
+ numberOfElements: number;
70
+ pageable: PageableResponse;
71
+ empty: boolean;
72
72
  };
73
73
  export type HypothesisCreateRequest = {
74
- name?: string;
75
- description?: string;
76
- opportunityId?: string;
74
+ name: string;
75
+ description: string;
76
+ opportunityId: string;
77
77
  };
78
78
  export type DocumentUploadRequest = {
79
- file?: Blob;
80
- description?: string;
81
- name?: string;
82
- typeId?: string;
83
- origin?: "AI" | "UPLOAD";
84
- };
85
- export type DocumentAttachRequest = {
86
- documentIds?: string[];
79
+ file: Blob;
80
+ description: string;
81
+ name: string;
82
+ typeId: string;
83
+ origin: "AI" | "UPLOAD";
87
84
  };
88
85
  export type AgentResponse = {
89
- id?: string;
90
- label?: string;
86
+ id: string;
87
+ label: string;
91
88
  image?: string;
92
- builtIn?: boolean;
93
- slug?: string;
89
+ builtIn: boolean;
90
+ slug: string;
94
91
  createdAt?: string;
95
92
  };
96
93
  export type DocumentTypeResponse = {
97
- id?: string;
98
- typeName?: "PRESS_RELEASE" | "PRODUCT_VISION" | "PRODUCT_REQUIREMENTS" | "MARKET_COMPARISON";
94
+ id: string;
95
+ typeName: "PRESS_RELEASE" | "PRODUCT_VISION" | "PRODUCT_REQUIREMENTS" | "MARKET_COMPARISON";
99
96
  agent?: AgentResponse;
100
- description?: string;
97
+ description: string;
98
+ createdAt?: string;
99
+ };
100
+ export type DocumentVersionSummaryResponse = {
101
+ id: string;
102
+ name: string;
101
103
  createdAt?: string;
104
+ createdBy?: string;
105
+ };
106
+ export type DocumentUploadResponse = {
107
+ id: string;
108
+ name: string;
109
+ description: string;
110
+ "type": DocumentTypeResponse;
111
+ origin: "AI" | "UPLOAD";
112
+ createdAt?: string;
113
+ createdBy: string;
114
+ version: DocumentVersionSummaryResponse;
115
+ };
116
+ export type DocumentAttachRequest = {
117
+ documentIds: string[];
102
118
  };
103
119
  export type DocumentDetailContent = {
104
- hasPreview?: boolean;
120
+ hasPreview: boolean;
105
121
  content?: string;
106
122
  };
107
- export type DocumentDetailResponse = {
108
- id?: string;
109
- name?: string;
110
- description?: string;
111
- "type"?: DocumentTypeResponse;
112
- origin?: "AI" | "UPLOAD";
123
+ export type DocumentVersion = {
124
+ id: string;
125
+ name: string;
113
126
  createdAt?: string;
114
127
  createdBy?: string;
115
- details?: DocumentDetailContent;
128
+ };
129
+ export type DocumentDetailResponse = {
130
+ id: string;
131
+ name: string;
132
+ description: string;
133
+ "type": DocumentTypeResponse;
134
+ origin: "AI" | "UPLOAD";
135
+ createdAt?: string;
136
+ createdBy: string;
137
+ details: DocumentDetailContent;
138
+ version: DocumentVersion;
116
139
  };
117
140
  export type DocumentPatchRequest = {
118
- file?: Blob;
141
+ file: Blob;
119
142
  description?: string;
120
143
  name?: string;
121
144
  };
122
145
  export type PageResponseOpportunityResponse = {
123
- totalElements?: number;
124
- totalPages?: number;
125
- first?: boolean;
126
- last?: boolean;
127
- size?: number;
128
- content?: OpportunityResponse[];
129
- "number"?: number;
130
- sort?: SortResponse[];
131
- numberOfElements?: number;
132
- pageable?: PageableResponse;
133
- empty?: boolean;
146
+ totalElements: number;
147
+ totalPages: number;
148
+ first: boolean;
149
+ last: boolean;
150
+ size: number;
151
+ content: OpportunityResponse[];
152
+ "number": number;
153
+ sort: SortResponse[];
154
+ numberOfElements: number;
155
+ pageable: PageableResponse;
156
+ empty: boolean;
134
157
  };
135
158
  export type HypothesisSummaryResponse = {
136
- id?: string;
137
- name?: string;
138
- "number"?: string;
139
- status?: "TO_DO" | "PRIORITIZED" | "IN_EXPERIMENTATION" | "VALIDATED" | "DISCARDED" | "CANCELED";
159
+ id: string;
160
+ name: string;
161
+ "number": string;
162
+ status: "TO_DO" | "PRIORITIZED" | "IN_EXPERIMENTATION" | "VALIDATED" | "DISCARDED" | "CANCELED";
140
163
  };
141
164
  export type DocumentWithHypothesesResponse = {
142
- id?: string;
143
- name?: string;
165
+ id: string;
166
+ name: string;
144
167
  description?: string;
145
- origin?: "AI" | "UPLOAD";
146
- hypotheses?: HypothesisSummaryResponse[];
168
+ origin: "AI" | "UPLOAD";
169
+ hypotheses: HypothesisSummaryResponse[];
147
170
  createdAt?: string;
148
- createdBy?: string;
171
+ createdBy: string;
149
172
  };
150
173
  export type PageResponseDocumentWithHypothesesResponse = {
151
- totalElements?: number;
152
- totalPages?: number;
153
- first?: boolean;
154
- last?: boolean;
155
- size?: number;
156
- content?: DocumentWithHypothesesResponse[];
157
- "number"?: number;
158
- sort?: SortResponse[];
159
- numberOfElements?: number;
160
- pageable?: PageableResponse;
161
- empty?: boolean;
174
+ totalElements: number;
175
+ totalPages: number;
176
+ first: boolean;
177
+ last: boolean;
178
+ size: number;
179
+ content: DocumentWithHypothesesResponse[];
180
+ "number": number;
181
+ sort: SortResponse[];
182
+ numberOfElements: number;
183
+ pageable: PageableResponse;
184
+ empty: boolean;
162
185
  };
163
- export type DocumentSummaryResponse = {
164
- id?: string;
165
- name?: string;
166
- description?: string;
167
- origin?: "AI" | "UPLOAD";
168
- hasMultipleHypotheses?: boolean;
186
+ export type DocumentVersionResponse = {
187
+ id: string;
188
+ documentId: string;
189
+ versionName: string;
190
+ s3VersionId: string;
169
191
  createdAt?: string;
170
192
  createdBy?: string;
171
193
  };
194
+ export type PageResponseDocumentVersionResponse = {
195
+ totalElements: number;
196
+ totalPages: number;
197
+ first: boolean;
198
+ last: boolean;
199
+ size: number;
200
+ content: DocumentVersionResponse[];
201
+ "number": number;
202
+ sort: SortResponse[];
203
+ numberOfElements: number;
204
+ pageable: PageableResponse;
205
+ empty: boolean;
206
+ };
207
+ export type DocumentSummaryResponse = {
208
+ id: string;
209
+ name: string;
210
+ description: string;
211
+ origin: "AI" | "UPLOAD";
212
+ hasMultipleHypotheses: boolean;
213
+ createdAt?: string;
214
+ createdBy: string;
215
+ };
172
216
  export type PageResponseDocumentSummaryResponse = {
173
- totalElements?: number;
174
- totalPages?: number;
175
- first?: boolean;
176
- last?: boolean;
177
- size?: number;
178
- content?: DocumentSummaryResponse[];
179
- "number"?: number;
180
- sort?: SortResponse[];
181
- numberOfElements?: number;
182
- pageable?: PageableResponse;
183
- empty?: boolean;
217
+ totalElements: number;
218
+ totalPages: number;
219
+ first: boolean;
220
+ last: boolean;
221
+ size: number;
222
+ content: DocumentSummaryResponse[];
223
+ "number": number;
224
+ sort: SortResponse[];
225
+ numberOfElements: number;
226
+ pageable: PageableResponse;
227
+ empty: boolean;
184
228
  };
185
229
  export function findHypothesisById({ hypothesisId }: {
186
230
  hypothesisId: string;
@@ -248,7 +292,10 @@ export function upload({ hypothesisId, documentUploadRequest }: {
248
292
  hypothesisId: string;
249
293
  documentUploadRequest?: DocumentUploadRequest;
250
294
  }, opts?: Oazapfts.RequestOpts) {
251
- return oazapfts.ok(oazapfts.fetchText(`/v1/documents/hypotheses/${encodeURIComponent(hypothesisId)}/upload`, oazapfts.multipart({
295
+ return oazapfts.ok(oazapfts.fetchJson<{
296
+ status: 200;
297
+ data: DocumentUploadResponse;
298
+ }>(`/v1/documents/hypotheses/${encodeURIComponent(hypothesisId)}/upload`, oazapfts.multipart({
252
299
  ...opts,
253
300
  method: "POST",
254
301
  body: documentUploadRequest
@@ -264,13 +311,16 @@ export function attach({ hypothesisId, documentAttachRequest }: {
264
311
  body: documentAttachRequest
265
312
  })));
266
313
  }
267
- export function getById({ documentId }: {
314
+ export function getById({ documentId, versionId }: {
268
315
  documentId: string;
316
+ versionId?: string;
269
317
  }, opts?: Oazapfts.RequestOpts) {
270
318
  return oazapfts.ok(oazapfts.fetchJson<{
271
319
  status: 200;
272
320
  data: DocumentDetailResponse;
273
- }>(`/v1/documents/${encodeURIComponent(documentId)}`, {
321
+ }>(`/v1/documents/${encodeURIComponent(documentId)}${QS.query(QS.explode({
322
+ versionId
323
+ }))}`, {
274
324
  ...opts
275
325
  }));
276
326
  }
@@ -334,6 +384,21 @@ export function listAllDocumentsWithHypotheses({ filter, page, size, sort, direc
334
384
  ...opts
335
385
  }));
336
386
  }
387
+ export function listVersions({ documentId, page, size }: {
388
+ documentId: string;
389
+ page?: number;
390
+ size?: number;
391
+ }, opts?: Oazapfts.RequestOpts) {
392
+ return oazapfts.ok(oazapfts.fetchJson<{
393
+ status: 200;
394
+ data: PageResponseDocumentVersionResponse;
395
+ }>(`/v1/documents/${encodeURIComponent(documentId)}/versions${QS.query(QS.explode({
396
+ page,
397
+ size
398
+ }))}`, {
399
+ ...opts
400
+ }));
401
+ }
337
402
  export function download({ documentId }: {
338
403
  documentId: string;
339
404
  }, opts?: Oazapfts.RequestOpts) {
@@ -373,6 +438,26 @@ export function getAll(opts?: Oazapfts.RequestOpts) {
373
438
  ...opts
374
439
  }));
375
440
  }
441
+ export function systemHealth(opts?: Oazapfts.RequestOpts) {
442
+ return oazapfts.ok(oazapfts.fetchJson<{
443
+ status: 200;
444
+ data: {
445
+ [key: string]: object;
446
+ };
447
+ }>("/system/health", {
448
+ ...opts
449
+ }));
450
+ }
451
+ export function health(opts?: Oazapfts.RequestOpts) {
452
+ return oazapfts.ok(oazapfts.fetchJson<{
453
+ status: 200;
454
+ data: {
455
+ [key: string]: string;
456
+ };
457
+ }>("/orchestrator/health", {
458
+ ...opts
459
+ }));
460
+ }
376
461
  export function deleteV1DocumentsByDocumentIdHypothesesAndHypothesisId({ hypothesisId, documentId }: {
377
462
  hypothesisId: string;
378
463
  documentId: string;
@@ -1,13 +1,10 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
- import { addFavoriteV1AgentsAgentIdFavoritePost, AgentVisibilityLevelEnum, createAgentV1AgentsPost, createToolkitToolsV1ToolkitsToolkitIdToolsPost, createToolkitV1ToolkitsPost, defaults, deleteAgentV1AgentsAgentIdDelete, deleteToolkitToolsV1ToolkitsToolkitIdToolsDelete, deleteToolkitV1ToolkitsToolkitIdDelete, editToolkitToolV1ToolkitsToolkitIdToolsToolIdPut, getAgentV1AgentsAgentIdGet, getPublicToolKitsV1BuiltinToolkitGet, getToolkitToolV1ToolkitsToolkitIdToolsToolIdGet, getToolkitV1ToolkitsToolkitIdGet, HttpValidationError, listAgentsV1AgentsGet, listToolkitsV1ToolkitsGet, publishAgentV1AgentsAgentIdPublishPost, searchAgentsV1AgentsSearchPost, updateAgentV1AgentsAgentIdPut, updateToolkitV1ToolkitsToolkitIdPatch, VisibilityLevelEnum } from '../api/agent-tools'
2
+ import { createToolkitToolsV1ToolkitsToolkitIdToolsPost, createToolkitV1ToolkitsPost, defaults, deleteToolkitToolsV1ToolkitsToolkitIdToolsDelete, deleteToolkitV1ToolkitsToolkitIdDelete, editToolkitToolV1ToolkitsToolkitIdToolsToolIdPut, getPublicToolKitsV1BuiltinToolkitGet, getToolkitToolV1ToolkitsToolkitIdToolsToolIdGet, getToolkitV1ToolkitsToolkitIdGet, HttpValidationError, listToolkitsV1ToolkitsGet, updateToolkitV1ToolkitsToolkitIdPatch } from '../api/agent-tools'
3
3
  import apis from '../apis.json'
4
4
  import { StackspotAPIError } from '../error/StackspotAPIError'
5
5
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
6
6
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
7
- import { AgentResponseWithBuiltIn, AgentToolsOpenAPIPreview, AgentVisibilityLevel } from './types'
8
- import { workspaceAiClient } from './workspace-ai'
9
-
10
- const AGENT_DEFAULT_SLUG = 'stk_code_buddy'
7
+ import { AgentToolsOpenAPIPreview } from './types'
11
8
 
12
9
  class AgentToolsClient extends ReactQueryNetworkClient {
13
10
  constructor() {
@@ -27,104 +24,8 @@ class AgentToolsClient extends ReactQueryNetworkClient {
27
24
  tools = this.query(getPublicToolKitsV1BuiltinToolkitGet)
28
25
 
29
26
  /**
30
- * Create agent
31
- */
32
- createAgent = this.mutation(removeAuthorizationParam(createAgentV1AgentsPost))
33
-
34
- /**
35
- * Delete agent
36
- */
37
- deleteAgent = this.mutation(deleteAgentV1AgentsAgentIdDelete)
38
-
39
- /**
40
- * Updates an agent
41
- */
42
- updateAgent = this.mutation(updateAgentV1AgentsAgentIdPut)
43
-
44
- /**
45
- * Favorite an agent
46
- */
47
- favoriteAgent = this.mutation(addFavoriteV1AgentsAgentIdFavoritePost)
48
-
49
- /**
50
- * Publish an agent
51
- */
52
- publishAgent = this.mutation(publishAgentV1AgentsAgentIdPublishPost)
53
-
54
- /**
55
- * List agents
56
- */
57
- agents = this.infiniteQuery(removeAuthorizationParam(listAgentsV1AgentsGet))
58
-
59
- /**
60
- * Gets agent by id
61
- */
62
- agent = this.query(removeAuthorizationParam(getAgentV1AgentsAgentIdGet))
63
-
64
- /**
65
- * Gets agents by ids
66
- */
67
- agentsByIds = this.query(removeAuthorizationParam(searchAgentsV1AgentsSearchPost))
68
-
69
- /**
70
- * Gets the default agent slug
71
- */
72
- agentDefaultSlug = AGENT_DEFAULT_SLUG
73
-
74
- /**
75
- * Gets the default agent
27
+ * Get list of Toolkits
76
28
  */
77
- agentDefault = this.query({
78
- name: 'agentDefault',
79
- request: async (signal) => {
80
- const agentDefault = await listAgentsV1AgentsGet(
81
- { visibility: 'built_in', slug: this.agentDefaultSlug, authorization: '' }, { signal },
82
- )
83
-
84
- const agentId = agentDefault.at(0)?.id
85
- const agent = agentId ? await this.agent.query({ agentId }) : undefined
86
- return agent
87
- },
88
- })
89
-
90
- /**
91
- * List agents filtered by visibility.
92
- */
93
- allAgents = this.query({
94
- name: 'allAgents',
95
- request: async (signal, variables: { visibilities: (AgentVisibilityLevel | 'all')[] }) => {
96
- const allVisibilities = ['account', 'built_in', 'favorite', 'personal', 'shared', 'workspace'] as const
97
- const visibilities = variables.visibilities.includes('all')
98
- ? allVisibilities
99
- : variables.visibilities as Array<AgentVisibilityLevelEnum | VisibilityLevelEnum>
100
-
101
- const shouldFetchWorkspaceAgents = visibilities.includes('workspace')
102
-
103
- const workspaceAgentsPromise = shouldFetchWorkspaceAgents
104
- ? workspaceAiClient.workspacesContentsByType.query({ contentType: 'agent' })
105
- : Promise.resolve([])
106
-
107
- const [workspaceAgents, ...agentsByVisibility] = await Promise.all([
108
- workspaceAgentsPromise,
109
- ...visibilities.map((visibility) => listAgentsV1AgentsGet({ visibility, authorization: '' }, { signal })),
110
- ])
111
-
112
- const workspaceAgentsWithSpaceName = workspaceAgents.flatMap(({ agents, space_name }) =>
113
- agents?.map((agent) => ({ ...agent, spaceName: space_name, builtIn: false }))) as AgentResponseWithBuiltIn[]
114
-
115
- const allAgents: AgentResponseWithBuiltIn[] = workspaceAgentsWithSpaceName ?? []
116
-
117
- agentsByVisibility.forEach(agents => allAgents.push(...agents.map(agent => ({
118
- ...agent,
119
- builtIn: agent?.visibility_level === 'built_in',
120
- }))))
121
-
122
- return allAgents
123
- },
124
- })
125
-
126
- /* Get list of Toolkits
127
- */
128
29
  toolkits = this.query(removeAuthorizationParam(listToolkitsV1ToolkitsGet))
129
30
  /**
130
31
  * Get a toolkit by Id