mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 16:28:31 +00:00
* feat(agent): configure who can chat, approve and continue triggered runs Approving held tool calls and continuing a conversation a trigger started become their own operations. With RBAC, an agent's Permissions section sets who may chat, approve and continue: a lowest role, specific people or teams, or nobody. Without RBAC every member chats and approves, and nobody continues. The owner of a private conversation can ask others to approve its held calls, and leave it to them. * feat(agent): let everyone in a private conversation leave it and name who stopped a reply Anyone asked to approve can now remove a private conversation from their own list; only its owner deletes it for everyone. Once the owner has left, the last person to leave deletes it for good, as only an owner's trash may list a private conversation. A reply someone else stopped says who stopped it. * fix(agent): close the gaps a security review of participation found Keep a triggered conversation's opening message untrusted when a person continues it, audit changes to who can chat, approve and continue, and require being able to chat to ask others to approve. People asked to approve follow runs only while they may read the conversations, the approver picker scans at most a thousand members, and the permission object lists only the agents the person may see. A reply whose sender was deleted can still be resumed by someone asked to approve it. * docs(agent): add the participation test plan with its results Cover every participation setting, asking others to approve, leaving a private conversation and stopping replies, with the outcome of the e2e run and the findings of the security review. * fix(agent): address the review of participation permissions - Name only people's messages to the model: a trigger's opening message no longer reads as written by a deleted user. - Check the approver candidates in one pass, so the number of queries doesn't grow with the workspace. - Show the read-only note only to who can't write in a conversation. - Take a person who leaves the workspace out of the conversations they were asked into and the rules naming them, and delete the conversations nobody is left in. - Record a rule change and its audit entry in one transaction. - Refuse a custom approve rule nobody named in it could use. * docs(agent): update the participation test plan after the review
113 lines
3.7 KiB
JavaScript
113 lines
3.7 KiB
JavaScript
import { getRealtimeRecoveryRequestConfig } from '@baserow/modules/core/plugins/realtimeProtocol'
|
|
|
|
// Fill tall conversation lists in one request with lightweight list metadata.
|
|
const CONVERSATION_PAGE_SIZE = 100
|
|
const MESSAGE_PAGE_SIZE = 50
|
|
|
|
export default (client) => ({
|
|
get(agentId) {
|
|
return client.get(`/agent/${agentId}/`)
|
|
},
|
|
recordView(agentId) {
|
|
return client.post(`/agent/${agentId}/`)
|
|
},
|
|
getConfiguration(agentId, realtimeRecovery = false) {
|
|
return client.get(`/agent/${agentId}/configuration/`, {
|
|
...(realtimeRecovery ? getRealtimeRecoveryRequestConfig() : {}),
|
|
})
|
|
},
|
|
getWorkspaceTools(workspaceId) {
|
|
return client.get(`/agent/tools/workspace/${workspaceId}/`)
|
|
},
|
|
getRunAsIdentities(agentId, page = 1, search = '') {
|
|
return client.get(`/agent/${agentId}/run-as-identities/`, {
|
|
params: { page, search, size: 100 },
|
|
// Opening the picker revalidates choices, including changes missed while
|
|
// disconnected. A lagging replica must not reintroduce a deleted choice.
|
|
...getRealtimeRecoveryRequestConfig(),
|
|
})
|
|
},
|
|
updateConfiguration(agentId, { run_as: runAs, ...values }) {
|
|
if (runAs !== undefined) {
|
|
values.run_as_subject_type = runAs?.type ?? null
|
|
values.run_as_subject_id = runAs?.id ?? null
|
|
}
|
|
return client.patch(`/agent/${agentId}/configuration/`, values)
|
|
},
|
|
getConversations(
|
|
agentId,
|
|
cursor = null,
|
|
{ realtimeRecovery = false, ...filters } = {}
|
|
) {
|
|
return client.get(`/agent/${agentId}/conversations/`, {
|
|
params: {
|
|
cursor,
|
|
limit: CONVERSATION_PAGE_SIZE,
|
|
...filters,
|
|
},
|
|
...(realtimeRecovery ? getRealtimeRecoveryRequestConfig() : {}),
|
|
})
|
|
},
|
|
createConversation(agentId, values) {
|
|
return client.post(`/agent/${agentId}/conversations/`, values)
|
|
},
|
|
updateConversation(agentId, conversationUuid, values) {
|
|
return client.patch(
|
|
`/agent/${agentId}/conversations/${conversationUuid}/`,
|
|
values
|
|
)
|
|
},
|
|
shareConversation(agentId, conversationUuid) {
|
|
return client.post(
|
|
`/agent/${agentId}/conversations/${conversationUuid}/share/`
|
|
)
|
|
},
|
|
leaveConversation(agentId, conversationUuid) {
|
|
return client.post(
|
|
`/agent/${agentId}/conversations/${conversationUuid}/leave/`
|
|
)
|
|
},
|
|
getApproverCandidates(agentId, conversationUuid, page, search) {
|
|
return client.get(
|
|
`/agent/${agentId}/conversations/${conversationUuid}/approvers/`,
|
|
{ params: { page, search } }
|
|
)
|
|
},
|
|
requestApproval(agentId, conversationUuid, userIds) {
|
|
return client.post(
|
|
`/agent/${agentId}/conversations/${conversationUuid}/approvers/`,
|
|
{ user_ids: userIds }
|
|
)
|
|
},
|
|
deleteConversation(agentId, conversationUuid) {
|
|
return client.delete(`/agent/${agentId}/conversations/${conversationUuid}/`)
|
|
},
|
|
getMessages(agentId, conversationUuid, page = 1, realtimeRecovery = false) {
|
|
return client.get(
|
|
`/agent/${agentId}/conversations/${conversationUuid}/messages/`,
|
|
{
|
|
params: { page, size: MESSAGE_PAGE_SIZE },
|
|
...(realtimeRecovery ? getRealtimeRecoveryRequestConfig() : {}),
|
|
}
|
|
)
|
|
},
|
|
createMessage(agentId, conversationUuid, values) {
|
|
return client.post(
|
|
`/agent/${agentId}/conversations/${conversationUuid}/messages/`,
|
|
values
|
|
)
|
|
},
|
|
getPendingApprovals(agentId, page = 1) {
|
|
return client.get(`/agent/${agentId}/pending-approvals/`, {
|
|
params: { page, size: 20 },
|
|
...getRealtimeRecoveryRequestConfig(),
|
|
})
|
|
},
|
|
decideApprovals(agentId, conversationUuid, decisions, { alwaysAllow } = {}) {
|
|
return client.post(
|
|
`/agent/${agentId}/conversations/${conversationUuid}/approvals/`,
|
|
{ decisions, ...(alwaysAllow ? { always_allow: true } : {}) }
|
|
)
|
|
},
|
|
})
|