Files
Davide Silvestri 9f9e068a27 feat(agent): show waiting approvals and let editors stop the asking (#6610)
* feat(agent): count pending approvals per application and conversation

* feat(agent): show waiting approvals in the sidebar, header and conversation list

* feat(agent): always allow a held tool from the approval

* feat(agent): add Always allow and the ask before changes switch

* fix(agent): read pending counts from the primary and lock the conversation first

* test(agent): run approval test actions through the action registry

* test(agent): read the decision result in the web search approval test

* test(agent): let the waiting conversations request start before answering it

* fix(agent): keep older waiting conversations through a reconnect

* perf(agent): count pending approvals for many users and conversations at once

The core hook takes many users and returns counts per user and application, so
creating or restoring an Agent and the count task count once for all members
instead of once per member; the task sends every count in one broadcast.
Pending approvals are defined once, and a page of conversations gets its counts
in one query passed to the serializer, like its runs, instead of an annotation
with a per-object fallback.

* refactor(agent): return one decision result and name the count signal after its event

The service and the action both return the decision result, which carries the
approved and rejected tools, so they are computed once for the audit params and
Always allow. Always allow bumps the Agent's updated_on like a configuration
update. The signal is renamed application_pending_count_updated, like its
websocket event.

* fix(agent): keep the deciding tab's waiting counts current

A decision lowers the Agent's count before its request and restores it when the
request fails, unless the call was decided elsewhere. Its conversation count
goes through the tracked update, so a list read that started earlier restarts
instead of bringing the old count back. The pill adds only the waiting
conversations it hadn't loaded, and leaves a conversation picked while it loads
selected.

* chore(agent): describe the ask switch and drop the unused counter class

The ask switch is described by its text and the row separator is hidden from
screen readers. The sidebar no longer adds tree__action--has-counter, whose
padding --has-options already sets.

* test: give fixture fields unique default names

Two fields of one table could get the same random name, so a formula
referencing the other field referenced itself and failed with
SelfReferenceFieldDependencyError.

* refactor(agent): show the sidebar count with the warning counter

The admin Templates count added badge-counter--warning, so the Agent's count
uses it too instead of its own yellow color prop on BadgeCounter.

* fix(agent): reconcile approval counts and cycle loaded conversations

* fix(agent): name the tools Always allow stops asking for

* fix(agent): load older pages until the pill reaches a waiting conversation
2026-11-11 17:25:51 +00:00

34 lines
1.1 KiB
JavaScript

import { getRealtimeRecoveryRequestConfig } from '@baserow/modules/core/plugins/realtimeProtocol'
export default (client) => {
return {
fetchAll(workspaceId = null) {
const workspaceUrl =
workspaceId !== null ? `workspace/${workspaceId}/` : ''
return client.get(`/applications/${workspaceUrl}`)
},
create(workspaceId, values) {
return client.post(`/applications/workspace/${workspaceId}/`, values)
},
asyncDuplicate(applicationId) {
return client.post(`/applications/${applicationId}/duplicate/async/`)
},
get(applicationId, { realtimeRecovery = false } = {}) {
return client.get(`/applications/${applicationId}/`, {
...(realtimeRecovery ? getRealtimeRecoveryRequestConfig() : {}),
})
},
update(applicationId, values) {
return client.patch(`/applications/${applicationId}/`, values)
},
order(workspaceId, order) {
return client.post(`/applications/workspace/${workspaceId}/order/`, {
application_ids: order,
})
},
delete(applicationId) {
return client.delete(`/applications/${applicationId}/`)
},
}
}