@budibase/frontend-core 3.41.0 → 3.41.2
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 +20 -5
- package/src/api/chatApps.ts +3 -3
- package/src/api/chatLinks.ts +8 -5
- package/src/api/index.ts +2 -2
- package/src/api/types.ts +1 -1
- package/src/api/{app.ts → workspace.ts} +80 -74
- package/src/components/Chatbox/index.svelte +12 -7
- package/src/components/grid/cells/HeaderCell.svelte +17 -14
- package/src/components/grid/stores/datasources/nonPlus.ts +16 -6
- package/src/components/grid/stores/datasources/table.ts +16 -6
- package/src/components/grid/stores/datasources/viewV2.ts +59 -44
- package/src/components/grid/stores/rows.ts +5 -2
- package/src/components/grid/stores/sort.ts +47 -25
- package/src/fetch/DataFetch.ts +44 -35
- package/src/fetch/TableFetch.ts +28 -6
- package/src/fetch/ViewV2Fetch.ts +38 -8
- package/src/fetch/sort.test.ts +73 -0
- package/src/fetch/sort.ts +70 -0
- package/src/components/grid/layout/RowCount.svelte +0 -9
- package/src/icons/BBAI.svelte +0 -96
- /package/src/utils/validation/yup/{app.ts → workspace.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "3.41.
|
|
3
|
+
"version": "3.41.2",
|
|
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": "556bd76bac5c556b307b1022fce8e1fe51d928d7"
|
|
27
27
|
}
|
package/src/api/agents.ts
CHANGED
|
@@ -109,10 +109,15 @@ export interface AgentEndpoints {
|
|
|
109
109
|
datasourceId: string,
|
|
110
110
|
authConfigId: string
|
|
111
111
|
) => Promise<FetchAgentKnowledgeSourceOptionsResponse>
|
|
112
|
-
|
|
112
|
+
fetchOperationKnowledgeSourceEntries: (
|
|
113
113
|
agentId: string,
|
|
114
114
|
operationId: string,
|
|
115
|
-
siteId: string
|
|
115
|
+
siteId: string,
|
|
116
|
+
options?: {
|
|
117
|
+
driveId?: string
|
|
118
|
+
parentItemId?: string
|
|
119
|
+
parentPath?: string
|
|
120
|
+
}
|
|
116
121
|
) => Promise<FetchAgentKnowledgeSourceEntriesResponse>
|
|
117
122
|
connectOperationSharePointSite: (
|
|
118
123
|
agentId: string,
|
|
@@ -331,14 +336,24 @@ export const buildAgentEndpoints = (API: BaseAPIClient): AgentEndpoints => ({
|
|
|
331
336
|
})
|
|
332
337
|
},
|
|
333
338
|
|
|
334
|
-
|
|
339
|
+
fetchOperationKnowledgeSourceEntries: async (
|
|
335
340
|
agentId: string,
|
|
336
341
|
operationId: string,
|
|
337
|
-
siteId: string
|
|
342
|
+
siteId: string,
|
|
343
|
+
options
|
|
338
344
|
) => {
|
|
339
345
|
const query = new URLSearchParams({ siteId })
|
|
346
|
+
if (options?.driveId) {
|
|
347
|
+
query.set("driveId", options.driveId)
|
|
348
|
+
}
|
|
349
|
+
if (options?.parentItemId) {
|
|
350
|
+
query.set("parentItemId", options.parentItemId)
|
|
351
|
+
}
|
|
352
|
+
if (options?.parentPath) {
|
|
353
|
+
query.set("parentPath", options.parentPath)
|
|
354
|
+
}
|
|
340
355
|
return await API.get<FetchAgentKnowledgeSourceEntriesResponse>({
|
|
341
|
-
url: `/api/agent/${agentId}/operations/${operationId}/knowledge-sources/sharepoint/entries
|
|
356
|
+
url: `/api/agent/${agentId}/operations/${operationId}/knowledge-sources/sharepoint/entries?${query.toString()}`,
|
|
342
357
|
})
|
|
343
358
|
},
|
|
344
359
|
|
package/src/api/chatApps.ts
CHANGED
|
@@ -92,7 +92,7 @@ export const buildChatAppEndpoints = (
|
|
|
92
92
|
headers: {
|
|
93
93
|
"Content-Type": "application/json",
|
|
94
94
|
Accept: "application/json",
|
|
95
|
-
[Header.
|
|
95
|
+
[Header.WORKSPACE_ID]: workspaceId,
|
|
96
96
|
},
|
|
97
97
|
body: JSON.stringify(body),
|
|
98
98
|
credentials: "same-origin",
|
|
@@ -166,7 +166,7 @@ export const buildChatAppEndpoints = (
|
|
|
166
166
|
const url = "/api/chatapps"
|
|
167
167
|
const headers = workspaceId
|
|
168
168
|
? {
|
|
169
|
-
[Header.
|
|
169
|
+
[Header.WORKSPACE_ID]: workspaceId,
|
|
170
170
|
}
|
|
171
171
|
: undefined
|
|
172
172
|
return await API.get({
|
|
@@ -218,7 +218,7 @@ export const buildChatAppEndpoints = (
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
if (resolvedWorkspaceId) {
|
|
221
|
-
headers[Header.
|
|
221
|
+
headers[Header.WORKSPACE_ID] = resolvedWorkspaceId
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
const response = await fetch(`/api/chatapps/${chatAppId}/conversations`, {
|
package/src/api/chatLinks.ts
CHANGED
|
@@ -18,7 +18,8 @@ export interface MSTeamsChannel {
|
|
|
18
18
|
|
|
19
19
|
export interface ChatLinksEndpoints {
|
|
20
20
|
fetchChatIdentityLinks: (
|
|
21
|
-
provider?: ChatIdentityLinkProvider
|
|
21
|
+
provider?: ChatIdentityLinkProvider,
|
|
22
|
+
agentId?: string
|
|
22
23
|
) => Promise<ChatIdentityLink[]>
|
|
23
24
|
fetchSlackChannels: (agentId: string) => Promise<SlackChannel[]>
|
|
24
25
|
fetchMSTeamsChannels: (agentId: string) => Promise<MSTeamsChannel[]>
|
|
@@ -27,10 +28,12 @@ export interface ChatLinksEndpoints {
|
|
|
27
28
|
export const buildChatLinksEndpoints = (
|
|
28
29
|
API: BaseAPIClient
|
|
29
30
|
): ChatLinksEndpoints => ({
|
|
30
|
-
fetchChatIdentityLinks: async provider => {
|
|
31
|
-
const
|
|
32
|
-
?
|
|
33
|
-
:
|
|
31
|
+
fetchChatIdentityLinks: async (provider, agentId) => {
|
|
32
|
+
const params = new URLSearchParams({
|
|
33
|
+
...(provider ? { provider } : {}),
|
|
34
|
+
...(agentId ? { agentId } : {}),
|
|
35
|
+
}).toString()
|
|
36
|
+
const query = params ? `?${params}` : ""
|
|
34
37
|
return await API.get({ url: `/api/chat-links${query}` })
|
|
35
38
|
},
|
|
36
39
|
fetchSlackChannels: async agentId => {
|
package/src/api/index.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { Header } from "@budibase/shared-core"
|
|
|
13
13
|
import { ApiVersion } from "../constants"
|
|
14
14
|
import { buildAnalyticsEndpoints } from "./analytics"
|
|
15
15
|
import { buildAIEndpoints } from "./ai"
|
|
16
|
-
import { buildAppEndpoints } from "./
|
|
16
|
+
import { buildAppEndpoints } from "./workspace"
|
|
17
17
|
import { buildAttachmentEndpoints } from "./attachments"
|
|
18
18
|
import { buildAuthEndpoints } from "./auth"
|
|
19
19
|
import { buildAutomationEndpoints } from "./automations"
|
|
@@ -282,7 +282,7 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
|
|
|
282
282
|
getAppID: (): string => {
|
|
283
283
|
let headers: Headers = {}
|
|
284
284
|
config?.attachHeaders?.(headers)
|
|
285
|
-
return headers?.[Header.
|
|
285
|
+
return headers?.[Header.WORKSPACE_ID]
|
|
286
286
|
},
|
|
287
287
|
}
|
|
288
288
|
|
package/src/api/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AIEndpoints } from "./ai"
|
|
2
2
|
import { AnalyticsEndpoints } from "./analytics"
|
|
3
|
-
import { AppEndpoints } from "./
|
|
3
|
+
import { AppEndpoints } from "./workspace"
|
|
4
4
|
import { AttachmentEndpoints } from "./attachments"
|
|
5
5
|
import { AuditLogEndpoints } from "./auditLogs"
|
|
6
6
|
import { AuthEndpoints } from "./auth"
|
|
@@ -27,31 +27,35 @@ import {
|
|
|
27
27
|
import { BaseAPIClient } from "./types"
|
|
28
28
|
|
|
29
29
|
export interface AppEndpoints {
|
|
30
|
-
fetchAppPackage: (
|
|
30
|
+
fetchAppPackage: (workspaceId: string) => Promise<FetchAppPackageResponse>
|
|
31
31
|
saveAppMetadata: (
|
|
32
|
-
|
|
32
|
+
workspaceId: string,
|
|
33
33
|
metadata: UpdateWorkspaceRequest
|
|
34
34
|
) => Promise<UpdateWorkspaceResponse>
|
|
35
|
-
unpublishApp: (
|
|
35
|
+
unpublishApp: (workspaceId: string) => Promise<UnpublishWorkspaceResponse>
|
|
36
36
|
publishAppChanges: (
|
|
37
|
-
|
|
37
|
+
workspaceId: string,
|
|
38
38
|
opts?: PublishWorkspaceRequest
|
|
39
39
|
) => Promise<PublishWorkspaceResponse>
|
|
40
|
-
revertAppChanges: (
|
|
41
|
-
updateAppClientVersion: (
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
revertAppChanges: (workspaceId: string) => Promise<RevertWorkspaceResponse>
|
|
41
|
+
updateAppClientVersion: (
|
|
42
|
+
workspaceId: string
|
|
43
|
+
) => Promise<UpdateAppClientResponse>
|
|
44
|
+
revertAppClientVersion: (
|
|
45
|
+
workspaceId: string
|
|
46
|
+
) => Promise<RevertAppClientResponse>
|
|
47
|
+
releaseAppLock: (workspaceId: string) => Promise<ClearDevLockResponse>
|
|
44
48
|
getAppDeployments: () => Promise<FetchDeploymentResponse>
|
|
45
49
|
createApp: (
|
|
46
|
-
|
|
50
|
+
workspace: CreateWorkspaceRequest | FormData
|
|
47
51
|
) => Promise<CreateWorkspaceResponse>
|
|
48
|
-
deleteApp: (
|
|
52
|
+
deleteApp: (workspaceId: string) => Promise<DeleteWorkspaceResponse>
|
|
49
53
|
duplicateApp: (
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
workspaceId: string,
|
|
55
|
+
workspace: DuplicateWorkspaceRequest
|
|
52
56
|
) => Promise<DuplicateWorkspaceResponse>
|
|
53
57
|
updateAppFromExport: (
|
|
54
|
-
|
|
58
|
+
workspaceId: string,
|
|
55
59
|
body: ImportToUpdateWorkspaceRequest,
|
|
56
60
|
appExport: File
|
|
57
61
|
) => Promise<ImportToUpdateWorkspaceResponse>
|
|
@@ -60,7 +64,9 @@ export interface AppEndpoints {
|
|
|
60
64
|
fetchComponentLibDefinitions: (
|
|
61
65
|
workspaceId: string
|
|
62
66
|
) => Promise<FetchAppDefinitionResponse>
|
|
63
|
-
addSampleData: (
|
|
67
|
+
addSampleData: (
|
|
68
|
+
workspaceId: string
|
|
69
|
+
) => Promise<AddWorkspaceSampleDataResponse>
|
|
64
70
|
getPublishedApps: () => Promise<FetchPublishedAppsResponse["apps"]>
|
|
65
71
|
|
|
66
72
|
// Missing request or response types
|
|
@@ -69,69 +75,69 @@ export interface AppEndpoints {
|
|
|
69
75
|
|
|
70
76
|
export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
|
|
71
77
|
/**
|
|
72
|
-
* Fetches screen definition for
|
|
73
|
-
* @param
|
|
78
|
+
* Fetches screen definition for a workspace.
|
|
79
|
+
* @param workspaceId the ID of the workspace to fetch from
|
|
74
80
|
*/
|
|
75
|
-
fetchAppPackage: async
|
|
81
|
+
fetchAppPackage: async workspaceId => {
|
|
76
82
|
return await API.get({
|
|
77
|
-
url: `/api/applications/${
|
|
83
|
+
url: `/api/applications/${workspaceId}/appPackage`,
|
|
78
84
|
})
|
|
79
85
|
},
|
|
80
86
|
|
|
81
87
|
/**
|
|
82
|
-
* Saves and patches metadata about
|
|
83
|
-
* @param
|
|
84
|
-
* @param metadata the
|
|
88
|
+
* Saves and patches metadata about a workspace.
|
|
89
|
+
* @param workspaceId the ID of the workspace to update
|
|
90
|
+
* @param metadata the workspace metadata to save
|
|
85
91
|
*/
|
|
86
|
-
saveAppMetadata: async (
|
|
92
|
+
saveAppMetadata: async (workspaceId, metadata) => {
|
|
87
93
|
return await API.put({
|
|
88
|
-
url: `/api/applications/${
|
|
94
|
+
url: `/api/applications/${workspaceId}`,
|
|
89
95
|
body: metadata,
|
|
90
96
|
})
|
|
91
97
|
},
|
|
92
98
|
|
|
93
99
|
/**
|
|
94
|
-
* Publishes the current
|
|
100
|
+
* Publishes the current workspace.
|
|
95
101
|
*/
|
|
96
|
-
publishAppChanges: async (
|
|
102
|
+
publishAppChanges: async (workspaceId, opts) => {
|
|
97
103
|
return await API.post({
|
|
98
|
-
url: `/api/applications/${
|
|
104
|
+
url: `/api/applications/${workspaceId}/publish`,
|
|
99
105
|
body: opts,
|
|
100
106
|
})
|
|
101
107
|
},
|
|
102
108
|
|
|
103
109
|
/**
|
|
104
|
-
* Reverts
|
|
105
|
-
* @param
|
|
110
|
+
* Reverts a workspace to a previous version.
|
|
111
|
+
* @param workspaceId the workspace ID to revert
|
|
106
112
|
*/
|
|
107
|
-
revertAppChanges: async
|
|
113
|
+
revertAppChanges: async workspaceId => {
|
|
108
114
|
return await API.post({
|
|
109
|
-
url: `/api/dev/${
|
|
115
|
+
url: `/api/dev/${workspaceId}/revert`,
|
|
110
116
|
})
|
|
111
117
|
},
|
|
112
118
|
|
|
113
119
|
/**
|
|
114
|
-
* Updates
|
|
115
|
-
* @param
|
|
120
|
+
* Updates a workspace's version of the client library.
|
|
121
|
+
* @param workspaceId the workspace ID to update
|
|
116
122
|
*/
|
|
117
|
-
updateAppClientVersion: async
|
|
123
|
+
updateAppClientVersion: async workspaceId => {
|
|
118
124
|
return await API.post({
|
|
119
|
-
url: `/api/applications/${
|
|
125
|
+
url: `/api/applications/${workspaceId}/client/update`,
|
|
120
126
|
})
|
|
121
127
|
},
|
|
122
128
|
|
|
123
129
|
/**
|
|
124
|
-
* Reverts
|
|
125
|
-
* @param
|
|
130
|
+
* Reverts a workspace's client library to the previous version.
|
|
131
|
+
* @param workspaceId the workspace ID to revert
|
|
126
132
|
*/
|
|
127
|
-
revertAppClientVersion: async
|
|
133
|
+
revertAppClientVersion: async workspaceId => {
|
|
128
134
|
return await API.post({
|
|
129
|
-
url: `/api/applications/${
|
|
135
|
+
url: `/api/applications/${workspaceId}/client/revert`,
|
|
130
136
|
})
|
|
131
137
|
},
|
|
132
138
|
|
|
133
139
|
/**
|
|
134
|
-
* Gets a list of
|
|
140
|
+
* Gets a list of workspace deployments.
|
|
135
141
|
*/
|
|
136
142
|
getAppDeployments: async () => {
|
|
137
143
|
return await API.get({
|
|
@@ -140,44 +146,44 @@ export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
|
|
|
140
146
|
},
|
|
141
147
|
|
|
142
148
|
/**
|
|
143
|
-
* Creates
|
|
144
|
-
* @param
|
|
149
|
+
* Creates a workspace.
|
|
150
|
+
* @param workspace the workspace to create
|
|
145
151
|
*/
|
|
146
|
-
createApp: async
|
|
147
|
-
if (
|
|
152
|
+
createApp: async workspace => {
|
|
153
|
+
if (workspace instanceof FormData) {
|
|
148
154
|
return await API.post({
|
|
149
155
|
url: "/api/applications",
|
|
150
|
-
body:
|
|
156
|
+
body: workspace,
|
|
151
157
|
json: false,
|
|
152
158
|
})
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
return await API.post({
|
|
156
162
|
url: "/api/applications",
|
|
157
|
-
body:
|
|
163
|
+
body: workspace,
|
|
158
164
|
})
|
|
159
165
|
},
|
|
160
166
|
|
|
161
167
|
/**
|
|
162
|
-
* Duplicate an existing
|
|
163
|
-
* @param
|
|
168
|
+
* Duplicate an existing workspace
|
|
169
|
+
* @param workspace the workspace to duplicate
|
|
164
170
|
*/
|
|
165
|
-
duplicateApp: async (
|
|
171
|
+
duplicateApp: async (workspaceId, workspace) => {
|
|
166
172
|
return await API.post({
|
|
167
|
-
url: `/api/applications/${
|
|
168
|
-
body:
|
|
173
|
+
url: `/api/applications/${workspaceId}/duplicate`,
|
|
174
|
+
body: workspace,
|
|
169
175
|
})
|
|
170
176
|
},
|
|
171
177
|
|
|
172
178
|
/**
|
|
173
|
-
* Update
|
|
179
|
+
* Update a workspace using an export - the body
|
|
174
180
|
* should be of type FormData, with a "file" and a "password" if encrypted.
|
|
175
|
-
* @param
|
|
181
|
+
* @param workspaceId The ID of the workspace to update - this will always be
|
|
176
182
|
* converted to development ID.
|
|
177
183
|
* @param body a FormData body with a file and password.
|
|
178
184
|
*/
|
|
179
|
-
updateAppFromExport: async (
|
|
180
|
-
const devId = sdk.
|
|
185
|
+
updateAppFromExport: async (workspaceId, body, appExport) => {
|
|
186
|
+
const devId = sdk.workspaces.getDevWorkspaceID(workspaceId)
|
|
181
187
|
const formData = new FormData()
|
|
182
188
|
formData.append("appExport", appExport)
|
|
183
189
|
for (const [key, field] of Object.entries(body)) {
|
|
@@ -203,32 +209,32 @@ export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
|
|
|
203
209
|
},
|
|
204
210
|
|
|
205
211
|
/**
|
|
206
|
-
* Unpublishes a published
|
|
207
|
-
* @param
|
|
212
|
+
* Unpublishes a published workspace.
|
|
213
|
+
* @param workspaceId the production ID of the workspace to unpublish
|
|
208
214
|
*/
|
|
209
|
-
unpublishApp: async
|
|
215
|
+
unpublishApp: async workspaceId => {
|
|
210
216
|
return await API.post({
|
|
211
|
-
url: `/api/applications/${
|
|
217
|
+
url: `/api/applications/${workspaceId}/unpublish`,
|
|
212
218
|
})
|
|
213
219
|
},
|
|
214
220
|
|
|
215
221
|
/**
|
|
216
|
-
* Deletes a
|
|
217
|
-
* @param
|
|
222
|
+
* Deletes a development workspace.
|
|
223
|
+
* @param workspaceId the development workspace ID to delete
|
|
218
224
|
*/
|
|
219
|
-
deleteApp: async
|
|
225
|
+
deleteApp: async workspaceId => {
|
|
220
226
|
return await API.delete({
|
|
221
|
-
url: `/api/applications/${
|
|
227
|
+
url: `/api/applications/${workspaceId}`,
|
|
222
228
|
})
|
|
223
229
|
},
|
|
224
230
|
|
|
225
231
|
/**
|
|
226
|
-
* Releases the lock on a
|
|
227
|
-
* @param
|
|
232
|
+
* Releases the lock on a development workspace.
|
|
233
|
+
* @param workspaceId the development workspace ID to unlock
|
|
228
234
|
*/
|
|
229
|
-
releaseAppLock: async
|
|
235
|
+
releaseAppLock: async workspaceId => {
|
|
230
236
|
return await API.delete({
|
|
231
|
-
url: `/api/dev/${
|
|
237
|
+
url: `/api/dev/${workspaceId}/lock`,
|
|
232
238
|
})
|
|
233
239
|
},
|
|
234
240
|
|
|
@@ -242,7 +248,7 @@ export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
|
|
|
242
248
|
},
|
|
243
249
|
|
|
244
250
|
/**
|
|
245
|
-
* Gets a list of
|
|
251
|
+
* Gets a list of workspaces.
|
|
246
252
|
*/
|
|
247
253
|
getApps: async () => {
|
|
248
254
|
return await API.get({
|
|
@@ -253,21 +259,21 @@ export const buildAppEndpoints = (API: BaseAPIClient): AppEndpoints => ({
|
|
|
253
259
|
/**
|
|
254
260
|
* Fetches the definitions for component library components. This includes
|
|
255
261
|
* their props and other metadata from components.json.
|
|
256
|
-
* @param
|
|
262
|
+
* @param workspaceId ID of the currently running app
|
|
257
263
|
*/
|
|
258
|
-
fetchComponentLibDefinitions: async
|
|
264
|
+
fetchComponentLibDefinitions: async workspaceId => {
|
|
259
265
|
return await API.get({
|
|
260
|
-
url: `/api/${
|
|
266
|
+
url: `/api/${workspaceId}/components/definitions`,
|
|
261
267
|
})
|
|
262
268
|
},
|
|
263
269
|
|
|
264
270
|
/**
|
|
265
|
-
* Adds sample data to
|
|
266
|
-
* @param
|
|
271
|
+
* Adds sample data to a workspace
|
|
272
|
+
* @param workspaceId the app ID
|
|
267
273
|
*/
|
|
268
|
-
addSampleData: async
|
|
274
|
+
addSampleData: async workspaceId => {
|
|
269
275
|
return await API.post({
|
|
270
|
-
url: `/api/applications/${
|
|
276
|
+
url: `/api/applications/${workspaceId}/sample`,
|
|
271
277
|
})
|
|
272
278
|
},
|
|
273
279
|
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
persistConversation?: boolean
|
|
40
40
|
conversationStarters?: { prompt: string }[]
|
|
41
41
|
initialPrompt?: string
|
|
42
|
-
onchatsaved?: (
|
|
42
|
+
onchatsaved?: (event: {
|
|
43
43
|
detail: { chatId?: string; chat: ChatConversationLike }
|
|
44
44
|
}) => void
|
|
45
45
|
// Fired when an escalation parks; the consumer polls the outcome and
|
|
46
46
|
// injects it via appendAssistantMessage.
|
|
47
|
-
onEscalationPending?: (
|
|
47
|
+
onEscalationPending?: (detail: { escalationId: string }) => void
|
|
48
48
|
// Live resolution per escalationId (from the poll) - drives the card state.
|
|
49
49
|
escalationState?: Record<
|
|
50
50
|
string,
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
// Dev-only: show the inline Approve/Reject buttons on the escalation card.
|
|
54
54
|
showInlineApproval?: boolean
|
|
55
55
|
onResolve?: (
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
escalationId: string,
|
|
57
|
+
accepted: boolean
|
|
58
58
|
) => Promise<EscalationRespondResult | undefined>
|
|
59
59
|
isAgentPreviewChat?: boolean
|
|
60
60
|
readOnly?: boolean
|
|
@@ -93,6 +93,11 @@
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
// Only a genuinely-raised escalation gets the approval card
|
|
97
|
+
const isRaisedEscalation = (output: unknown) =>
|
|
98
|
+
(output as { status?: string } | undefined)?.status ===
|
|
99
|
+
EscalateToolResultStatus.PENDING_APPROVAL
|
|
100
|
+
|
|
96
101
|
// The escalate part's input/output are loosely typed by the AI SDK, so the
|
|
97
102
|
// casts live here rather than cluttering the template.
|
|
98
103
|
const escalationCardProps = (part: { input?: unknown; output?: unknown }) => {
|
|
@@ -113,7 +118,7 @@
|
|
|
113
118
|
createAPIClient({
|
|
114
119
|
attachHeaders: headers => {
|
|
115
120
|
if (workspaceId) {
|
|
116
|
-
headers[Header.
|
|
121
|
+
headers[Header.WORKSPACE_ID] = workspaceId
|
|
117
122
|
}
|
|
118
123
|
},
|
|
119
124
|
})
|
|
@@ -308,7 +313,7 @@
|
|
|
308
313
|
|
|
309
314
|
const chatInstance = new Chat<UIMessage<AgentMessageMetadata>>({
|
|
310
315
|
transport: new DefaultChatTransport({
|
|
311
|
-
headers: () => ({ [Header.
|
|
316
|
+
headers: () => ({ [Header.WORKSPACE_ID]: workspaceId }),
|
|
312
317
|
prepareSendMessagesRequest: ({ messages }) => {
|
|
313
318
|
const chatAppId = resolvedChatAppId || chat?.chatAppId
|
|
314
319
|
const conversationId = resolvedConversationId || chat?._id || "new"
|
|
@@ -777,7 +782,7 @@
|
|
|
777
782
|
{#each message.parts ?? [] as part, partIndex}
|
|
778
783
|
{#if isTextUIPart(part)}
|
|
779
784
|
<MarkdownViewer value={part.text} />
|
|
780
|
-
{:else if isToolUIPart(part) && getToolName(part) === ESCALATE_TOOL_NAME}
|
|
785
|
+
{:else if isToolUIPart(part) && getToolName(part) === ESCALATE_TOOL_NAME && isRaisedEscalation(part.output)}
|
|
781
786
|
{@const card = escalationCardProps(part)}
|
|
782
787
|
<EscalationCard
|
|
783
788
|
title={card.title}
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
let searchValue
|
|
55
55
|
let input
|
|
56
56
|
|
|
57
|
-
$:
|
|
57
|
+
$: columnSort = $sort.find(sortEntry => sortEntry.column === column.name)
|
|
58
|
+
$: sortedBy = !!columnSort
|
|
58
59
|
$: canMoveLeft = orderable && idx > 0
|
|
59
60
|
$: canMoveRight = orderable && idx < $scrollableColumns.length - 1
|
|
60
61
|
$: sortingLabels = getSortingLabels(column)
|
|
@@ -150,18 +151,22 @@
|
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
const sortAscending = () => {
|
|
153
|
-
sort.set(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
sort.set([
|
|
155
|
+
{
|
|
156
|
+
column: column.name,
|
|
157
|
+
order: SortOrder.ASCENDING,
|
|
158
|
+
},
|
|
159
|
+
])
|
|
157
160
|
open = false
|
|
158
161
|
}
|
|
159
162
|
|
|
160
163
|
const sortDescending = () => {
|
|
161
|
-
sort.set(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
sort.set([
|
|
165
|
+
{
|
|
166
|
+
column: column.name,
|
|
167
|
+
order: SortOrder.DESCENDING,
|
|
168
|
+
},
|
|
169
|
+
])
|
|
165
170
|
open = false
|
|
166
171
|
}
|
|
167
172
|
|
|
@@ -341,7 +346,7 @@
|
|
|
341
346
|
<Icon
|
|
342
347
|
hoverable
|
|
343
348
|
size="S"
|
|
344
|
-
name={
|
|
349
|
+
name={columnSort?.order === SortOrder.DESCENDING
|
|
345
350
|
? "sort-descending"
|
|
346
351
|
: "sort-ascending"}
|
|
347
352
|
/>
|
|
@@ -389,8 +394,7 @@
|
|
|
389
394
|
icon="sort-ascending"
|
|
390
395
|
on:click={sortAscending}
|
|
391
396
|
disabled={!canBeSortColumn(column.schema) ||
|
|
392
|
-
|
|
393
|
-
$sort.order === SortOrder.ASCENDING)}
|
|
397
|
+
columnSort?.order === SortOrder.ASCENDING}
|
|
394
398
|
>
|
|
395
399
|
Sort {sortingLabels.ascending}
|
|
396
400
|
</MenuItem>
|
|
@@ -398,8 +402,7 @@
|
|
|
398
402
|
icon="sort-descending"
|
|
399
403
|
on:click={sortDescending}
|
|
400
404
|
disabled={!canBeSortColumn(column.schema) ||
|
|
401
|
-
|
|
402
|
-
$sort.order === SortOrder.DESCENDING)}
|
|
405
|
+
columnSort?.order === SortOrder.DESCENDING}
|
|
403
406
|
>
|
|
404
407
|
Sort {sortingLabels.descending}
|
|
405
408
|
</MenuItem>
|
|
@@ -93,10 +93,17 @@ export const initialise = (context: StoreContext) => {
|
|
|
93
93
|
// Wipe state
|
|
94
94
|
filter.set(get(initialFilter) ?? undefined)
|
|
95
95
|
inlineFilters.set([])
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
const initialColumn = get(initialSortColumn)
|
|
97
|
+
sort.set(
|
|
98
|
+
initialColumn
|
|
99
|
+
? [
|
|
100
|
+
{
|
|
101
|
+
column: initialColumn,
|
|
102
|
+
order: get(initialSortOrder) || SortOrder.ASCENDING,
|
|
103
|
+
},
|
|
104
|
+
]
|
|
105
|
+
: []
|
|
106
|
+
)
|
|
100
107
|
|
|
101
108
|
// Update fetch when filter changes
|
|
102
109
|
unsubscribers.push(
|
|
@@ -120,9 +127,12 @@ export const initialise = (context: StoreContext) => {
|
|
|
120
127
|
if (!isSameDatasource($fetch?.options?.datasource, $datasource)) {
|
|
121
128
|
return
|
|
122
129
|
}
|
|
130
|
+
const sorts = $sort.map(sortEntry => ({
|
|
131
|
+
field: sortEntry.column,
|
|
132
|
+
order: sortEntry.order,
|
|
133
|
+
}))
|
|
123
134
|
$fetch?.update({
|
|
124
|
-
|
|
125
|
-
sortColumn: $sort.column ?? undefined,
|
|
135
|
+
sorts,
|
|
126
136
|
})
|
|
127
137
|
})
|
|
128
138
|
)
|
|
@@ -111,10 +111,17 @@ export const initialise = (context: StoreContext) => {
|
|
|
111
111
|
// Wipe state
|
|
112
112
|
filter.set(get(initialFilter) ?? undefined)
|
|
113
113
|
inlineFilters.set([])
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
const initialColumn = get(initialSortColumn)
|
|
115
|
+
sort.set(
|
|
116
|
+
initialColumn
|
|
117
|
+
? [
|
|
118
|
+
{
|
|
119
|
+
column: initialColumn,
|
|
120
|
+
order: get(initialSortOrder) || SortOrder.ASCENDING,
|
|
121
|
+
},
|
|
122
|
+
]
|
|
123
|
+
: []
|
|
124
|
+
)
|
|
118
125
|
|
|
119
126
|
// Update fetch when filter changes
|
|
120
127
|
unsubscribers.push(
|
|
@@ -138,9 +145,12 @@ export const initialise = (context: StoreContext) => {
|
|
|
138
145
|
if ($fetch?.options?.datasource?.tableId !== $datasource.tableId) {
|
|
139
146
|
return
|
|
140
147
|
}
|
|
148
|
+
const sorts = $sort.map(sortEntry => ({
|
|
149
|
+
field: sortEntry.column,
|
|
150
|
+
order: sortEntry.order,
|
|
151
|
+
}))
|
|
141
152
|
$fetch.update({
|
|
142
|
-
|
|
143
|
-
sortColumn: $sort.column ?? undefined,
|
|
153
|
+
sorts,
|
|
144
154
|
})
|
|
145
155
|
})
|
|
146
156
|
)
|