@stack-spot/portal-network 0.146.2 → 0.148.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/CHANGELOG.md +14 -0
- package/dist/api/agent-tools.d.ts +684 -15
- package/dist/api/agent-tools.d.ts.map +1 -1
- package/dist/api/agent-tools.js +370 -9
- package/dist/api/agent-tools.js.map +1 -1
- package/dist/api/genAiInference.d.ts +5 -2
- package/dist/api/genAiInference.d.ts.map +1 -1
- package/dist/api/genAiInference.js +5 -2
- package/dist/api/genAiInference.js.map +1 -1
- package/dist/client/agent-tools.d.ts +119 -1
- package/dist/client/agent-tools.d.ts.map +1 -1
- package/dist/client/agent-tools.js +107 -2
- package/dist/client/agent-tools.js.map +1 -1
- package/dist/client/ai.d.ts +30 -30
- package/dist/client/cloud-account.d.ts +5 -5
- package/dist/client/cloud-platform-horizon.d.ts +20 -20
- package/dist/client/cloud-platform.d.ts +28 -28
- package/dist/client/cloud-runtimes.d.ts +21 -21
- package/dist/client/code-shift.d.ts +37 -37
- package/dist/client/content.d.ts +6 -6
- package/dist/client/data-integration.d.ts +19 -8
- package/dist/client/data-integration.d.ts.map +1 -1
- package/dist/client/data-integration.js +13 -4
- package/dist/client/data-integration.js.map +1 -1
- package/dist/client/discovery.d.ts +6 -6
- package/dist/client/gen-ai-inference.d.ts +11 -9
- package/dist/client/gen-ai-inference.d.ts.map +1 -1
- package/dist/client/types.d.ts +9 -0
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/workflow.d.ts +10 -10
- package/dist/client/workspace-ai.d.ts +15 -15
- package/dist/utils/StreamedJson.js +2 -2
- package/dist/utils/StreamedJson.js.map +1 -1
- package/package.json +1 -1
- package/src/api/agent-tools.ts +1169 -54
- package/src/api/genAiInference.ts +8 -2
- package/src/client/agent-tools.ts +59 -2
- package/src/client/data-integration.ts +27 -19
- package/src/client/types.ts +10 -0
- package/src/utils/StreamedJson.tsx +2 -2
|
@@ -328,10 +328,12 @@ export function addSelfHostedModelV1LlmModelsPost({ xAccountId, authorization, c
|
|
|
328
328
|
/**
|
|
329
329
|
* List Models
|
|
330
330
|
*/
|
|
331
|
-
export function listModelsV1LlmModelsGet({ active, resource, $default, orderBy, orderDir, page, pageSize, xAccountId, authorization }: {
|
|
331
|
+
export function listModelsV1LlmModelsGet({ active, resource, $default, displayName, selfHosted, orderBy, orderDir, page, pageSize, xAccountId, authorization }: {
|
|
332
332
|
active?: boolean | null;
|
|
333
333
|
resource?: string | null;
|
|
334
334
|
$default?: boolean | null;
|
|
335
|
+
displayName?: string | null;
|
|
336
|
+
selfHosted?: boolean | null;
|
|
335
337
|
orderBy?: OrderBy;
|
|
336
338
|
orderDir?: OrderDir;
|
|
337
339
|
page?: number;
|
|
@@ -351,6 +353,8 @@ export function listModelsV1LlmModelsGet({ active, resource, $default, orderBy,
|
|
|
351
353
|
active,
|
|
352
354
|
resource,
|
|
353
355
|
"default": $default,
|
|
356
|
+
display_name: displayName,
|
|
357
|
+
self_hosted: selfHosted,
|
|
354
358
|
order_by: orderBy,
|
|
355
359
|
order_dir: orderDir,
|
|
356
360
|
page,
|
|
@@ -545,7 +549,8 @@ export function listLlmProvidersV1LlmProvidersGet({ acceptsSelfHosted, xAccountI
|
|
|
545
549
|
/**
|
|
546
550
|
* Handle completions requests
|
|
547
551
|
*/
|
|
548
|
-
export function createCompletionsV1ChatCompletionsPost({ xAccountId, authorization, chatCompletion }: {
|
|
552
|
+
export function createCompletionsV1ChatCompletionsPost({ xRequestOrigin, xAccountId, authorization, chatCompletion }: {
|
|
553
|
+
xRequestOrigin?: string | null;
|
|
549
554
|
xAccountId?: string | null;
|
|
550
555
|
authorization: string;
|
|
551
556
|
chatCompletion: ChatCompletion;
|
|
@@ -563,6 +568,7 @@ export function createCompletionsV1ChatCompletionsPost({ xAccountId, authorizati
|
|
|
563
568
|
method: "POST",
|
|
564
569
|
body: chatCompletion,
|
|
565
570
|
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
571
|
+
"x-request-origin": xRequestOrigin,
|
|
566
572
|
"x-account-id": xAccountId,
|
|
567
573
|
authorization
|
|
568
574
|
})
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
-
import { defaults, getPublicToolKitsV1BuiltinToolkitGet, HttpValidationError } 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
|
+
import { removeAuthorizationParam } from '../utils/remove-authorization-param'
|
|
7
|
+
import { AgentToolsOpenAPIPreview } from './types'
|
|
6
8
|
|
|
7
9
|
class AgentToolsClient extends ReactQueryNetworkClient {
|
|
8
10
|
constructor() {
|
|
@@ -14,11 +16,66 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
14
16
|
status: error.status,
|
|
15
17
|
headers: error.headers,
|
|
16
18
|
stack: error.stack,
|
|
17
|
-
|
|
19
|
+
// @ts-ignore API documentation is wrong
|
|
20
|
+
message: (error.data as HttpValidationError | undefined)?.details?.map(d => d.msg)?.join('\n'),
|
|
18
21
|
})
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
tools = this.query(getPublicToolKitsV1BuiltinToolkitGet)
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get list of Toolkits
|
|
28
|
+
*/
|
|
29
|
+
toolkits = this.query(removeAuthorizationParam(listToolkitsV1ToolkitsGet))
|
|
30
|
+
/**
|
|
31
|
+
* Get a toolkit by Id
|
|
32
|
+
*/
|
|
33
|
+
toolkitById = this.query(removeAuthorizationParam(getToolkitV1ToolkitsToolkitIdGet))
|
|
34
|
+
/**
|
|
35
|
+
* Create a toolkit
|
|
36
|
+
*/
|
|
37
|
+
createToolkit = this.mutation(removeAuthorizationParam(createToolkitV1ToolkitsPost))
|
|
38
|
+
/**
|
|
39
|
+
* Update a toolkit
|
|
40
|
+
*/
|
|
41
|
+
updateToolkit = this.mutation(removeAuthorizationParam(updateToolkitV1ToolkitsToolkitIdPatch))
|
|
42
|
+
/**
|
|
43
|
+
* Delete a toolkit
|
|
44
|
+
*/
|
|
45
|
+
deleteToolkit = this.mutation(removeAuthorizationParam(deleteToolkitV1ToolkitsToolkitIdDelete))
|
|
46
|
+
/**
|
|
47
|
+
* Get Tool from Toolkit
|
|
48
|
+
*/
|
|
49
|
+
toolFromToolkit = this.query(removeAuthorizationParam(getToolkitToolV1ToolkitsToolkitIdToolsToolIdGet))
|
|
50
|
+
/**
|
|
51
|
+
* Add tool on Toolkit
|
|
52
|
+
*/
|
|
53
|
+
addToolOnToolkit = this.mutation(removeAuthorizationParam(createToolkitToolsV1ToolkitsToolkitIdToolsPost))
|
|
54
|
+
/**
|
|
55
|
+
* Edit tool on Toolkit
|
|
56
|
+
*/
|
|
57
|
+
editToolOnToolkit = this.mutation(removeAuthorizationParam(editToolkitToolV1ToolkitsToolkitIdToolsToolIdPut))
|
|
58
|
+
/**
|
|
59
|
+
* Delete tool from Toolkit
|
|
60
|
+
*/
|
|
61
|
+
deleteToolFromToolkit = this.mutation(removeAuthorizationParam(deleteToolkitToolsV1ToolkitsToolkitIdToolsDelete))
|
|
62
|
+
/**
|
|
63
|
+
* Previews an uploaded open api file.
|
|
64
|
+
*/
|
|
65
|
+
previewUploadedAPI = this.query({
|
|
66
|
+
name: 'previewUploadedAPI',
|
|
67
|
+
request: async (signal, params: { fileUploadId: string }) => {
|
|
68
|
+
const url = `/v1/toolkits/tools/preview/${encodeURIComponent(params.fileUploadId)}`
|
|
69
|
+
const events = await this.stream(url, { signal })
|
|
70
|
+
const result: AgentToolsOpenAPIPreview[] = []
|
|
71
|
+
for await (const event of events) {
|
|
72
|
+
if (event.data) {
|
|
73
|
+
result.push(JSON.parse(event.data))
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return result
|
|
77
|
+
},
|
|
78
|
+
})
|
|
22
79
|
}
|
|
23
80
|
|
|
24
81
|
export const agentToolsClient = new AgentToolsClient()
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
listKsV1KnowledgeSourcesGet,
|
|
10
10
|
saveChunkedFilesDeprecatedV1FileUploadFileUploadIdPost,
|
|
11
11
|
saveChunkedFilesV1FileUploadFileUploadIdKnowledgeObjectsPost,
|
|
12
|
+
splitUploadedFilePreviewV1FileUploadFileUploadIdSplitPreviewSplitStrategyGet,
|
|
12
13
|
splitUploadedFileV1FileUploadFileUploadIdSplitPost,
|
|
13
14
|
} from '../api/dataIntegration'
|
|
14
15
|
import apis from '../apis.json'
|
|
@@ -65,7 +66,12 @@ class DataIntegrationClient extends ReactQueryNetworkClient {
|
|
|
65
66
|
'Accept': 'text/event-stream',
|
|
66
67
|
},
|
|
67
68
|
signal: options?.signal,
|
|
68
|
-
})
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Generate a preview with splitted objects
|
|
73
|
+
*/
|
|
74
|
+
previewFromSplit = this.query(removeAuthorizationParam(splitUploadedFilePreviewV1FileUploadFileUploadIdSplitPreviewSplitStrategyGet))
|
|
69
75
|
/**
|
|
70
76
|
* List of knowledge sources
|
|
71
77
|
*/
|
|
@@ -81,24 +87,26 @@ class DataIntegrationClient extends ReactQueryNetworkClient {
|
|
|
81
87
|
|
|
82
88
|
uploadFiles = this.mutation({
|
|
83
89
|
name: 'uploadFiles',
|
|
84
|
-
request: (abortSignal, params: { files: File[], type: FileUploadType }) =>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
90
|
+
request: (abortSignal, params: { files: File[], type: FileUploadType, targetId?: string }) => (
|
|
91
|
+
Promise.all(params.files.map(async (f) => {
|
|
92
|
+
try {
|
|
93
|
+
const { id, url, form } = await getUploadFormV2V2FileUploadFormPost({
|
|
94
|
+
authorization: '',
|
|
95
|
+
newFileUploadRequest: { file_name: f.name, target_type: params.type, target_id: params.targetId ?? '' },
|
|
96
|
+
}, { signal: abortSignal })
|
|
97
|
+
const formData = new FormData()
|
|
98
|
+
Object.entries(form).forEach(([key, value]) => {
|
|
99
|
+
formData.append(key, value)
|
|
100
|
+
})
|
|
101
|
+
formData.append('file', f)
|
|
102
|
+
const response = await fetch(url, { method: 'post', body: formData, signal: abortSignal })
|
|
103
|
+
if (!response.ok) throw new StackspotAPIError({ status: response.status, headers: response.headers, message: 'Failed to upload' })
|
|
104
|
+
return id
|
|
105
|
+
} catch (e: any) {
|
|
106
|
+
throw new FileUploadError(f.name, e)
|
|
107
|
+
}
|
|
108
|
+
}))
|
|
109
|
+
),
|
|
102
110
|
})
|
|
103
111
|
}
|
|
104
112
|
|
package/src/client/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RequestOpts } from '@oazapfts/runtime'
|
|
2
2
|
import { AccountScmInfoSaveRequest, AccountScmInfoUpdateRequest, AccountScmStatusResponse, GroupsFromResourceResponse, MembersFromResourceResponse } from '../api/account'
|
|
3
3
|
import { AgentResponse, VisibilityLevel } from '../api/agent'
|
|
4
|
+
import { HttpMethod } from '../api/agent-tools'
|
|
4
5
|
import { ChatRequest, ChatResponse3, ContentDependencyResponse, ConversationHistoryResponse, ConversationResponse, DependencyResponse } from '../api/ai'
|
|
5
6
|
import { ConnectAccountRequestV2, ManagedAccountProvisionRequest } from '../api/cloudAccount'
|
|
6
7
|
import { AllocationCostRequest, AllocationCostResponse, ChargePeriod, getAllocationCostFilters, ManagedService, ServiceResource } from '../api/cloudServices'
|
|
@@ -363,3 +364,12 @@ export interface AgentResponseWithBuiltIn extends AgentResponse {
|
|
|
363
364
|
}
|
|
364
365
|
|
|
365
366
|
export type AgentVisibilityLevel = VisibilityLevel | 'BUILT-IN' | 'ALL'
|
|
367
|
+
|
|
368
|
+
export interface AgentToolsOpenAPIPreview {
|
|
369
|
+
name: string,
|
|
370
|
+
description: string,
|
|
371
|
+
method: HttpMethod,
|
|
372
|
+
url: string,
|
|
373
|
+
parameters?: Record<string, any>,
|
|
374
|
+
request_body?: Record<string, any>,
|
|
375
|
+
}
|
|
@@ -92,8 +92,8 @@ export class StreamedJson<T> {
|
|
|
92
92
|
else if (typeof source[k] === 'string') target[k] += source[k]
|
|
93
93
|
else if (Array.isArray(source[k])) target[k].push(...source[k])
|
|
94
94
|
else if (typeof source[k] === 'number') parseFloat(target[k] + source[k])
|
|
95
|
-
else if (typeof source[k] === 'object') this.merge(source[k], target[k])
|
|
96
|
-
else target[k] = source[k]
|
|
95
|
+
else if (source[k] && typeof source[k] === 'object') this.merge(source[k], target[k])
|
|
96
|
+
else if (source[k]) target[k] = source[k]
|
|
97
97
|
})
|
|
98
98
|
}
|
|
99
99
|
|