haematite-cli 0.21.1

The haematite command: serve a store, its door and Studio, answer MCP, query with jq, and host the store's assistant seat
Documentation
use serde_json::Value;
use std::collections::VecDeque;

pub(super) struct Prompt {
    pub id: Value,
    pub text: String,
}
pub(super) struct Prompts {
    waiting: VecDeque<Prompt>,
    bound: usize,
}
impl Prompts {
    pub const fn new(bound: usize) -> Self {
        Self {
            waiting: VecDeque::new(),
            bound,
        }
    }
    pub fn push(&mut self, prompt: Prompt) -> Result<(), &'static str> {
        if self.waiting.len() >= self.bound {
            return Err("prompt_queue_full");
        }
        self.waiting.push_back(prompt);
        Ok(())
    }
    pub fn pop(&mut self) -> Option<Prompt> {
        self.waiting.pop_front()
    }
    pub fn len(&self) -> usize {
        self.waiting.len()
    }
}