use std::collections::BTreeMap;
use std::path::PathBuf;
use std::sync::Arc;
pub use ag_agent::{
AgentBackend, AgentBackendError, AppServerClient, AppServerError, AppServerTurnResponse,
MockAgentBackend, MockAppServerClient, RealOneShotClient, instruction_bootstrap_key,
};
use ag_contracts::{AgentChannel, OneShotClient};
use ag_session::AgentKind;
use super::{RuntimeFactory, SessionRuntime, UtilityRuntime};
pub fn cli_runtime(backend: std::sync::Arc<dyn AgentBackend>, kind: AgentKind) -> SessionRuntime {
SessionRuntime::from_channel(ag_agent::create_cli_agent_channel_with_backend(
backend, kind,
))
}
impl RuntimeFactory {
pub fn with_app_server(client: Arc<dyn ag_agent::AppServerClient>) -> Self {
Self {
app_server: Some(client),
..Self::default()
}
}
#[must_use]
pub fn with_native_harness_environment(
mut self,
data_root: PathBuf,
environment: BTreeMap<String, String>,
) -> Self {
self.native_harness = Some(ag_agent::NativeHarnessConfig::with_environment(
data_root,
move || environment.clone(),
));
self
}
}
impl SessionRuntime {
pub fn from_channel(channel: Arc<dyn AgentChannel>) -> Self {
Self { channel }
}
}
impl UtilityRuntime {
pub fn from_client(client: Arc<dyn OneShotClient>) -> Self {
Self { client }
}
}