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§
Required Methods§
Provided Methods§
Sourcefn on_agent_event(
&self,
_agent: &str,
_conversation_id: u64,
_event: &AgentEvent,
)
fn on_agent_event( &self, _agent: &str, _conversation_id: u64, _event: &AgentEvent, )
Called when an agent event occurs. Default: no-op.
Sourcefn subscribe_events(&self) -> Option<Receiver<AgentEventMsg>>
fn subscribe_events(&self) -> Option<Receiver<AgentEventMsg>>
Subscribe to agent events. Returns None if event broadcasting
is not supported.
Sourcefn discover_instructions(&self, _cwd: &Path) -> Option<String>
fn discover_instructions(&self, _cwd: &Path) -> Option<String>
Collect layered instructions (e.g. Crab.md files) for the
given working directory.
Sourcefn effective_cwd(&self, _conversation_id: u64) -> PathBuf
fn effective_cwd(&self, _conversation_id: u64) -> PathBuf
Effective working directory for a conversation. Defaults to the process CWD.