const STEERING_QUEUE_CAPACITY: usize = 256;
const FOLLOW_UP_QUEUE_CAPACITY: usize = 64;
pub(crate) fn clear_steering_queue(loop_ref: &super::AgentLoop) {
loop_ref.steering_queue.write().clear();
}
pub(crate) fn clear_follow_up_queue(loop_ref: &super::AgentLoop) {
loop_ref.follow_up_queue.write().clear();
}
pub(crate) fn clear_all_queues(loop_ref: &super::AgentLoop) {
clear_steering_queue(loop_ref);
clear_follow_up_queue(loop_ref);
}
pub(crate) fn drain_steering_queue(loop_ref: &super::AgentLoop) -> Vec<oxi_ai::Message> {
let mut queue = loop_ref.steering_queue.write();
queue.drain(..).collect()
}
pub(crate) fn drain_follow_up_queue(loop_ref: &super::AgentLoop) -> Vec<oxi_ai::Message> {
let mut queue = loop_ref.follow_up_queue.write();
queue.drain(..).collect()
}
pub(crate) fn try_push_steering(loop_ref: &super::AgentLoop, message: oxi_ai::Message) -> bool {
let mut queue = loop_ref.steering_queue.write();
if queue.len() >= STEERING_QUEUE_CAPACITY {
tracing::warn!(
capacity = STEERING_QUEUE_CAPACITY,
"Steering queue at capacity — dropping message"
);
return false;
}
queue.push(message);
true
}
pub(crate) fn try_push_follow_up(loop_ref: &super::AgentLoop, message: oxi_ai::Message) -> bool {
let mut queue = loop_ref.follow_up_queue.write();
if queue.len() >= FOLLOW_UP_QUEUE_CAPACITY {
tracing::warn!(
capacity = FOLLOW_UP_QUEUE_CAPACITY,
"Follow-up queue at capacity — dropping message"
);
return false;
}
queue.push(message);
true
}
#[allow(dead_code)]
pub(crate) fn steering_queue_len(loop_ref: &super::AgentLoop) -> usize {
loop_ref.steering_queue.read().len()
}
#[allow(dead_code)]
pub(crate) fn follow_up_queue_len(loop_ref: &super::AgentLoop) -> usize {
loop_ref.follow_up_queue.read().len()
}