use std::sync::Arc;
use crate::{browser::BrowserSession, console::Sandbox, message::Message};
#[derive(Default)]
pub struct AgentState {
pub history: Vec<Message>,
pub sandbox: Option<Sandbox>,
pub last_input_tokens: Option<u64>,
pub(crate) browser: Option<Arc<BrowserSession>>,
}
impl AgentState {
pub fn new() -> Self {
Self::default()
}
pub fn with_history(mut self, history: impl IntoIterator<Item = Message>) -> Self {
self.history = history.into_iter().collect();
self
}
pub fn with_sandbox(mut self, sandbox: Sandbox) -> Self {
self.sandbox = Some(sandbox);
self
}
pub(crate) fn with_browser(mut self, browser: Arc<BrowserSession>) -> Self {
self.browser = Some(browser);
self
}
}