mod env;
pub use env::{
build_base_env, expand_env_ref, expand_env_ref_with_allowlist, substitute, PlaceholderError,
SubstCtx,
};
mod error;
pub mod history;
mod protocol;
mod profile;
mod runner;
#[cfg(feature = "executors")]
pub mod executors;
#[cfg(test)]
mod conformance;
pub use error::{protocol_error, ProtocolError, RunnerError};
pub use protocol::{
parse_event, read_turn, Attachment, AgentEvent, PartialRole, PermissionBehavior,
PermissionRequest, PermissionResponse, TurnInput, TurnObject, PROTOCOL_VERSION,
};
pub use profile::Profile;
pub use runner::{run, RunOptions, RunResult};
#[cfg(feature = "executors")]
pub use executors::{
executor_names, Executor, ParseResult, TurnHandlers, UnknownExecutor,
};
pub type PermissionFuture = std::pin::Pin<Box<dyn std::future::Future<Output = PermissionDecision> + Send>>;
#[derive(Debug, Clone)]
pub enum PermissionDecision {
Allow { updated_input: Option<serde_json::Value> },
Deny { message: String },
}
impl PermissionDecision {
pub fn allow() -> Self {
Self::Allow { updated_input: None }
}
pub fn deny(reason: impl Into<String>) -> Self {
Self::Deny { message: reason.into() }
}
}