LazyBoy2/crates/grokboy-core/src/lib.rs

37 lines
1.4 KiB
Rust

//! GrokBoy core: config, streaming chat, tools, ReAct agent, sessions.
mod agent;
mod browser;
mod confirm;
mod config;
mod model;
mod session;
mod tools;
pub use agent::{
AGENT_SYSTEM, AgentVerdict, DEFAULT_CONTEXT_CHARS, DEFAULT_MAX_ROUNDS,
DEFAULT_MAX_ROUNDS_TOTAL, LOOP_GUARD_REPEAT, context_char_budget, max_rounds_budget,
max_rounds_total_budget, message_char_len, messages_char_len, round_signature, run_agent,
run_agent_with, tool_call_signature, truncate_messages,
};
pub use browser::{INSTALL_HINT as BROWSER_INSTALL_HINT, HandoffWait, browser_oneshot, browser_self_test, find_helper_script, wait_for_handoff_resume};
pub use confirm::{ConfirmWait, confirm_tool_definition, execute_request_user_confirm, wait_for_user_confirm};
pub use config::Config;
pub use model::{ChatMessage, FunctionCall, Role, ToolCall, chat_completion, stream_chat};
pub use session::{Session, load_or_create, load_session, save_session, sessions_dir};
pub use tools::{ToolContext, execute_tool, is_completion_tool, tool_definitions};
/// Serialize tests that mutate process env (CONFIRM_AUTO / HANDOFF_AUTO).
#[cfg(test)]
pub(crate) mod test_env {
use std::sync::{Mutex, MutexGuard, OnceLock};
pub(crate) fn lock() -> MutexGuard<'static, ()> {
static M: OnceLock<Mutex<()>> = OnceLock::new();
M.get_or_init(|| Mutex::new(()))
.lock()
.unwrap_or_else(|e| e.into_inner())
}
}