@budibase/frontend-core 3.39.16 → 3.39.17

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "3.39.16",
3
+ "version": "3.39.17",
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": "b1c87febc51bc49767bb6438e75a06038fea8fbf"
26
+ "gitHead": "5eef1080b6e1446800f1dae94e98eec10ac535f6"
27
27
  }
package/src/api/agents.ts CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  CreateAgentResponse,
7
7
  DisconnectAgentSharePointSiteResponse,
8
8
  DuplicateAgentResponse,
9
- FetchAgentKnowledgeResponse,
9
+ FetchAgentKnowledgeIndexResponse,
10
10
  FetchAgentFileUrlResponse,
11
11
  FetchAgentKnowledgeSourceEntriesResponse,
12
12
  FetchAgentKnowledgeSourceOptionsResponse,
@@ -28,6 +28,9 @@ import {
28
28
  UpdateAgentSharePointSiteResponse,
29
29
  UpdateAgentRequest,
30
30
  UpdateAgentResponse,
31
+ CreateAgentOperationRequest,
32
+ UpdateAgentOperationRequest,
33
+ AgentOperationMutationResponse,
31
34
  } from "@budibase/types"
32
35
 
33
36
  import { BaseAPIClient } from "./types"
@@ -35,8 +38,24 @@ import { BaseAPIClient } from "./types"
35
38
  export interface AgentEndpoints {
36
39
  fetchTools: (aiconfigId?: string) => Promise<ToolMetadata[]>
37
40
  fetchAgents: () => Promise<FetchAgentsResponse>
41
+ fetchAgentKnowledge: (
42
+ agentId: string
43
+ ) => Promise<FetchAgentKnowledgeIndexResponse>
38
44
  createAgent: (agent: CreateAgentRequest) => Promise<CreateAgentResponse>
39
45
  updateAgent: (agent: UpdateAgentRequest) => Promise<UpdateAgentResponse>
46
+ createAgentOperation: (
47
+ agentId: string,
48
+ operation: CreateAgentOperationRequest
49
+ ) => Promise<AgentOperationMutationResponse>
50
+ updateAgentOperation: (
51
+ agentId: string,
52
+ operationId: string,
53
+ operation: UpdateAgentOperationRequest
54
+ ) => Promise<AgentOperationMutationResponse>
55
+ deleteAgentOperation: (
56
+ agentId: string,
57
+ operationId: string
58
+ ) => Promise<AgentOperationMutationResponse>
40
59
  duplicateAgent: (agentId: string) => Promise<DuplicateAgentResponse>
41
60
  deleteAgent: (agentId: string) => Promise<{ deleted: true }>
42
61
  syncAgentDiscordCommands: (
@@ -71,45 +90,55 @@ export interface AgentEndpoints {
71
90
  agentId: string,
72
91
  enabled: boolean
73
92
  ) => Promise<ToggleAgentDeploymentResponse>
74
- fetchAgentKnowledge: (agentId: string) => Promise<FetchAgentKnowledgeResponse>
75
- uploadAgentFile: (
93
+ uploadOperationFile: (
76
94
  agentId: string,
95
+ operationId: string,
77
96
  file: File
78
97
  ) => Promise<AgentFileUploadResponse>
79
- deleteAgentFile: (
98
+ deleteOperationFile: (
80
99
  agentId: string,
100
+ operationId: string,
81
101
  fileId: string
82
102
  ) => Promise<{ deleted: true }>
83
- fetchAgentFileUrl: (
103
+ fetchOperationFileUrl: (
84
104
  agentId: string,
105
+ operationId: string,
85
106
  fileId: string
86
107
  ) => Promise<FetchAgentFileUrlResponse>
87
108
  fetchAgentKnowledgeSourceOptions: (
88
109
  datasourceId: string,
89
110
  authConfigId: string
90
111
  ) => Promise<FetchAgentKnowledgeSourceOptionsResponse>
91
- fetchAgentKnowledgeSourceAllEntries: (
112
+ fetchOperationKnowledgeSourceAllEntries: (
92
113
  agentId: string,
114
+ operationId: string,
93
115
  siteId: string
94
116
  ) => Promise<FetchAgentKnowledgeSourceEntriesResponse>
95
- connectAgentSharePointSite: (
117
+ connectOperationSharePointSite: (
96
118
  agentId: string,
119
+ operationId: string,
97
120
  body: ConnectAgentSharePointSiteRequest
98
121
  ) => Promise<ConnectAgentSharePointSiteResponse>
99
- updateAgentSharePointSite: (
122
+ updateOperationSharePointSite: (
100
123
  agentId: string,
124
+ operationId: string,
101
125
  siteId: string,
102
126
  body: UpdateAgentSharePointSiteRequest
103
127
  ) => Promise<UpdateAgentSharePointSiteResponse>
104
- disconnectAgentSharePointSite: (
128
+ disconnectOperationSharePointSite: (
105
129
  agentId: string,
130
+ operationId: string,
106
131
  siteId: string
107
132
  ) => Promise<DisconnectAgentSharePointSiteResponse>
108
- syncAgentKnowledgeSources: (
133
+ syncOperationKnowledgeSources: (
109
134
  agentId: string,
135
+ operationId: string,
110
136
  sourceId: string
111
137
  ) => Promise<SyncAgentKnowledgeSourcesResponse>
112
- resetAgentKnowledgeBaseStore: (agentId: string) => Promise<void>
138
+ resetOperationKnowledgeBaseStore: (
139
+ agentId: string,
140
+ operationId: string
141
+ ) => Promise<void>
113
142
  }
114
143
 
115
144
  export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
@@ -127,6 +156,12 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
127
156
  })
128
157
  },
129
158
 
159
+ fetchAgentKnowledge: async (agentId: string) => {
160
+ return await API.get<FetchAgentKnowledgeIndexResponse>({
161
+ url: `/api/agent/${agentId}/knowledge`,
162
+ })
163
+ },
164
+
130
165
  createAgent: async (agent: CreateAgentRequest) => {
131
166
  return await API.post({
132
167
  url: "/api/agent",
@@ -141,6 +176,26 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
141
176
  })
142
177
  },
143
178
 
179
+ createAgentOperation: async (agentId, operation) => {
180
+ return await API.post({
181
+ url: `/api/agent/${agentId}/operations`,
182
+ body: operation,
183
+ })
184
+ },
185
+
186
+ updateAgentOperation: async (agentId, operationId, operation) => {
187
+ return await API.put({
188
+ url: `/api/agent/${agentId}/operations/${operationId}`,
189
+ body: operation,
190
+ })
191
+ },
192
+
193
+ deleteAgentOperation: async (agentId, operationId) => {
194
+ return await API.delete({
195
+ url: `/api/agent/${agentId}/operations/${operationId}`,
196
+ })
197
+ },
198
+
144
199
  duplicateAgent: async (agentId: string) => {
145
200
  return await API.post({
146
201
  url: `/api/agent/${agentId}/duplicate`,
@@ -233,31 +288,37 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
233
288
  })
234
289
  },
235
290
 
236
- fetchAgentKnowledge: async (agentId: string) => {
237
- return await API.get<FetchAgentKnowledgeResponse>({
238
- url: `/api/agent/${agentId}/knowledge`,
239
- })
240
- },
241
-
242
- uploadAgentFile: async (agentId: string, file: File) => {
291
+ uploadOperationFile: async (
292
+ agentId: string,
293
+ operationId: string,
294
+ file: File
295
+ ) => {
243
296
  const formData = new FormData()
244
297
  formData.append("file", file)
245
298
  return await API.post<FormData, AgentFileUploadResponse>({
246
- url: `/api/agent/${agentId}/files`,
299
+ url: `/api/agent/${agentId}/operations/${operationId}/files`,
247
300
  body: formData,
248
301
  json: false,
249
302
  })
250
303
  },
251
304
 
252
- deleteAgentFile: async (agentId: string, fileId: string) => {
305
+ deleteOperationFile: async (
306
+ agentId: string,
307
+ operationId: string,
308
+ fileId: string
309
+ ) => {
253
310
  return await API.delete({
254
- url: `/api/agent/${agentId}/files/${fileId}`,
311
+ url: `/api/agent/${agentId}/operations/${operationId}/files/${fileId}`,
255
312
  })
256
313
  },
257
314
 
258
- fetchAgentFileUrl: async (agentId: string, fileId: string) => {
315
+ fetchOperationFileUrl: async (
316
+ agentId: string,
317
+ operationId: string,
318
+ fileId: string
319
+ ) => {
259
320
  return await API.get<FetchAgentFileUrlResponse>({
260
- url: `/api/agent/${agentId}/files/${fileId}/url`,
321
+ url: `/api/agent/${agentId}/operations/${operationId}/files/${fileId}/url`,
261
322
  })
262
323
  },
263
324
 
@@ -270,54 +331,75 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
270
331
  })
271
332
  },
272
333
 
273
- fetchAgentKnowledgeSourceAllEntries: async (
334
+ fetchOperationKnowledgeSourceAllEntries: async (
274
335
  agentId: string,
336
+ operationId: string,
275
337
  siteId: string
276
338
  ) => {
277
339
  const query = new URLSearchParams({ siteId })
278
340
  return await API.get<FetchAgentKnowledgeSourceEntriesResponse>({
279
- url: `/api/agent/${agentId}/knowledge-sources/sharepoint/entries/all?${query.toString()}`,
341
+ url: `/api/agent/${agentId}/operations/${operationId}/knowledge-sources/sharepoint/entries/all?${query.toString()}`,
280
342
  })
281
343
  },
282
344
 
283
- connectAgentSharePointSite: async (agentId: string, body) => {
345
+ connectOperationSharePointSite: async (
346
+ agentId: string,
347
+ operationId: string,
348
+ body
349
+ ) => {
284
350
  return await API.post<
285
351
  ConnectAgentSharePointSiteRequest,
286
352
  ConnectAgentSharePointSiteResponse
287
353
  >({
288
- url: `/api/agent/${agentId}/knowledge-sources/sharepoint/sites`,
354
+ url: `/api/agent/${agentId}/operations/${operationId}/knowledge-sources/sharepoint/sites`,
289
355
  body,
290
356
  })
291
357
  },
292
358
 
293
- updateAgentSharePointSite: async (agentId: string, siteId: string, body) => {
359
+ updateOperationSharePointSite: async (
360
+ agentId: string,
361
+ operationId: string,
362
+ siteId: string,
363
+ body
364
+ ) => {
294
365
  return await API.patch<
295
366
  UpdateAgentSharePointSiteRequest,
296
367
  UpdateAgentSharePointSiteResponse
297
368
  >({
298
- url: `/api/agent/${agentId}/knowledge-sources/sharepoint/sites/${encodeURIComponent(siteId)}`,
369
+ url: `/api/agent/${agentId}/operations/${operationId}/knowledge-sources/sharepoint/sites/${encodeURIComponent(siteId)}`,
299
370
  body,
300
371
  })
301
372
  },
302
373
 
303
- disconnectAgentSharePointSite: async (agentId: string, siteId: string) => {
374
+ disconnectOperationSharePointSite: async (
375
+ agentId: string,
376
+ operationId: string,
377
+ siteId: string
378
+ ) => {
304
379
  return await API.delete<void, DisconnectAgentSharePointSiteResponse>({
305
- url: `/api/agent/${agentId}/knowledge-sources/sharepoint/sites/${encodeURIComponent(siteId)}`,
380
+ url: `/api/agent/${agentId}/operations/${operationId}/knowledge-sources/sharepoint/sites/${encodeURIComponent(siteId)}`,
306
381
  })
307
382
  },
308
383
 
309
- syncAgentKnowledgeSources: async (agentId: string, sourceId: string) => {
384
+ syncOperationKnowledgeSources: async (
385
+ agentId: string,
386
+ operationId: string,
387
+ sourceId: string
388
+ ) => {
310
389
  return await API.post<
311
390
  SyncAgentKnowledgeSourcesRequest | undefined,
312
391
  SyncAgentKnowledgeSourcesResponse
313
392
  >({
314
- url: `/api/agent/${agentId}/knowledge-sources/${encodeURIComponent(sourceId)}/sync`,
393
+ url: `/api/agent/${agentId}/operations/${operationId}/knowledge-sources/${encodeURIComponent(sourceId)}/sync`,
315
394
  })
316
395
  },
317
396
 
318
- resetAgentKnowledgeBaseStore: async (agentId: string) => {
397
+ resetOperationKnowledgeBaseStore: async (
398
+ agentId: string,
399
+ operationId: string
400
+ ) => {
319
401
  await API.post({
320
- url: `/api/agent/${agentId}/knowledge/store/reset`,
402
+ url: `/api/agent/${agentId}/operations/${operationId}/knowledge/store/reset`,
321
403
  })
322
404
  },
323
405
  })
@@ -80,9 +80,9 @@
80
80
 
81
81
  $: readOnlyReason = getReadOnlyReason(agentAvailability)
82
82
 
83
- $: allowKnowledgeSourceDownload =
84
- enabledAgentList.find(agent => agent.agentId === selectedAgentId)
85
- ?.allowKnowledgeSourceDownload !== false
83
+ $: allowKnowledgeSourceDownload = enabledAgentList.find(
84
+ agent => agent.agentId === selectedAgentId
85
+ )?.allowKnowledgeSourceDownload
86
86
 
87
87
  const selectAgent = (agentId: string) => {
88
88
  dispatch("agentSelected", { agentId })
@@ -39,6 +39,7 @@
39
39
  detail: { chatId?: string; chat: ChatConversationLike }
40
40
  }) => void
41
41
  isAgentPreviewChat?: boolean
42
+ operationId?: string
42
43
  readOnly?: boolean
43
44
  readOnlyReason?: "disabled" | "deleted" | "offline"
44
45
  allowKnowledgeSourceDownload?: boolean
@@ -52,6 +53,7 @@
52
53
  initialPrompt = "",
53
54
  onchatsaved,
54
55
  isAgentPreviewChat = false,
56
+ operationId,
55
57
  readOnly = false,
56
58
  readOnlyReason,
57
59
  allowKnowledgeSourceDownload = true,
@@ -103,8 +105,14 @@
103
105
  source.fileId
104
106
  )
105
107
  ).url
106
- : chat?.agentId
107
- ? (await API.fetchAgentFileUrl(chat.agentId, source.fileId)).url
108
+ : isAgentPreviewChat && chat?.agentId && operationId
109
+ ? (
110
+ await API.fetchOperationFileUrl(
111
+ chat.agentId,
112
+ operationId,
113
+ source.fileId
114
+ )
115
+ ).url
108
116
  : undefined
109
117
  if (!resolvedUrl) {
110
118
  notifications.error("Could not resolve source file URL")
@@ -193,7 +193,7 @@
193
193
  value={readableValue}
194
194
  on:change={onChange}
195
195
  />
196
- {:else if filter.type === FieldType.ARRAY || (filter.type === FieldType.OPTIONS && filter.operator === ArrayOperator.ONE_OF)}
196
+ {:else if filter.type === FieldType.ARRAY || (filter.type === FieldType.OPTIONS && (filter.operator === ArrayOperator.ONE_OF || filter.operator === ArrayOperator.NOT_ONE_OF))}
197
197
  <Multiselect
198
198
  disabled={filter.noValue}
199
199
  options={getFieldOptions(filter.field)}