@budibase/frontend-core 3.43.0 → 3.44.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/package.json +2 -2
- package/src/api/agents.ts +26 -57
- package/src/api/ai.ts +26 -0
- package/src/api/chatLinks.ts +26 -6
- package/src/api/escalations.ts +6 -2
- package/src/api/index.ts +15 -5
- package/src/api/types.ts +1 -2
- package/src/components/Chatbox/index.svelte +61 -324
- package/src/components/index.ts +0 -2
- package/src/utils/download.test.js +34 -0
- package/src/api/chatApps.ts +0 -268
- package/src/components/Chatbox/ChatConversationPanel.svelte +0 -401
- package/src/components/Chatbox/ChatNavigationPanel.svelte +0 -326
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "v3.
|
|
3
|
+
"version": "v3.44.0",
|
|
4
4
|
"description": "Budibase frontend core libraries used in builder and client",
|
|
5
5
|
"author": "Budibase",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"vitest": "^4.1.0"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "3b4b472084bfed7fdf0b083c5a7390ce0a3eebda"
|
|
27
27
|
}
|
package/src/api/agents.ts
CHANGED
|
@@ -13,12 +13,8 @@ import {
|
|
|
13
13
|
FetchAgentsResponse,
|
|
14
14
|
ProvisionAgentSlackChannelRequest,
|
|
15
15
|
ProvisionAgentSlackChannelResponse,
|
|
16
|
-
ProvisionAgentTelegramChannelRequest,
|
|
17
|
-
ProvisionAgentTelegramChannelResponse,
|
|
18
16
|
ProvisionAgentMSTeamsChannelRequest,
|
|
19
17
|
ProvisionAgentMSTeamsChannelResponse,
|
|
20
|
-
SyncAgentDiscordCommandsRequest,
|
|
21
|
-
SyncAgentDiscordCommandsResponse,
|
|
22
18
|
SyncAgentKnowledgeSourcesRequest,
|
|
23
19
|
SyncAgentKnowledgeSourcesResponse,
|
|
24
20
|
ToggleAgentDeploymentRequest,
|
|
@@ -31,12 +27,14 @@ import {
|
|
|
31
27
|
CreateAgentOperationRequest,
|
|
32
28
|
UpdateAgentOperationRequest,
|
|
33
29
|
AgentOperationMutationResponse,
|
|
30
|
+
CreateAgentSlackAppRequest,
|
|
31
|
+
CreateAgentSlackAppResponse,
|
|
34
32
|
} from "@budibase/types"
|
|
35
33
|
|
|
36
34
|
import { BaseAPIClient } from "./types"
|
|
37
35
|
|
|
38
36
|
export interface AgentEndpoints {
|
|
39
|
-
fetchTools: (
|
|
37
|
+
fetchTools: () => Promise<ToolMetadata[]>
|
|
40
38
|
fetchAgents: () => Promise<FetchAgentsResponse>
|
|
41
39
|
fetchAgentKnowledge: (
|
|
42
40
|
agentId: string
|
|
@@ -58,26 +56,20 @@ export interface AgentEndpoints {
|
|
|
58
56
|
) => Promise<AgentOperationMutationResponse>
|
|
59
57
|
duplicateAgent: (agentId: string) => Promise<DuplicateAgentResponse>
|
|
60
58
|
deleteAgent: (agentId: string) => Promise<{ deleted: true }>
|
|
61
|
-
syncAgentDiscordCommands: (
|
|
62
|
-
agentId: string,
|
|
63
|
-
body?: SyncAgentDiscordCommandsRequest
|
|
64
|
-
) => Promise<SyncAgentDiscordCommandsResponse>
|
|
65
59
|
provisionAgentMSTeamsChannel: (
|
|
66
60
|
agentId: string,
|
|
67
61
|
body?: ProvisionAgentMSTeamsChannelRequest
|
|
68
62
|
) => Promise<ProvisionAgentMSTeamsChannelResponse>
|
|
63
|
+
downloadAgentMSTeamsPackage: (agentId: string) => Promise<Response>
|
|
69
64
|
provisionAgentSlackChannel: (
|
|
70
65
|
agentId: string,
|
|
71
66
|
body?: ProvisionAgentSlackChannelRequest
|
|
72
67
|
) => Promise<ProvisionAgentSlackChannelResponse>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
body?: ProvisionAgentTelegramChannelRequest
|
|
76
|
-
) => Promise<ProvisionAgentTelegramChannelResponse>
|
|
77
|
-
toggleAgentDiscordDeployment: (
|
|
68
|
+
downloadAgentSlackManifest: (agentId: string) => Promise<string>
|
|
69
|
+
createAgentSlackApp: (
|
|
78
70
|
agentId: string,
|
|
79
|
-
|
|
80
|
-
) => Promise<
|
|
71
|
+
body?: CreateAgentSlackAppRequest
|
|
72
|
+
) => Promise<CreateAgentSlackAppResponse>
|
|
81
73
|
toggleAgentMSTeamsDeployment: (
|
|
82
74
|
agentId: string,
|
|
83
75
|
enabled: boolean
|
|
@@ -86,10 +78,6 @@ export interface AgentEndpoints {
|
|
|
86
78
|
agentId: string,
|
|
87
79
|
enabled: boolean
|
|
88
80
|
) => Promise<ToggleAgentDeploymentResponse>
|
|
89
|
-
toggleAgentTelegramDeployment: (
|
|
90
|
-
agentId: string,
|
|
91
|
-
enabled: boolean
|
|
92
|
-
) => Promise<ToggleAgentDeploymentResponse>
|
|
93
81
|
uploadOperationFile: (
|
|
94
82
|
agentId: string,
|
|
95
83
|
operationId: string,
|
|
@@ -147,12 +135,9 @@ export interface AgentEndpoints {
|
|
|
147
135
|
}
|
|
148
136
|
|
|
149
137
|
export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
150
|
-
fetchTools: async (
|
|
151
|
-
const query = aiconfigId
|
|
152
|
-
? `?aiconfigId=${encodeURIComponent(aiconfigId)}`
|
|
153
|
-
: ""
|
|
138
|
+
fetchTools: async () => {
|
|
154
139
|
return await API.get({
|
|
155
|
-
url:
|
|
140
|
+
url: "/api/agent/tools",
|
|
156
141
|
})
|
|
157
142
|
},
|
|
158
143
|
fetchAgents: async () => {
|
|
@@ -213,16 +198,6 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
|
213
198
|
})
|
|
214
199
|
},
|
|
215
200
|
|
|
216
|
-
syncAgentDiscordCommands: async (agentId: string, body) => {
|
|
217
|
-
return await API.post<
|
|
218
|
-
SyncAgentDiscordCommandsRequest | undefined,
|
|
219
|
-
SyncAgentDiscordCommandsResponse
|
|
220
|
-
>({
|
|
221
|
-
url: `/api/agent/${agentId}/discord/sync`,
|
|
222
|
-
body,
|
|
223
|
-
})
|
|
224
|
-
},
|
|
225
|
-
|
|
226
201
|
provisionAgentMSTeamsChannel: async (agentId: string, body) => {
|
|
227
202
|
return await API.post<
|
|
228
203
|
ProvisionAgentMSTeamsChannelRequest | undefined,
|
|
@@ -233,6 +208,13 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
|
233
208
|
})
|
|
234
209
|
},
|
|
235
210
|
|
|
211
|
+
downloadAgentMSTeamsPackage: async (agentId: string) => {
|
|
212
|
+
return await API.get<Response>({
|
|
213
|
+
url: `/api/agent/${agentId}/ms-teams/package`,
|
|
214
|
+
parseResponse: response => response,
|
|
215
|
+
})
|
|
216
|
+
},
|
|
217
|
+
|
|
236
218
|
provisionAgentSlackChannel: async (agentId: string, body) => {
|
|
237
219
|
return await API.post<
|
|
238
220
|
ProvisionAgentSlackChannelRequest | undefined,
|
|
@@ -243,23 +225,20 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
|
243
225
|
})
|
|
244
226
|
},
|
|
245
227
|
|
|
246
|
-
|
|
247
|
-
return await API.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
>({
|
|
251
|
-
url: `/api/agent/${agentId}/telegram/provision`,
|
|
252
|
-
body,
|
|
228
|
+
downloadAgentSlackManifest: async (agentId: string) => {
|
|
229
|
+
return await API.get<string>({
|
|
230
|
+
url: `/api/agent/${agentId}/slack/manifest`,
|
|
231
|
+
parseResponse: async response => await response.text(),
|
|
253
232
|
})
|
|
254
233
|
},
|
|
255
234
|
|
|
256
|
-
|
|
235
|
+
createAgentSlackApp: async (agentId: string, body) => {
|
|
257
236
|
return await API.post<
|
|
258
|
-
|
|
259
|
-
|
|
237
|
+
CreateAgentSlackAppRequest | undefined,
|
|
238
|
+
CreateAgentSlackAppResponse
|
|
260
239
|
>({
|
|
261
|
-
url: `/api/agent/${agentId}/
|
|
262
|
-
body
|
|
240
|
+
url: `/api/agent/${agentId}/slack/app/create`,
|
|
241
|
+
body,
|
|
263
242
|
})
|
|
264
243
|
},
|
|
265
244
|
|
|
@@ -283,16 +262,6 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
|
283
262
|
})
|
|
284
263
|
},
|
|
285
264
|
|
|
286
|
-
toggleAgentTelegramDeployment: async (agentId: string, enabled: boolean) => {
|
|
287
|
-
return await API.post<
|
|
288
|
-
ToggleAgentDeploymentRequest,
|
|
289
|
-
ToggleAgentDeploymentResponse
|
|
290
|
-
>({
|
|
291
|
-
url: `/api/agent/${agentId}/telegram/toggle`,
|
|
292
|
-
body: { enabled },
|
|
293
|
-
})
|
|
294
|
-
},
|
|
295
|
-
|
|
296
265
|
uploadOperationFile: async (
|
|
297
266
|
agentId: string,
|
|
298
267
|
operationId: string,
|
package/src/api/ai.ts
CHANGED
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
GenerateJsResponse,
|
|
6
6
|
GenerateTablesRequest,
|
|
7
7
|
GenerateTablesResponse,
|
|
8
|
+
SaveSlackAppConfigRequest,
|
|
9
|
+
SlackAppConfigResponse,
|
|
8
10
|
} from "@budibase/types"
|
|
9
11
|
import { BaseAPIClient } from "./types"
|
|
10
12
|
|
|
@@ -49,6 +51,11 @@ export interface AIEndpoints {
|
|
|
49
51
|
req: GenerateTablesRequest,
|
|
50
52
|
onProgress?: (message: string) => void
|
|
51
53
|
) => Promise<GenerateTablesResponse>
|
|
54
|
+
fetchSlackAppConfig: () => Promise<SlackAppConfigResponse>
|
|
55
|
+
saveSlackAppConfig: (
|
|
56
|
+
req: SaveSlackAppConfigRequest
|
|
57
|
+
) => Promise<SlackAppConfigResponse>
|
|
58
|
+
deleteSlackAppConfig: () => Promise<SlackAppConfigResponse>
|
|
52
59
|
}
|
|
53
60
|
|
|
54
61
|
export const buildAIEndpoints = (API: BaseAPIClient): AIEndpoints => ({
|
|
@@ -129,4 +136,23 @@ export const buildAIEndpoints = (API: BaseAPIClient): AIEndpoints => ({
|
|
|
129
136
|
},
|
|
130
137
|
})
|
|
131
138
|
},
|
|
139
|
+
|
|
140
|
+
fetchSlackAppConfig: async () => {
|
|
141
|
+
return await API.get({
|
|
142
|
+
url: "/api/ai/slack/app-config",
|
|
143
|
+
})
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
saveSlackAppConfig: async req => {
|
|
147
|
+
return await API.put({
|
|
148
|
+
url: "/api/ai/slack/app-config",
|
|
149
|
+
body: req,
|
|
150
|
+
})
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
deleteSlackAppConfig: async () => {
|
|
154
|
+
return await API.delete({
|
|
155
|
+
url: "/api/ai/slack/app-config",
|
|
156
|
+
})
|
|
157
|
+
},
|
|
132
158
|
})
|
package/src/api/chatLinks.ts
CHANGED
|
@@ -16,13 +16,27 @@ export interface MSTeamsChannel {
|
|
|
16
16
|
teamName: string
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
// Cursor is an opaque provider token - callers only act on hasNext and echo
|
|
20
|
+
// the cursor back verbatim.
|
|
21
|
+
export interface PagedChannels<T> {
|
|
22
|
+
channels: T[]
|
|
23
|
+
hasNext: boolean
|
|
24
|
+
cursor?: string
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
export interface ChatLinksEndpoints {
|
|
20
28
|
fetchChatIdentityLinks: (
|
|
21
29
|
provider?: ChatIdentityLinkProvider,
|
|
22
30
|
agentId?: string
|
|
23
31
|
) => Promise<ChatIdentityLink[]>
|
|
24
|
-
fetchSlackChannels: (
|
|
25
|
-
|
|
32
|
+
fetchSlackChannels: (
|
|
33
|
+
agentId: string,
|
|
34
|
+
cursor?: string
|
|
35
|
+
) => Promise<PagedChannels<SlackChannel>>
|
|
36
|
+
fetchMSTeamsChannels: (
|
|
37
|
+
agentId: string,
|
|
38
|
+
cursor?: string
|
|
39
|
+
) => Promise<PagedChannels<MSTeamsChannel>>
|
|
26
40
|
}
|
|
27
41
|
|
|
28
42
|
export const buildChatLinksEndpoints = (
|
|
@@ -36,12 +50,18 @@ export const buildChatLinksEndpoints = (
|
|
|
36
50
|
const query = params ? `?${params}` : ""
|
|
37
51
|
return await API.get({ url: `/api/chat-links${query}` })
|
|
38
52
|
},
|
|
39
|
-
fetchSlackChannels: async agentId => {
|
|
40
|
-
const query = new URLSearchParams({
|
|
53
|
+
fetchSlackChannels: async (agentId, cursor) => {
|
|
54
|
+
const query = new URLSearchParams({
|
|
55
|
+
agentId,
|
|
56
|
+
...(cursor ? { cursor } : {}),
|
|
57
|
+
}).toString()
|
|
41
58
|
return await API.get({ url: `/api/slack-channels?${query}` })
|
|
42
59
|
},
|
|
43
|
-
fetchMSTeamsChannels: async agentId => {
|
|
44
|
-
const query = new URLSearchParams({
|
|
60
|
+
fetchMSTeamsChannels: async (agentId, cursor) => {
|
|
61
|
+
const query = new URLSearchParams({
|
|
62
|
+
agentId,
|
|
63
|
+
...(cursor ? { cursor } : {}),
|
|
64
|
+
}).toString()
|
|
45
65
|
return await API.get({ url: `/api/teams-channels?${query}` })
|
|
46
66
|
},
|
|
47
67
|
})
|
package/src/api/escalations.ts
CHANGED
|
@@ -10,7 +10,10 @@ export interface EscalationEndpoints {
|
|
|
10
10
|
fetchEscalationContext: (
|
|
11
11
|
escalationId: string
|
|
12
12
|
) => Promise<EscalationContextDoc>
|
|
13
|
-
fetchEscalationResult: (
|
|
13
|
+
fetchEscalationResult: (
|
|
14
|
+
escalationId: string,
|
|
15
|
+
signal?: AbortSignal
|
|
16
|
+
) => Promise<EscalationResult>
|
|
14
17
|
resolveEscalation: (
|
|
15
18
|
escalationId: string,
|
|
16
19
|
response: EscalationResponse
|
|
@@ -26,9 +29,10 @@ export const buildEscalationEndpoints = (
|
|
|
26
29
|
})
|
|
27
30
|
},
|
|
28
31
|
|
|
29
|
-
fetchEscalationResult: async escalationId => {
|
|
32
|
+
fetchEscalationResult: async (escalationId, signal) => {
|
|
30
33
|
return await API.get({
|
|
31
34
|
url: `/api/escalations/${escalationId}/result`,
|
|
35
|
+
signal,
|
|
32
36
|
})
|
|
33
37
|
},
|
|
34
38
|
|
package/src/api/index.ts
CHANGED
|
@@ -51,7 +51,6 @@ import { buildAgentEndpoints } from "./agents"
|
|
|
51
51
|
import { buildAgentTestEndpoints } from "./agentTests"
|
|
52
52
|
import { buildAgentLogEndpoints } from "./agentLogs"
|
|
53
53
|
import { buildAgentRequestEndpoints } from "./agentRequests"
|
|
54
|
-
import { buildChatAppEndpoints } from "./chatApps"
|
|
55
54
|
import { buildEscalationEndpoints } from "./escalations"
|
|
56
55
|
import { buildChatLinksEndpoints } from "./chatLinks"
|
|
57
56
|
import { buildFeatureFlagEndpoints } from "./features"
|
|
@@ -146,8 +145,16 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
|
|
|
146
145
|
const makeApiCall = async <RequestT = null, ResponseT = void>(
|
|
147
146
|
callConfig: APICallConfig<RequestT, ResponseT>
|
|
148
147
|
): Promise<ResponseT> => {
|
|
149
|
-
let {
|
|
150
|
-
|
|
148
|
+
let {
|
|
149
|
+
json,
|
|
150
|
+
method,
|
|
151
|
+
external,
|
|
152
|
+
body,
|
|
153
|
+
url,
|
|
154
|
+
parseResponse,
|
|
155
|
+
suppressErrors,
|
|
156
|
+
signal,
|
|
157
|
+
} = callConfig
|
|
151
158
|
|
|
152
159
|
// Ensure we don't do JSON processing if sending a GET request
|
|
153
160
|
json = json && method !== HTTPMethod.GET
|
|
@@ -183,9 +190,13 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
|
|
|
183
190
|
headers,
|
|
184
191
|
body: requestBody,
|
|
185
192
|
credentials: "same-origin",
|
|
193
|
+
signal,
|
|
186
194
|
})
|
|
187
195
|
} catch (error) {
|
|
188
196
|
delete cache[url]
|
|
197
|
+
if (signal?.aborted) {
|
|
198
|
+
throw error
|
|
199
|
+
}
|
|
189
200
|
throw makeError("Failed to send request", url, method)
|
|
190
201
|
}
|
|
191
202
|
|
|
@@ -261,7 +272,7 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
|
|
|
261
272
|
const handler = cacheRequest ? makeCachedApiCall : makeApiCall
|
|
262
273
|
return await handler(callConfig)
|
|
263
274
|
} catch (error) {
|
|
264
|
-
if (config?.onError) {
|
|
275
|
+
if (config?.onError && !params.signal?.aborted) {
|
|
265
276
|
config.onError(error as APIError)
|
|
266
277
|
}
|
|
267
278
|
throw error
|
|
@@ -327,7 +338,6 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
|
|
|
327
338
|
...buildAgentTestEndpoints(API),
|
|
328
339
|
...buildAgentLogEndpoints(API),
|
|
329
340
|
...buildAgentRequestEndpoints(API),
|
|
330
|
-
...buildChatAppEndpoints(API),
|
|
331
341
|
...buildEscalationEndpoints(API),
|
|
332
342
|
...buildChatLinksEndpoints(API),
|
|
333
343
|
...buildFeatureFlagEndpoints(API),
|
package/src/api/types.ts
CHANGED
|
@@ -39,7 +39,6 @@ import { AgentEndpoints } from "./agents"
|
|
|
39
39
|
import { AgentTestEndpoints } from "./agentTests"
|
|
40
40
|
import { AgentLogEndpoints } from "./agentLogs"
|
|
41
41
|
import { AgentRequestEndpoints } from "./agentRequests"
|
|
42
|
-
import { ChatAppEndpoints } from "./chatApps"
|
|
43
42
|
import { ChatLinksEndpoints } from "./chatLinks"
|
|
44
43
|
import { EscalationEndpoints } from "./escalations"
|
|
45
44
|
import { NavigationEndpoints } from "./navigation"
|
|
@@ -80,6 +79,7 @@ export type APICallConfig<RequestT, ResponseT> = {
|
|
|
80
79
|
suppressErrors: boolean
|
|
81
80
|
cache: boolean
|
|
82
81
|
body?: RequestT
|
|
82
|
+
signal?: AbortSignal
|
|
83
83
|
parseResponse?: (response: Response) => Promise<ResponseT> | ResponseT
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -128,7 +128,6 @@ export type APIClient = BaseAPIClient &
|
|
|
128
128
|
AgentTestEndpoints &
|
|
129
129
|
AgentLogEndpoints &
|
|
130
130
|
AgentRequestEndpoints &
|
|
131
|
-
ChatAppEndpoints &
|
|
132
131
|
ChatLinksEndpoints &
|
|
133
132
|
EscalationEndpoints &
|
|
134
133
|
AnalyticsEndpoints &
|