agentstack-sdk 0.5.1-rc2 → 0.5.2-rc2
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/dist/api.cjs +2 -0
- package/dist/api.cjs.map +1 -0
- package/dist/api.d.ts +5 -0
- package/dist/api.js +2 -0
- package/dist/api.js.map +1 -0
- package/dist/api.umd.js +2 -0
- package/dist/api.umd.js.map +1 -0
- package/dist/client/a2a/extensions/{ui/oauth.d.ts → auth/oauth/index.d.ts} +3 -6
- package/dist/client/a2a/extensions/auth/oauth/schemas.d.ts +32 -0
- package/dist/client/a2a/extensions/auth/oauth/types.d.ts +13 -0
- package/dist/client/a2a/extensions/auth/secrets/index.d.ts +10 -0
- package/dist/client/a2a/extensions/auth/secrets/schemas.d.ts +23 -0
- package/dist/client/a2a/extensions/auth/secrets/types.d.ts +10 -0
- package/dist/client/a2a/extensions/common/{form.d.ts → form/schemas.d.ts} +87 -45
- package/dist/client/a2a/extensions/common/form/types.d.ts +23 -0
- package/dist/client/a2a/extensions/index.d.ts +20 -0
- package/dist/client/a2a/extensions/interactions/approval/index.d.ts +9 -0
- package/dist/client/a2a/extensions/interactions/{approval.d.ts → approval/schemas.d.ts} +0 -8
- package/dist/client/a2a/extensions/interactions/approval/types.d.ts +10 -0
- package/dist/client/a2a/extensions/schemas.d.ts +18 -0
- package/dist/client/a2a/extensions/services/embedding/index.d.ts +9 -0
- package/dist/client/a2a/extensions/services/{embedding.d.ts → embedding/schemas.d.ts} +12 -8
- package/dist/client/a2a/extensions/services/embedding/types.d.ts +10 -0
- package/dist/client/a2a/extensions/services/form/index.d.ts +9 -0
- package/dist/client/a2a/extensions/services/{form.d.ts → form/schemas.d.ts} +2 -8
- package/dist/client/a2a/extensions/services/form/types.d.ts +8 -0
- package/dist/client/a2a/extensions/services/llm/index.d.ts +9 -0
- package/dist/client/a2a/extensions/services/{llm.d.ts → llm/schemas.d.ts} +12 -8
- package/dist/client/a2a/extensions/services/llm/types.d.ts +10 -0
- package/dist/client/a2a/extensions/services/mcp/index.d.ts +9 -0
- package/dist/client/a2a/extensions/services/mcp/schemas.d.ts +35 -0
- package/dist/client/a2a/extensions/services/mcp/types.d.ts +14 -0
- package/dist/client/a2a/extensions/services/{platform.d.ts → platform-api/index.d.ts} +1 -1
- package/dist/client/a2a/extensions/services/platform-api/schemas.d.ts +10 -0
- package/dist/client/a2a/extensions/services/platform-api/types.d.ts +7 -0
- package/dist/client/a2a/extensions/types.d.ts +14 -12
- package/dist/client/a2a/extensions/ui/agent-detail/index.d.ts +9 -0
- package/dist/client/a2a/extensions/ui/{agent-detail.d.ts → agent-detail/schemas.d.ts} +9 -17
- package/dist/client/a2a/extensions/ui/agent-detail/types.d.ts +13 -0
- package/dist/client/a2a/extensions/ui/canvas/index.d.ts +9 -0
- package/dist/client/a2a/extensions/ui/canvas/schemas.d.ts +11 -0
- package/dist/client/a2a/extensions/ui/canvas/types.d.ts +7 -0
- package/dist/client/a2a/extensions/ui/citation/index.d.ts +9 -0
- package/dist/client/a2a/extensions/ui/{citation.d.ts → citation/schemas.d.ts} +2 -8
- package/dist/client/a2a/extensions/ui/citation/types.d.ts +8 -0
- package/dist/client/a2a/extensions/ui/error/index.d.ts +9 -0
- package/dist/client/a2a/extensions/ui/{error.d.ts → error/schemas.d.ts} +12 -6
- package/dist/client/a2a/extensions/ui/error/types.d.ts +9 -0
- package/dist/client/a2a/extensions/ui/form-request/index.d.ts +9 -0
- package/dist/client/a2a/extensions/ui/settings/index.d.ts +9 -0
- package/dist/client/a2a/extensions/ui/{settings.d.ts → settings/schemas.d.ts} +46 -43
- package/dist/client/a2a/extensions/ui/settings/types.d.ts +18 -0
- package/dist/client/a2a/extensions/ui/trajectory/index.d.ts +9 -0
- package/dist/client/a2a/extensions/ui/trajectory/schemas.d.ts +10 -0
- package/dist/client/a2a/extensions/ui/trajectory/types.d.ts +7 -0
- package/dist/client/a2a/index.d.ts +6 -0
- package/dist/client/a2a/protocol/index.d.ts +6 -0
- package/dist/client/a2a/protocol/schemas.d.ts +988 -0
- package/dist/client/a2a/protocol/tests.d.ts +5 -0
- package/dist/client/a2a/protocol/types.d.ts +52 -0
- package/dist/client/a2a/protocol/utils.d.ts +6 -0
- package/dist/client/api/common/schemas.d.ts +30 -0
- package/dist/client/api/common/types.d.ts +18 -0
- package/dist/client/api/configuration/api.d.ts +22 -0
- package/dist/client/api/configuration/schemas.d.ts +31 -0
- package/dist/client/api/configuration/types.d.ts +11 -0
- package/dist/client/api/connectors/api.d.ts +78 -0
- package/dist/client/api/connectors/schemas.d.ts +114 -0
- package/dist/client/api/connectors/types.d.ts +28 -0
- package/dist/client/api/contexts/api.d.ts +133 -0
- package/dist/client/api/contexts/schemas.d.ts +359 -0
- package/dist/client/api/contexts/types.d.ts +34 -0
- package/dist/client/api/core/client.d.ts +1273 -0
- package/dist/client/api/core/errors/index.d.ts +6 -0
- package/dist/client/api/core/errors/types.d.ts +36 -0
- package/dist/client/api/core/errors/utils.d.ts +23 -0
- package/dist/client/api/core/index.d.ts +7 -0
- package/dist/client/api/core/schemas.d.ts +17 -0
- package/dist/client/api/core/types.d.ts +45 -0
- package/dist/client/api/core/utils.d.ts +23 -0
- package/dist/client/api/files/api.d.ts +32 -0
- package/dist/client/api/files/schemas.d.ts +61 -0
- package/dist/client/api/files/types.d.ts +19 -0
- package/dist/client/api/index.d.ts +7 -0
- package/dist/client/api/model-providers/api.d.ts +50 -0
- package/dist/client/api/model-providers/schemas.d.ts +80 -0
- package/dist/client/api/model-providers/types.d.ts +44 -0
- package/dist/client/api/provider-builds/api.d.ts +143 -0
- package/dist/client/api/provider-builds/schemas.d.ts +250 -0
- package/dist/client/api/provider-builds/types.d.ts +31 -0
- package/dist/client/api/providers/api.d.ts +847 -0
- package/dist/client/api/providers/schemas.d.ts +1335 -0
- package/dist/client/api/providers/types.d.ts +45 -0
- package/dist/client/api/schemas.d.ts +15 -0
- package/dist/client/api/types.d.ts +11 -97
- package/dist/client/api/user-feedback/api.d.ts +9 -0
- package/dist/client/api/user-feedback/schemas.d.ts +15 -0
- package/dist/client/api/user-feedback/types.d.ts +8 -0
- package/dist/client/api/users/api.d.ts +13 -0
- package/dist/client/api/users/schemas.d.ts +20 -0
- package/dist/client/api/users/types.d.ts +14 -0
- package/dist/client/api/variables/api.d.ts +12 -0
- package/dist/client/api/variables/schemas.d.ts +13 -0
- package/dist/client/api/variables/types.d.ts +10 -0
- package/dist/client/{a2a/extensions/utils.d.ts → core/extensions/extract.d.ts} +2 -5
- package/dist/client/core/extensions/fulfill.d.ts +8 -0
- package/dist/client/core/extensions/resolve-user-metadata.d.ts +6 -0
- package/dist/client/core/extensions/types.d.ts +67 -0
- package/dist/client/core/fulfillment-resolvers/build-llm-extension-fulfillment-resolver.d.ts +8 -0
- package/dist/client/{a2a/extensions → core}/handle-agent-card.d.ts +3 -24
- package/dist/client/core/handle-task-status-update.d.ts +7 -0
- package/dist/client/core/index.d.ts +13 -0
- package/dist/client/{a2a/extensions → core}/utils/build-message-builder.d.ts +2 -2
- package/dist/core.cjs +2 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.ts +5 -0
- package/dist/core.js +2 -0
- package/dist/core.js.map +1 -0
- package/dist/core.umd.js +2 -0
- package/dist/core.umd.js.map +1 -0
- package/dist/extensions.cjs +2 -0
- package/dist/extensions.cjs.map +1 -0
- package/dist/extensions.d.ts +5 -0
- package/dist/extensions.js +2 -0
- package/dist/extensions.js.map +1 -0
- package/dist/extensions.umd.js +2 -0
- package/dist/extensions.umd.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -26
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +36 -8
- package/src/api.ts +6 -0
- package/src/client/a2a/extensions/auth/oauth/index.ts +23 -0
- package/src/client/a2a/extensions/auth/oauth/schemas.ts +34 -0
- package/src/client/a2a/extensions/auth/oauth/types.ts +27 -0
- package/src/client/a2a/extensions/auth/secrets/index.ts +23 -0
- package/src/client/a2a/extensions/auth/secrets/schemas.ts +23 -0
- package/src/client/a2a/extensions/auth/secrets/types.ts +19 -0
- package/src/client/a2a/extensions/common/{form.ts → form/schemas.ts} +62 -73
- package/src/client/a2a/extensions/common/form/types.ts +48 -0
- package/src/client/a2a/extensions/index.ts +21 -0
- package/src/client/a2a/extensions/interactions/approval/index.ts +17 -0
- package/src/client/a2a/extensions/interactions/{approval.ts → approval/schemas.ts} +0 -13
- package/src/client/a2a/extensions/interactions/approval/types.ts +19 -0
- package/src/client/a2a/extensions/schemas.ts +19 -0
- package/src/client/a2a/extensions/services/embedding/index.ts +16 -0
- package/src/client/a2a/extensions/services/embedding/schemas.ts +26 -0
- package/src/client/a2a/extensions/services/embedding/types.ts +19 -0
- package/src/client/a2a/extensions/services/form/index.ts +16 -0
- package/src/client/a2a/extensions/services/form/schemas.ts +20 -0
- package/src/client/a2a/extensions/services/form/types.ts +12 -0
- package/src/client/a2a/extensions/services/llm/index.ts +16 -0
- package/src/client/a2a/extensions/services/llm/schemas.ts +26 -0
- package/src/client/a2a/extensions/services/llm/types.ts +14 -0
- package/src/client/a2a/extensions/services/mcp/index.ts +16 -0
- package/src/client/a2a/extensions/services/mcp/schemas.ts +32 -0
- package/src/client/a2a/extensions/services/mcp/types.ts +19 -0
- package/src/client/a2a/extensions/services/{platform.ts → platform-api/index.ts} +5 -9
- package/src/client/a2a/extensions/services/platform-api/schemas.ts +12 -0
- package/src/client/a2a/extensions/services/platform-api/types.ts +10 -0
- package/src/client/a2a/extensions/types.ts +14 -15
- package/src/client/a2a/extensions/ui/agent-detail/index.ts +17 -0
- package/src/client/a2a/extensions/ui/agent-detail/schemas.ts +36 -0
- package/src/client/a2a/extensions/ui/agent-detail/types.ts +19 -0
- package/src/client/a2a/extensions/ui/canvas/index.ts +17 -0
- package/src/client/a2a/extensions/ui/canvas/schemas.ts +13 -0
- package/src/client/a2a/extensions/ui/canvas/types.ts +10 -0
- package/src/client/a2a/extensions/ui/citation/index.ts +17 -0
- package/src/client/a2a/extensions/ui/citation/schemas.ts +18 -0
- package/src/client/a2a/extensions/ui/citation/types.ts +12 -0
- package/src/client/a2a/extensions/ui/error/index.ts +17 -0
- package/src/client/a2a/extensions/ui/error/schemas.ts +22 -0
- package/src/client/a2a/extensions/ui/error/types.ts +14 -0
- package/src/client/a2a/extensions/ui/{form-request.ts → form-request/index.ts} +5 -6
- package/src/client/a2a/extensions/ui/settings/index.ts +16 -0
- package/src/client/a2a/extensions/ui/settings/schemas.ts +65 -0
- package/src/client/a2a/extensions/ui/settings/types.ts +38 -0
- package/src/client/a2a/extensions/ui/{trajectory.ts → trajectory/index.ts} +4 -10
- package/src/client/a2a/extensions/ui/trajectory/schemas.ts +12 -0
- package/src/client/a2a/extensions/ui/trajectory/types.ts +10 -0
- package/src/client/a2a/index.ts +7 -0
- package/src/client/a2a/protocol/index.ts +7 -0
- package/src/client/a2a/protocol/schemas.ts +413 -0
- package/src/client/a2a/protocol/tests.ts +172 -0
- package/src/client/a2a/protocol/types.ts +127 -0
- package/src/client/a2a/protocol/utils.ts +39 -0
- package/src/client/api/common/schemas.ts +45 -0
- package/src/client/api/common/types.ts +34 -0
- package/src/client/api/configuration/api.ts +31 -0
- package/src/client/api/configuration/schemas.ts +25 -0
- package/src/client/api/configuration/types.ts +22 -0
- package/src/client/api/connectors/api.ts +86 -0
- package/src/client/api/connectors/schemas.ts +77 -0
- package/src/client/api/connectors/types.ts +57 -0
- package/src/client/api/contexts/api.ts +113 -0
- package/src/client/api/contexts/schemas.ts +156 -0
- package/src/client/api/contexts/types.ts +74 -0
- package/src/client/api/core/client.ts +155 -0
- package/src/client/api/core/errors/index.ts +7 -0
- package/src/client/api/core/errors/types.ts +45 -0
- package/src/client/api/core/errors/utils.ts +63 -0
- package/src/client/api/core/index.ts +8 -0
- package/src/client/api/core/schemas.ts +20 -0
- package/src/client/api/core/types.ts +57 -0
- package/src/client/api/core/utils.ts +100 -0
- package/src/client/api/files/api.ts +65 -0
- package/src/client/api/files/schemas.ts +56 -0
- package/src/client/api/files/types.ts +37 -0
- package/src/client/api/index.ts +8 -0
- package/src/client/api/model-providers/api.ts +67 -0
- package/src/client/api/model-providers/schemas.ts +68 -0
- package/src/client/api/model-providers/types.ts +66 -0
- package/src/client/api/provider-builds/api.ts +80 -0
- package/src/client/api/provider-builds/schemas.ts +98 -0
- package/src/client/api/provider-builds/types.ts +61 -0
- package/src/client/api/providers/api.ts +122 -0
- package/src/client/api/providers/schemas.ts +140 -0
- package/src/client/api/providers/types.ts +87 -0
- package/src/client/api/schemas.ts +16 -0
- package/src/client/api/types.ts +11 -130
- package/src/client/api/user-feedback/api.ts +23 -0
- package/src/client/api/user-feedback/schemas.ts +18 -0
- package/src/client/api/user-feedback/types.ts +11 -0
- package/src/client/api/users/api.ts +21 -0
- package/src/client/api/users/schemas.ts +21 -0
- package/src/client/api/users/types.ts +19 -0
- package/src/client/api/variables/api.ts +31 -0
- package/src/client/api/variables/schemas.ts +18 -0
- package/src/client/api/variables/types.ts +19 -0
- package/src/client/{a2a/extensions/utils.ts → core/extensions/extract.ts} +2 -21
- package/src/client/core/extensions/fulfill.ts +24 -0
- package/src/client/core/extensions/resolve-user-metadata.ts +25 -0
- package/src/client/core/extensions/types.ts +84 -0
- package/src/client/{a2a/extensions → core}/fulfillment-resolvers/build-llm-extension-fulfillment-resolver.ts +14 -10
- package/src/client/{a2a/extensions → core}/handle-agent-card.ts +14 -37
- package/src/client/core/handle-task-status-update.ts +60 -0
- package/src/client/core/index.ts +14 -0
- package/src/client/{a2a/extensions → core}/utils/build-message-builder.ts +2 -3
- package/src/core.ts +6 -0
- package/src/extensions.ts +6 -0
- package/src/index.ts +3 -30
- package/dist/client/a2a/extensions/fulfillment-resolvers/build-llm-extension-fulfillment-resolver.d.ts +0 -8
- package/dist/client/a2a/extensions/handle-task-status-update.d.ts +0 -32
- package/dist/client/a2a/extensions/resolve-user-metadata.d.ts +0 -11
- package/dist/client/a2a/extensions/services/mcp.d.ts +0 -46
- package/dist/client/a2a/extensions/services/oauth-provider.d.ts +0 -30
- package/dist/client/a2a/extensions/services/secrets.d.ts +0 -28
- package/dist/client/a2a/extensions/ui/canvas.d.ts +0 -16
- package/dist/client/a2a/extensions/ui/form-request.d.ts +0 -11
- package/dist/client/a2a/extensions/ui/trajectory.d.ts +0 -15
- package/dist/client/api/build-api-client.d.ts +0 -62
- package/dist/types.d.ts +0 -10
- package/src/client/a2a/extensions/handle-task-status-update.ts +0 -95
- package/src/client/a2a/extensions/resolve-user-metadata.ts +0 -30
- package/src/client/a2a/extensions/services/embedding.ts +0 -43
- package/src/client/a2a/extensions/services/form.ts +0 -31
- package/src/client/a2a/extensions/services/llm.ts +0 -39
- package/src/client/a2a/extensions/services/mcp.ts +0 -59
- package/src/client/a2a/extensions/services/oauth-provider.ts +0 -52
- package/src/client/a2a/extensions/services/secrets.ts +0 -46
- package/src/client/a2a/extensions/ui/agent-detail.ts +0 -46
- package/src/client/a2a/extensions/ui/canvas.ts +0 -24
- package/src/client/a2a/extensions/ui/citation.ts +0 -30
- package/src/client/a2a/extensions/ui/error.ts +0 -33
- package/src/client/a2a/extensions/ui/oauth.ts +0 -21
- package/src/client/a2a/extensions/ui/settings.ts +0 -84
- package/src/client/api/build-api-client.ts +0 -125
- package/src/types.ts +0 -9
- /package/dist/client/{a2a → core}/create-authenticated-fetch.d.ts +0 -0
- /package/src/client/{a2a → core}/create-authenticated-fetch.ts +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { CallApi } from '../core/types';
|
|
7
|
+
import { ApiMethod } from '../core/types';
|
|
8
|
+
import {
|
|
9
|
+
createProviderResponseSchema,
|
|
10
|
+
deleteProviderResponseSchema,
|
|
11
|
+
listProvidersResponseSchema,
|
|
12
|
+
listProviderVariablesResponseSchema,
|
|
13
|
+
patchProviderResponseSchema,
|
|
14
|
+
previewProviderResponseSchema,
|
|
15
|
+
readProviderByLocationResponseSchema,
|
|
16
|
+
readProviderLogsResponseSchema,
|
|
17
|
+
readProviderResponseSchema,
|
|
18
|
+
updateProviderVariablesResponseSchema,
|
|
19
|
+
} from './schemas';
|
|
20
|
+
import type {
|
|
21
|
+
CreateProviderRequest,
|
|
22
|
+
DeleteProviderRequest,
|
|
23
|
+
ListProvidersRequest,
|
|
24
|
+
ListProviderVariablesRequest,
|
|
25
|
+
PatchProviderRequest,
|
|
26
|
+
PreviewProviderRequest,
|
|
27
|
+
ReadProviderByLocationRequest,
|
|
28
|
+
ReadProviderLogsRequest,
|
|
29
|
+
ReadProviderRequest,
|
|
30
|
+
UpdateProviderVariablesRequest,
|
|
31
|
+
} from './types';
|
|
32
|
+
|
|
33
|
+
export function createProvidersApi(callApi: CallApi) {
|
|
34
|
+
const listProviders = ({ query }: ListProvidersRequest) =>
|
|
35
|
+
callApi({
|
|
36
|
+
method: ApiMethod.Get,
|
|
37
|
+
path: '/api/v1/providers',
|
|
38
|
+
schema: listProvidersResponseSchema,
|
|
39
|
+
query,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const createProvider = ({ ...body }: CreateProviderRequest) =>
|
|
43
|
+
callApi({
|
|
44
|
+
method: ApiMethod.Post,
|
|
45
|
+
path: '/api/v1/providers',
|
|
46
|
+
schema: createProviderResponseSchema,
|
|
47
|
+
body,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const readProvider = ({ id }: ReadProviderRequest) =>
|
|
51
|
+
callApi({
|
|
52
|
+
method: ApiMethod.Get,
|
|
53
|
+
path: `/api/v1/providers/${id}`,
|
|
54
|
+
schema: readProviderResponseSchema,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const deleteProvider = ({ id }: DeleteProviderRequest) =>
|
|
58
|
+
callApi({
|
|
59
|
+
method: ApiMethod.Delete,
|
|
60
|
+
path: `/api/v1/providers/${id}`,
|
|
61
|
+
schema: deleteProviderResponseSchema,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const patchProvider = ({ id, ...body }: PatchProviderRequest) =>
|
|
65
|
+
callApi({
|
|
66
|
+
method: ApiMethod.Patch,
|
|
67
|
+
path: `/api/v1/providers/${id}`,
|
|
68
|
+
schema: patchProviderResponseSchema,
|
|
69
|
+
body,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const readProviderLogs = ({ id }: ReadProviderLogsRequest) =>
|
|
73
|
+
callApi({
|
|
74
|
+
method: ApiMethod.Get,
|
|
75
|
+
path: `/api/v1/providers/${id}/logs`,
|
|
76
|
+
schema: readProviderLogsResponseSchema,
|
|
77
|
+
parseAsStream: true,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const listProviderVariables = ({ id }: ListProviderVariablesRequest) =>
|
|
81
|
+
callApi({
|
|
82
|
+
method: ApiMethod.Get,
|
|
83
|
+
path: `/api/v1/providers/${id}/variables`,
|
|
84
|
+
schema: listProviderVariablesResponseSchema,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const updateProviderVariables = ({ id, ...body }: UpdateProviderVariablesRequest) =>
|
|
88
|
+
callApi({
|
|
89
|
+
method: ApiMethod.Put,
|
|
90
|
+
path: `/api/v1/providers/${id}/variables`,
|
|
91
|
+
schema: updateProviderVariablesResponseSchema,
|
|
92
|
+
body,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const readProviderByLocation = ({ location }: ReadProviderByLocationRequest) =>
|
|
96
|
+
callApi({
|
|
97
|
+
method: ApiMethod.Get,
|
|
98
|
+
path: `/api/v1/providers/by-location/${location}`,
|
|
99
|
+
schema: readProviderByLocationResponseSchema,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const previewProvider = ({ ...body }: PreviewProviderRequest) =>
|
|
103
|
+
callApi({
|
|
104
|
+
method: ApiMethod.Post,
|
|
105
|
+
path: '/api/v1/providers/preview',
|
|
106
|
+
schema: previewProviderResponseSchema,
|
|
107
|
+
body,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
listProviders,
|
|
112
|
+
createProvider,
|
|
113
|
+
readProvider,
|
|
114
|
+
deleteProvider,
|
|
115
|
+
patchProvider,
|
|
116
|
+
readProviderLogs,
|
|
117
|
+
listProviderVariables,
|
|
118
|
+
updateProviderVariables,
|
|
119
|
+
readProviderByLocation,
|
|
120
|
+
previewProvider,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import z from 'zod';
|
|
7
|
+
|
|
8
|
+
import { agentCardSchema } from '../../a2a/protocol/schemas';
|
|
9
|
+
import {
|
|
10
|
+
dockerImageProviderLocationSchema,
|
|
11
|
+
fileSystemRegistryLocationSchema,
|
|
12
|
+
gitHubRegistryLocationSchema,
|
|
13
|
+
networkProviderLocationSchema,
|
|
14
|
+
networkRegistryLocationSchema,
|
|
15
|
+
readableStreamSchema,
|
|
16
|
+
resolvedDockerImageIdSchema,
|
|
17
|
+
resolvedGitHubUrlSchema,
|
|
18
|
+
} from '../common/schemas';
|
|
19
|
+
import { paginatedResponseSchema } from '../core/schemas';
|
|
20
|
+
import { ProviderStatus, ProviderType, ProviderUnmanagedStatus } from './types';
|
|
21
|
+
|
|
22
|
+
export const providerTypeSchema = z.enum(ProviderType);
|
|
23
|
+
|
|
24
|
+
export const providerStatusSchema = z.enum(ProviderStatus);
|
|
25
|
+
|
|
26
|
+
export const providerUnmanagedStatusSchema = z.enum(ProviderUnmanagedStatus);
|
|
27
|
+
|
|
28
|
+
export const providerErrorSchema = z.object({
|
|
29
|
+
message: z.string(),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const providerEnvVarSchema = z.object({
|
|
33
|
+
name: z.string(),
|
|
34
|
+
required: z.boolean(),
|
|
35
|
+
description: z.string().nullish(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const providerVersionInfoSchema = z.object({
|
|
39
|
+
docker: resolvedDockerImageIdSchema.nullish(),
|
|
40
|
+
github: resolvedGitHubUrlSchema.nullish(),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const providerSchema = z.object({
|
|
44
|
+
id: z.string(),
|
|
45
|
+
source: z.union([dockerImageProviderLocationSchema, networkProviderLocationSchema]),
|
|
46
|
+
agent_card: agentCardSchema,
|
|
47
|
+
state: z.union([providerStatusSchema, providerUnmanagedStatusSchema]),
|
|
48
|
+
origin: z.string(),
|
|
49
|
+
created_at: z.string(),
|
|
50
|
+
created_by: z.string(),
|
|
51
|
+
updated_at: z.string(),
|
|
52
|
+
last_active_at: z.string(),
|
|
53
|
+
auto_stop_timeout: z.string(),
|
|
54
|
+
managed: z.boolean(),
|
|
55
|
+
type: providerTypeSchema,
|
|
56
|
+
env: z.array(providerEnvVarSchema),
|
|
57
|
+
registry: z
|
|
58
|
+
.union([gitHubRegistryLocationSchema, networkRegistryLocationSchema, fileSystemRegistryLocationSchema])
|
|
59
|
+
.nullish(),
|
|
60
|
+
last_error: providerErrorSchema.nullish(),
|
|
61
|
+
missing_configuration: z.array(providerEnvVarSchema).optional(),
|
|
62
|
+
version_info: providerVersionInfoSchema.optional(),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const listProvidersRequestSchema = z.object({
|
|
66
|
+
query: z
|
|
67
|
+
.object({
|
|
68
|
+
origin: z.string().nullish(),
|
|
69
|
+
user_owned: z.boolean().nullish(),
|
|
70
|
+
})
|
|
71
|
+
.optional(),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export const listProvidersResponseSchema = paginatedResponseSchema.extend({
|
|
75
|
+
items: z.array(providerSchema),
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export const createProviderRequestSchema = z.object({
|
|
79
|
+
location: z.union([dockerImageProviderLocationSchema, networkProviderLocationSchema]),
|
|
80
|
+
agent_card: agentCardSchema.nullish(),
|
|
81
|
+
auto_stop_timeout_sec: z.number().nullish(),
|
|
82
|
+
origin: z.string().nullish(),
|
|
83
|
+
variables: z.record(z.string(), z.string()).nullish(),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export const createProviderResponseSchema = providerSchema;
|
|
87
|
+
|
|
88
|
+
export const readProviderRequestSchema = z.object({
|
|
89
|
+
id: z.string(),
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export const readProviderResponseSchema = providerSchema;
|
|
93
|
+
|
|
94
|
+
export const deleteProviderRequestSchema = z.object({
|
|
95
|
+
id: z.string(),
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export const deleteProviderResponseSchema = z.null();
|
|
99
|
+
|
|
100
|
+
export const patchProviderRequestSchema = z.object({
|
|
101
|
+
id: z.string(),
|
|
102
|
+
location: z.union([dockerImageProviderLocationSchema, networkProviderLocationSchema]).nullish(),
|
|
103
|
+
agent_card: agentCardSchema.nullish(),
|
|
104
|
+
auto_stop_timeout_sec: z.number().nullish(),
|
|
105
|
+
origin: z.string().nullish(),
|
|
106
|
+
variables: z.record(z.string(), z.string()).nullish(),
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
export const patchProviderResponseSchema = providerSchema;
|
|
110
|
+
|
|
111
|
+
export const readProviderLogsRequestSchema = z.object({
|
|
112
|
+
id: z.string(),
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export const readProviderLogsResponseSchema = readableStreamSchema;
|
|
116
|
+
|
|
117
|
+
export const listProviderVariablesRequestSchema = z.object({
|
|
118
|
+
id: z.string(),
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
export const listProviderVariablesResponseSchema = z.object({
|
|
122
|
+
variables: z.record(z.string(), z.string()),
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
export const updateProviderVariablesRequestSchema = z.object({
|
|
126
|
+
id: z.string(),
|
|
127
|
+
variables: z.record(z.string(), z.union([z.string(), z.null()])),
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export const updateProviderVariablesResponseSchema = z.null();
|
|
131
|
+
|
|
132
|
+
export const readProviderByLocationRequestSchema = z.object({
|
|
133
|
+
location: z.string(),
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
export const readProviderByLocationResponseSchema = providerSchema;
|
|
137
|
+
|
|
138
|
+
export const previewProviderRequestSchema = createProviderRequestSchema;
|
|
139
|
+
|
|
140
|
+
export const previewProviderResponseSchema = providerSchema;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type z from 'zod';
|
|
7
|
+
|
|
8
|
+
import type {
|
|
9
|
+
createProviderRequestSchema,
|
|
10
|
+
createProviderResponseSchema,
|
|
11
|
+
deleteProviderRequestSchema,
|
|
12
|
+
deleteProviderResponseSchema,
|
|
13
|
+
listProvidersRequestSchema,
|
|
14
|
+
listProvidersResponseSchema,
|
|
15
|
+
listProviderVariablesRequestSchema,
|
|
16
|
+
listProviderVariablesResponseSchema,
|
|
17
|
+
patchProviderRequestSchema,
|
|
18
|
+
patchProviderResponseSchema,
|
|
19
|
+
previewProviderRequestSchema,
|
|
20
|
+
previewProviderResponseSchema,
|
|
21
|
+
providerEnvVarSchema,
|
|
22
|
+
providerErrorSchema,
|
|
23
|
+
providerSchema,
|
|
24
|
+
providerVersionInfoSchema,
|
|
25
|
+
readProviderByLocationRequestSchema,
|
|
26
|
+
readProviderByLocationResponseSchema,
|
|
27
|
+
readProviderLogsRequestSchema,
|
|
28
|
+
readProviderLogsResponseSchema,
|
|
29
|
+
readProviderRequestSchema,
|
|
30
|
+
readProviderResponseSchema,
|
|
31
|
+
updateProviderVariablesRequestSchema,
|
|
32
|
+
updateProviderVariablesResponseSchema,
|
|
33
|
+
} from './schemas';
|
|
34
|
+
|
|
35
|
+
export enum ProviderType {
|
|
36
|
+
Managed = 'managed',
|
|
37
|
+
Unmanaged = 'unmanaged',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export enum ProviderStatus {
|
|
41
|
+
Missing = 'missing',
|
|
42
|
+
Starting = 'starting',
|
|
43
|
+
Ready = 'ready',
|
|
44
|
+
Running = 'running',
|
|
45
|
+
Error = 'error',
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export enum ProviderUnmanagedStatus {
|
|
49
|
+
Online = 'online',
|
|
50
|
+
Offline = 'offline',
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type ProviderError = z.infer<typeof providerErrorSchema>;
|
|
54
|
+
export type ProviderEnvVar = z.infer<typeof providerEnvVarSchema>;
|
|
55
|
+
export type ProviderVersionInfo = z.infer<typeof providerVersionInfoSchema>;
|
|
56
|
+
|
|
57
|
+
export type Provider = z.infer<typeof providerSchema>;
|
|
58
|
+
|
|
59
|
+
export type ListProvidersRequest = z.infer<typeof listProvidersRequestSchema>;
|
|
60
|
+
export type ListProvidersResponse = z.infer<typeof listProvidersResponseSchema>;
|
|
61
|
+
|
|
62
|
+
export type CreateProviderRequest = z.infer<typeof createProviderRequestSchema>;
|
|
63
|
+
export type CreateProviderResponse = z.infer<typeof createProviderResponseSchema>;
|
|
64
|
+
|
|
65
|
+
export type ReadProviderRequest = z.infer<typeof readProviderRequestSchema>;
|
|
66
|
+
export type ReadProviderResponse = z.infer<typeof readProviderResponseSchema>;
|
|
67
|
+
|
|
68
|
+
export type DeleteProviderRequest = z.infer<typeof deleteProviderRequestSchema>;
|
|
69
|
+
export type DeleteProviderResponse = z.infer<typeof deleteProviderResponseSchema>;
|
|
70
|
+
|
|
71
|
+
export type PatchProviderRequest = z.infer<typeof patchProviderRequestSchema>;
|
|
72
|
+
export type PatchProviderResponse = z.infer<typeof patchProviderResponseSchema>;
|
|
73
|
+
|
|
74
|
+
export type ReadProviderLogsRequest = z.infer<typeof readProviderLogsRequestSchema>;
|
|
75
|
+
export type ReadProviderLogsResponse = z.infer<typeof readProviderLogsResponseSchema>;
|
|
76
|
+
|
|
77
|
+
export type ListProviderVariablesRequest = z.infer<typeof listProviderVariablesRequestSchema>;
|
|
78
|
+
export type ListProviderVariablesResponse = z.infer<typeof listProviderVariablesResponseSchema>;
|
|
79
|
+
|
|
80
|
+
export type UpdateProviderVariablesRequest = z.infer<typeof updateProviderVariablesRequestSchema>;
|
|
81
|
+
export type UpdateProviderVariablesResponse = z.infer<typeof updateProviderVariablesResponseSchema>;
|
|
82
|
+
|
|
83
|
+
export type ReadProviderByLocationRequest = z.infer<typeof readProviderByLocationRequestSchema>;
|
|
84
|
+
export type ReadProviderByLocationResponse = z.infer<typeof readProviderByLocationResponseSchema>;
|
|
85
|
+
|
|
86
|
+
export type PreviewProviderRequest = z.infer<typeof previewProviderRequestSchema>;
|
|
87
|
+
export type PreviewProviderResponse = z.infer<typeof previewProviderResponseSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export * from './common/schemas';
|
|
7
|
+
export * from './configuration/schemas';
|
|
8
|
+
export * from './connectors/schemas';
|
|
9
|
+
export * from './contexts/schemas';
|
|
10
|
+
export * from './files/schemas';
|
|
11
|
+
export * from './model-providers/schemas';
|
|
12
|
+
export * from './provider-builds/schemas';
|
|
13
|
+
export * from './providers/schemas';
|
|
14
|
+
export * from './user-feedback/schemas';
|
|
15
|
+
export * from './users/schemas';
|
|
16
|
+
export * from './variables/schemas';
|
package/src/client/api/types.ts
CHANGED
|
@@ -3,133 +3,14 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export type CreateContextResponse = z.infer<typeof contextSchema>;
|
|
18
|
-
|
|
19
|
-
export const contextTokenSchema = z.object({
|
|
20
|
-
token: z.string(),
|
|
21
|
-
expires_at: z.string().nullable(),
|
|
22
|
-
});
|
|
23
|
-
export type ContextToken = z.infer<typeof contextTokenSchema>;
|
|
24
|
-
|
|
25
|
-
export enum ModelCapability {
|
|
26
|
-
Llm = 'llm',
|
|
27
|
-
Embedding = 'embedding',
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const paginatedResultSchema = z.object({
|
|
31
|
-
items: z.array(z.unknown()),
|
|
32
|
-
total_count: z.number(),
|
|
33
|
-
has_more: z.boolean(),
|
|
34
|
-
next_page_token: z.string().nullable(),
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export const modelProviderMatchSchema = paginatedResultSchema.extend({
|
|
38
|
-
items: z.array(
|
|
39
|
-
z.object({
|
|
40
|
-
model_id: z.string(),
|
|
41
|
-
score: z.number(),
|
|
42
|
-
}),
|
|
43
|
-
),
|
|
44
|
-
});
|
|
45
|
-
export type ModelProviderMatch = z.infer<typeof modelProviderMatchSchema>;
|
|
46
|
-
|
|
47
|
-
export const resourceIdPermissionSchema = z.object({
|
|
48
|
-
id: z.string(),
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export type ResourceIdPermission = z.infer<typeof resourceIdPermissionSchema>;
|
|
52
|
-
|
|
53
|
-
export const contextPermissionsGrantSchema = z.object({
|
|
54
|
-
files: z.array(z.literal(['read', 'write', 'extract', '*'])).optional(),
|
|
55
|
-
vector_stores: z.array(z.literal(['read', 'write', '*'])).optional(),
|
|
56
|
-
context_data: z.array(z.literal(['read', 'write', '*'])).optional(),
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
export type ContextPermissionsGrant = z.infer<typeof contextPermissionsGrantSchema>;
|
|
60
|
-
|
|
61
|
-
export const globalPermissionsGrantSchema = contextPermissionsGrantSchema
|
|
62
|
-
.extend({
|
|
63
|
-
feedback: z.array(z.literal('write')).optional(),
|
|
64
|
-
|
|
65
|
-
llm: z.array(z.union([z.literal('*'), resourceIdPermissionSchema])).optional(),
|
|
66
|
-
embeddings: z.array(z.union([z.literal('*'), resourceIdPermissionSchema])).optional(),
|
|
67
|
-
model_providers: z.array(z.literal(['read', 'write', '*'])).optional(),
|
|
68
|
-
|
|
69
|
-
a2a_proxy: z.array(z.union([z.literal('*'), z.string()])).optional(),
|
|
70
|
-
|
|
71
|
-
providers: z.array(z.literal(['read', 'write', '*'])).optional(),
|
|
72
|
-
provider_variables: z.array(z.literal(['read', 'write', '*'])).optional(),
|
|
73
|
-
|
|
74
|
-
contexts: z.array(z.literal(['read', 'write', '*'])).optional(),
|
|
75
|
-
|
|
76
|
-
mcp_providers: z.array(z.literal(['read', 'write', '*'])).optional(),
|
|
77
|
-
mcp_tools: z.array(z.literal(['read', '*'])).optional(),
|
|
78
|
-
mcp_proxy: z.array(z.literal('*')).optional(),
|
|
79
|
-
|
|
80
|
-
connectors: z.array(z.literal(['read', 'write', 'proxy', '*'])).optional(),
|
|
81
|
-
})
|
|
82
|
-
.superRefine((val, ctx) => {
|
|
83
|
-
if (!val.a2a_proxy) return;
|
|
84
|
-
|
|
85
|
-
if (val.a2a_proxy.length === 0) {
|
|
86
|
-
ctx.addIssue({
|
|
87
|
-
code: z.ZodIssueCode.custom,
|
|
88
|
-
message: 'a2a_proxy cannot be empty array',
|
|
89
|
-
path: ['a2a_proxy'],
|
|
90
|
-
});
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const hasWildcard = val.a2a_proxy.includes('*');
|
|
95
|
-
const hasOthers = val.a2a_proxy.some((v) => v !== '*');
|
|
96
|
-
|
|
97
|
-
if (hasWildcard && hasOthers) {
|
|
98
|
-
ctx.addIssue({
|
|
99
|
-
code: z.ZodIssueCode.custom,
|
|
100
|
-
message: "a2a_proxy cannot mix '*' with specific providers",
|
|
101
|
-
path: ['a2a_proxy'],
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
export type GlobalPermissionsGrant = z.infer<typeof globalPermissionsGrantSchema>;
|
|
107
|
-
|
|
108
|
-
export enum ConnectorState {
|
|
109
|
-
Created = 'created',
|
|
110
|
-
AuthRequired = 'auth_required',
|
|
111
|
-
Connected = 'connected',
|
|
112
|
-
Disconnected = 'disconnected',
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export const connectorSchema = z.object({
|
|
116
|
-
id: z.string(),
|
|
117
|
-
url: z.string(),
|
|
118
|
-
state: z.enum(ConnectorState),
|
|
119
|
-
auth_request: z
|
|
120
|
-
.object({
|
|
121
|
-
type: z.literal('code'),
|
|
122
|
-
authorization_endpoint: z.string(),
|
|
123
|
-
})
|
|
124
|
-
.nullable(),
|
|
125
|
-
disconnect_reason: z.string().nullable(),
|
|
126
|
-
metadata: z.record(z.string(), z.string()).nullable(),
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
export type Connector = z.infer<typeof connectorSchema>;
|
|
130
|
-
|
|
131
|
-
export const listConnectorsResponseSchema = paginatedResultSchema.extend({
|
|
132
|
-
items: z.array(connectorSchema),
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
export type ListConnectorsResponse = z.infer<typeof listConnectorsResponseSchema>;
|
|
6
|
+
export * from './common/types';
|
|
7
|
+
export * from './configuration/types';
|
|
8
|
+
export * from './connectors/types';
|
|
9
|
+
export * from './contexts/types';
|
|
10
|
+
export * from './files/types';
|
|
11
|
+
export * from './model-providers/types';
|
|
12
|
+
export * from './provider-builds/types';
|
|
13
|
+
export * from './providers/types';
|
|
14
|
+
export * from './user-feedback/types';
|
|
15
|
+
export * from './users/types';
|
|
16
|
+
export * from './variables/types';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { CallApi } from '../core/types';
|
|
7
|
+
import { ApiMethod } from '../core/types';
|
|
8
|
+
import { createUserFeedbackResponseSchema } from './schemas';
|
|
9
|
+
import type { CreateUserFeedbackRequest } from './types';
|
|
10
|
+
|
|
11
|
+
export function createUserFeedbackApi(callApi: CallApi) {
|
|
12
|
+
const createUserFeedback = ({ ...body }: CreateUserFeedbackRequest) =>
|
|
13
|
+
callApi({
|
|
14
|
+
method: ApiMethod.Post,
|
|
15
|
+
path: '/api/v1/user_feedback',
|
|
16
|
+
schema: createUserFeedbackResponseSchema,
|
|
17
|
+
body,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
createUserFeedback,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import z from 'zod';
|
|
7
|
+
|
|
8
|
+
export const createUserFeedbackRequestSchema = z.object({
|
|
9
|
+
provider_id: z.string(),
|
|
10
|
+
context_id: z.string(),
|
|
11
|
+
task_id: z.string(),
|
|
12
|
+
message: z.string(),
|
|
13
|
+
rating: z.union([z.literal(1), z.literal(-1)]),
|
|
14
|
+
comment: z.string().nullish(),
|
|
15
|
+
comment_tags: z.array(z.string()).nullish(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const createUserFeedbackResponseSchema = z.null();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type z from 'zod';
|
|
7
|
+
|
|
8
|
+
import type { createUserFeedbackRequestSchema, createUserFeedbackResponseSchema } from './schemas';
|
|
9
|
+
|
|
10
|
+
export type CreateUserFeedbackRequest = z.infer<typeof createUserFeedbackRequestSchema>;
|
|
11
|
+
export type CreateUserFeedbackResponse = z.infer<typeof createUserFeedbackResponseSchema>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { CallApi } from '../core/types';
|
|
7
|
+
import { ApiMethod } from '../core/types';
|
|
8
|
+
import { readUserResponseSchema } from './schemas';
|
|
9
|
+
|
|
10
|
+
export function createUsersApi(callApi: CallApi) {
|
|
11
|
+
const readUser = () =>
|
|
12
|
+
callApi({
|
|
13
|
+
method: ApiMethod.Get,
|
|
14
|
+
path: '/api/v1/user',
|
|
15
|
+
schema: readUserResponseSchema,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
readUser,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import z from 'zod';
|
|
7
|
+
|
|
8
|
+
import { UserRole } from './types';
|
|
9
|
+
|
|
10
|
+
export const userRoleSchema = z.enum(UserRole);
|
|
11
|
+
|
|
12
|
+
export const userSchema = z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
role: userRoleSchema,
|
|
15
|
+
email: z.string(),
|
|
16
|
+
created_at: z.string(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const readUserRequestSchema = z.never();
|
|
20
|
+
|
|
21
|
+
export const readUserResponseSchema = userSchema;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type z from 'zod';
|
|
7
|
+
|
|
8
|
+
import type { readUserRequestSchema, readUserResponseSchema, userSchema } from './schemas';
|
|
9
|
+
|
|
10
|
+
export enum UserRole {
|
|
11
|
+
Admin = 'admin',
|
|
12
|
+
Developer = 'developer',
|
|
13
|
+
User = 'user',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type User = z.infer<typeof userSchema>;
|
|
17
|
+
|
|
18
|
+
export type ReadUserRequest = z.infer<typeof readUserRequestSchema>;
|
|
19
|
+
export type ReadUserResponse = z.infer<typeof readUserResponseSchema>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { CallApi } from '../core/types';
|
|
7
|
+
import { ApiMethod } from '../core/types';
|
|
8
|
+
import { listVariablesResponseSchema, updateVariablesResponseSchema } from './schemas';
|
|
9
|
+
import type { UpdateVariablesRequest } from './types';
|
|
10
|
+
|
|
11
|
+
export function createVariablesApi(callApi: CallApi) {
|
|
12
|
+
const listVariables = () =>
|
|
13
|
+
callApi({
|
|
14
|
+
method: ApiMethod.Get,
|
|
15
|
+
path: '/api/v1/variables',
|
|
16
|
+
schema: listVariablesResponseSchema,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const updateVariables = ({ ...body }: UpdateVariablesRequest) =>
|
|
20
|
+
callApi({
|
|
21
|
+
method: ApiMethod.Put,
|
|
22
|
+
path: '/api/v1/variables',
|
|
23
|
+
schema: updateVariablesResponseSchema,
|
|
24
|
+
body,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
listVariables,
|
|
29
|
+
updateVariables,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 © BeeAI a Series of LF Projects, LLC
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import z from 'zod';
|
|
7
|
+
|
|
8
|
+
export const listVariablesRequestSchema = z.never();
|
|
9
|
+
|
|
10
|
+
export const listVariablesResponseSchema = z.object({
|
|
11
|
+
variables: z.record(z.string(), z.string()),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const updateVariablesRequestSchema = z.object({
|
|
15
|
+
variables: z.record(z.string(), z.union([z.string(), z.null()])),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const updateVariablesResponseSchema = z.null();
|