liminal-cli 0.3.4

The liminal command: serve the network, maintain its stores, or serve its discovery MCP over stdio
Documentation
use std::collections::VecDeque;

pub(super) struct Prompts {
    bound: usize,
    unread: VecDeque<String>,
}

impl Prompts {
    pub const fn new(bound: usize) -> Self {
        Self {
            bound,
            unread: VecDeque::new(),
        }
    }
    pub fn push(&mut self, text: String) -> anyhow::Result<()> {
        anyhow::ensure!(
            self.unread.len() < self.bound,
            "prompt_queue {} reached: {} unread prompts",
            self.bound,
            self.unread.len()
        );
        self.unread.push_back(text);
        Ok(())
    }
    pub fn pop(&mut self) -> Option<String> {
        self.unread.pop_front()
    }
    pub fn len(&self) -> usize {
        self.unread.len()
    }
}