Skip to main content

RuntimeHook

Struct RuntimeHook 

Source
pub struct RuntimeHook<B: RuntimeBridge = NoBridge> {
    pub bridge: B,
    /* private fields */
}

Fields§

§bridge: B

Bridge to server-specific functionality.

Implementations§

Source§

impl<B: RuntimeBridge> RuntimeHook<B>

Source

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

Create a new RuntimeHook with the given backends.

Source

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

Access memory.

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, session_id: Option<u64>, ) -> String

Route a tool call by name to the appropriate handler.

Source§

impl<B: RuntimeBridge> RuntimeHook<B>

Source

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

Source§

impl<B: RuntimeBridge> RuntimeHook<B>

Source

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

Source

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

Source

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

Source

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

Source§

impl<B: RuntimeBridge> RuntimeHook<B>

Source

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

Dispatch a bash tool call — run a command directly.

Source§

impl<B: RuntimeBridge> RuntimeHook<B>

Source

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

Trait Implementations§

Source§

impl<B: RuntimeBridge + 'static> Hook for RuntimeHook<B>

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, session_id: u64, history: &[Message], ) -> Vec<Message>

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, session_id: u64, event: &AgentEvent)

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

Auto Trait Implementations§

§

impl<B = NoBridge> !Freeze for RuntimeHook<B>

§

impl<B = NoBridge> !RefUnwindSafe for RuntimeHook<B>

§

impl<B> Send for RuntimeHook<B>

§

impl<B> Sync for RuntimeHook<B>

§

impl<B> Unpin for RuntimeHook<B>
where B: Unpin,

§

impl<B> UnsafeUnpin for RuntimeHook<B>
where B: UnsafeUnpin,

§

impl<B = NoBridge> !UnwindSafe for RuntimeHook<B>

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