2026-09-13 07:42:59 +00:00
|
|
|
//! GrokBoy core: config, streaming chat, tools, ReAct agent, sessions.
|
2026-09-13 07:25:02 +00:00
|
|
|
|
2026-09-13 07:42:59 +00:00
|
|
|
mod agent;
|
2026-09-13 16:38:32 +00:00
|
|
|
mod browser_client;
|
|
|
|
|
mod jobs;
|
|
|
|
|
mod runtime;
|
|
|
|
|
pub mod team;
|
|
|
|
|
pub use runtime::{AgentEvent, InputBroker, PlanStep, Runtime, StepStatus};
|
2026-09-13 07:57:57 +00:00
|
|
|
mod browser;
|
2026-09-13 07:25:02 +00:00
|
|
|
mod config;
|
2026-09-13 16:38:32 +00:00
|
|
|
mod confirm;
|
2026-09-13 07:25:02 +00:00
|
|
|
mod model;
|
2026-09-13 07:42:59 +00:00
|
|
|
mod session;
|
|
|
|
|
mod tools;
|
2026-09-13 07:25:02 +00:00
|
|
|
|
2026-09-13 07:51:13 +00:00
|
|
|
pub use agent::{
|
2026-09-13 16:38:32 +00:00
|
|
|
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, AgentVerdict, AGENT_SYSTEM, DEFAULT_CONTEXT_CHARS, DEFAULT_MAX_ROUNDS,
|
|
|
|
|
DEFAULT_MAX_ROUNDS_TOTAL, LOOP_GUARD_REPEAT,
|
|
|
|
|
};
|
|
|
|
|
pub use browser::{
|
|
|
|
|
browser_oneshot, browser_self_test, find_helper_script, wait_for_handoff_resume, HandoffWait,
|
|
|
|
|
INSTALL_HINT as BROWSER_INSTALL_HINT,
|
2026-09-13 07:51:13 +00:00
|
|
|
};
|
2026-09-13 07:25:02 +00:00
|
|
|
pub use config::Config;
|
2026-09-13 16:38:32 +00:00
|
|
|
pub use confirm::{
|
|
|
|
|
confirm_tool_definition, execute_request_user_confirm, wait_for_user_confirm, ConfirmWait,
|
|
|
|
|
};
|
|
|
|
|
pub use model::{chat_completion, stream_chat, ChatMessage, FunctionCall, Role, ToolCall};
|
|
|
|
|
pub use session::{load_or_create, load_session, save_session, sessions_dir, Session};
|
|
|
|
|
pub use tools::{execute_tool, is_completion_tool, tool_definitions, ToolContext};
|
2026-09-13 08:54:48 +00:00
|
|
|
|
|
|
|
|
/// Serialize tests that mutate process env (CONFIRM_AUTO / HANDOFF_AUTO).
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
pub(crate) mod test_env {
|
2026-09-13 16:38:32 +00:00
|
|
|
use std::sync::OnceLock;
|
|
|
|
|
use tokio::sync::{Mutex, MutexGuard};
|
|
|
|
|
fn mutex() -> &'static Mutex<()> {
|
2026-09-13 08:54:48 +00:00
|
|
|
static M: OnceLock<Mutex<()>> = OnceLock::new();
|
|
|
|
|
M.get_or_init(|| Mutex::new(()))
|
2026-09-13 16:38:32 +00:00
|
|
|
}
|
|
|
|
|
pub fn lock() -> MutexGuard<'static, ()> {
|
|
|
|
|
mutex().blocking_lock()
|
|
|
|
|
}
|
|
|
|
|
pub async fn lock_async() -> MutexGuard<'static, ()> {
|
|
|
|
|
mutex().lock().await
|
2026-09-13 08:54:48 +00:00
|
|
|
}
|
|
|
|
|
}
|