Skip to main content

Env

Trait Env 

Source
pub trait Env:
    Send
    + Sync
    + 'static {
    type Hook: Hook;

    // Required method
    fn hook(&self) -> &Self::Hook;

    // Provided methods
    fn on_agent_event(
        &self,
        _agent: &str,
        _conversation_id: u64,
        _event: &AgentEvent,
    ) { ... }
    fn subscribe_events(&self) -> Option<Receiver<AgentEventMsg>> { ... }
    fn discover_instructions(&self, _cwd: &Path) -> Option<String> { ... }
    fn effective_cwd(&self, _conversation_id: u64) -> PathBuf { ... }
}
Expand description

The runtime environment — combines server capabilities with tool dispatch.

Each node/binary defines one implementation that wires together the composite hook, event broadcasting, CWD management, and instruction discovery.

Required Associated Types§

Source

type Hook: Hook

The composite hook providing tool schemas, dispatch, and lifecycle.

Required Methods§

Source

fn hook(&self) -> &Self::Hook

Access the composite hook.

Provided Methods§

Source

fn on_agent_event( &self, _agent: &str, _conversation_id: u64, _event: &AgentEvent, )

Called when an agent event occurs. Default: no-op.

Source

fn subscribe_events(&self) -> Option<Receiver<AgentEventMsg>>

Subscribe to agent events. Returns None if event broadcasting is not supported.

Source

fn discover_instructions(&self, _cwd: &Path) -> Option<String>

Collect layered instructions (e.g. Crab.md files) for the given working directory.

Source

fn effective_cwd(&self, _conversation_id: u64) -> PathBuf

Effective working directory for a conversation. Defaults to the process CWD.

Implementations on Foreign Types§

Source§

impl Env for ()

Source§

type Hook = ()

Source§

fn hook(&self) -> &()

Implementors§