@stack-spot/portal-network 0.173.0 → 0.174.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/api/agent-tools.d.ts +1 -0
  3. package/dist/api/agent-tools.d.ts.map +1 -1
  4. package/dist/api/agent-tools.js.map +1 -1
  5. package/dist/api/ai.d.ts +2 -1
  6. package/dist/api/ai.d.ts.map +1 -1
  7. package/dist/api/ai.js.map +1 -1
  8. package/dist/api/discover.d.ts +294 -0
  9. package/dist/api/discover.d.ts.map +1 -0
  10. package/dist/api/discover.js +180 -0
  11. package/dist/api/discover.js.map +1 -0
  12. package/dist/apis.json +2 -2
  13. package/dist/client/agent-tools.d.ts.map +1 -1
  14. package/dist/client/agent-tools.js +3 -8
  15. package/dist/client/agent-tools.js.map +1 -1
  16. package/dist/client/ai.js +3 -3
  17. package/dist/client/ai.js.map +1 -1
  18. package/dist/client/discover.d.ts +64 -0
  19. package/dist/client/discover.d.ts.map +1 -0
  20. package/dist/client/discover.js +124 -0
  21. package/dist/client/discover.js.map +1 -0
  22. package/dist/error/dictionary/agent-tools.d.ts +75 -0
  23. package/dist/error/dictionary/agent-tools.d.ts.map +1 -0
  24. package/dist/error/dictionary/agent-tools.js +75 -0
  25. package/dist/error/dictionary/agent-tools.js.map +1 -0
  26. package/dist/index.d.ts +2 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +2 -1
  29. package/dist/index.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/api/agent-tools.ts +1 -0
  32. package/src/api/ai.ts +2 -1
  33. package/src/api/discover.ts +435 -0
  34. package/src/apis.json +2 -2
  35. package/src/client/agent-tools.ts +4 -8
  36. package/src/client/ai.ts +3 -3
  37. package/src/client/discover.ts +89 -0
  38. package/src/error/dictionary/agent-tools.ts +76 -0
  39. package/src/index.ts +2 -1
  40. package/dist/api/discovery.d.ts +0 -494
  41. package/dist/api/discovery.d.ts.map +0 -1
  42. package/dist/api/discovery.js +0 -205
  43. package/dist/api/discovery.js.map +0 -1
  44. package/dist/client/discovery.d.ts +0 -110
  45. package/dist/client/discovery.d.ts.map +0 -1
  46. package/dist/client/discovery.js +0 -133
  47. package/dist/client/discovery.js.map +0 -1
  48. package/src/api/discovery.ts +0 -729
  49. package/src/client/discovery.ts +0 -73
package/src/api/ai.ts CHANGED
@@ -512,6 +512,7 @@ export type QuickCommandStepLlmResponse = {
512
512
  agent_data?: AgentDefinitionResponse | null;
513
513
  next_step_slug?: string | null;
514
514
  use_uploaded_files?: boolean;
515
+ allow_use_current_workspace?: boolean;
515
516
  };
516
517
  export type ConditionExpr2 = {
517
518
  left?: any | null;
@@ -599,10 +600,10 @@ export type QuickCommandEvaluateStepRouterRequest = {
599
600
  input_data?: string | {
600
601
  [key: string]: any;
601
602
  } | null;
603
+ selected_code?: string | null;
602
604
  slugs_executions: {
603
605
  [key: string]: QuickCommandPromptResponse | QuickCommandFetchResponseResult;
604
606
  } | null;
605
- selected_code: string | null;
606
607
  };
607
608
  export type QuickCommandEvaluateStepRouterResponse = {
608
609
  next_step_slug: string;
@@ -0,0 +1,435 @@
1
+ /**
2
+ * OpenAPI definition
3
+ * v0
4
+ * DO NOT MODIFY - This file has been generated using oazapfts.
5
+ * See https://www.npmjs.com/package/oazapfts
6
+ */
7
+ import * as Oazapfts from "@oazapfts/runtime";
8
+ import * as QS from "@oazapfts/runtime/query";
9
+ export const defaults: Oazapfts.Defaults<Oazapfts.CustomHeaders> = {
10
+ headers: {},
11
+ baseUrl: "https://discover-discover-core.stg.stackspot.com",
12
+ };
13
+ const oazapfts = Oazapfts.runtime(defaults);
14
+ export const servers = {
15
+ generatedServerUrl: "https://discover-discover-core.stg.stackspot.com"
16
+ };
17
+ export type GetOpportunityResponseHypothesisResponse = {
18
+ id: string;
19
+ title: string;
20
+ description: string;
21
+ };
22
+ export type GetOpportunityResponse = {
23
+ id: string;
24
+ title: string;
25
+ description: string;
26
+ createdBy: string;
27
+ createdAt?: string;
28
+ hypotheses: GetOpportunityResponseHypothesisResponse[];
29
+ updatedBy?: string;
30
+ updatedAt?: string;
31
+ chatId?: string;
32
+ };
33
+ export type UpdateOpportunityRequest = {
34
+ title?: string;
35
+ description?: string;
36
+ };
37
+ export type UpdateOpportunityResponse = {
38
+ id: string;
39
+ title: string;
40
+ description: string;
41
+ createdBy: string;
42
+ createdAt?: string;
43
+ updatedBy?: string;
44
+ updatedAt?: string;
45
+ chatId?: string;
46
+ };
47
+ export type GetHypothesisResponseDocumentResponse = {
48
+ id: string;
49
+ title: string;
50
+ description: string;
51
+ };
52
+ export type GetHypothesisResponse = {
53
+ id: string;
54
+ opportunityId: string;
55
+ title: string;
56
+ description: string;
57
+ documents: GetHypothesisResponseDocumentResponse[];
58
+ createdBy: string;
59
+ createdAt?: string;
60
+ updatedBy?: string;
61
+ updatedAt?: string;
62
+ chatId?: string;
63
+ };
64
+ export type UpdateHypothesisRequest = {
65
+ title?: string;
66
+ description?: string;
67
+ };
68
+ export type UpdateHypothesisResponse = {
69
+ id: string;
70
+ opportunityId: string;
71
+ title: string;
72
+ description: string;
73
+ createdBy: string;
74
+ createdAt?: string;
75
+ updatedBy?: string;
76
+ updatedAt?: string;
77
+ chatId?: string;
78
+ };
79
+ export type GetDocumentResponse = {
80
+ id: string;
81
+ hypothesisId: string;
82
+ title: string;
83
+ description: string;
84
+ createdBy: string;
85
+ createdAt?: string;
86
+ updatedBy?: string;
87
+ updatedAt?: string;
88
+ chatId?: string;
89
+ };
90
+ export type UpdateDocumentRequest = {
91
+ title?: string;
92
+ description?: string;
93
+ content?: string;
94
+ };
95
+ export type UpdateDocumentResponse = {
96
+ id: string;
97
+ hypothesisId: string;
98
+ title: string;
99
+ description: string;
100
+ createdBy: string;
101
+ createdAt?: string;
102
+ updatedBy?: string;
103
+ updatedAt?: string;
104
+ chatId?: string;
105
+ };
106
+ export type SortResponse = {
107
+ direction: string;
108
+ nullHandling: string;
109
+ ascending: boolean;
110
+ property: string;
111
+ ignoreCase: boolean;
112
+ };
113
+ export type PageableResponse = {
114
+ offset: number;
115
+ sort: SortResponse[];
116
+ paged: boolean;
117
+ pageSize: number;
118
+ pageNumber: number;
119
+ unpaged: boolean;
120
+ };
121
+ export type PageResponseGetOpportunityResponse = {
122
+ totalElements: number;
123
+ totalPages: number;
124
+ first: boolean;
125
+ last: boolean;
126
+ size: number;
127
+ content: GetOpportunityResponse[];
128
+ "number": number;
129
+ sort: SortResponse[];
130
+ numberOfElements: number;
131
+ pageable: PageableResponse;
132
+ empty: boolean;
133
+ };
134
+ export type CreateOpportunityRequest = {
135
+ title?: string;
136
+ description?: string;
137
+ chatId?: string;
138
+ };
139
+ export type CreateOpportunityResponse = {
140
+ id: string;
141
+ title: string;
142
+ description: string;
143
+ createdBy: string;
144
+ createdAt?: string;
145
+ updatedBy?: string;
146
+ updatedAt?: string;
147
+ chatId?: string;
148
+ };
149
+ export type CreateHypothesisRequest = {
150
+ opportunityId?: string;
151
+ title?: string;
152
+ description?: string;
153
+ chatId?: string;
154
+ };
155
+ export type CreateHypothesisResponse = {
156
+ id: string;
157
+ opportunityId: string;
158
+ title: string;
159
+ description: string;
160
+ createdBy: string;
161
+ createdAt?: string;
162
+ updatedBy?: string;
163
+ updatedAt?: string;
164
+ chatId?: string;
165
+ };
166
+ export type CreateDocumentRequest = {
167
+ hypothesisId?: string;
168
+ title?: string;
169
+ description?: string;
170
+ content?: string;
171
+ chatId?: string;
172
+ };
173
+ export type CreateDocumentResponse = {
174
+ id: string;
175
+ hypothesisId: string;
176
+ title: string;
177
+ description: string;
178
+ createdBy: string;
179
+ createdAt?: string;
180
+ updatedBy?: string;
181
+ updatedAt?: string;
182
+ chatId?: string;
183
+ };
184
+ export type GetArtifactResponse = {
185
+ "type": "OPPORTUNITY" | "HYPOTHESIS" | "DOCUMENT";
186
+ id: string;
187
+ title: string;
188
+ description: string;
189
+ };
190
+ /**
191
+ * Get specific Opportunity
192
+ */
193
+ export function getById({ opportunityId }: {
194
+ opportunityId: string;
195
+ }, opts?: Oazapfts.RequestOpts) {
196
+ return oazapfts.ok(oazapfts.fetchJson<{
197
+ status: 200;
198
+ data: GetOpportunityResponse;
199
+ }>(`/v2/opportunities/${encodeURIComponent(opportunityId)}`, {
200
+ ...opts
201
+ }));
202
+ }
203
+ /**
204
+ * Update specific Opportunity
205
+ */
206
+ export function updateById({ opportunityId, updateOpportunityRequest }: {
207
+ opportunityId: string;
208
+ updateOpportunityRequest: UpdateOpportunityRequest;
209
+ }, opts?: Oazapfts.RequestOpts) {
210
+ return oazapfts.ok(oazapfts.fetchJson<{
211
+ status: 200;
212
+ data: UpdateOpportunityResponse;
213
+ }>(`/v2/opportunities/${encodeURIComponent(opportunityId)}`, oazapfts.json({
214
+ ...opts,
215
+ method: "PUT",
216
+ body: updateOpportunityRequest
217
+ })));
218
+ }
219
+ /**
220
+ * Delete specific Opportunity
221
+ */
222
+ export function deleteById({ opportunityId }: {
223
+ opportunityId: string;
224
+ }, opts?: Oazapfts.RequestOpts) {
225
+ return oazapfts.ok(oazapfts.fetchText(`/v2/opportunities/${encodeURIComponent(opportunityId)}`, {
226
+ ...opts,
227
+ method: "DELETE"
228
+ }));
229
+ }
230
+ /**
231
+ * Get specific Hypothesis
232
+ */
233
+ export function getById1({ hypothesisId }: {
234
+ hypothesisId: string;
235
+ }, opts?: Oazapfts.RequestOpts) {
236
+ return oazapfts.ok(oazapfts.fetchJson<{
237
+ status: 200;
238
+ data: GetHypothesisResponse;
239
+ }>(`/v2/hypotheses/${encodeURIComponent(hypothesisId)}`, {
240
+ ...opts
241
+ }));
242
+ }
243
+ /**
244
+ * Update specific Hypothesis
245
+ */
246
+ export function updateById1({ hypothesisId, updateHypothesisRequest }: {
247
+ hypothesisId: string;
248
+ updateHypothesisRequest: UpdateHypothesisRequest;
249
+ }, opts?: Oazapfts.RequestOpts) {
250
+ return oazapfts.ok(oazapfts.fetchJson<{
251
+ status: 200;
252
+ data: UpdateHypothesisResponse;
253
+ }>(`/v2/hypotheses/${encodeURIComponent(hypothesisId)}`, oazapfts.json({
254
+ ...opts,
255
+ method: "PUT",
256
+ body: updateHypothesisRequest
257
+ })));
258
+ }
259
+ /**
260
+ * Delete specific Hypothesis
261
+ */
262
+ export function deleteById1({ hypothesisId }: {
263
+ hypothesisId: string;
264
+ }, opts?: Oazapfts.RequestOpts) {
265
+ return oazapfts.ok(oazapfts.fetchText(`/v2/hypotheses/${encodeURIComponent(hypothesisId)}`, {
266
+ ...opts,
267
+ method: "DELETE"
268
+ }));
269
+ }
270
+ /**
271
+ * Get specific Document
272
+ */
273
+ export function getById2({ documentId }: {
274
+ documentId: string;
275
+ }, opts?: Oazapfts.RequestOpts) {
276
+ return oazapfts.ok(oazapfts.fetchJson<{
277
+ status: 200;
278
+ data: GetDocumentResponse;
279
+ }>(`/v2/documents/${encodeURIComponent(documentId)}`, {
280
+ ...opts
281
+ }));
282
+ }
283
+ /**
284
+ * Update specific Document
285
+ */
286
+ export function updateById2({ documentId, updateDocumentRequest }: {
287
+ documentId: string;
288
+ updateDocumentRequest: UpdateDocumentRequest;
289
+ }, opts?: Oazapfts.RequestOpts) {
290
+ return oazapfts.ok(oazapfts.fetchJson<{
291
+ status: 200;
292
+ data: UpdateDocumentResponse;
293
+ }>(`/v2/documents/${encodeURIComponent(documentId)}`, oazapfts.json({
294
+ ...opts,
295
+ method: "PUT",
296
+ body: updateDocumentRequest
297
+ })));
298
+ }
299
+ /**
300
+ * Delete specific Document
301
+ */
302
+ export function deleteById2({ documentId }: {
303
+ documentId: string;
304
+ }, opts?: Oazapfts.RequestOpts) {
305
+ return oazapfts.ok(oazapfts.fetchText(`/v2/documents/${encodeURIComponent(documentId)}`, {
306
+ ...opts,
307
+ method: "DELETE"
308
+ }));
309
+ }
310
+ /**
311
+ * Get all Opportunities
312
+ */
313
+ export function getAll({ filter, page, size, sort, direction }: {
314
+ filter?: string;
315
+ page?: number;
316
+ size?: number;
317
+ sort?: string;
318
+ direction?: string;
319
+ }, opts?: Oazapfts.RequestOpts) {
320
+ return oazapfts.ok(oazapfts.fetchJson<{
321
+ status: 200;
322
+ data: PageResponseGetOpportunityResponse;
323
+ }>(`/v2/opportunities${QS.query(QS.explode({
324
+ filter,
325
+ page,
326
+ size,
327
+ sort,
328
+ direction
329
+ }))}`, {
330
+ ...opts
331
+ }));
332
+ }
333
+ /**
334
+ * Create new Opportunity
335
+ */
336
+ export function create({ createOpportunityRequest }: {
337
+ createOpportunityRequest: CreateOpportunityRequest;
338
+ }, opts?: Oazapfts.RequestOpts) {
339
+ return oazapfts.ok(oazapfts.fetchJson<{
340
+ status: 200;
341
+ data: CreateOpportunityResponse;
342
+ }>("/v2/opportunities", oazapfts.json({
343
+ ...opts,
344
+ method: "POST",
345
+ body: createOpportunityRequest
346
+ })));
347
+ }
348
+ /**
349
+ * Get all Hypotheses
350
+ */
351
+ export function getAll1({ opportunityId }: {
352
+ opportunityId: string;
353
+ }, opts?: Oazapfts.RequestOpts) {
354
+ return oazapfts.ok(oazapfts.fetchJson<{
355
+ status: 200;
356
+ data: GetHypothesisResponse[];
357
+ }>(`/v2/hypotheses${QS.query(QS.explode({
358
+ opportunityId
359
+ }))}`, {
360
+ ...opts
361
+ }));
362
+ }
363
+ /**
364
+ * Create new Hypothesis
365
+ */
366
+ export function create1({ createHypothesisRequest }: {
367
+ createHypothesisRequest: CreateHypothesisRequest;
368
+ }, opts?: Oazapfts.RequestOpts) {
369
+ return oazapfts.ok(oazapfts.fetchJson<{
370
+ status: 200;
371
+ data: CreateHypothesisResponse;
372
+ }>("/v2/hypotheses", oazapfts.json({
373
+ ...opts,
374
+ method: "POST",
375
+ body: createHypothesisRequest
376
+ })));
377
+ }
378
+ /**
379
+ * Get all Documents by Hypothesis
380
+ */
381
+ export function getAllByHypothesis({ hypothesisId }: {
382
+ hypothesisId: string;
383
+ }, opts?: Oazapfts.RequestOpts) {
384
+ return oazapfts.ok(oazapfts.fetchJson<{
385
+ status: 200;
386
+ data: GetDocumentResponse[];
387
+ }>(`/v2/documents${QS.query(QS.explode({
388
+ hypothesisId
389
+ }))}`, {
390
+ ...opts
391
+ }));
392
+ }
393
+ /**
394
+ * Create Document
395
+ */
396
+ export function create2({ createDocumentRequest }: {
397
+ createDocumentRequest: CreateDocumentRequest;
398
+ }, opts?: Oazapfts.RequestOpts) {
399
+ return oazapfts.ok(oazapfts.fetchJson<{
400
+ status: 200;
401
+ data: CreateDocumentResponse;
402
+ }>("/v2/documents", oazapfts.json({
403
+ ...opts,
404
+ method: "POST",
405
+ body: createDocumentRequest
406
+ })));
407
+ }
408
+ /**
409
+ * Get specific Document content
410
+ */
411
+ export function getContentById({ documentId }: {
412
+ documentId: string;
413
+ }, opts?: Oazapfts.RequestOpts) {
414
+ return oazapfts.ok(oazapfts.fetchJson<{
415
+ status: 200;
416
+ data: string;
417
+ }>(`/v2/documents/${encodeURIComponent(documentId)}/content`, {
418
+ ...opts
419
+ }));
420
+ }
421
+ /**
422
+ * Get chat artifacts
423
+ */
424
+ export function getAll2({ chatId }: {
425
+ chatId: string;
426
+ }, opts?: Oazapfts.RequestOpts) {
427
+ return oazapfts.ok(oazapfts.fetchJson<{
428
+ status: 200;
429
+ data: GetArtifactResponse[];
430
+ }>(`/v2/artifacts${QS.query(QS.explode({
431
+ chatId
432
+ }))}`, {
433
+ ...opts
434
+ }));
435
+ }
package/src/apis.json CHANGED
@@ -214,11 +214,11 @@
214
214
  },
215
215
  "docs": "/openapi.json"
216
216
  },
217
- "discovery": {
217
+ "discover": {
218
218
  "url": {
219
219
  "dev": "https://discover-discover-core.dev.stackspot.com",
220
220
  "stg": "https://discover-discover-core.stg.stackspot.com",
221
- "prd": "https://discover-discover-core.stackspot.com"
221
+ "prd": "https://discover-core.stackspot.com"
222
222
  },
223
223
  "docs": "/v3/api-docs"
224
224
  }
@@ -1,6 +1,8 @@
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, HttpValidationError, listAgentsUsingToolsV1ToolkitsToolkitIdToolsAgentsPost, listAgentsV1AgentsGet, listMultiAgentsV1AgentsMultiAgentsGet, listToolkitsV1ToolkitsGet, publishAgentV1AgentsAgentIdPublishPost, searchAgentsV1AgentsSearchPost, shareV1AgentsAgentIdSharePost, updateAgentV1AgentsAgentIdPatch, updateToolkitV1ToolkitsToolkitIdPatch, VisibilityLevelEnum } from '../api/agent-tools'
3
+ import { addFavoriteV1AgentsAgentIdFavoritePost, AgentVisibilityLevelEnum, createAgentV1AgentsPost, createToolkitToolsV1ToolkitsToolkitIdToolsPost, createToolkitV1ToolkitsPost, defaults, deleteAgentV1AgentsAgentIdDelete, deleteFavoriteV1AgentsAgentIdFavoriteDelete, deleteToolkitToolsV1ToolkitsToolkitIdToolsDelete, deleteToolkitV1ToolkitsToolkitIdDelete, editToolkitToolV1ToolkitsToolkitIdToolsToolIdPut, forkAgentV1AgentsAgentIdForkPost, forkToolkitV1ToolkitsToolkitIdForkPost, getAgentV1AgentsAgentIdGet, getPublicToolKitsV1BuiltinToolkitGet, getToolkitToolV1ToolkitsToolkitIdToolsToolIdGet, getToolkitV1ToolkitsToolkitIdGet, listAgentsUsingToolsV1ToolkitsToolkitIdToolsAgentsPost, listAgentsV1AgentsGet, listMultiAgentsV1AgentsMultiAgentsGet, listToolkitsV1ToolkitsGet, publishAgentV1AgentsAgentIdPublishPost, searchAgentsV1AgentsSearchPost, shareV1AgentsAgentIdSharePost, updateAgentV1AgentsAgentIdPatch, updateToolkitV1ToolkitsToolkitIdPatch, VisibilityLevelEnum } from '../api/agent-tools'
4
+ import { DefaultAPIError } from '../error/DefaultAPIError'
5
+ import { agentToolsDictionary } from '../error/dictionary/agent-tools'
4
6
  import { StackspotAPIError } from '../error/StackspotAPIError'
5
7
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
6
8
  import { FetchEventStream } from '../network/types'
@@ -17,13 +19,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
17
19
  }
18
20
 
19
21
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
20
- return new StackspotAPIError({
21
- status: error.status,
22
- headers: error.headers,
23
- stack: error.stack,
24
- // @ts-ignore API documentation is wrong
25
- message: (error?.data as HttpValidationError | undefined)?.details?.map(d => d?.msg)?.join('\n'),
26
- })
22
+ return new DefaultAPIError(error.data, error.status, agentToolsDictionary, error.headers)
27
23
  }
28
24
 
29
25
  tools = this.query(removeAuthorizationParam(getPublicToolKitsV1BuiltinToolkitGet))
package/src/client/ai.ts CHANGED
@@ -47,7 +47,7 @@ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
47
47
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
48
48
  import { StreamedJson } from '../utils/StreamedJson'
49
49
  import { formatJson } from '../utils/string'
50
- import { agentClient } from './agent'
50
+ import { agentToolsClient } from './agent-tools'
51
51
  import {
52
52
  ChatAgentTool,
53
53
  ChatResponseWithSteps,
@@ -260,10 +260,10 @@ class AIClient extends ReactQueryNetworkClient {
260
260
 
261
261
  private static async toolsOfAgent(agentId?: string) {
262
262
  try {
263
- const agent = agentId ? await agentClient.agent.query({ agentId }) : undefined
263
+ const agent = agentId ? await agentToolsClient.agent.query({ agentId }) : undefined
264
264
  if (!agent) return []
265
265
  const tools: (Omit<ChatAgentTool, 'duration' | 'prompt' | 'output'>)[] = []
266
- agent.toolkits?.builtins?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
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
269
  return tools
@@ -0,0 +1,89 @@
1
+ import { HttpError } from '@oazapfts/runtime'
2
+ import { getApiAddresses } from '../api-addresses'
3
+ import { ConversationResponse } from '../api/ai'
4
+ import { create, create1, create2, defaults, deleteById, deleteById1, deleteById2, getAll, getAll1, getAll2, getAllByHypothesis, getById, getById1, getById2, GetOpportunityResponse } from '../api/discover'
5
+ import { DefaultAPIError } from '../error/DefaultAPIError'
6
+ import { StackspotAPIError } from '../error/StackspotAPIError'
7
+ import { baseDictionary } from '../error/dictionary/base'
8
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
9
+ import { aiClient } from './ai'
10
+
11
+ export interface ChatConversionDetails extends ConversationResponse {
12
+ opportunityName?: string,
13
+ hypothesisCount?: number,
14
+ }
15
+
16
+ class DiscoverClient extends ReactQueryNetworkClient {
17
+ constructor() {
18
+ super(getApiAddresses().discover.url, defaults)
19
+ }
20
+
21
+ protected buildStackSpotError(error: HttpError): StackspotAPIError {
22
+ return new DefaultAPIError(error.data, error.status, baseDictionary, error.headers)
23
+ }
24
+
25
+ opportunities = this.query(getAll)
26
+
27
+ opportunity = this.query(getById)
28
+
29
+ hypotheses = this.query(getAll1)
30
+
31
+ hypothesisById = this.query(getById1)
32
+
33
+ documents = this.query(getAllByHypothesis)
34
+
35
+ document = this.query(getById2)
36
+
37
+ artifacts = this.query(getAll2)
38
+
39
+ createOpportunity = this.mutation(create)
40
+
41
+ createHypothesis = this.mutation(create1)
42
+
43
+ createDocument = this.mutation(create2)
44
+
45
+ deleteOpportunity = this.mutation(deleteById)
46
+
47
+ deleteHypothesis = this.mutation(deleteById1)
48
+
49
+ deleteDocument = this.mutation(deleteById2)
50
+
51
+ chats = this.query({
52
+ name: 'chats',
53
+ request: async (_signal, variables: { filter?: string, page?: number, size?: number }) => {
54
+ const opportunities = await this.opportunities.query({})
55
+
56
+ const opportunitiesByChatId: Record<string, any> = opportunities.content.reduce(
57
+ (acc, opp: GetOpportunityResponse) => {
58
+ if (opp.chatId) {
59
+ acc[opp.chatId] = opp
60
+ }
61
+ return acc
62
+ },
63
+ {} as Record<string, any>,
64
+ )
65
+
66
+ const chatsHistory = await aiClient.chats.query(
67
+ { ...variables, page: variables.page, size: variables.size ?? 40 },
68
+ )
69
+
70
+ const filteredItems = variables.filter
71
+ ? chatsHistory.filter((chat) => chat.title.toLowerCase().includes(variables.filter!.toLowerCase()))
72
+ : chatsHistory
73
+
74
+ const enrichedChats = filteredItems?.map(chat => {
75
+ const relatedOpportunity = opportunitiesByChatId[chat.id]
76
+
77
+ return {
78
+ ...chat,
79
+ opportunityName: relatedOpportunity?.title ?? null,
80
+ hypothesisCount: relatedOpportunity?.hypotheses?.length ?? 0,
81
+ }
82
+ })
83
+
84
+ return enrichedChats as ChatConversionDetails[]
85
+ },
86
+ })
87
+ }
88
+
89
+ export const discoverClient = new DiscoverClient()
@@ -0,0 +1,76 @@
1
+ import { Dictionary } from '@stack-spot/portal-translate'
2
+
3
+ export const agentToolsDictionary = {
4
+ en: {
5
+ AGENT_1000_INVALID_JWT: 'Invalid JWT token',
6
+ AGENT_1001_DECODE_JWT_ERROR: 'Error decoding JWT token',
7
+ AGENTS_6000_FORBIDDEN_1: 'Insufficient permissions',
8
+ AGENTS_6000_FORBIDDEN_2: 'You do not have permission to access the specified secret.',
9
+ AGENTS_6000_FORBIDDEN_3: 'Toolkit publication is restricted to account secrets or if secrets are not present.',
10
+ AGENT_1002_STRUCT_OUTPUT_WITH_BUILTIN_TOOLS_NOT_PERMITED: 'Structured output cannot be used alongside with builtin tools',
11
+ AGENT_1003_REQUIRED_LLM_PARAM_NOT_PROVIDED: 'Required parameter of llm model was not provided',
12
+ AGENT_1004_INVALID_LLM_PARAM: "The parameter '{param}' is invalid",
13
+ AGENT_1005_INVALID_KNOWLEDGE_SOURCE_ID: 'Knowledge source is invalid',
14
+ AGENT_1006_INVALID_LLM_PARAM_VALUE_TYPE: 'LLM param value is invalid',
15
+ AGENT_1007_LLM_PARAM_VALUE_IS_REQUIRED: 'LLM param value is required',
16
+ AGENT_1008_INVALID_ULID_FOR_MODEL_ID: 'Invalid ulid passed for model id',
17
+ AGENT_1009_INVALID_STRUCTURE_OUTPUT_SCHEMA: 'Structure output schema is invalid. Please, check our documentation or contact our support',
18
+ AGENT_1010_STRUCTURED_OUTPUT_SCHEMA_CONTAINS_INVALID_DATA: 'Your structure output schema contains invalid data. Please, check our documentation or contact our support',
19
+ AGENT_1011_AGENT_WITH_SLUG_ALREADY_EXISTS: 'An agent with this slug already exists',
20
+ AGENT_1013_INVALID_VISIBILITY: 'Visibility is invalid',
21
+ AGENT_1015_AGENT_HAS_PERSONAL_SECRET_TOOL: 'It is not possible to publish this agent, because it has a tool with a personal secret',
22
+ AGENT_2002_INVALID_VISIBILITY_CHANGE: 'Cannot change visibility',
23
+ AGENT_2003_SECRETS_WITH_SAME_TYPE: 'Secrets with the same type are not allowed.',
24
+ TOOL_1200_TOOL_IN_USE: 'You have a tool that is already in use by an Agent and therefore cannot be removed.',
25
+ AGENT_1101_TOOLKIT_IN_USE: 'The toolkit is already in use by an Agent and therefore cannot be removed.',
26
+ AGENT_1101_TOOLKIT_INVALID_CREDENTIAL_TYPE: 'Your toolkit has an invalid type of authorization. Only Client Credentials, and API Key are accepted.',
27
+ AGENT_1102_TOOLKIT_AUTHENTICATION_FAILED: 'An error occurred during authentication in the toolkit.',
28
+ AGENT_1105_TOOLKIT_WITH_PERSONAL_SECRET: 'It is not possible to share the agent, as it has a tool with a personal secret. Remove the tool or replace it with an organization secret.',
29
+ AGENT_1012_AGENT_NOT_FOUND: 'Agent with id was not found',
30
+ AGENT_1014_AGENT_TOOL_NOT_FOUND: 'Agent Tool with id was not found',
31
+ AGENT_1100_TOOLKIT_NOT_FOUND: 'Toolkit with id was not found',
32
+ TOOL_1201_TOOL_NOT_FOUND: 'Tool was not found',
33
+ TOOL_1202_INVALID_SUB_AGENT_ASSIGNMENT: 'Cannot assign sub-agents, this agent is already a sub-agent of another agent.',
34
+ TOOL_1203_INVALID_SUB_AGENT_SELF_ASSIGNMENT: 'Agent cannot be assigned as its own tool. Please select a different agent.',
35
+ TOOL_1204_INVALID_SUB_AGENT_AS_ORCHESTRATOR: 'Cannot assign an orchestrator agent as a sub-agent to another orchestrator. Only single-level agent delegation is supported.',
36
+ AGENT_5000_UNEXPECTED_ERROR: 'An unexpected error occurred. Try again later or contact our support',
37
+ AGENT_2000_ACCOUNT_API_ERROR: 'Error with Account API integration',
38
+ AGENT_2001_IAM_API_ERROR: 'Error with IAM API integration',
39
+ },
40
+ pt: {
41
+ AGENT_1000_INVALID_JWT: 'Token JWT inválido',
42
+ AGENT_1001_DECODE_JWT_ERROR: 'Erro ao decodificar o token JWT',
43
+ AGENTS_6000_FORBIDDEN_1: 'Permissões insuficientes',
44
+ AGENTS_6000_FORBIDDEN_2: 'Você não tem permissão para acessar o segredo especificado.',
45
+ AGENTS_6000_FORBIDDEN_3: 'A publicação do toolkit é restrita a segredos de conta ou se segredos não estiverem presentes.',
46
+ AGENT_1002_STRUCT_OUTPUT_WITH_BUILTIN_TOOLS_NOT_PERMITED: 'A saída estruturada não pode ser usada juntamente com ferramentas internas.',
47
+ AGENT_1003_REQUIRED_LLM_PARAM_NOT_PROVIDED: 'Parâmetro obrigatório do modelo LLM não foi fornecido',
48
+ AGENT_1004_INVALID_LLM_PARAM: "O parâmetro '{param}' é inválido",
49
+ AGENT_1005_INVALID_KNOWLEDGE_SOURCE_ID: 'Fonte de conhecimento inválida',
50
+ AGENT_1006_INVALID_LLM_PARAM_VALUE_TYPE: 'Valor do parâmetro LLM é inválido',
51
+ AGENT_1007_LLM_PARAM_VALUE_IS_REQUIRED: 'Valor do parâmetro LLM é obrigatório',
52
+ AGENT_1008_INVALID_ULID_FOR_MODEL_ID: 'ULID inválido fornecido para o ID do modelo',
53
+ AGENT_1009_INVALID_STRUCTURE_OUTPUT_SCHEMA: 'O schema de saída da estrutura é inválido. Por favor, verifique nossa documentação ou entre em contato com o suporte',
54
+ AGENT_1010_STRUCTURED_OUTPUT_SCHEMA_CONTAINS_INVALID_DATA: 'Seu schema de saída da estrutura contém dados inválidos. Por favor, verifique nossa documentação ou entre em contato com o suporte',
55
+ AGENT_1011_AGENT_WITH_SLUG_ALREADY_EXISTS: 'Já existe um agente com este slug',
56
+ AGENT_1013_INVALID_VISIBILITY: 'Visibilidade inválida',
57
+ AGENT_1015_AGENT_HAS_PERSONAL_SECRET_TOOL: 'Não é possível publicar este agente, pois ele possui uma ferramenta com segredo pessoal',
58
+ AGENT_2002_INVALID_VISIBILITY_CHANGE: 'Não é possível alterar a visibilidade',
59
+ AGENT_2003_SECRETS_WITH_SAME_TYPE: 'Segredos do mesmo tipo não são permitidos.',
60
+ TOOL_1200_TOOL_IN_USE: 'Você possui uma ferramenta que já está em uso por um agente e, portanto, não pode ser removida.',
61
+ AGENT_1101_TOOLKIT_IN_USE: 'O toolkit já está em uso por um agente e, portanto, não pode ser removido.',
62
+ AGENT_1101_TOOLKIT_INVALID_CREDENTIAL_TYPE: 'Seu toolkit possui um tipo de autorização inválido. Apenas Client Credentials e API Key são aceitos.',
63
+ AGENT_1102_TOOLKIT_AUTHENTICATION_FAILED: 'Ocorreu um erro durante a autenticação no toolkit.',
64
+ AGENT_1105_TOOLKIT_WITH_PERSONAL_SECRET: 'Não é possível compartilhar o agente, pois ele possui uma ferramenta com segredo pessoal. Remova a ferramenta ou substitua por um segredo da organização.',
65
+ AGENT_1012_AGENT_NOT_FOUND: 'Agente com o ID informado não foi encontrado',
66
+ AGENT_1014_AGENT_TOOL_NOT_FOUND: 'Ferramenta do agente com o ID informado não foi encontrada',
67
+ AGENT_1100_TOOLKIT_NOT_FOUND: 'Toolkit com o ID informado não foi encontrado',
68
+ TOOL_1201_TOOL_NOT_FOUND: 'Ferramenta não encontrada',
69
+ TOOL_1202_INVALID_SUB_AGENT_ASSIGNMENT: 'Não é possível atribuir subagentes, este agente já é subagente de outro agente.',
70
+ TOOL_1203_INVALID_SUB_AGENT_SELF_ASSIGNMENT: 'O agente não pode ser atribuído como sua própria ferramenta. Por favor, selecione outro agente.',
71
+ TOOL_1204_INVALID_SUB_AGENT_AS_ORCHESTRATOR: 'Não é possível atribuir um agente orquestrador como subagente de outro orquestrador. Apenas delegação de agente em um único nível é suportada.',
72
+ AGENT_5000_UNEXPECTED_ERROR: 'Ocorreu um erro inesperado. Tente novamente mais tarde ou entre em contato com o suporte',
73
+ AGENT_2000_ACCOUNT_API_ERROR: 'Erro na integração com a API de Conta',
74
+ AGENT_2001_IAM_API_ERROR: 'Erro na integração com a API IAM',
75
+ },
76
+ } satisfies Dictionary