Skip to main content

Env

Struct Env 

Source
pub struct Env<H: Host = NoHost> {
    pub host: H,
    /* private fields */
}

Fields§

§host: H

Host providing server-specific functionality.

Implementations§

Source§

impl<H: Host> Env<H>

Source

pub fn new( skills: SkillHandler, mcp: McpHandler, cwd: PathBuf, memory: Option<Memory>, host: H, ) -> Self

Create a new Env with the given backends.

Source

pub fn memory(&self) -> Option<&Memory>

Access memory.

Source

pub fn mcp_servers(&self) -> Vec<(String, Vec<String>)>

List connected MCP servers with their tool names.

Source

pub fn register_scope(&mut self, name: String, config: &AgentConfig)

Register an agent’s scope for dispatch enforcement.

Source

pub async fn dispatch_tool( &self, name: &str, args: &str, agent: &str, sender: &str, conversation_id: Option<u64>, ) -> Result<String, String>

Route a tool call by name to the appropriate handler.

Source§

impl<H: Host> Env<H>

Source

pub async fn dispatch_mcp( &self, args: &str, agent: &str, ) -> Result<String, String>

Source§

impl<H: Host> Env<H>

Source

pub async fn dispatch_recall(&self, args: &str) -> Result<String, String>

Source

pub async fn dispatch_remember(&self, args: &str) -> Result<String, String>

Source

pub async fn dispatch_forget(&self, args: &str) -> Result<String, String>

Source

pub async fn dispatch_memory(&self, args: &str) -> Result<String, String>

Source§

impl<H: Host> Env<H>

Source

pub async fn dispatch_edit( &self, args: &str, conversation_id: Option<u64>, ) -> Result<String, String>

Source§

impl<H: Host> Env<H>

Source

pub async fn dispatch_read( &self, args: &str, conversation_id: Option<u64>, ) -> Result<String, String>

Source§

impl<H: Host> Env<H>

Source

pub async fn dispatch_bash( &self, args: &str, conversation_id: Option<u64>, ) -> Result<String, String>

Dispatch a bash tool call — run a command directly.

A non-zero exit code is not an Err — the shell ran successfully and the JSON payload describes the outcome. Only dispatcher-level failures (spawn error, wait error, timeout) become Err.

Source§

impl<H: Host> Env<H>

Source

pub async fn dispatch_skill( &self, args: &str, agent: &str, ) -> Result<String, String>

Trait Implementations§

Source§

impl<H: Host + 'static> Hook for Env<H>

Source§

fn on_build_agent(&self, config: AgentConfig) -> AgentConfig

Called by Runtime::add_agent() before building the Agent. Read more
Source§

fn preprocess(&self, agent: &str, content: &str) -> String

Called by Runtime to preprocess user content before it becomes a message. Read more
Source§

fn on_before_run( &self, agent: &str, conversation_id: u64, history: &[HistoryEntry], ) -> Vec<HistoryEntry>

Called by Runtime before each agent run (send_to / stream_to). Read more
Source§

async fn on_register_tools(&self, tools: &mut ToolRegistry)

Called by Runtime::new() to register tool schemas into the registry. Read more
Source§

fn on_event(&self, agent: &str, conversation_id: u64, event: &AgentEvent)

Called by Runtime after each agent step during execution. Read more

Auto Trait Implementations§

§

impl<H = NoHost> !Freeze for Env<H>

§

impl<H = NoHost> !RefUnwindSafe for Env<H>

§

impl<H> Send for Env<H>

§

impl<H> Sync for Env<H>

§

impl<H> Unpin for Env<H>
where H: Unpin,

§

impl<H> UnsafeUnpin for Env<H>
where H: UnsafeUnpin,

§

impl<H = NoHost> !UnwindSafe for Env<H>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more