Files
Davide Silvestri 9af8a8422e feat(agent): rate-limit agent triggers and let a busy trigger skip or wait (#6672)
* feat(agent): rate-limit agent triggers and let a busy trigger skip or wait

* feat(agent): choose a trigger's overlap rule and show skipped firings

* feat(agent): let a trigger run its replies in parallel

A third overlap rule, Run in parallel, starts up to
BASEROW_AGENT_TRIGGER_MAX_PARALLEL_RUNS replies at once (default 5) and
queues the rest up to the queue cap. Skip, Wait and Parallel now share one
rule (OverlapLimits): start while there is room to go and nothing is
queued ahead, queue while the queue has room, else skip. A firing held
back by the workspace's run limit queues where the rule queues. The
hand-off and the sweep start as many queued replies as fit.

* test(agent): pin the trigger lock order a hand-off and a builder's save rely on

* fix(agent): lock agent before firing its trigger

* fix(agent): tighten trigger overlap counts and limit parsing

- A reply in a trashed conversation no longer counts as going, so it
  can't block a trigger until the trash is emptied.
- A message that fails to resolve fails its reply before the overlap
  rule, so the builder sees it instead of a skip.
- The hand-off locks only the queued replies that can start.
- Rate-limit pairs must be positive integers.
- The API help text describes `parallel`.

* fix(agent): hand a trigger's queue on in its own task

- When a trigger's reply ends, a task started with the trigger's id
  starts its queued replies, instead of the ending reply's save doing
  it. With the broker down, a hand-off fails at most one reply instead
  of the whole queue, and the reply's save no longer loads the trigger.
- The hand-off and the sweep check what a firing checks: Agents on, the
  trigger type available and the agent ready. A trigger that can't fire
  keeps its queue until it can.
2026-11-13 17:38:50 +01:00

87 lines
1.8 KiB
Vue

<template>
<div class="radio" :class="classNames" @click="select(value)">
<div v-if="loading" class="radio__loading"></div>
<div v-else class="radio__input">
<input
type="radio"
:name="name"
:value="value"
:checked="modelValue === value"
:disabled="disabled || loading"
:aria-labelledby="hasSlot ? labelId : null"
/>
<label></label>
</div>
<div v-if="hasSlot" :id="labelId" class="radio__label">
<slot></slot>
</div>
</div>
</template>
<script>
import { useId } from 'vue'
export default {
name: 'Radio',
props: {
value: {
type: [String, Number, Boolean, Object],
required: false,
default: '',
},
modelValue: {
type: [String, Number, Boolean, Object],
required: false,
default: '',
},
disabled: {
type: Boolean,
required: false,
default: false,
},
loading: {
type: Boolean,
required: false,
default: false,
},
/**
* Groups radios sharing it, so arrow keys move between them.
*/
name: {
type: String,
required: false,
default: null,
},
},
emits: ['input', 'update:modelValue'],
setup() {
return { labelId: useId() }
},
computed: {
classNames() {
return {
'radio--active': this.modelValue === this.value,
'radio--disabled': this.disabled,
'radio--loading': this.loading,
selected: this.modelValue === this.value,
}
},
selected() {
return this.modelValue === this.value
},
hasSlot() {
return !!this.$slots.default
},
},
methods: {
select(value) {
if (this.disabled || this.selected || this.loading) {
return
}
this.$emit('update:modelValue', value)
this.$emit('input', value)
},
},
}
</script>